diff options
author | Gary Lockyer <gary@catalyst.net.nz> | 2017-02-17 14:55:10 +1300 |
---|---|---|
committer | Douglas Bagnall <dbagnall@samba.org> | 2017-03-01 09:01:07 +0100 |
commit | b12562fac096c0a1a76fa80942e3ab90d2d33547 (patch) | |
tree | 8d68d73e25d1dbfcf240bf5e03f480cb3e7d7546 /script | |
parent | 2b62cafeacf79c83eabab5ba7ad85715997492a7 (diff) | |
download | samba-b12562fac096c0a1a76fa80942e3ab90d2d33547.tar.gz |
script: Add test script for traffic_summary.pl
Add the test script for traffic_summary.pl, test data in previous
commit.
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Wed Mar 1 09:01:07 CET 2017 on sn-devel-144
Diffstat (limited to 'script')
-rwxr-xr-x | script/tests/test_traffic_summary.sh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/script/tests/test_traffic_summary.sh b/script/tests/test_traffic_summary.sh new file mode 100755 index 00000000000..2dc7bed51fe --- /dev/null +++ b/script/tests/test_traffic_summary.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +if [ $# -lt 1 ]; then +cat <<EOF +Usage: test_traffic_summary.sh +EOF +exit 1; +fi + +PREFIX="$1" +shift 1 +ARGS=$@ + +. `dirname $0`/../../testprogs/blackbox/subunit.sh + +script_dir=`dirname $0`/.. +input="$script_dir/testdata/traffic_summary.pdml" +expected="$script_dir/testdata/traffic_summary.expected" +output="$(mktemp $TMPDIR/traffic_summary.XXXXXXXXXXX)" +ts="$script_dir/traffic_summary.pl" + +traffic_summary() { + + $ts $input >$output + if [ "$?" != "0" ]; then + return 1 + fi + + diff $output $expected + if [ "$?" != "0" ]; then + return 1 + fi +} + +# Check the required perl modules for traffic_summary +# skip the tests if they are not installed +perl -MXML::Twig -e 1 +if [ "$?" != "0" ]; then + subunit_start_test "traffic_summary" + subunit_skip_test "traffic_summary" <<EOF +perl module XML::Twig not installed +EOF +else + testit "traffic_summary" traffic_summary +fi + +exit $failed |