From 79c5c5d792cf925afa4ed2465a96553d60a844bd Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Mon, 6 Apr 2015 23:40:13 +0000 Subject: [PATCH] tests: workaround old gawk versions that do not provide @include support 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 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/init.sh b/tests/init.sh index 0c5b121f..c9768064 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -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" -- 2.50.1