apenwarr-redo/docs/cookbook/redoconf-simple/test.od

33 lines
1.1 KiB
Text
Raw Permalink Normal View History

# Run a simple test of our hello binary.
#
# The 'run' script is automatically generated by
# redoconf when requested (by redo-ifchange) and if
# it's possible (ie. we are not cross compiling). A
# typical project might choose to fail if it is not
# available, but because this script runs as part of
# the redo source tree, we'll skip the test politely
# if it's not possible to run.
# 'test' is a target you always want to run when
# requested, even if it passes.
redo-always
# Make sure the program (all) is built, and that the
# redoconf program runner (run) is built, if possible.
redo-ifchange all run
# Test the program only if redoconf knows how to run
# produced binaries. It will try to run programs directly,
# or try wine if you are cross-compiling windows programs.
# If the run script is nonexistent (run.od didn't produce
# output), we'll skip it, because we are presumably cross
# compiling for an incompatible platform.
if [ -x ./run ]; then
./run ./hello | tee "$3" >&2
if ! grep "^Hello" "$3" >/dev/null; then
echo "Hello program did not say hello!" >&2
exit 10
fi
else
echo "Non-native platform: test skipped." >&2
fi