[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] tests: avoid false failure when comparing /proc/cpuinfo
From: |
Pádraig Brady |
Subject: |
Re: [PATCH] tests: avoid false failure when comparing /proc/cpuinfo |
Date: |
Thu, 16 Oct 2014 09:34:16 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 10/16/2014 09:24 AM, Bernhard Voelker wrote:
> The MHz number in /proc/cpuinfo may change, thus leading to
> a false positive failure when comparing the expected against
> the actual output file.
>
> * tests/misc/head-c.sh: Replace the actual MHz number in the files
> to be compared by a placeholder.
> ---
> tests/misc/head-c.sh | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tests/misc/head-c.sh b/tests/misc/head-c.sh
> index 807e965..67c01b1 100755
> --- a/tests/misc/head-c.sh
> +++ b/tests/misc/head-c.sh
> @@ -50,6 +50,8 @@ for file in /proc/cpuinfo /sys/kernel/profiling; do
> head -c -1 copy > exp1 || framework_failure_
>
> head -c -1 $file > out1 || fail=1
> + test $file = /proc/cpuinfo \
> + && { sed -i -e '/MHz/ s/[0-9]/X/g' exp1 out1 || framework_failure_; }
> compare exp1 out1 || fail=1
> fi
> done
>
Oh right good one.
It's probably better to use an invariant file rather than
messing with sed and GHz and possible other variant parts.
How about /proc/version
thanks,
Pádraig.