>From 3a6e0abab8eaa92922ce4cb1cfdfda278ccde8a6 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker 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) ;; -- 1.7.3.4