~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to tests/ls/color-dtype-dir.sh

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# Ensure "ls --color" properly colors other-writable and sticky directories.
 
3
# Before coreutils-6.2, this test would fail, coloring all three
 
4
# directories the same as the first one -- but only on a file system
 
5
# with dirent.d_type support.
 
6
 
 
7
# Copyright (C) 2006-2012 Free Software Foundation, Inc.
 
8
 
 
9
# This program is free software: you can redistribute it and/or modify
 
10
# it under the terms of the GNU General Public License as published by
 
11
# the Free Software Foundation, either version 3 of the License, or
 
12
# (at your option) any later version.
 
13
 
 
14
# This program is distributed in the hope that it will be useful,
 
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
# GNU General Public License for more details.
 
18
 
 
19
# You should have received a copy of the GNU General Public License
 
20
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
21
 
 
22
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 
23
print_ver_ ls
 
24
 
 
25
# Don't let a different umask perturb the results.
 
26
umask 22
 
27
 
 
28
mkdir d other-writable sticky || framework_failure_
 
29
chmod o+w other-writable || framework_failure_
 
30
chmod o+t sticky || framework_failure_
 
31
 
 
32
 
 
33
ls --color=always > out || fail=1
 
34
cat -A out > o1 || fail=1
 
35
mv o1 out || fail=1
 
36
 
 
37
cat <<\EOF > exp || fail=1
 
38
^[[0m^[[01;34md^[[0m$
 
39
^[[34;42mother-writable^[[0m$
 
40
out$
 
41
^[[37;44msticky^[[0m$
 
42
EOF
 
43
 
 
44
compare exp out || fail=1
 
45
 
 
46
rm exp
 
47
 
 
48
# Turn off colors for other-writable dirs and ensure
 
49
# we fall back to the color for standard directories.
 
50
 
 
51
LS_COLORS="ow=:" ls --color=always > out || fail=1
 
52
cat -A out > o1 || fail=1
 
53
mv o1 out || fail=1
 
54
 
 
55
cat <<\EOF > exp || fail=1
 
56
^[[0m^[[01;34md^[[0m$
 
57
^[[01;34mother-writable^[[0m$
 
58
out$
 
59
^[[37;44msticky^[[0m$
 
60
EOF
 
61
 
 
62
compare exp out || fail=1
 
63
 
 
64
Exit $fail