File: mawktest

package info (click to toggle)
mawk 1.3.3-5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,204 kB
  • ctags: 1,530
  • sloc: ansic: 13,023; yacc: 994; awk: 629; sh: 330; makefile: 164
file content (73 lines) | stat: -rwxr-xr-x 1,635 bytes parent folder | download
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh

# This is a simple test that a new made mawk seems to
# be working OK.
# It's certainly not exhaustive, but the last two tests in 
# particular use most features.
#
# It needs to be run from  mawk/test
# and mawk needs to be in mawk/test or in PATH

dat=mawktest.dat

trap 'echo mawk_test failed ; rm -f temp$$ ; exit 1'  0

PATH=.:$PATH

# find out which mawk we're testing
mawk -W version


#################################
echo
echo testing input and field splitting

mawk -f wc.awk $dat | cmp -s - wc-awk.out || exit

echo input and field splitting OK
#####################################

echo
echo testing regular expression matching
mawk -f reg0.awk $dat > temp$$
mawk -f reg1.awk $dat >> temp$$
mawk -f reg2.awk $dat >> temp$$

cmp -s  reg-awk.out temp$$ || exit

echo regular expression matching OK
#######################################

echo
echo testing checking for write errors
# Check for write errors noticed when closing the file
mawk '{print}' <full-awk.dat >/dev/full 2>/dev/null && exit
# Check for write errors noticed on writing
# The file has to be bigger than the buffer size of the libc
mawk '{print}' <../scan.c >/dev/full 2>/dev/null && exit

echo checking for write errors OK
#######################################

echo
echo testing arrays and flow of control

mawk -f wfrq0.awk $dat | cmp -s - wfrq-awk.out || exit

echo array test OK
#################################

echo
echo testing function calls and general stress test

mawk -f ../examples/decl.awk $dat | cmp -s - decl-awk.out || exit 

echo general stress test passed


echo
echo  tested mawk seems OK

trap 0
rm -f temp$$
exit 0