2 # NOTE: Not a script, to be included by scripts
4 BASEDIR=rundir/${TESTNAME}/
8 rm -f ${BASEDIR}cokebank.db
10 # Template configuration (disables door and the coke machine)
11 cat << EOF > ${BASEDIR}cfg_server.conf
12 # AUTOGENERATED Test ${TESTNAME}
14 cokebank_database ${BASEDIR}cokebank.db
15 items_file ${BASEDIR}cfg_items.conf
16 door_serial_port /dev/null
18 coke_modbus_address 0.0.0.0
26 echo "# AUTOGENERATED Test ${TESTNAME}" > ${BASEDIR}cfg_items.conf
29 echo "TEST ${TESTNAME}: "$*
32 echo "TEST ${TESTNAME} FAIL: "$*
38 FAIL "Command \`$cmd\` failed"
42 DISPENSE="../dispense -H localhost -P ${PORT}"
44 LD_LIBRARY_PATH=.. ../dispsrv -f ${BASEDIR}cfg_server.conf --dont-daemonise > ${BASEDIR}server.log 2>&1 &
48 LOG "Killing ${server_pid}"
49 kill ${server_pid}; true
53 LOG "Server running on PID ${server_pid}"
55 # - Make sure that the server started
56 if ! (echo "" | nc localhost ${PORT}); then
57 LOG "Server not responding on ${PORT}"
58 LOG "Server log contents:"
59 cat ${BASEDIR}server.log