about summary refs log tree commit diff
path: root/test/pamexec.test
blob: 7c2bf054e7138783ce05632704c065c4f213fafc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /bin/sh
# This script tests: pamexec
# Also requires: pbmtext pamfile pbmminkowski pbmtog3 g3topbm

tmpdir=${tmpdir:-/tmp}
test_pbm=${tmpdir}/test.pbm
combined_pbm=${tmpdir}/combined.pbm

for i in 0 1 2 3 4 5 6 7 8 9  # for i in `seq 0 9`
  do echo ${i} | pbmtext -builtin=fixed > ${test_pbm}${i}
  done
cat ${test_pbm}[0123456789] > ${combined_pbm}

echo "Test 1 : Should print 10 stdin: PBM RAW 21 24 1 1 BLACKANDWHITE twice"

cat ${combined_pbm} | pamfile -all -mach | uniq -c | sed 's/^ *//' 
pamexec "pamfile -mach" ${combined_pbm}  | uniq -c | sed 's/^ *//' 

echo "Test 2: Should print 1791121103 989 twice"

for i in 0 1 2 3 4 5 6 7 8 9  # for i in `seq 0 9`
  do pbmminkowski ${test_pbm}${i}; done | cksum
pamexec "pbmminkowski" ${combined_pbm} | cksum

rm ${test_pbm}[0123456789]

echo "Test 3: Should print 2983705297 810 twice"

pamexec "pbmtog3 -no | g3topbm" ${combined_pbm}  | cksum
cat ${combined_pbm}  | cksum

echo "Invalid command" 1>&2
echo "Executes quietly." 1>&2
echo "Errors message should not appear below the line." 1>&2
echo "-----------------------------------------------------------" 1>&2

echo "Test Invalid: Should not print anything"

pamexec "false" ${combined_pbm}
pamexec "pamfile | false" ${combined_pbm}

rm ${combined_pbm}