mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
tests: work around portability and clock-skew problems
* tests/misc/ls-misc (push_ls_colors): Don't assume LS_COLORS is set. This part of the fix is by Jim Meyering. (sl-dangle2, sl-dangle3, sl-dangle4, sl-dangle5): Don't assume that newly-created files will have time stamps in the past. They might not, due to clock skew, if the file systems are remote. http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/21322/focus=21346
This commit is contained in:
1 parent
c586bff1c0
commit
7324fba675
1 file changed
+9
-9
+9
-9
@@ -27,7 +27,7 @@ my $saved_ls_colors;
|
||||
|
||||
sub push_ls_colors($)
|
||||
{
|
||||
$saved_ls_colors = $ENV{LS_COLORS};
|
||||
$saved_ls_colors = $ENV{LS_COLORS} || '';
|
||||
$ENV{LS_COLORS} = $_[0];
|
||||
}
|
||||
|
||||
@@ -186,8 +186,8 @@ my @Tests =
|
||||
],
|
||||
|
||||
# Test for a bug fixed after coreutils-8.2.
|
||||
['sl-dangle2', '-o --color=always l',
|
||||
{OUT_SUBST => 's/.*[0-9][0-9]:[0-9][0-9] //'},
|
||||
['sl-dangle2', '-o --time-style=+:TIME: --color=always l',
|
||||
{OUT_SUBST => 's/.*:TIME: //'},
|
||||
{OUT => "l -> nowhere\n"},
|
||||
{PRE => sub {symlink 'nowhere', 'l' or die "l: $!\n";
|
||||
push_ls_colors('ln=target')
|
||||
@@ -195,8 +195,8 @@ my @Tests =
|
||||
{POST => sub {unlink 'l' or die "l: $!\n";
|
||||
restore_ls_colors; }},
|
||||
],
|
||||
['sl-dangle3', '-o --color=always l',
|
||||
{OUT_SUBST => 's/.*[0-9][0-9]:[0-9][0-9] //'},
|
||||
['sl-dangle3', '-o --time-style=+:TIME: --color=always l',
|
||||
{OUT_SUBST => 's/.*:TIME: //'},
|
||||
{OUT => "$e\e[40ml$e -> \e[34mnowhere$e\n"},
|
||||
{PRE => sub {symlink 'nowhere', 'l' or die "l: $!\n";
|
||||
push_ls_colors('ln=target:or=40:mi=34:')
|
||||
@@ -204,8 +204,8 @@ my @Tests =
|
||||
{POST => sub {unlink 'l' or die "l: $!\n";
|
||||
restore_ls_colors; }},
|
||||
],
|
||||
['sl-dangle4', '-o --color=always l',
|
||||
{OUT_SUBST => 's/.*[0-9][0-9]:[0-9][0-9] //'},
|
||||
['sl-dangle4', '-o --time-style=+:TIME: --color=always l',
|
||||
{OUT_SUBST => 's/.*:TIME: //'},
|
||||
{OUT => "$e\e[36ml$e -> \e[35mnowhere$e\n"},
|
||||
{PRE => sub {symlink 'nowhere', 'l' or die "l: $!\n";
|
||||
push_ls_colors('ln=34:mi=35:or=36:')
|
||||
@@ -213,8 +213,8 @@ my @Tests =
|
||||
{POST => sub {unlink 'l' or die "l: $!\n";
|
||||
restore_ls_colors; }},
|
||||
],
|
||||
['sl-dangle5', '-o --color=always l',
|
||||
{OUT_SUBST => 's/.*[0-9][0-9]:[0-9][0-9] //'},
|
||||
['sl-dangle5', '-o --time-style=+:TIME: --color=always l',
|
||||
{OUT_SUBST => 's/.*:TIME: //'},
|
||||
{OUT => "$e\e[34ml$e -> \e[35mnowhere$e\n"},
|
||||
{PRE => sub {symlink 'nowhere', 'l' or die "l: $!\n";
|
||||
push_ls_colors('ln=34:mi=35:')
|
||||
|
||||
Reference in new issue
Block a user