3 # This is a simple test that a new made mawk seems to
5 # It's certainly not exhaustive, but the last two tests in
6 # particular use most features.
8 # It needs to be run from mawk/test
9 # and mawk needs to be in mawk/test or in PATH
13 trap 'echo mawk_test failed ; rm -f temp$$ ; exit 1' 0
17 # find out which mawk we're testing
21 #################################
23 echo testing input and field splitting
25 mawk -f wc.awk $dat | cmp -s - wc-awk.out || exit
27 echo input and field splitting OK
28 #####################################
31 echo testing regular expression matching
32 mawk -f reg0.awk $dat > temp$$
33 mawk -f reg1.awk $dat >> temp$$
34 mawk -f reg2.awk $dat >> temp$$
36 cmp -s reg-awk.out temp$$ || exit
38 echo regular expression matching OK
39 #######################################
42 if [ -c /dev/full ]; then
43 echo testing checking for write errors
44 # Check for write errors noticed when closing the file
45 mawk '{print}' <full-awk.dat >/dev/full 2>/dev/null && exit
46 # Check for write errors noticed on writing
47 # The file has to be bigger than the buffer size of the libc
48 mawk '{print}' <../scan.c >/dev/full 2>/dev/null && exit
50 echo checking for write errors OK
52 echo "No /dev/full - check for write errors skipped"
55 #######################################
58 echo testing arrays and flow of control
60 mawk -f wfrq0.awk $dat | cmp -s - wfrq-awk.out || exit
63 #################################
66 echo testing function calls and general stress test
68 mawk -f ../examples/decl.awk $dat | cmp -s - decl-awk.out || exit
70 echo general stress test passed
74 echo tested mawk seems OK