mirror of
https://github.com/samba-team/samba.git
synced 2025-01-05 09:18:06 +03:00
b12562fac0
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
48 lines
917 B
Bash
Executable File
48 lines
917 B
Bash
Executable File
#!/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
|