Debian Codegraph @

builds/zos/runtests

raw symbols SCIP
1 #! /bin/sh
2 # Run ZeroMQ tests, in order. This is extracted from the tests/Makefile
3 # which won't run as-is because it relies on libtool building things, and
4 # thus creating various libtool files, which don't work well on z/OS
5 #
6 # noinst_PROGRAMS needs to be kept in sync with tests/Makefile.am, as it
7 # defines the order in which tests are run.
8 #
9 # Written by Ewen McNeill <[email protected]>, 2014-07-19
10 # Updated by Ewen McNeill <[email protected]>, 2014-07-24
11 #---------------------------------------------------------------------------
12
13 set -e # Stop if a test fails
14
15 #---------------------------------------------------------------------------
16 # Change to tests directory if necessary
17
18 # Figure out where we are
19 BIN_DIR=$(dirname $0)
20 if [ -z "${BIN_DIR}" ]; then BIN_DIR="."; fi
21 case "${BIN_DIR}" in
22 .) BIN_DIR="$(pwd)"; ;;
23 /*) ;;
24 *) BIN_DIR="$(pwd)/${BIN_DIR}"; ;;
25 esac
26
27 # Locate top of source tree, assuming we're in builds/zos
28 TOP="${BIN_DIR}/../.."
29 SRCDIR="${TOP}/src"
30 TESTDIR="${TOP}/tests"
31
32 case "$(pwd)" in
33 *tests) ;;
34 *) echo "Changing to ${TESTDIR}"
35 cd "${TESTDIR}"
36 ;;
37 esac
38
39 if [ -x "test_system" ]; then
40 :
41 else
42 echo "Run makelibzmq and maketests before runtests" >&2
43 exit 1
44 fi
45
46 #---------------------------------------------------------------------------
47 # Explanation of tests expected to fail:
48 # test_abstract_ipc: Relies on Linux-specific IPC functionality
49 # test_fork: Relies on using pthreads _after_ fork, _before_ exec
50 # test_diffserv: Needs IP_PROTO, IP_TOS setsockopt(); the headers
51 # are present on z/OS UNIX System Services, but
52 # fails with:
53 # EDC8109I Protocol not available. (./ip.cpp:164)
54 # NOTE: not listed as a valid IP setsockopt() option at:
55 # http://pic.dhe.ibm.com/infocenter/zos/v2r1/index.jsp?topic=%2Fcom.ibm.zos.v2r1.bpxbd00%2Fsetopt.htm
56 #
57 XFAIL_TESTS="test_abstract_ipc|test_fork|test_diffserv"
58
59 # BUILD_TIPC is not defined, so we skip all these tests
60 SKIP_TESTS="test_.*_tipc"
61
62 # Extract list of all test programs from tests/Makefile.am
63 #
64 # Excluding tests we know will fail because of missing functionality
65 #
66 noinst_PROGRAMS=$(grep "test_" Makefile.am | grep -E -v "_SOURCES|XFAIL" |
67 sed 's/noinst_PROGRAMS.* test/test/; s/^ *//; s/ *\\ *$//;' |
68 grep -v "${SKIP_TESTS}" | grep -E -v "${XFAIL_TESTS}")
69 #echo "Found tetsts: ${noinst_PROGRAMS}"
70
71 # Run tests on command line, or all tests we found
72 if [ -n "${1}" ]; then
73 TESTS="$*" # Run tests on command line
74 else
75 TESTS="${noinst_PROGRAMS}"
76 fi
77
78 verbose() {
79 echo "Starting: $@" >&2
80 "$@"
81 }
82
83 # Uncomment TESTS_ENVIRONMENT=verbose to see "Starting: TEST" messages
84 #TESTS_ENVIRONMENT=verbose
85 TESTS_ENVIRONMENT=
86
87 #---------------------------------------------------------------------------
88 # Explicitly add SRCDIR into library search path, to make sure we
89 # use our just-built version
90 LIBPATH="${SRCDIR}:/lib:/usr/lib"
91 export LIBPATH
92
93 #---------------------------------------------------------------------------
94 # check-TESTS: target from tests/Makefile, converted from Make syntax to
95 # shell syntax
96
97 failed=0; all=0; xfail=0; xpass=0; skip=0;
98 srcdir=.; export srcdir;
99 list="${TESTS}";
100 red=""; grn=""; lgn=""; blu=""; std="";
101 if test -n "$list"; then
102 for tst in $list; do
103 if test -f ./$tst; then dir=./;
104 elif test -f $tst; then dir=;
105 else dir="${srcdir}/"; fi;
106 if ${TESTS_ENVIRONMENT} ${dir}$tst; then
107 all=`expr $all + 1`;
108 case " ${XFAIL_TESTS} " in
109 *"$tst"*)
110 xpass=`expr $xpass + 1`;
111 failed=`expr $failed + 1`;
112 col=$red; res=XPASS;
113 ;;
114 *)
115 col=$grn; res=PASS;
116 ;;
117 esac;
118 elif test $? -ne 77; then
119 all=`expr $all + 1`;
120 case " ${XFAIL_TESTS} " in
121 *"$tst"*)
122 xfail=`expr $xfail + 1`;
123 col=$lgn; res=XFAIL;
124 ;;
125 *)
126 failed=`expr $failed + 1`;
127 col=$red; res=FAIL;
128 ;;
129 esac;
130 else
131 skip=`expr $skip + 1`;
132 col=$blu; res=SKIP;
133 fi;
134 echo "${col}$res${std}: $tst";
135 done;
136 if test "$all" -eq 1; then
137 tests="test";
138 All="";
139 else
140 tests="tests";
141 All="All ";
142 fi;
143 if test "$failed" -eq 0; then
144 if test "$xfail" -eq 0; then
145 banner="$All$all $tests passed";
146 else
147 if test "$xfail" -eq 1; then failures=failure; else failures=failures; fi;
148 banner="$All$all $tests behaved as expected ($xfail expected $failures)";
149 fi;
150 else
151 if test "$xpass" -eq 0; then
152 banner="$failed of $all $tests failed";
153 else
154 if test "$xpass" -eq 1; then passes=pass; else passes=passes; fi;
155
156 banner="$failed of $all $tests did not behave as expected ($xpass unexpected $passes)";
157 fi;
158 fi;
159 dashes="$banner";
160 skipped="";
161 if test "$skip" -ne 0; then
162 if test "$skip" -eq 1; then
163 skipped="($skip test was not run)";
164 else
165 skipped="($skip tests were not run)";
166 fi;
167 test `echo "$skipped" | wc -c` -le `echo "$banner" | wc -c` ||
168 dashes="$skipped"; \
169 fi;
170 report="";
171 if test "$failed" -ne 0 && test -n "${PACKAGE_BUGREPORT}"; then
172 report="Please report to ${PACKAGE_BUGREPORT}";
173 test `echo "$report" | wc -c` -le `echo "$banner" | wc -c` ||
174 dashes="$report";
175 fi;
176 dashes=`echo "$dashes" | sed s/./=/g`;
177 if test "$failed" -eq 0; then
178 col="$grn";
179 else
180 col="$red";
181 fi;
182 echo "${col}$dashes${std}";
183 echo "${col}$banner${std}";
184 test -z "$skipped" || echo "${col}$skipped${std}";
185 test -z "$report" || echo "${col}$report${std}";
186 echo "${col}$dashes${std}";
187 test "$failed" -eq 0;
188 else :; fi