summaryrefslogtreecommitdiffstats
path: root/tests/test-self-check
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2023-12-05 20:10:48 +0100
committerMattias Andrée <maandree@kth.se>2023-12-05 20:10:48 +0100
commit6d77b155bcd4725e09837604e6ea86f5f124ba9c (patch)
tree7cfdf466bb94bbbe3e7929432bc048da5eaa2349 /tests/test-self-check
parentSecond commit (diff)
downloadlibsyscalls-6d77b155bcd4725e09837604e6ea86f5f124ba9c.tar.gz
libsyscalls-6d77b155bcd4725e09837604e6ea86f5f124ba9c.tar.bz2
libsyscalls-6d77b155bcd4725e09837604e6ea86f5f124ba9c.tar.xz
Third commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'tests/test-self-check')
-rw-r--r--tests/test-self-check47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/test-self-check b/tests/test-self-check
new file mode 100644
index 0000000..8e42f18
--- /dev/null
+++ b/tests/test-self-check
@@ -0,0 +1,47 @@
+# -*- sh -*-
+# See LICENSE file for copyright and license details.
+
+set -e
+
+stderr_printf () {
+ printf "$@" >&2
+}
+test "$(stderr_printf 'hello\n')" = ''
+test "$(stderr stderr_printf 'hello\n' 2>&1)" = 'hello'
+
+(! (false > $a) )
+
+getname OS 0
+(! getname OS)
+getnum OS LINUX
+(! getnum OS 0)
+
+getnamelist OS | grep LINUX
+getnamelist ARCH | grep AMD64_X32
+
+getnumlist OS | grep '^0$'
+getnumlist ARCH | grep 10
+
+getnumlist OS ${CPP} | grep '^0$'
+test -n "${CPP}"
+
+test "$(getname OS 0)" = LINUX
+test "$(getnum OS LINUX)" = 0
+
+test "$(lookupnum "$(getlist OS)" LINUX)" = 0
+test "$(lookupname "$(getlist OS)" 0)" = LINUX
+
+printf 'a\n' > $a
+printf 'b\n' > $b
+(! diff -u $a $b)
+
+printf 'a\n' > $a
+printf 'a\n' > $b
+diff -u $a $b
+
+for os in ${SUPPORTED_OSES}; do
+ issupported $os
+ for arch in $(env | sed -n 's/^SUPPORTED_'"$os"'_ARCHES=//p' | xargs printf '%s\n'); do
+ issupported $os $arch
+ done
+done