2 # Include this file in your shell script by using:
7 # we don't quote $TEXT in case it contains newlines; newlines
8 # aren't allowed in test output. However, we set -f so that
9 # at least shell glob characters aren't processed.
16 if [ -n "$BASH_VERSION" ]; then
20 WVCALLER_FILE=${BASH_SOURCE[2]}
21 WVCALLER_LINE=${BASH_LINENO[1]}
27 WVCALLER_FILE="unknown"
36 TEXT=$(_wvtextclean "$2")
38 if [ "$CODE" -ne 0 ]; then
41 echo "! $WVCALLER_FILE:$WVCALLER_LINE $TEXT $OK" >&2
42 if [ "$CODE" -ne 0 ]; then
72 _wvcheck 1 "NOT($TEXT)"
76 _wvcheck 0 "NOT($TEXT)"
92 _wvcheck $(_wvgetrv [ "$#" -eq 2 ]) "exactly 2 arguments"
97 _wvcheck $(_wvgetrv [ "$1" = "$2" ]) "'$1' = '$2'"
104 _wvcheck $(_wvgetrv [ "$#" -eq 2 ]) "exactly 2 arguments"
105 echo "Comparing:" >&2
109 _wvcheck $(_wvgetrv [ "$1" != "$2" ]) "'$1' != '$2'"
117 _wvcheck $(_wvgetrv [ $RC -eq 0 ]) "return code($RC) == 0"
125 _wvcheck $(_wvgetrv [ $RC -ne 0 ]) "return code($RC) != 0"
133 echo "Testing \"$* ($OMK_RULES)\" in $WVCALLER_FILE:" >&2
138 WVPASS cp "$OMK_TESTSROOT/../leaf-makefile/Makefile" .
139 for i in `find -L . -mindepth 2 -name Makefile.omk`; do
141 WVPASS cp Makefile "${d}/Makefile"
147 CC=$(make omk-get-var VAR=CC|sed -ne '/^CC=/ s///p')
148 if ! which ${CC%% *} > /dev/null; then
149 echo "Warning: '$CC' not found - skipping the test"
153 if [[ $OMK_RULES = sysless-keil16x ]] && ! which cygpath; then
154 echo "Warning: cygpath command not found - skipping the test"
158 if [[ $OMK_RULES = sysless-keil51 ]] && ! which l51; then
159 echo "Warning: l51 command not found - skipping the test"
164 OMK_TESTSROOT=${OMK_TESTSROOT:-$(readlink --canonicalize $(dirname $0))}
165 OMK_RULES=${OMK_RULES:-linux} # When run manually, we use linux rules
167 if [[ -f "${OMK_TESTSROOT}/${OMK_RULES}.env" ]]; then
168 WVPASS . "${OMK_TESTSROOT}/${OMK_RULES}.env"
173 [[ -z "$RTEMS_MAKEFILE_PATH" ]] && exit 0
176 [[ -z "$WRENV" ]] && exit 0
180 echo "Testing \"$OMK_RULES rules\" in $(basename $0):" >&2
181 testdir="tmp/$(basename $0 .sh).$OMK_RULES"
182 [[ -d "$testdir" ]] && WVPASS rm -rf "$testdir"
183 WVPASS mkdir -p "$testdir"
185 WVPASS cp "$OMK_TESTSROOT"/../rules/$OMK_RULES/* .