From 9f449569df9c94670f51fd8cd5558b66884cd877 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 7 Dec 2023 22:51:52 +0100 Subject: Improve portability MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- tests/enums | 2 +- tests/errors | 6 +++--- tests/fundamental-primitives | 2 +- tests/load-archinfo | 6 +++--- tests/load-functions | 2 +- tests/signals | 12 ++++++------ tests/split-register-types | 2 +- tests/syscall-errors | 12 ++++++------ 8 files changed, 22 insertions(+), 22 deletions(-) (limited to 'tests') diff --git a/tests/enums b/tests/enums index 43afe3d..476c478 100644 --- a/tests/enums +++ b/tests/enums @@ -16,7 +16,7 @@ for cat in $(getnamelist CAT); do continue fi check_enum_good ${cat}_SUBCAT - grep -i "enum.libsyscalls_${cat}_syscall_subcategory"'\s\+'"$cat"\\b < libsyscalls.h >/dev/null + grep -i "enum.libsyscalls_${cat}_syscall_subcategory"'[[:space:]]\{1,\}'"$cat"'\([^A-Za-z0-9_]\|$\)' < libsyscalls.h >/dev/null done check_enum_good SIGN check_enum_good ANNOTATION diff --git a/tests/errors b/tests/errors index f14ddfc..8c74731 100644 --- a/tests/errors +++ b/tests/errors @@ -30,9 +30,9 @@ done strerror-all.tu > $a list-errors.tu > $b (! grep '^-' >/dev/null < $b) -grep '^[0-9]\+ ' >/dev/null < $b -grep '^[0-9]\+ LIBSYSCALLS_E_[A-Z]\+ ' >/dev/null < $b -grep '^[0-9]\+ LIBSYSCALLS_E_[A-Z]\+ [A-Z].*[^.]$' >/dev/null < $b +grep '^[0-9]\{1,\} ' >/dev/null < $b +grep '^[0-9]\{1,\} LIBSYSCALLS_E_[A-Z]\{1,\} ' >/dev/null < $b +grep '^[0-9]\{1,\} LIBSYSCALLS_E_[A-Z]\{1,\} [A-Z].*[^.]$' >/dev/null < $b cut -d ' ' -f 3- < $b | diff -u $a - sed 1q < $b | grep '^0 LIBSYSCALLS_E_OK Success$' >/dev/null test -z "$(cut -d ' ' -f 1 < $b | sort | uniq -d)" diff --git a/tests/fundamental-primitives b/tests/fundamental-primitives index 4068934..1c8a47a 100644 --- a/tests/fundamental-primitives +++ b/tests/fundamental-primitives @@ -77,7 +77,7 @@ for os in $(getnamelist OS); do grep "^is_unsigned = 0"\$ < $a >/dev/null grep "^annotation = ${noannotation}"\$ < $a >/dev/null grep "^section = ${whole}"\$ < $a >/dev/null - grep "^byteorder =\s*"\$ < $a >/dev/null + grep "^byteorder =[[:space:]]*"\$ < $a >/dev/null type=NO_RETURN get-datatype-description.tu $osn $archn $(lookupnum "$types" $type) $os $arch $type | diff -u $a - diff --git a/tests/load-archinfo b/tests/load-archinfo index 4c38f6b..09d472b 100644 --- a/tests/load-archinfo +++ b/tests/load-archinfo @@ -20,9 +20,9 @@ getbyteorder () { sed '1,/LIST_ARCH_SPECS/d' < libsyscalls_get_datatype_description.c \ | sed '/#include/q' \ -| sed 's/\(TO''DO\)\s*([^)]*)/\1/g' \ -| sed -n 's/^\s*[A-Z_]\+(LIBSYSCALLS_ARCH_\([^)]*\)).*$/\1/p' \ -| sed 's/,\s*/ /g' > $b +| sed 's/\(TO''DO\)[[:space:]]*([^)]*)/\1/g' \ +| sed -n 's/^[[:space:]]*[A-Z_]\{1,\}(LIBSYSCALLS_ARCH_\([^)]*\)).*$/\1/p' \ +| sed 's/,[[:space:]]*/ /g' > $b archinfo="$(cat $b)" getbytesize () { printf '%s\n' "$archinfo" | grep "^$1 " | cut -d ' ' -f 2 diff --git a/tests/load-functions b/tests/load-functions index a31f236..2e9ddda 100644 --- a/tests/load-functions +++ b/tests/load-functions @@ -11,7 +11,7 @@ getlist () { if test $# = 0; then set cat; fi "$@" < libsyscalls.h \ | tr , '\n' \ - | sed -n 's/^\s*LIBSYSCALLS_'"${getlist_list}"'_\([A-Z0-9_]\+\(\s*=\s*[ 0-9A-Fa-fxXULul()^&|!*/<>~+-]\+\)\?\)\b.*$/\1/p' \ + | sed -n 's/^[[:space:]]*LIBSYSCALLS_'"${getlist_list}"'_\([A-Z0-9_]\{1,\}\([[:space:]]*=[[:space:]]*[[:space:]0-9A-Fa-fxXULul()^&|!*/<>~+-]\{1,\}\)\{0,1\}\)\([^A-Za-z0-9_].*\)*$/\1/p' \ | tr = ' ' \ | (i=0; while read name value; do if test -n "$value"; then diff --git a/tests/signals b/tests/signals index 7e58621..4052402 100644 --- a/tests/signals +++ b/tests/signals @@ -6,26 +6,26 @@ for os in $(getnamelist OS); do for arch in $(getnamelist ARCH); do archn=$(getnum ARCH $arch) get-signals.tu $osn $archn $os $arch > $a - grep -v '^[0-9]\+ -' >/dev/null < $a + grep -v '^[0-9]\{1,\} -' >/dev/null < $a grep -v '^-' < $a > $b - grep '^\([0-9]\+\) \1 ' < $a | diff -u $a - + grep '^\([0-9]\{1,\}\) \1 ' < $a | diff -u $a - if issupported $os $arch; then (! test "$(cat $a)" = x) if test "$os" = LINUX; then signed=1 - grep '^[0-9]\+ [0-9]\+ [A-Z0-9_+]\+$' >/dev/null < $a - test -z "$(grep -v '^[0-9]\+ [0-9]\+ [A-Z0-9_+]\+$' < $a)" + grep '^[0-9]\{1,\} [0-9]\{1,\} [A-Z0-9_+]\{1,\}$' >/dev/null < $a + test -z "$(grep -v '^[0-9]\{1,\} [0-9]\{1,\} [A-Z0-9_+]\{1,\}$' < $a)" required="SIGKILL SIGTERM SIGCONT SIGSTOP SIGHUP _SIGRTMIN _SIGRTMIN+8" else continue; fi for req in $required; do - grep '^-\?[0-9]\+ [0-9]\+ '"$req"\$ >/dev/null < $a + grep '^-\{0,1\}[0-9]\{1,\} [0-9]\{1,\} '"$req"\$ >/dev/null < $a done cut -d ' ' -f $(( 2 - signed )) < $a > $b && sort -n < $b | diff -u $b - if test -f testcases/signals-$os-$arch; then if ! diff -u testcases/signals-$os-$arch $a; then - printf '\x1b[33m%s\x1b[m\n' "Maybe new signals have been added for $os on $arch" + printf '\033[33m%s\033[m\n' "Maybe new signals have been added for $os on $arch" exit 1 fi fi diff --git a/tests/split-register-types b/tests/split-register-types index 3b3070b..454d836 100644 --- a/tests/split-register-types +++ b/tests/split-register-types @@ -13,7 +13,7 @@ for os in $(getnamelist OS); do for stype in INT64_HIGH_32 INT64_LOW_32 INT64_FRONT_32 INT64_BACK_32; do utype=U$stype - rtype="$(printf '%s\n' "$stype" | sed 's/^\(INT\)[0-9]\+_[A-Z]\+_\([0-9]\+\)$/\1\2/')" + rtype="$(printf '%s\n' "$stype" | sed 's/^\(INT\)[0-9]\{1,\}_[A-Z]\{1,\}_\([0-9]\{1,\}\)$/\1\2/')" test ! "$rtype" = "$stype" rtypen=$(lookupnum "$types" $rtype) stypen=$(lookupnum "$types" $stype) diff --git a/tests/syscall-errors b/tests/syscall-errors index 0d36428..8d85ded 100644 --- a/tests/syscall-errors +++ b/tests/syscall-errors @@ -6,26 +6,26 @@ for os in $(getnamelist OS); do for arch in $(getnamelist ARCH); do archn=$(getnum ARCH $arch) get-syscall-errors.tu $osn $archn $os $arch > $a - grep -v '^[0-9]\+ -' >/dev/null < $a + grep -v '^[0-9]\{1,\} -' >/dev/null < $a grep -v '^-' < $a > $b - grep '^\([0-9]\+\) \1 ' < $a | diff -u $a - + grep '^\([0-9]\{1,\}\) \1 ' < $a | diff -u $a - if issupported $os $arch; then (! test "$(cat $a)" = x) if test "$os" = LINUX; then signed=1 - grep '^[0-9]\+ [0-9]\+ [A-Z0-9_]\+$' >/dev/null < $a - test -z "$(grep -v '^[0-9]\+ [0-9]\+ [A-Z0-9_]\+$' < $a)" + grep '^[0-9]\{1,\} [0-9]\{1,\} [A-Z0-9_]\{1,\}$' >/dev/null < $a + test -z "$(grep -v '^[0-9]\{1,\} [0-9]\{1,\} [A-Z0-9_]\{1,\}$' < $a)" required="ERESTARTSYS ERESTARTNOINTR ERESTARTNOHAND ERESTART_RESTARTBLOCK EPERM ENOENT EDOM ELOOP" else continue; fi for req in $required; do - grep '^-\?[0-9]\+ [0-9]\+ '"$req"\$ >/dev/null < $a + grep '^-\{0,1\}[0-9]\{1,\} [0-9]\{1,\} '"$req"\$ >/dev/null < $a done cut -d ' ' -f $(( 2 - signed )) < $a > $b && sort -n < $b | diff -u $b - if test -f testcases/errors-$os-$arch; then if ! diff -u testcases/errors-$os-$arch $a; then - printf '\x1b[33m%s\x1b[m\n' "Maybe new errors have been added for $os on $arch" + printf '\033[33m%s\033[m\n' "Maybe new errors have been added for $os on $arch" exit 1 fi fi -- cgit v1.2.3-70-g09d2