if [ -n "$BASH_VERSION" ]; then
+ trap 'echo "! ${BASH_SOURCE[0]}:${LINENO} ${BASH_COMMAND} FAILED"' ERR
+
_wvfind_caller()
{
LVL=$1
echo >&2
_wvfind_caller
echo "Testing \"$* ($OMK_RULES)\" in $WVCALLER_FILE:" >&2
+ cd "$WV_BASE_DIR"
+ local dir=test.$(echo $* | tr -s '[[:blank:]]' _ | tr "A-Z" "a-z")
+ rm -rf "$dir"
+ mkdir -p "$dir"
+ WVPASS cd "$WV_BASE_DIR/$dir"
+ WVPASS cp "$OMK_TESTSROOT"/../rules/$OMK_RULES/* .
+ WVPASS cp "$OMK_TESTSROOT"/../snippets/Makefile.rules.$OMK_RULES Makefile.rules
+ WVPASS cp "$OMK_TESTSROOT/../leaf-makefile/Makefile" .
}
omkize()
needs_valid_CC()
{
- CC=$(make -qp|sed -ne '/^CC = / s///p')
- if ! [[ -x "$CC" ]]; then
- echo "Warning: $CC not found - skipping the test"
+ CC=$(make omk-get-var VAR=CC|sed -ne '/^CC=/ s///p')
+ if ! which ${CC%% *} > /dev/null; then
+ echo "Warning: '$CC' not found - skipping the test"
+ exit 0
+ fi
+
+ if [[ $OMK_RULES = sysless-keil16x ]] && ! which cygpath; then
+ echo "Warning: cygpath command not found - skipping the test"
+ exit 0
+ fi
+
+ if [[ $OMK_RULES = sysless-keil51 ]] && ! which l51; then
+ echo "Warning: l51 command not found - skipping the test"
exit 0
fi
}
OMK_TESTSROOT=${OMK_TESTSROOT:-$(readlink --canonicalize $(dirname $0))}
OMK_RULES=${OMK_RULES:-linux} # When run manually, we use linux rules
+if [[ -f "${OMK_TESTSROOT}/${OMK_RULES}.env" ]]; then
+ WVPASS . "${OMK_TESTSROOT}/${OMK_RULES}.env"
+fi
+
case $OMK_RULES in
rtems)
[[ -z "$RTEMS_MAKEFILE_PATH" ]] && exit 0
echo "Testing \"$OMK_RULES rules\" in $(basename $0):" >&2
testdir="tmp/$(basename $0 .sh).$OMK_RULES"
-[ -d "$testdir" ] && WVPASS rm -rf "$testdir"
+[[ -d "$testdir" ]] && WVPASS rm -rf "$testdir"
WVPASS mkdir -p "$testdir"
WVPASS cd "$testdir"
WVPASS cp "$OMK_TESTSROOT"/../rules/$OMK_RULES/* .
+WVPASS cp "$OMK_TESTSROOT"/../snippets/Makefile.rules.$OMK_RULES Makefile.rules
+WVPASS cp "$OMK_TESTSROOT/../leaf-makefile/Makefile" .
+
+WV_BASE_DIR="$PWD"
+export MAKEFLAGS="--include-dir=$OMK_TESTSROOT/../snippets"
+export LC_ALL=C