From: "Mitani" <mitani@ryobi.co.jp>
To: ltp-list@lists.sourceforge.net
Subject: [LTP] [PATCH] fix "ar" test
Date: Tue, 6 Apr 2010 19:46:11 +0900 [thread overview]
Message-ID: <000601cad576$5f86fde0$1e94f9a0$@co.jp> (raw)
Hi,
* I don't know whether I can add "[PATCH]" to the title of my
contribution. (Because I'm not maintainer.)
If my manners are wrong, I am sorry.
---
I found out that "-)20" test of "ar01" failed once in a while.
Its code is as follows:
------------
...
rm -rf $TCtmp/lib.a;cd $TCdat
ar -cr $TCtmp/lib.a file0.in file2.in
crtest
File1time=`ar -tv $TCtmp/lib.a | grep file0.in | cut -f2 -d: | cut -f1 -d"
"`
File2time=`ar -tv $TCtmp/lib.a | grep file2.in | cut -f2 -d: | cut -f1 -d"
"`
#sleep 5
touch -c -t 201503030303.55 file0.in
ar -ru $TCtmp/lib.a file0.in file2.in 2>&1 1>/dev/null
File1time1=`ar -tv $TCtmp/lib.a | grep file0.in | cut -f2 -d: | cut -f1 -d"
"`
File2time2=`ar -tv $TCtmp/lib.a | grep file2.in | cut -f2 -d: | cut -f1 -d"
"`
if [ $File2time = $File2time2 ]
then
if [ $File1time = $File1time1 ]
then
TCRESULT=20
echo "FAIL - ar with -u flag failed"
else
echo "-)20"
fi
else
TCRESULT=20
echo "FAIL - ar with -u flag failed"
fi
#Reset the timestamp on file0.in to current
touch file0.in
...
------------
"file0.in" and "file2.in" are offered with "ar01" source, and they are
copied when "make install" is executed.
In this code, "File1time" and "File1time1" are times of before and
after time-stamp changing of "file0.in" by "touch -c -t ..." command.
But "File1time" and "File1time1" are only minute numbers.
It's problem, I think.
If installation is at 2010.04.06 XX:03 accidentally, both of
"File1time" and "File1time1" are "03".
And this code ends as "FAIL".
This happens with a one-60th probability.
Why must not all time informations are compared?
---
How about following patch?
Signed-off-by: Tomonori Mitani <mitani@ryobi.co.jp>
============
--- a/testcases/commands/ade/ar/ar01 2010-04-01 16:15:00.000000000 +0900
+++ b/testcases/commands/ade/ar/ar01 2010-04-06 19:04:44.000000000 +0900
@@ -519,19 +519,19 @@
rm -rf $TCtmp/lib.a;cd $TCdat
ar -cr $TCtmp/lib.a file0.in file2.in
crtest
-File1time=`ar -tv $TCtmp/lib.a | grep file0.in | cut -f2 -d: | cut -f1 -d"
"`
-File2time=`ar -tv $TCtmp/lib.a | grep file2.in | cut -f2 -d: | cut -f1 -d"
"`
+File1time=`ar -tv $TCtmp/lib.a | grep file0.in`
+File2time=`ar -tv $TCtmp/lib.a | grep file2.in`
#sleep 5
touch -c -t 201503030303.55 file0.in
ar -ru $TCtmp/lib.a file0.in file2.in 2>&1 1>/dev/null
-File1time1=`ar -tv $TCtmp/lib.a | grep file0.in | cut -f2 -d: | cut -f1 -d"
"`
-File2time2=`ar -tv $TCtmp/lib.a | grep file2.in | cut -f2 -d: | cut -f1 -d"
"`
+File1time1=`ar -tv $TCtmp/lib.a | grep file0.in`
+File2time2=`ar -tv $TCtmp/lib.a | grep file2.in`
-if [ $File2time = $File2time2 ]
+if [ "$File2time" = "$File2time2" ]
then
- if [ $File1time = $File1time1 ]
+ if [ "$File1time" = "$File1time1" ]
then
TCRESULT=20
echo "FAIL - ar with -u flag failed"
============
Thank you--
-Tomonori Mitani
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next reply other threads:[~2010-04-06 10:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-06 10:46 Mitani [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-04-15 2:59 [LTP] [PATCH] fix \"ar\" test Mitani
2010-04-15 6:52 ` Rishikesh K Rajak
2010-04-15 8:21 ` Garrett Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000601cad576$5f86fde0$1e94f9a0$@co.jp' \
--to=mitani@ryobi.co.jp \
--cc=ltp-list@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox