Propset suite-unittests.sh and add executable to .sh files
[metze/wireshark/wip.git] / test / suite-unittests.sh
1 #!/bin/bash
2 #
3 # Run the epan unit tests
4 #
5 # $Id$
6 #
7 # Wireshark - Network traffic analyzer
8 # By Gerald Combs <gerald@wireshark.org>
9 #
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License
12 # as published by the Free Software Foundation; either version 2
13 # of the License, or (at your option) any later version.
14 #
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23
24
25 unittests_step_test() {
26         make -C `dirname $DUT` `basename $DUT` >testout.txt 2>&1
27         if [ $? -ne 0 ]; then
28                 echo
29                 cat ./testout.txt
30                 test_step_failed "make $DUT failed"
31                 return
32         fi
33         
34         $DUT > testout.txt 2>&1
35         RETURNVALUE=$?
36         if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
37                 echo
38                 cat ./testout.txt
39                 test_step_failed "exit status of $DUT: $RETURNVALUE"
40                 return
41         fi
42         test_step_ok
43 }
44
45
46 unittests_step_exntest() {
47         DUT=../epan/exntest
48         unittests_step_test
49 }
50
51 unittests_step_reassemble_test() {
52         DUT=../epan/reassemble_test
53         unittests_step_test
54 }
55
56 unittests_step_tvbtest() {
57         DUT=../epan/tvbtest
58         unittests_step_test
59 }
60
61 unittests_cleanup_step() {
62         rm -f ./testout.txt
63 }
64
65 unittests_suite() {
66         test_step_set_pre unittests_cleanup_step
67         test_step_set_post unittests_cleanup_step
68         test_step_add "exntest" unittests_step_exntest
69         test_step_add "reassemble_test" unittests_step_reassemble_test
70         test_step_add "tvbtest" unittests_step_tvbtest
71 }