]> rtime.felk.cvut.cz Git - omk.git/blobdiff - tests/wvtest.sh
Update wvtool
[omk.git] / tests / wvtest.sh
index 42889978bb0bdc2461c172fd56e6f08126715548..d6bc1984d73ad4651e8ee310caefd2c9028085f9 100644 (file)
@@ -14,6 +14,8 @@ _wvtextclean()
 
 
 if [ -n "$BASH_VERSION" ]; then
+        trap 'echo "! ${BASH_SOURCE[0]}:${LINENO} ${BASH_COMMAND} FAILED"' ERR
+
        _wvfind_caller()
        {
                LVL=$1
@@ -131,6 +133,14 @@ WVSTART()
        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()
@@ -144,9 +154,19 @@ 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
 }
@@ -154,6 +174,10 @@ needs_valid_CC()
 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
@@ -169,3 +193,9 @@ testdir="tmp/$(basename $0 .sh).$OMK_RULES"
 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