summaryrefslogtreecommitdiff
path: root/tests/ls
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2010-04-14 15:32:27 +0100
committerPádraig Brady <P@draigBrady.com>2010-04-16 00:26:21 +0100
commit3a1595a3fbb07c53ea920c969667f0346a10534c (patch)
treea075644861906be57308412eac69d19b8f548972 /tests/ls
parentf8291d0ec489c6363769c3c767b161ffbdb7f082 (diff)
downloadcoreutils-3a1595a3fbb07c53ea920c969667f0346a10534c.tar.xz
tests: avoid spurious failure of ls/color-norm test
* tests/ls/color-norm: Use the "time" output by `ls -l` to check normal style. Previously we used the size from `ls -s`, but the size of "empty" files can vary depending on whether SELinux is enabled for example.
Diffstat (limited to 'tests/ls')
-rwxr-xr-xtests/ls/color-norm54
1 files changed, 31 insertions, 23 deletions
diff --git a/tests/ls/color-norm b/tests/ls/color-norm
index 16ffa22a1..e7a68299e 100755
--- a/tests/ls/color-norm
+++ b/tests/ls/color-norm
@@ -28,51 +28,59 @@ fi
# Don't let a different umask perturb the results.
umask 22
+# Output time as something constant
+export TIME_STYLE="+norm"
+
+# helper to to strip ls columns up to "norm" time
+qls() { sed 's/-r.*norm/norm/'; }
+
touch exe || framework_failure
chmod u+x exe || framework_failure
touch nocolor || framework_failure
+TCOLORS="no=7:ex=01;32"
+
# Non coloured files inherit NORMAL attributes
-LS_COLORS=no=7 ls -s1U --color exe nocolor >> out || fail=1
-LS_COLORS=no=7 ls -sxU --color exe nocolor >> out || fail=1
-LS_COLORS=no=7 ls -s1U --color nocolor exe >> out || fail=1
-LS_COLORS=no=7 ls -sxU --color nocolor exe >> out || fail=1
+LS_COLORS=$TCOLORS ls -gGU --color exe nocolor | qls >> out || fail=1
+LS_COLORS=$TCOLORS ls -xU --color exe nocolor >> out || fail=1
+LS_COLORS=$TCOLORS ls -gGU --color nocolor exe | qls >> out || fail=1
+LS_COLORS=$TCOLORS ls -xU --color nocolor exe >> out || fail=1
# NORMAL does not override FILE though
-LS_COLORS=no=7:fi=1 ls -s1U --color nocolor exe >> out || fail=1
+LS_COLORS=$TCOLORS:fi=1 ls -gGU --color nocolor exe | qls >> out || fail=1
# Support uncolored ordinary files that do _not_ inherit from NORMAL.
# Note there is a redundant RESET output before a non colored
# file in this case which may be removed in future.
-LS_COLORS=no=7:fi= ls -s1U --color nocolor exe >> out || fail=1
-LS_COLORS=no=7:fi=0 ls -s1U --color nocolor exe >> out || fail=1
+LS_COLORS=$TCOLORS:fi= ls -gGU --color nocolor exe | qls >> out || fail=1
+LS_COLORS=$TCOLORS:fi=0 ls -gGU --color nocolor exe | qls >> out || fail=1
# A caveat worth noting is that commas (-m), indicator chars (-F)
# and the "total" line, do not currently use NORMAL attributes
-LS_COLORS="no=7" ls -mFU --color nocolor exe >> out || fail=1
+LS_COLORS=$TCOLORS ls -mFU --color nocolor exe >> out || fail=1
# Ensure no coloring is done unless enabled
-LS_COLORS="no=7" ls -s1U nocolor exe >> out || fail=1
+LS_COLORS=$TCOLORS ls -gGU nocolor exe | qls >> out || fail=1
cat -A out > out.display || framework_failure
mv out.display out || framework_failure
cat <<\EOF > exp || framework_failure
-^[[0m^[[7m0 ^[[m^[[01;32mexe^[[0m$
-^[[7m0 nocolor^[[0m$
-^[[0m^[[7m0 ^[[m^[[01;32mexe^[[0m ^[[7m0 nocolor^[[0m$
-^[[0m^[[7m0 nocolor^[[0m$
-^[[7m0 ^[[m^[[01;32mexe^[[0m$
-^[[0m^[[7m0 nocolor^[[0m ^[[7m0 ^[[m^[[01;32mexe^[[0m$
-^[[0m^[[7m0 ^[[m^[[1mnocolor^[[0m$
-^[[7m0 ^[[m^[[01;32mexe^[[0m$
-^[[0m^[[7m0 ^[[m^[[mnocolor^[[0m$
-^[[7m0 ^[[m^[[01;32mexe^[[0m$
-^[[0m^[[7m0 ^[[m^[[0mnocolor^[[0m$
-^[[7m0 ^[[m^[[01;32mexe^[[0m$
+^[[0m^[[7mnorm ^[[m^[[01;32mexe^[[0m$
+^[[7mnorm nocolor^[[0m$
+^[[0m^[[7m^[[m^[[01;32mexe^[[0m ^[[7mnocolor^[[0m$
+^[[0m^[[7mnorm nocolor^[[0m$
+^[[7mnorm ^[[m^[[01;32mexe^[[0m$
+^[[0m^[[7mnocolor^[[0m ^[[7m^[[m^[[01;32mexe^[[0m$
+^[[0m^[[7mnorm ^[[m^[[1mnocolor^[[0m$
+^[[7mnorm ^[[m^[[01;32mexe^[[0m$
+^[[0m^[[7mnorm ^[[m^[[mnocolor^[[0m$
+^[[7mnorm ^[[m^[[01;32mexe^[[0m$
+^[[0m^[[7mnorm ^[[m^[[0mnocolor^[[0m$
+^[[7mnorm ^[[m^[[01;32mexe^[[0m$
^[[0m^[[7mnocolor^[[0m, ^[[7m^[[m^[[01;32mexe^[[0m*$
-0 nocolor$
-0 exe$
+norm nocolor$
+norm exe$
EOF
compare out exp || fail=1