public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* Re: [LTP] [PATCH] fix \"ar\" test
@ 2010-04-15  2:59 Mitani
  2010-04-15  6:52 ` Rishikesh K Rajak
  0 siblings, 1 reply; 4+ messages in thread
From: Mitani @ 2010-04-15  2:59 UTC (permalink / raw)
  To: mitani; +Cc: ltp-list, kamimura

[-- Attachment #1: Type: text/plain, Size: 157 bytes --]

Sorry.
My patch was destroyed by e-mail.
I attach patch for "ar01" file.


Signed-off-by: Tomonori Mitani <mitani@ryobi.co.jp>


Regards--

-Tomonori Mitani

[-- Attachment #2: ar01.patch --]
[-- Type: application/octet-stream, Size: 1119 bytes --]

--- 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"

[-- Attachment #3: Type: text/plain, Size: 345 bytes --]

------------------------------------------------------------------------------
Download Intel&#174; 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

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [LTP] [PATCH] fix "ar" test
@ 2010-04-06 10:46 Mitani
  0 siblings, 0 replies; 4+ messages in thread
From: Mitani @ 2010-04-06 10:46 UTC (permalink / raw)
  To: ltp-list

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&#174; 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-15  8:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
  -- strict thread matches above, loose matches on Subject: below --
2010-04-06 10:46 [LTP] [PATCH] fix "ar" test Mitani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox