]> git.pond.sub.org Git - empserver/commitdiff
tests: Move "not expected to work" warning into test-common.sh
authorMarkus Armbruster <armbru@pond.sub.org>
Wed, 8 Jan 2014 19:51:52 +0000 (20:51 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 19 Jan 2014 09:08:20 +0000 (10:08 +0100)
Warn the first time a server is started.  Incorrect for info-test with
POSIX threads, so suppress the warning there.

Improve the warning message a bit while we're at it.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
tests/actofgod-test
tests/fire-test
tests/info-test
tests/smoke-test
tests/test-common.sh

index 0afe1bc496f581da2a119f2d840b95087adf880c..4f86a4bf9baab2891cd496e7e35fc26eb58ae1f2 100755 (executable)
@@ -9,20 +9,6 @@ srcdir="$1"
 
 . "$srcdir"/tests/test-common.sh
 
-#
-# Currently expected to work only with thread package LWP, because:
-#
-# - Thread scheduling is reliably deterministic only with LWP
-# - Shell builtin kill appears not to do the job in MinGW
-# - The Windows server tries to run as service when -d isn't
-#   specified
-#
-# TODO address these shortcomings.
-#
-if [ `sed -n 's/empthread *:= *\(.*\)/\1/p' <GNUmakefile` != LWP ]
-then echo "Warning: test not expected to work with this thread package!" >&2
-fi
-
 create_sandbox
 cat >>sandbox/etc/empire/econfig <<EOF
 WORLD_X 24
index c819c06452fd6e321747a62d7e8c4bde0f7ed0bd..e4de869a0ff16cda0b00159d8888a2faf611cfb9 100755 (executable)
@@ -9,20 +9,6 @@ srcdir="$1"
 
 . "$srcdir"/tests/test-common.sh
 
-#
-# Currently expected to work only with thread package LWP, because:
-#
-# - Thread scheduling is reliably deterministic only with LWP
-# - Shell builtin kill appears not to do the job in MinGW
-# - The Windows server tries to run as service when -d isn't
-#   specified
-#
-# TODO address these shortcomings.
-#
-if [ `sed -n 's/empthread *:= *\(.*\)/\1/p' <GNUmakefile` != LWP ]
-then echo "Warning: test not expected to work with this thread package!" >&2
-fi
-
 create_sandbox
 cat >>sandbox/etc/empire/econfig <<EOF
 WORLD_X 32
index 5fa1776e1263b3b720a33bea0ae7dac5a280b47d..09940f7e531331c60ad3d02f6cb752f64590d87a 100755 (executable)
@@ -11,6 +11,11 @@ srcdir="$1"
 
 create_sandbox
 
+# begin_test warns POSIX isn't expected to work, because thread
+# scheduling isn't reliably deterministic.  Not an issue for this
+# test, so suppress the warning.
+[ "$empthread" = POSIX ] && warn_empthread=
+
 begin_test <<EOF
 add 1 1 1 p
 des 0:2,0 -
index 9b3681fcde19a826e648d72b1cbe7b024cc3a2b4..acde52195eadfcd3bcb24a29c20d3cbcd33e56db 100755 (executable)
@@ -9,20 +9,6 @@ srcdir="$1"
 
 . "$srcdir"/tests/test-common.sh
 
-#
-# Currently expected to work only with thread package LWP, because:
-#
-# - Thread scheduling is reliably deterministic only with LWP
-# - Shell builtin kill appears not to do the job in MinGW
-# - The Windows server tries to run as service when -d isn't
-#   specified
-#
-# TODO address these shortcomings.
-#
-if [ `sed -n 's/empthread *:= *\(.*\)/\1/p' <GNUmakefile` != LWP ]
-then echo "Warning: smoke test not expected to work with this thread package!" >&2
-fi
-
 create_sandbox
 
 begin_test "$srcdir"/tests/smoke/fairland.xdump
index 73b0021092b51d728b2548f48f51c36948383f19..806452063048d03e193b650b6bd4f208ee4383a5 100644 (file)
@@ -8,6 +8,18 @@ fi
 test=${0##*/}
 test=${test%-test}
 
+empthread=`sed -n 's/empthread *:= *\(.*\)/\1/p' <GNUmakefile`
+warn_empthread=y
+
+check_empthread()
+{
+    if [ "$warn_empthread" ] && [ "$empthread" != "LWP" ]
+    then
+       echo "Warning: test not expected to work with thread package $empthread!" >&2
+       warn_empthread=
+    fi
+}
+
 create_sandbox()
 {
     rm -rf sandbox
@@ -33,6 +45,20 @@ start_server()
 {
     local pidfile=sandbox/var/empire/server.pid
     local timeout
+
+    #
+    # Currently expected to work only with thread package LWP,
+    # because:
+    #
+    # - Thread scheduling is reliably deterministic only with LWP
+    # - Shell builtin kill appears not to do the job in MinGW
+    # - The Windows server tries to run as service when -d isn't
+    #   specified
+    #
+    # TODO address these shortcomings.
+    #
+    check_empthread
+
     pid=
     trap 'if [ "$pid" ]; then kill -9 "$pid" 2>/dev/null || true; fi' EXIT
     src/server/emp_server -e sandbox/etc/empire/econfig -R 1 -s