]> arthur.barton.de Git - ngircd.git/blobdiff - src/testsuite/tests.sh
Testsuite: Test for the openssl command before using it
[ngircd.git] / src / testsuite / tests.sh
index 8ecf8abf659b85fdedb7f8b59b17a8bdf0af83ed..7af8c593fad57eb78fb7cf6d7900003bba45d571 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # ngIRCd Test Suite
-# Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
+# Copyright (c)2001-2024 Alexander Barton (alex@barton.de) and Contributors.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -18,6 +18,7 @@ test=`echo ${name} | cut -d '.' -f 1`
 [ -d logs ] || mkdir logs
 
 if [ ! -r "$test" ]; then
+  echo "$test: test not found" >>tests-skipped.lst
   echo "${name}: test \"$test\" not found!";  exit 77
   exit 1
 fi
@@ -27,13 +28,25 @@ fi
 
 type expect > /dev/null 2>&1
 if [ $? -ne 0 ]; then
+  echo "$test: \"expect\" not found" >>tests-skipped.lst
   echo "${name}: \"expect\" not found.";  exit 77
 fi
 type telnet > /dev/null 2>&1
 if [ $? -ne 0 ]; then
+  echo "$test: \"telnet\" not found" >>tests-skipped.lst
   echo "${name}: \"telnet\" not found.";  exit 77
 fi
 
+case "$test" in
+  *ssl*)
+    type openssl > /dev/null 2>&1
+    if [ $? -ne 0 ]; then
+      echo "$test: \"openssl\" not found" >>tests-skipped.lst
+      echo "${name}: \"openssl\" not found.";  exit 77
+    fi
+    ;;
+esac
+
 # prepare expect script
 e_in="${srcdir}/${test}.e"
 e_tmp="${test}.e_"
@@ -45,7 +58,7 @@ if test -t 1 2>/dev/null; then
 fi
 
 echo_n "running ${test} ..."
-expect "$e_tmp" > logs/${test}.log; r=$?
+expect "$e_exec" > logs/${test}.log; r=$?
 [ $r -eq 0 ] && echo " ok." || echo " failure!"
 
 rm -f "$e_tmp"