From 225f1408e03f2e66198f3da20c42a746e2729ab0 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 7 Dec 2023 20:35:16 +0100 Subject: Fourth commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- tests/default-integers | 21 +++++++++++++++++++++ tests/load-functions | 4 ++++ tests/os-dependent-integers | 9 +++++++++ 3 files changed, 34 insertions(+) create mode 100644 tests/default-integers create mode 100644 tests/os-dependent-integers (limited to 'tests') diff --git a/tests/default-integers b/tests/default-integers new file mode 100644 index 0000000..12faa5a --- /dev/null +++ b/tests/default-integers @@ -0,0 +1,21 @@ +# -*- sh -*- +# See LICENSE file for copyright and license details. + +for arch in $(getnamelist ARCH); do + archn=$(getnum ARCH $arch) + if ! issupported $os $arch; then + continue + fi + + if test $arch = M68K; then + maxalign=16 + elif test $arch = I386; then + maxalign=32 + else + maxalign=64 + fi + + for width in 8 16 32 64; do + test "$(get-integer-alignment.tu $osn $archn $width $os $arch)" = $(min $maxalign $width) + done +done diff --git a/tests/load-functions b/tests/load-functions index f0c5311..a31f236 100644 --- a/tests/load-functions +++ b/tests/load-functions @@ -58,3 +58,7 @@ issupported () { cpp_enum_clean () { $CPP < libsyscalls.h 2>/dev/null | grep -v '#' | tr '\n,{}' ' \n\n\n' } + +min () { + printf '%s\n' "$@" | tr -d + | sort -n | sed -n 1p +} diff --git a/tests/os-dependent-integers b/tests/os-dependent-integers new file mode 100644 index 0000000..09a11e3 --- /dev/null +++ b/tests/os-dependent-integers @@ -0,0 +1,9 @@ +# -*- sh -*- +# See LICENSE file for copyright and license details. + +for os in $(getnamelist OS); do + osn=$(getnum OS $os) + if issupported $os; then + . $(printf '%s\n' $os | tr '[A-Z]' '[a-z]')/tests/os-dependent-integers + fi +done -- cgit v1.2.3-70-g09d2