diff options
author | Rob Landley <rob@landley.net> | 2014-09-20 13:09:14 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2014-09-20 13:09:14 -0500 |
commit | 387edf547eb09b27ca6d49772eb048d729f09cf4 (patch) | |
tree | 59d482f33735690cab6d90723393afa1e2c8dce5 /tests/du.test | |
parent | d3df423a6cde0c6282658ff628574771d3824d71 (diff) | |
download | toybox-387edf547eb09b27ca6d49772eb048d729f09cf4.tar.gz |
Move testsuite out of scripts/test into its own top level tests directory, and make ctrl-c kill "make test" more reliably.
Diffstat (limited to 'tests/du.test')
-rwxr-xr-x | tests/du.test | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/du.test b/tests/du.test new file mode 100755 index 00000000..ee4867b8 --- /dev/null +++ b/tests/du.test @@ -0,0 +1,26 @@ +#!/bin/bash + +[ -f testing.sh ] && . testing.sh + +#testing "name" "command" "result" "infile" "stdin" + +# we only test with -k since getting POSIX version is variable +# POSIXLY_CORRECT is sometimes needed, sometimes -P is needed, +# while -k is the default on most Linux systems + +mkdir -p du_test/test du_2/foo +testing "du (no options)" "du -k du_test" "4\tdu_test/test\n8\tdu_test\n" "" "" +testing "du -s" "du -k -s du_test" "8\tdu_test\n" "" "" +ln -s ../du_2 du_test/xyz +# "du shall count the size of the symbolic link" +# I assume this means the space used to store the link name +testing "du counts symlinks without following" "du -ks du_test" "12\tdu_test\n" "" "" +testing "du -L follows symlinks" "du -ksL du_test" "16\tdu_test\n" "" "" +# if -H and -L are specified, the last takes priority +testing "du -HL follows symlinks" "du -ksHL du_test" "16\tdu_test\n" "" "" +testing "du -H does not follow unspecified symlinks" "du -ksH du_test" "12\tdu_test\n" "" "" +testing "du -LH does not follow unspecified symlinks" "du -ksLH du_test" "12\tdu_test\n" "" "" +testing "du -H follows specified symlinks" "du -ksH du_test/xyz" "8\tdu_test/xyz\n" "" "" + +rm -rf du_test du_2 + |