root/tags/v1.2.5/testall.sh

Revision 1508, 1.4 kB (checked in by dsugar, 2 years ago)

Added -r option to testall.sh script to run only and not rebuild

  • Property svn:executable set to *
Line 
1 #!/bin/bash
2
3 STARTDIR=`pwd`
4
5 BUILD=1
6 INFO=0
7
8 for PARAM in $@; do
9         case $PARAM in
10                 ("-i")
11                         BUILD=0;
12                         INFO=1;;
13                 ("-r")
14                         BUILD=0;;
15                 ("-h")
16                         echo
17                         echo Usage: $0
18                         echo -i display info about each test
19                         echo -r run only - do not rebuild compiler
20                         echo -h help;
21                         echo;
22                         exit;
23                         ;;
24         esac
25 done;
26
27 if [ $BUILD -eq 1 ]; then
28 # build command line test program if it doesn't exist
29 #if [ ! -e build/com/tresys/framework/compiler/Compiler.java ]; then
30 #       make -C libapoljava
31         make -C framework-plugin/libselinuxjava
32         ant -q -f compilerbuild.xml compile
33 #fi;
34 fi;
35
36 LIBSELINUX=`pwd`/framework-plugin/libselinuxjava/libselinuxjava.so
37
38 # list of all tests
39 ALLTESTS=`ls test | egrep test[0-9]{4}`
40 declare -a ERRORTESTS
41
42 # loop through each test directory
43 for TEST in $ALLTESTS; do
44         DIR=test/$TEST
45         echo -n Test: $TEST " "
46
47         if [ $INFO -eq 0 ]; then
48                 if [ ! -e $DIR/test.sh ]; then
49                         echo - skipping test
50                         ERRORTESTS[${#ERRORTESTS[*]}]=$TEST
51                         continue
52                 fi;
53
54                 cd $DIR
55                 source test.sh
56                 cd $STARTDIR
57                 if [ $RESULT -ne 0 ]; then
58                         ERRORTESTS[${#ERRORTESTS[*]}]=$TEST
59                 fi;
60         fi;
61         if [ $INFO -eq 1 ]; then
62                 echo -n ",\""
63                 if [ -e $DIR/README ]; then
64                         cat $DIR/README
65                 else
66                         echo -n Missing!
67                 fi;
68                 echo  -n "\""
69                 echo
70         fi;
71 done;
72
73 if [ $INFO -eq 0 ]; then
74         echo
75         echo
76         # report each test that failed
77         if [ ${#ERRORTESTS} -gt 0 ]; then
78                 echo The following tests have errors
79                 echo ${ERRORTESTS[@]}
80         else
81                 echo All tests ran successfully
82         fi;
83 fi;
Note: See TracBrowser for help on using the browser.