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 <[email protected]>
============
--- 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list