libzmq/builds/zos/maketests
Ewen McNeill 6e0c1c0a80 builds/zos/* portability files to z/OS UNIX
builds/zos includes:
    README.md: Overview of z/OS UNIX System Services port (Markdown)
    makelibzmq: Compile src/*.cpp and make libzmq.a
    maketests:  Compile tests/*.cpp and make test_* executables
    runtests:   Run tests/test_* executables and report results
    makeclean:  Remove built files
    zc++: /bin/c++ wrapper supplying required build arguments
    cxxall: run zc++ for all *.cpp files in directory

    platform.hpp: pre-generated (and edited) src/platform.hpp for z/OS
    test_fork.cpp: updated tests/test_fork.cpp that completes on z/OS
2014-07-22 12:05:51 +12:00

80 lines
1.8 KiB
Bash

#! /bin/sh
# Build tests/* executables; assumes that libzmq.a is already built
#
# Written by Ewen McNeill <ewen@imatix.com>, 2014-07-21
# Updated by Ewen McNeill <ewen@imatix.com>, 2014-07-22
#---------------------------------------------------------------------------
set -e # Stop on errors
VERBOSE="${VERBOSE:-}" # Set to non-empty for already done status
export VERBOSE
# Figure out where we are
BIN_DIR=$(dirname $0)
if [ -z "${BIN_DIR}" ]; then BIN_DIR="."; fi
case "${BIN_DIR}" in
.) BIN_DIR="$(pwd)"; ;;
/*) ;;
*) BIN_DIR="$(pwd)/${BIN_DIR}"; ;;
esac
# Locate compiler wrapper
ZCXX="${BIN_DIR}/zc++"
# Locate top of source tree, assuming we're in builds/zos
TOP="${BIN_DIR}/../.."
SRC="${TOP}/src"
TESTS="${TOP}/tests"
if [ -f "${SRC}/platform.hpp" -a -f "${SRC}/libzmq.a" ]; then
:
else
echo "Error: run makezmqlib to build libzmq.a first" >&2
exit 1
fi
# Copy in replacement test with timeout, if main version is not already
# up to date
#
if [ -f "${TESTS}/test_fork.cpp" ] &&
grep "TIMEOUT" "${TESTS}/test_fork.cpp" >/dev/null 2>&1; then
: # Already copied in
else
echo "Updating test_fork.cpp to version with master timeout"
cp -p "${BIN_DIR}/test_fork.cpp" "${TESTS}/test_fork.cpp"
fi
# Compile all the source
cd "${TESTS}"
"${BIN_DIR}/cxxall"
# Link all the executables that are not already linked
skip() {
OBJ="$1"
EXE="$2"
if [ -n "${VERBOSE}" ]; then
echo "${OBJ} linked to ${EXE}"
fi
}
compile() {
OBJ="$1"
EXE="$2"
echo " LD ${EXE}"
"${ZCXX}" -L ../src -o "${EXE}" "${OBJ}" -lzmq
}
for OBJ in *.o; do
EXE=$(echo "${OBJ}" | sed 's/\.o//;')
if [ -f "${EXE}" ]; then
if [ "${EXE}" -nt "${OBJ}" ]; then
skip "${OBJ}" "${EXE}"
else
compile "${OBJ}" "${EXE}"
fi
else
compile "${OBJ}" "${EXE}"
fi
done