[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#8909: tests/ls/stat-free-color: fails on OpenSuSE 11.4
From: |
Jim Meyering |
Subject: |
bug#8909: tests/ls/stat-free-color: fails on OpenSuSE 11.4 |
Date: |
Wed, 22 Jun 2011 16:09:54 +0200 |
Bernhard Voelker wrote:
> On 06/21/2011 04:16 PM, Jim Meyering wrote:
>> Bernhard Voelker wrote:
>>> On 06/21/2011 03:41 PM, Jim Meyering wrote:
>>>> It might be useful to see the entire strace output, too.
>>>> To get that, remove the "-e stat,lstat,stat64,lstat64" argument
>>>> from the strace invocation, and rerun the test.
>>>
>>> The output of both runs is attached.
>>> stat("/usr/lib64/mpi/gcc/openmpi/lib64") and friends is the culprit.
>>
>> Thanks.
>>
>>> I can't remember to have anything un-OpenSuSE-11.4-like in my toolchain.
>>>
>>> To me it seems that the test should count the difference of the
>>> number of stat,lstat,stat64,lstat64 calls when run
>>> a) as a dummy: ls --color=always --help
>>> and
>>> b) for ".": ls --color=always .
>>
>> That would be more robust.
>> Do you feel like writing the patch?
>
> Attached try #1 and the log.
>
> I'm not sure about x-platform calculation, but I guess
> n_lines=$(expr $n_lines - $n_lines_help)
> is okay - actually I saw it somewhere else in tests/.
>
> Have a nice day,
> Berny
>
>>From 3a6e0abab8eaa92922ce4cb1cfdfda278ccde8a6 Mon Sep 17 00:00:00 2001
> From: Bernhard Voelker <address@hidden>
> Date: Tue, 21 Jun 2011 16:26:50 +0200
> Subject: [PATCH] tests: ls/stat-free-color: count only the number of stat
> calls compared to --help
>
> * tests/ls/stat-free-color: The system may do additional stat calls upon
> loading
> (seen on OpenSuSE-11.4). Count only the number of stat calls compared to
> --help.
> ---
> tests/ls/stat-free-color | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/tests/ls/stat-free-color b/tests/ls/stat-free-color
> index b1c4744..03ef6e1 100755
> --- a/tests/ls/stat-free-color
> +++ b/tests/ls/stat-free-color
> @@ -49,9 +49,15 @@ MULTIHARDLINK 00
> EOF
> eval $(dircolors -b color-without-stat)
>
> +# The system may do additional *stat*()s upon loading.
> +# Count the difference compared to a dummy "--help" call.
> +strace -o log -e stat,lstat,stat64,lstat64 ls --color=always --help
> >/dev/null 2>&1 || fail=1
> +n_lines_help=$(wc -l < log)
> strace -o log -e stat,lstat,stat64,lstat64 ls --color=always . || fail=1
> n_lines=$(wc -l < log)
>
> +n_lines=$(expr $n_lines - $n_lines_help)
> +
> # Expect one or two stat calls.
> case $n_lines in
> 1|2) ;;
Thank you.
I've made some small adjustments including file name and variable name changes.
Also, I've tightened up the test to expect exactly one stat-like call:
(Since I've changed your commit, I'll wait for an ACK before pushing it)
And I've marked this issue as "done".
>From 376b19410eb57f36f711750ca75ed30dc1ebddce Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <address@hidden>
Date: Tue, 21 Jun 2011 16:26:50 +0200
Subject: [PATCH] tests: stat-free-color: do not count stat calls before main
* tests/ls/stat-free-color: The system may perform additional stat
calls upon loading (seen on OpenSuSE-11.4). Count only the number
of stat calls compared to --help.
This also reduces back to "1" the number of expected calls,
effectively reverting part of 2011-06-01 commit, ccf2d9a4.
---
tests/ls/stat-free-color | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/tests/ls/stat-free-color b/tests/ls/stat-free-color
index b1c4744..1288560 100755
--- a/tests/ls/stat-free-color
+++ b/tests/ls/stat-free-color
@@ -49,13 +49,22 @@ MULTIHARDLINK 00
EOF
eval $(dircolors -b color-without-stat)
+# The system may perform additional stat-like calls before main.
+# To avoid counting those, first get a baseline count by running
+# ls with only the --help option. Then, compare that with the
+# invocation under test.
+strace -o log-help -e stat,lstat,stat64,lstat64 ls --help >/dev/null || fail=1
+n_lines_help=$(wc -l < log-help)
+
strace -o log -e stat,lstat,stat64,lstat64 ls --color=always . || fail=1
n_lines=$(wc -l < log)
+n_stat=$(expr $n_lines - $n_lines_help)
+
# Expect one or two stat calls.
-case $n_lines in
- 1|2) ;;
- *) fail=1 ;;
+case $n_stat in
+ 1) ;;
+ *) fail=1; head -n30 log* ;;
esac
Exit $fail
--
1.7.6.rc2.302.gc2115