]> granicus.if.org Git - strace/commitdiff
tests: workaround old gawk versions that do not provide @include support
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 6 Apr 2015 23:40:13 +0000 (23:40 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 7 Apr 2015 00:10:39 +0000 (00:10 +0000)
Some of our tests use GNU awk @include extension, but not all currently
used versions of GNU awk support it.  Skip these tests if gawk does not
provide @include support.

* tests/init.sh (check_gawk): New function.
(match_awk): Use it.

tests/init.sh

index 0c5b121f0405ae0e995c5761a3a8443dfbfd2757..c9768064ffdf4f92f3da014345ddad40d74d7865 100644 (file)
@@ -59,6 +59,18 @@ run_strace_merge()
        rm -f -- "$LOG".[0-9]*
 }
 
+check_gawk()
+{
+       check_prog gawk
+       check_prog grep
+
+       local program="$1"; shift
+       if grep '^@include[[:space:]]' < "$program" > /dev/null; then
+               gawk '@include "/dev/null"' < /dev/null ||
+                       framework_skip_ 'gawk does not support @include'
+       fi
+}
+
 # Usage: [FILE_TO_CHECK [AWK_PROGRAM [ERROR_MESSAGE [EXTRA_AWK_OPTIONS...]]]]
 # Check whether all patterns listed in AWK_PROGRAM
 # match FILE_TO_CHECK using egrep.
@@ -83,7 +95,7 @@ match_awk()
                error="$1"; shift
        fi
 
-       check_prog gawk
+       check_gawk "$program"
 
        AWKPATH="$srcdir" gawk -f "$program" "$@" < "$output" || {
                cat < "$output"