ladybird/Userland/Shell/Tests/builtin-redir.sh
Andrew Kaster c6eff55439 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.
2021-05-22 00:24:27 +04:30

22 lines
674 B
Bash

#!/bin/sh
source $(dirname "$0")/test-commons.inc
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
# We cannot be sure about the values, so just assert that they're not empty.
if not test -n "$(cat timeerr)" { fail "'time' stderr output not redirected correctly" }
if not test -e timeout { fail "'time' stdout output not redirected correctly" }
time ls 2> /dev/null | head > timeout
if not test -n "$(cat timeout)" { fail "'time' stdout not piped correctly" }
popd
rm -rf /tmp/shell-test # TODO (#7339): Remove this file at the end once we have `trap'
echo PASS