Debian Codegraph @

builds/zos/maketests

raw symbols SCIP
1 #! /bin/shscip-shell filesystem . . `/bin/sh`.
2 # Build tests/* executables; assumes that libzmq.a or libzmq.so/libzmq.x
3 # is already built
4 #
5 # If libzmq.so and libzmq.x exist, then dynamic linking is used, otherwise
6 # static linking is used.
7 #
8 # Written by Ewen McNeill <[email protected]>, 2014-07-21
9 # Updated by Ewen McNeill <[email protected]>, 2014-07-22
10 #---------------------------------------------------------------------------
11
12 set -e # Stop on errors
13
14 VERBOSE="${VERBOSE:-}" # Set to non-empty for already done status
15 export VERBOSE
16
17 # Figure out where we are
18 BIN_DIR=$(dirnamescip-shell system . . dirname. $0)
19 if [scip-shell system . . `[`. -z "${BIN_DIR}" ]; then BIN_DIR="."; fi
20 case "${BIN_DIR}" in
21 .) BIN_DIR="$(pwdscip-shell system . . pwd.)"; ;;
22 /*) ;;
23 *) BIN_DIR="$(pwdscip-shell system . . pwd.)/${BIN_DIR}"; ;;
24 esac
25
26 # Locate compiler wrapper
27 ZCXX="${BIN_DIR}/zc++"
28
29 # Locate top of source tree, assuming we're in builds/zos
30 TOP="${BIN_DIR}/../.."
31 SRC="${TOP}/src"
32 TESTS="${TOP}/tests"
33
34 # Figure out how we are going to link to ZMQ
35 LINK_TYPE=unknown
36
37 if [scip-shell system . . `[`. -f "${SRC}/platform.hpp" -a -f "${SRC}/libzmq.so" -a -f "${SRC}/libzmq.x" ]; then
38 LINK_TYPE=dynamic
39 elif [scip-shell system . . `[`. -f "${SRC}/platform.hpp" -a -f "${SRC}/libzmq.a" ]; then
40 LINK_TYPE=static
41 else
42 echoscip-shell system . . echo. "Error: run makezmqlib to build libzmq.a and/or libzmq.so/libzmq.x first" >&2
43 exit 1
44 fi
45
46 # Copy in replacement test with timeout, if main version is not already
47 # up to date
48 #
49 if [scip-shell system . . `[`. -f "${TESTS}/test_fork.cpp" ] &&
50 grepscip-shell system . . grep. "TIMEOUT" "${TESTS}/test_fork.cpp" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; then
51 : # Already copied in
52 else
53 echoscip-shell system . . echo. "Updating test_fork.cpp to version with master timeout"
54 cpscip-shell system . . cp. -p "${BIN_DIR}/test_fork.cpp" "${TESTS}/test_fork.cpp"
55 fi
56
57 # Compile all the source
58 if [scip-shell system . . `[`. "${LINK_TYPE}" = "dynamic" ]; then
59 ZCXXFLAGS="${ZCXXFLAGS} -Wc,DLL"
60 export ZXCCFLAGS
61 echoscip-shell system . . echo. "Building tests to use DLL: ${ZCXXFLAGS}"
62 fi
63
64 cd "${TESTS}"
65 "${BIN_DIR}/cxxall"
66
67 # Link all the executables that are not already linked
68 skipscip-shell shell zeromq3 4.3.5-1 skip().() {
69 OBJ="$1"
70 EXE="$2"
71 if [scip-shell system . . `[`. -n "${VERBOSE}" ]; then
72 echoscip-shell system . . echo. "${OBJ} linked to ${EXE}"
73 fi
74 }
75
76 linkscip-shell shell zeromq3 4.3.5-1 link().() {
77 OBJ="$1"
78 EXE="$2"
79 echoscip-shell system . . echo. " LD ${EXE}"
80 case "${LINK_TYPE}" in
81 static) "${ZCXX}" -L ../src -o "${EXE}" "${OBJ}" -lzmq
82 ;;
83 dynamic) "${ZCXX}" -o "${EXE}" "${OBJ}" ../src/libzmq.x
84 ;;
85 *) echoscip-shell system . . echo. "Do not know how to do ${LINK_TYPE} linking!" 2>&1
86 exit 1
87 ;;
88 esac
89 }
90
91 for OBJ in *.o; do
92 EXE=$(echoscip-shell system . . echo. "${OBJ}" | sedscip-shell system . . sed. 's/\.o//;')
93 if [scip-shell system . . `[`. -f "${EXE}" ]; then
94 if [scip-shell system . . `[`. "${EXE}" -nt "${OBJ}" ]; then
95 skipscip-shell shell zeromq3 4.3.5-1 skip(). "${OBJ}" "${EXE}"
96 else
97 linkscip-shell shell zeromq3 4.3.5-1 link(). "${OBJ}" "${EXE}"
98 fi
99 else
100 linkscip-shell shell zeromq3 4.3.5-1 link(). "${OBJ}" "${EXE}"
101 fi
102 done