diff options
author | Andrew Kaster <andrewdkaster@gmail.com> | 2021-05-21 04:44:11 -0600 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-05-22 00:24:27 +0430 |
commit | c6eff55439bfd550b46a6d48a13b04b5f984a844 (patch) | |
tree | dbe7f0a3cd8bb2cc728d338db251701f79055afe | |
parent | 5018b3b4b7dc191d217ec60d2ac744cf7444e39f (diff) | |
download | serenity-c6eff55439bfd550b46a6d48a13b04b5f984a844.zip |
Shell: Make sure all tests put their temp dirs in /tmp
Follow-on to #7337. Been seeing other CI test failures that point to
these temp directories, so let's just move all of them to /tmp. I'm sure
someone will write ext2fs stress tests later :^)
Example:
/usr/Tests/Shell/control-structure-as-command.sh
Core::Socket: Failed to connect() to /tmp/portal/inspectables: ...
+ rm -rf shell-test 2>/dev/null
+ mkdir shell-test
Error: The action has timed out.
-rw-r--r-- | Userland/Shell/Tests/builtin-redir.sh | 10 | ||||
-rw-r--r-- | Userland/Shell/Tests/control-structure-as-command.sh | 10 | ||||
-rw-r--r-- | Userland/Shell/Tests/subshell.sh | 10 | ||||
-rw-r--r-- | Userland/Shell/Tests/valid.sh | 1 |
4 files changed, 16 insertions, 15 deletions
diff --git a/Userland/Shell/Tests/builtin-redir.sh b/Userland/Shell/Tests/builtin-redir.sh index ff4254c311..0669f2fdda 100644 --- a/Userland/Shell/Tests/builtin-redir.sh +++ b/Userland/Shell/Tests/builtin-redir.sh @@ -2,9 +2,9 @@ source $(dirname "$0")/test-commons.inc -rm -rf shell-test -mkdir -p shell-test -cd shell-test +rm -rf /tmp/shell-test 2> /dev/null +mkdir -p /tmp/shell-test +pushd /tmp/shell-test time sleep 1 2>timeerr >timeout cat timeout @@ -15,7 +15,7 @@ cd shell-test time ls 2> /dev/null | head > timeout if not test -n "$(cat timeout)" { fail "'time' stdout not piped correctly" } -cd .. -rm -rf shell-test # TODO: Remove this file at the end once we have `trap' +popd +rm -rf /tmp/shell-test # TODO (#7339): Remove this file at the end once we have `trap' echo PASS diff --git a/Userland/Shell/Tests/control-structure-as-command.sh b/Userland/Shell/Tests/control-structure-as-command.sh index 0ec3a3055f..08ad044f2a 100644 --- a/Userland/Shell/Tests/control-structure-as-command.sh +++ b/Userland/Shell/Tests/control-structure-as-command.sh @@ -4,9 +4,9 @@ source $(dirname "$0")/test-commons.inc setopt --verbose -rm -rf shell-test 2> /dev/null -mkdir shell-test -cd shell-test +rm -rf /tmp/shell-test 2> /dev/null +mkdir -p /tmp/shell-test +pushd /tmp/shell-test touch a b c @@ -38,7 +38,7 @@ cd shell-test if not test "$(cat listing)" = "TRUE!" { fail if cannot be correctly redirected from } rm listing -cd .. -rm -rf shell-test +popd +rm -rf /tmp/shell-test echo PASS diff --git a/Userland/Shell/Tests/subshell.sh b/Userland/Shell/Tests/subshell.sh index 178e358b15..b3db2512a8 100644 --- a/Userland/Shell/Tests/subshell.sh +++ b/Userland/Shell/Tests/subshell.sh @@ -4,9 +4,9 @@ source $(dirname "$0")/test-commons.inc setopt --verbose -rm -rf shell-test -mkdir shell-test -cd shell-test +rm -rf /tmp/shell-test 2> /dev/null +mkdir -p /tmp/shell-test +pushd /tmp/shell-test # Simple sequence (grouping) { echo test > testfile } @@ -33,7 +33,7 @@ cd shell-test fail exits with $exitcode when it should exit with 0 } -cd .. -rm -rf shell-test +popd +rm -rf /tmp/shell-test echo PASS diff --git a/Userland/Shell/Tests/valid.sh b/Userland/Shell/Tests/valid.sh index a33ad2307e..dc624f1fdd 100644 --- a/Userland/Shell/Tests/valid.sh +++ b/Userland/Shell/Tests/valid.sh @@ -65,6 +65,7 @@ word_count=(() | wc -w) if not test "$(echo well hello friends $word_count)" -eq 3 { fail variable containing pipeline } # Globs +rm -fr /tmp/sh-test 2> /dev/null mkdir -p /tmp/sh-test pushd /tmp/sh-test touch (a b c)(d e f) |