selftest: skip client_etypes tests if tshark or sha1sum is not installed
authorUri Simchoni <uri@samba.org>
Tue, 23 Aug 2016 04:50:35 +0000 (07:50 +0300)
committerGarming Sam <garming@samba.org>
Thu, 25 Aug 2016 07:39:43 +0000 (09:39 +0200)
That was the original plan - not to fail existing envs, but for subunit
not to fail, it is not sufficient to just return 0 from the script.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Garming Sam <garming@samba.org>
Autobuild-Date(master): Thu Aug 25 09:39:43 CEST 2016 on sn-devel-144

testprogs/blackbox/test_client_etypes.sh

index 3327517011aa561d012d6f22fa15744d3df602a1..f424b52cd9fbd2d065978ac40326e880735df84e 100755 (executable)
@@ -5,10 +5,6 @@ EOF
 exit 1;
 fi
 
-#requires tshark
-which tshark > /dev/null 2>&1 || exit 0
-which sha1sum > /dev/null 2>&1 || exit 0
-
 DC_SERVER=$1
 DC_USERNAME=$2
 DC_PASSWORD=$3
@@ -16,6 +12,18 @@ BASEDIR=$4
 ETYPE_CONF=$5
 EXPECTED_ETYPES="$6"
 
+# Load test functions
+. `dirname $0`/subunit.sh
+
+#requires tshark and sha1sum
+if ! which tshark > /dev/null 2>&1 || ! which sha1sum > /dev/null 2>&1 ; then
+    subunit_start_test "client encryption types"
+    subunit_skip_test "client encryption types" <<EOF
+Skipping tests - tshark or sha1sum not installed
+EOF
+    exit 0
+fi
+
 HOSTNAME=`dd if=/dev/urandom bs=1 count=32 2>/dev/null | sha1sum | cut -b 1-10`
 
 RUNDIR=`pwd`
@@ -33,9 +41,6 @@ failed=0
 net_tool="$BINDIR/net -s $BASEDIR/$WORKDIR/client.conf --option=security=ads --option=kerberosencryptiontypes=$ETYPE_CONF"
 pcap_file=$BASEDIR/$WORKDIR/test.pcap
 
-# Load test functions
-. `dirname $0`/subunit.sh
-
 export SOCKET_WRAPPER_PCAP_FILE=$pcap_file
 testit "join" $VALGRIND $net_tool ads join -kU$DC_USERNAME%$DC_PASSWORD || failed=`expr $failed + 1`