forked from bonsai/harakit
intcmp(1): new tool; npc(1): new tool; scrut(1): new tool; str(1): new tool; strcmp(1): new tool; tests: added POSIX compatibility test and C compiler compatibility test; Makefile: converted to GNUmakefile; README: added README; docs: added docs
This commit is contained in:
35
tests/cc-compat.sh
Executable file
35
tests/cc-compat.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2023 Emma Tebibyte <emma@tebibyte.media>
|
||||
# SPDX-License-Identifier: FSFAP
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice and this
|
||||
# notice are preserved. This file is offered as-is, without any warranty.
|
||||
|
||||
set -e
|
||||
|
||||
if ! ls GNUmakefile >/dev/null 2>&1
|
||||
then
|
||||
printf '%s: Run this script in the root of the project.\n' "$0" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
make clean
|
||||
|
||||
for CC in cc\
|
||||
clang \
|
||||
gcc \
|
||||
tcc \
|
||||
'zig cc'
|
||||
do
|
||||
export CC
|
||||
printf '%s: %s: Testing build.\n' "$0" "$CC"
|
||||
|
||||
make CC="$CC" && printf '%s: Build successful.\n' "$0"
|
||||
|
||||
ls -lA build/
|
||||
|
||||
make clean
|
||||
printf '\n'
|
||||
done
|
||||
24
tests/posix-compat.sh
Executable file
24
tests/posix-compat.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2023 Emma Tebibyte <emma@tebibyte.media>
|
||||
# SPDX-License-Identifier: FSFAP
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice and this
|
||||
# notice are preserved. This file is offered as-is, without any warranty.
|
||||
|
||||
set -e
|
||||
|
||||
if ! ls GNUmakefile >/dev/null 2>&1
|
||||
then
|
||||
printf '%s: Run this script in the root of the project.\n' "$0" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf "Starting POSIX compatibility testing.\n"
|
||||
|
||||
for utility in tests/posix/*; do
|
||||
printf '%s: %s: Testing utility.\n' "$0" "$utility"
|
||||
"$utility"
|
||||
printf '\n'
|
||||
done
|
||||
19
tests/posix/test
Executable file
19
tests/posix/test
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2023 DTB <trinity@trinity.moe>
|
||||
# SPDX-License-Identifier: FSFAP
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice and this
|
||||
# notice are preserved. This file is offered as-is, without any warranty.
|
||||
|
||||
set -e
|
||||
|
||||
i=1
|
||||
while test -e "$i".test; do
|
||||
printf '%s: %s: Running test...\n' "$0" "$i".test
|
||||
./"$i".test >"$i".result
|
||||
diff 1.expected 1.result
|
||||
printf '%s: %s: Test passed.\n' "$0" "$i".test
|
||||
i="$(printf '%s + %s\n' 1 "$i" | bc)"
|
||||
done
|
||||
Reference in New Issue
Block a user