/
regtest
80 lines (59 loc) · 1.78 KB
/
regtest
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
74
75
76
77
78
79
80
#set -x
export -n BASH_ENV
# ancient versions of awk won't work with these scripts,
# but will give syntax errors trying to parse their program.
# On sun, may have to change this to `nawk' or `gawk'.
export AWK=awk
echo " * Testing on: `uname -a`"
echo " * OS version: `cat -v /etc/issue`"
echo " * gcc version: `gcc -v 2>&1`"
echo " * Afio shared libraries: `ldd ../afio`"
#if 1, inject some errors to self-test the regression test.
ERRORINJECT=0
#for security, regresson test will make
#some devices and suid scripts (solve more elegantly later)
chmod 700 .
#binary of new afio
NEWAF=`pwd`/../afio
#try to find an old afio binary
OLDAF=`type -p afio`
if [ "$OLDAF" = "" ]; then
echo "Can't" find an old afio executable, will not do parts of regression testing...
fi
#clean up any old regtest directories
source ./regtest.clean
#----------------
failed=0;
#1) run batch of tests with included test archive
#OLDTESTD=/root/afio/afiot
OLDTESTD=/i/n/v/a/l/i/d
TESTA=`pwd`/afiotsmall.af
TESTTAR=`pwd`/afiotsmall.tgz
TESTTOC=$TESTA.toc
if [ "`whoami`" != root ]; then
echo Not running as root, regression test will not cover special files like devices
TESTA=`pwd`/afiotsmallnoroot.af
TESTTAR=`pwd`/afiotsmallnoroot.tgz
TESTTOC=$TESTA.toc
#umask 000 needed to make tar restore all permissions, as afio does
umask 000
fi
source ./regtest.do
if [ $failed = 1 ]; then
exit 1
fi
#2) are we on Koen's machine? Yes, then run a second batch of tests
#(only on Koen's machine) location of existing unpacked test directory
OLDTESTD=/oldlin/root/src/afiot
if [ -d $OLDTESTD ]; then
if [ "`whoami`" = root ]; then
TESTTAR=/i/n/v/a/l/i/d
TESTA=/oldlin/root/src/afiot.af
TESTTOC=$TESTA.toc
source ./regtest.do
fi
fi
if [ $failed = 0 ]; then
echo All regression tests OK\!\!
source ./regtest.clean
fi