diff options
Diffstat (limited to '')
-rw-r--r-- | tests/load-archinfo | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/load-archinfo b/tests/load-archinfo new file mode 100644 index 0000000..4c38f6b --- /dev/null +++ b/tests/load-archinfo @@ -0,0 +1,41 @@ +# -*- sh -*- +# See LICENSE file for copyright and license details. + +#in this test, we are assuming that char is 8 bits +intsizes="8 16 32 64" +cat > $b <<. +8Little 0 +16Little 0 8 +32Little 0 8 16 24 +64Little 0 8 16 24 32 40 48 56 +8Big 0 +16Big 8 0 +32Big 24 16 8 0 +64Big 56 48 40 32 24 16 8 0 +. +byteorders="$(cat $b)" +getbyteorder () { + printf '%s\n' "$byteorders" | grep "^$1$2 " | cut -d ' ' -f 2- +} + +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 +archinfo="$(cat $b)" +getbytesize () { + printf '%s\n' "$archinfo" | grep "^$1 " | cut -d ' ' -f 2 +} +getaddrsize () { + printf '%s\n' "$archinfo" | grep "^$1 " | cut -d ' ' -f 3 +} +getsizesize () { + printf '%s\n' "$archinfo" | grep "^$1 " | cut -d ' ' -f 4 +} +getendian () { + printf '%s\n' "$archinfo" | grep "^$1 " | cut -d ' ' -f 5 +} +getsign () { + printf '%s\n' "$archinfo" | grep "^$1 " | cut -d ' ' -f 6 +} |