aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/README.test23
-rwxr-xr-xtest/suite-unittests.sh59
2 files changed, 31 insertions, 51 deletions
diff --git a/test/README.test b/test/README.test
index 58b80d2ab0..068d7d8816 100644
--- a/test/README.test
+++ b/test/README.test
@@ -4,28 +4,28 @@ This is a collection of bash scripts which test the features of:
- Wireshark
- TShark
- - Dumpcap
+ - Dumpcap
Motivation
----------
-The command line options of Wireshark and the companion command line tools are
-numerous. This makes it hard to find newly introduced bugs doing manual testing
+The command line options of Wireshark and the companion command line tools are
+numerous. This makes it hard to find newly introduced bugs doing manual testing
(try and error) with source code changes.
-The current way is to do some changes, testing some scenarios by hand and
-commit the code so other users will complain about new problems. This obviously
+The current way is to do some changes, testing some scenarios by hand and
+commit the code so other users will complain about new problems. This obviously
is far from being optimal.
Limitations
-----------
-The test set currently provided will only do some basic tests, but even that
+The test set currently provided will only do some basic tests, but even that
is far better than nothing. This may involve in time as new tests can be added
-to fix problems reported by users. This will hopefully lead to a "complete"
+to fix problems reported by users. This will hopefully lead to a "complete"
and reliable testset in the future.
-The tests are limited to command line tests, other things like unit tests or
+The tests are limited to command line tests, other things like unit tests or
GUI test are not included.
Prerequisites
@@ -34,10 +34,11 @@ Prerequisites
What you'll need (to do):
- edit the file config.sh to suit your configuration
- - obviously, compile the programs (wireshark, ...) to be tested
+ - build the "all" target
+ - build the "test-programs" target
- have a bash (cygwin should do well)
- have tput (e.g. in the cygwin ncurses package)
- - you'll need a network interface with some network traffic
+ - you'll need a network interface with some network traffic
(so you can run the capture tests)
- (for non-Windows platforms) An X server for running the capture tests with
the graphical Wireshark program.
@@ -69,7 +70,7 @@ it with:
When your configuration is sane, you can start test.sh which should provide a
basic menu. Just press Enter to start all tests.
-It should start all the available tests. Each test will throw out a line
+It should start all the available tests. Each test will throw out a line
which should end with a green "Ok". If one of the tests fail, the script
will report it and stop at this test step.
diff --git a/test/suite-unittests.sh b/test/suite-unittests.sh
index 864f5a30b6..102ab6ac98 100755
--- a/test/suite-unittests.sh
+++ b/test/suite-unittests.sh
@@ -20,35 +20,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
-if [ "$WS_SYSTEM" == "Windows" ] ; then
- MAKE="nmake -f Makefile.nmake"
-else
- MAKE=make
-fi
-
unittests_step_test() {
- ( cd `dirname $DUT` && $MAKE `basename $DUT` ) >testout.txt 2>&1
- if [ $? -ne 0 ]; then
- echo
- cat ./testout.txt
- test_step_failed "make $DUT failed"
- return
- fi
-
- # if we're on windows, we have to copy the test exe to the wireshark-gtk2
- # dir before we can use them.
- # {Note that 'INSTALL_DIR' must be a Windows Pathname)
- if [ "$WS_SYSTEM" == "Windows" ] ; then
- (cd `dirname $DUT` && $MAKE `basename $DUT`_install INSTALL_DIR='wireshark-gtk2\') > testout.txt 2>&1
- if [ $? -ne 0 ]; then
- echo
- cat ./testout.txt
- test_step_failed "install $DUT failed"
- return
- fi
- DUT=$SOURCE_DIR/wireshark-gtk2/`basename $DUT`
- fi
-
$DUT $ARGS > testout.txt 2>&1
RETURNVALUE=$?
if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
@@ -60,43 +32,50 @@ unittests_step_test() {
test_step_ok
}
-set_dut() {
- if [ "$SOURCE_DIR" = "$WS_BIN_PATH" -o "$WS_SYSTEM" = "Windows" ]; then
- DUT=$SOURCE_DIR/epan/$1
+check_dut() {
+ TEST_EXE=""
+ # WS_BIN_PATH must be checked first, otherwise when using Nmake
+ # we'll find a non-functional program in epan or epan/wmem.
+ for TEST_PATH in "$WS_BIN_PATH" "$SOURCE_DIR/epan" "$SOURCE_DIR/epan/wmem" ; do
+ if [ -x "$TEST_PATH/$1" ]; then
+ TEST_EXE=$TEST_PATH/$1
+ break
+ fi
+ done
+
+ if [ -n "$TEST_EXE" ]; then
+ DUT=$TEST_EXE
else
- # In out-of-tree builds, all binaries end up in the same folder
- # regardless of their path during in-tree builds, so we strip
- # off any prefix part of the path (such as wmem/ for wmem_test)
- DUT=$WS_BIN_PATH/${1##*/}
+ test_step_failed "$1 not found. Have you built test-programs?"
fi
}
unittests_step_exntest() {
- set_dut exntest
+ check_dut exntest
ARGS=
unittests_step_test
}
unittests_step_oids_test() {
- set_dut oids_test
+ check_dut oids_test
ARGS=
unittests_step_test
}
unittests_step_reassemble_test() {
- set_dut reassemble_test
+ check_dut reassemble_test
ARGS=
unittests_step_test
}
unittests_step_tvbtest() {
- set_dut tvbtest
+ check_dut tvbtest
ARGS=
unittests_step_test
}
unittests_step_wmem_test() {
- set_dut wmem/wmem_test
+ check_dut wmem_test
ARGS=--verbose
unittests_step_test
}