summaryrefslogtreecommitdiff
path: root/Base/home
diff options
context:
space:
mode:
authorAndrew Kaster <akaster@serenityos.org>2021-06-27 14:22:25 -0600
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-06-30 08:18:28 +0430
commitcc0a376c95ac08981b58b4985ab7209fdc368533 (patch)
tree0ec929a4025878473233d5eafb3f05fc685a1eb0 /Base/home
parent601c9e89de64534451b5be878896d1bdf84762df (diff)
downloadserenity-cc0a376c95ac08981b58b4985ab7209fdc368533.zip
Base+Utilities: Add run-tests program to run system tests with LibTest
This test program heavily pulls from the JavaScriptTestRunner/test-js, but with a twist. Instead of loading JavaScript files into the current process, constructing a JS environment for them, and executing test suites/tests directly, run-tests posix_spawns each test file. Test file stdout is written to a temp file, and only dumped to console if the test fails or the verbose option is passed to the program. Unlike test-js, times are always printed for every test executed for better visibility in CI.
Diffstat (limited to 'Base/home')
-rw-r--r--Base/home/anon/.config/Tests.ini7
-rwxr-xr-xBase/home/anon/tests/run-tests-and-shutdown.sh50
2 files changed, 9 insertions, 48 deletions
diff --git a/Base/home/anon/.config/Tests.ini b/Base/home/anon/.config/Tests.ini
new file mode 100644
index 0000000000..f549dad980
--- /dev/null
+++ b/Base/home/anon/.config/Tests.ini
@@ -0,0 +1,7 @@
+[Global]
+SkipDirectories=Kernel/Legacy UserEmulator
+SkipTests=stack-smash test-web
+NotTestsPattern=.txt|.frm|.inc
+
+[test-js]
+Arguments=--show-progress=false
diff --git a/Base/home/anon/tests/run-tests-and-shutdown.sh b/Base/home/anon/tests/run-tests-and-shutdown.sh
index 4cf9fac690..0f8072bbce 100755
--- a/Base/home/anon/tests/run-tests-and-shutdown.sh
+++ b/Base/home/anon/tests/run-tests-and-shutdown.sh
@@ -3,54 +3,8 @@
echo
echo "==== Running Tests on SerenityOS ===="
-run(index) {
- shift
- test_dir=$(dirname $1)
- if test -z $test_dir {
- test_dir="."
- }
- test_cmd=($*)
- echo "==== Running test $index out of $count_of_all_tests -- $test_cmd ===="
- echo "::group::$test_cmd"
- cd $test_dir
- if $test_cmd {
- echo "::endgroup::"
- echo "==== $test_cmd passed! ===="
- } else {
- echo "::endgroup::"
- failed_tests=${concat_lists $failed_tests ($test_cmd)}
- echo "==== Added $test_cmd to list of failed tests. Failed tests so far: $failed_tests ===="
- echo "::error file=$test_cmd:: $test_cmd returned non-zero exit code, check logs!"
- }
- cd -
-}
-
-# Files in /usr/Tests/* that we don't want to execute match these patterns:
-# Kernel/Legacy: Kernel tests that are either old patched exploits, or hang the system/shell
-# .inc: Shell test helper file that's not a test
-# UserEmulator: Tests designed to run inside the Userspace Emulator
-# stack-smash: Intentionally crashes by smashing the stack
-# .frm,.txt: Test inputs that are not tests
-# test-web: Requires the window server in order to work
-# test-js: We start this one manually with the show progress flag set to false
-exclude_patterns='Kernel/Legacy|.inc|UserEmulator|stack-smash|.txt|.frm|test-web|test-js'
-
-system_tests=((test-js --show-progress=false) (test-crypto -c -t test))
-all_tests=${concat_lists $system_tests $(find /usr/Tests -type f | grep -E -v $exclude_patterns | shuf) }
-count_of_all_tests=${length $all_tests}
-failed_tests=()
-
-for index i cmd in $all_tests {
- run $(expr $i + 1) $cmd
-}
-
-fail_count=${length $failed_tests}
-
-echo "==== Out of $count_of_all_tests tests, $(expr $count_of_all_tests - $fail_count) passed and $fail_count failed. ===="
-
-if test $fail_count -gt 0 {
- echo "==== Failing tests: $failed_tests ===="
-}
+run-tests
+fail_count=$?
echo "Failed: $fail_count" > ./test-results.log