summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-08-14 23:34:03 +0430
committerAndreas Kling <kling@serenityos.org>2020-08-15 20:48:17 +0200
commit154ffa3f5f15f0bc1897c8322299f7bc2d9caee2 (patch)
treea665b8c2ab75ccf619616f16c0e1c8e81ad00b11
parentc589625418e444164b6732ac9f4e1908a9bdbc5c (diff)
downloadserenity-154ffa3f5f15f0bc1897c8322299f7bc2d9caee2.zip
Shell: Add some tests for builtin redirection
-rw-r--r--Shell/Tests/builtin-redir.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/Shell/Tests/builtin-redir.sh b/Shell/Tests/builtin-redir.sh
new file mode 100644
index 0000000000..ba9f1f15e2
--- /dev/null
+++ b/Shell/Tests/builtin-redir.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+rm -rf shell-test
+mkdir -p shell-test
+cd 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.
+ test -n "$(cat timeerr)" || echo "Failure: 'time' stderr output not redirected correctly" && exit 1
+ test -e timeout || echo "Failure: 'time' stdout output not redirected correctly" && exit 1
+
+ time ls 2> /dev/null | head > timeout
+ test -n "$(cat timeout)" || echo "Failure: 'time' stdout not piped correctly" && exit 1
+
+cd ..
+rm -rf shell-test # TODO: Remove this file at the end once we have `trap'