Tests: Run each test in their respective directories

This is so they can find their associated resources and it's
the same behavior as in Lagom.

This also required changing some tests so that they could
write their resources in a writable location.
This commit is contained in:
coderdreams 2021-05-30 12:15:20 -03:00 committed by Ali Mohammad Pur
parent 9ffb3e7e30
commit 6bc7f2204e
Notes: sideshowbarker 2024-07-18 11:40:00 +09:00
3 changed files with 16 additions and 4 deletions

View file

@ -5,9 +5,14 @@ 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! ===="
@ -17,6 +22,7 @@ run(index) {
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:
@ -25,10 +31,10 @@ run(index) {
# UserEmulator: Tests designed to run inside the Userspace Emulator
# stack-smash: Intentionally crashes by smashing the stack
# TestJSON: AK/TestJSON makes assumptions about $PWD to load its input files
# .frm: Test inputs that are not tests
# .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|TestJSON|.frm|test-web|test-js'
exclude_patterns='Kernel/Legacy|.inc|UserEmulator|stack-smash|TestJSON|.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) }

View file

@ -1,6 +1,8 @@
#!/bin/sh
source $(dirname "$0")/test-commons.inc
# go to a writable directory
cd /tmp
# Simple usage, single doc
echo <<-test > sh.doc.test
@ -71,4 +73,6 @@ test
test2
rm -f sh.doc.test
# return to original directory
cd -
pass

View file

@ -1,7 +1,8 @@
#!/bin/sh
source $(dirname "$0")/test-commons.inc
# go to a writable directory
cd /tmp
singlecommand_ok=yes
multicommand_ok=yes
inlineexec_ok=yes
@ -95,5 +96,6 @@ if not test \
fail "Something failed :("
}
# return to original directory
cd -
echo PASS