annotate tests/du.test @ 1497:f64ca21ed444 draft

Fix du test: du symlink -> "0\tsymlink"
author Felix Janda <felix.janda@posteo.de>
date Mon, 22 Sep 2014 08:22:12 -0500
parents 8700cbe1cb29
children a016421051e4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1332
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
1 #!/bin/bash
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
2
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
3 [ -f testing.sh ] && . testing.sh
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
4
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
5 #testing "name" "command" "result" "infile" "stdin"
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
6
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
7 # we only test with -k since getting POSIX version is variable
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
8 # POSIXLY_CORRECT is sometimes needed, sometimes -P is needed,
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
9 # while -k is the default on most Linux systems
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
10
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
11 mkdir -p du_test/test du_2/foo
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
12 testing "du (no options)" "du -k du_test" "4\tdu_test/test\n8\tdu_test\n" "" ""
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
13 testing "du -s" "du -k -s du_test" "8\tdu_test\n" "" ""
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
14 ln -s ../du_2 du_test/xyz
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
15 # "du shall count the size of the symbolic link"
1497
f64ca21ed444 Fix du test: du symlink -> "0\tsymlink"
Felix Janda <felix.janda@posteo.de>
parents: 1485
diff changeset
16 # The tests assume that like for most POSIX systems symbolic
f64ca21ed444 Fix du test: du symlink -> "0\tsymlink"
Felix Janda <felix.janda@posteo.de>
parents: 1485
diff changeset
17 # links are stored directly in the inode so that the
f64ca21ed444 Fix du test: du symlink -> "0\tsymlink"
Felix Janda <felix.janda@posteo.de>
parents: 1485
diff changeset
18 # allocated file space is zero.
f64ca21ed444 Fix du test: du symlink -> "0\tsymlink"
Felix Janda <felix.janda@posteo.de>
parents: 1485
diff changeset
19 testing "du counts symlinks without following" "du -ks du_test" "8\tdu_test\n" "" ""
1332
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
20 testing "du -L follows symlinks" "du -ksL du_test" "16\tdu_test\n" "" ""
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
21 # if -H and -L are specified, the last takes priority
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
22 testing "du -HL follows symlinks" "du -ksHL du_test" "16\tdu_test\n" "" ""
1497
f64ca21ed444 Fix du test: du symlink -> "0\tsymlink"
Felix Janda <felix.janda@posteo.de>
parents: 1485
diff changeset
23 testing "du -H does not follow unspecified symlinks" "du -ksH du_test" "8\tdu_test\n" "" ""
f64ca21ed444 Fix du test: du symlink -> "0\tsymlink"
Felix Janda <felix.janda@posteo.de>
parents: 1485
diff changeset
24 testing "du -LH does not follow unspecified symlinks" "du -ksLH du_test" "8\tdu_test\n" "" ""
1332
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
25 testing "du -H follows specified symlinks" "du -ksH du_test/xyz" "8\tdu_test/xyz\n" "" ""
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
26
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
27 rm -rf du_test du_2
7e0c577a977e The tests for link and du are attached.
Isaac Dunham <ibid.ag@gmail.com>
parents:
diff changeset
28