~ubuntu-branches/ubuntu/maverick/aspectc++/maverick

« back to all changes in this revision

Viewing changes to Ag++/tests/run_tests.sh

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-04-10 17:40:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080410174052-xdnsm7oi8hauyyf1
Tags: 1.0pre4~svn.20080409+dfsg-3
Fix another missing include, this time in Ag++/StdSystem.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/bash
 
2
 
 
3
# path to ag++
 
4
AGCC="../../AspectC++/bin/${TARGET}/ag++"
 
5
 
 
6
# summary printed in case at least one testcase failed
 
7
ERR_SUM="+-----------------+\n";
 
8
ERR_SUM="${ERR_SUM}| Error Messages: |\n";
 
9
ERR_SUM="${ERR_SUM}+-----------------+\n";
 
10
ERR_OCCURED=0;
 
11
 
 
12
# files for storing output from stdout and stderr
 
13
STDOUT_FILE=stdout.tmp;
 
14
STDERR_FILE=stderr.tmp;
 
15
 
 
16
# check if TARGET variable is set
2
17
if [ -z ${TARGET} ];then
3
18
        echo -en "\n\nThis script has to be invoked by 'make test' from the toplevel directory\n\n"
4
19
        exit
5
20
fi
6
21
 
7
 
if (test $1);then
8
 
        if (test -e $1);then
9
 
                export TEST_FILES=$1;
 
22
# check if the name of a test was passed
 
23
if [ $# -gt 0 ];then
 
24
        if [ -f $1 ];then
 
25
                TEST_FILES="$1";
10
26
        else
11
27
                echo "Test file '$1' not found";
12
28
                exit;
13
29
        fi
14
30
else
15
 
        export TEST_FILES=`find . -maxdepth 1 -name 'test_??' -printf '%p '`;
 
31
   # if no test was execute all test in this folder
 
32
        TEST_FILES=`find . -maxdepth 1 -name 'test_??' -printf '%p '`;
16
33
fi
17
34
 
18
 
export AGCC=../../AspectC++/bin/${TARGET}/ag++
19
 
export ERR_SUM="+-----------------+\n";
20
 
export ERR_SUM="${ERR_SUM}| Error Messages: |\n";
21
 
export ERR_SUM="${ERR_SUM}+-----------------+\n";
22
 
export ERR_OCCURED=0;
23
 
export STDOUT_FILE=stdout.tmp;
24
 
export STDERR_FILE=stderr.tmp;
 
35
 
 
36
# loop through all test files
25
37
for testfile in ${TEST_FILES};
26
38
do
27
39
        rm -f puma.config;
28
40
        ERR_MSG="";
 
41
   
 
42
   # include testfile file
29
43
        source $testfile;
 
44
 
 
45
   # redirect stdout and stderr
30
46
        exec 6>&1;      
31
47
        exec 7>&2;      
32
 
        exec > $STDOUT_FILE;
33
 
        exec 2> $STDERR_FILE;
34
 
        main ;
 
48
        exec > ${STDOUT_FILE};
 
49
        exec 2> ${STDERR_FILE};
 
50
 
 
51
        # execute main function of current test
 
52
   main ;
35
53
        RET=$?;
 
54
 
 
55
        # execute main function of current test
 
56
 
 
57
   #restore stdout and stderr
36
58
        exec 1>&6 6>&-;
37
59
        exec 2>&7 7>&-;
 
60
 
 
61
   # perform cleanup of test
 
62
   cleanup ;
 
63
 
 
64
   # check if test succeeded
38
65
        if [ $RET == 1 ]; then
39
 
                echo -n ".";
 
66
      # test succeded
 
67
      echo -n ".";
40
68
        else
41
 
                export ERR_OCCURED=1;
42
 
                export STDOUT=`cat $STDOUT_FILE`;
43
 
                export STDERR=`cat $STDERR_FILE`;
44
 
                echo -n "[${testfile/test_/}:F]";
45
 
                export ERR_SUM="${ERR_SUM}\n\n-----------------------------------------------------------------------------------------\n";
46
 
                export ERR_SUM="${ERR_SUM}TESTFILE: ${testfile}\n";
47
 
                export ERR_SUM="${ERR_SUM}-----------------------------------------------------------------------------------------\n\n";
48
 
                export ERR_SUM="${ERR_SUM}TEST DESCRIPTION: ${DESC//'\\'/\\\\}\n";
49
 
                export ERR_SUM="${ERR_SUM}-----------------\n\n";
50
 
                export ERR_SUM="${ERR_SUM}ERROR: ${ERR_MSG//'\\'/\\\\}\n";
51
 
                export ERR_SUM="${ERR_SUM}------\n\n";
52
 
                export ERR_SUM="${ERR_SUM}STDOUT:\n";
53
 
                export ERR_SUM="${ERR_SUM}-------\n${STDOUT//'\\'/\\\\}\n";
54
 
                export ERR_SUM="${ERR_SUM}STDERR:\n";
55
 
                export ERR_SUM="${ERR_SUM}-------\n${STDERR//'\\'/\\\\}\n";
 
69
      # test failed
 
70
      echo -n "[${testfile/*_/}:F]";
 
71
      ERR_OCCURED=1;
 
72
                
 
73
      # get stdout and stderr
 
74
                STDOUT=`cat ${STDOUT_FILE}`;
 
75
                STDERR=`cat ${STDERR_FILE}`;
 
76
 
 
77
      # add information to error summary
 
78
                ERR_SUM="${ERR_SUM}\n\n-----------------------------------------------------------------------------------------\n";
 
79
                ERR_SUM="${ERR_SUM}TESTFILE: ${testfile}\n";
 
80
                ERR_SUM="${ERR_SUM}-----------------------------------------------------------------------------------------\n\n";
 
81
                ERR_SUM="${ERR_SUM}TEST DESCRIPTION: ${DESC//'\\'/\\\\}\n";
 
82
                ERR_SUM="${ERR_SUM}-----------------\n\n";
 
83
                ERR_SUM="${ERR_SUM}ERROR: ${ERR_MSG//'\\'/\\\\}\n";
 
84
                ERR_SUM="${ERR_SUM}------\n\n";
 
85
                ERR_SUM="${ERR_SUM}STDOUT:\n";
 
86
                ERR_SUM="${ERR_SUM}-------\n${STDOUT//'\\'/\\\\}\n";
 
87
                ERR_SUM="${ERR_SUM}STDERR:\n";
 
88
                ERR_SUM="${ERR_SUM}-------\n${STDERR//'\\'/\\\\}\n";
56
89
        fi
57
90
        rm -f puma.config;
58
91
        
59
92
done
60
93
echo;
61
94
echo;
 
95
 
 
96
# print summery of all errors occured
62
97
if [ $ERR_OCCURED == 1 ];then
63
98
        echo -e "$ERR_SUM";
64
99
else
65
100
        echo "All tests OK";
66
101
fi
67
102
 
 
103
# remove files containing output from stdout and stderr
68
104
rm $STDERR_FILE $STDOUT_FILE;
69
105