*Hi All,*
I have faced a problem while running LTP on my ARM board. The below command
is failing.
unzip01 unzip_tests.sh $LTPROOT/testcases/data/tst_unzip_file.zip
As i observed the "unzip" binary on my board uses a string "inflating" to
show the verbose message for compression of files.
The test case is is expecting "unzip" binary to use a string "extracting"
to show the verbose message for compression of files.
In unzip_tests.sh the code has been written to compare the verbose message
to PASS/FAIL the test case.
hence it is PASS in my x86 but FAIL in my ARM board.
*So i have added this patch which will compare the directory tree output
structure not the verbose message.*
Please find the patch below and please revert for any suggestion and
concerns.
This is my first patch. So please regret for any wrong formatting of make
the patch review. :)
*I will eagerly wait for your valuable reply ASAP.*
*
*
*Regards,*
*Siva*
>From 32c9bfda270a55a708c92c2a35fe6bd28d4d777b Mon Sep 17 00:00:00 2001
From: siva padhy <[email protected]>
Date: Mon, 23 Sep 2013 14:37:54 +0530
Subject: [PATCH] Unzip command validation irrespective of verbose
This patch is the fix for the unzip command testing.
unzip_tests.sh compares the verbose output of "unzip" command to check the
unzip functionality.
That may fail in some scenario,where the verbose text differs like
"inflatted" and "extracted".
This patch will do the following things:
1.Store the desired directory tree output structure in tst_unzip.out.exp
2.unzip the zip file
3.execute the ls -R command and store the created directory output
structure in tst_unzip.out
4.Find the difference between tst_unzip.out and tst_unzip.out.exp
Change-Id: I6add048bfe03bca1f466ab843e010d833ecf1a46
Signed-off-by: siva padhy <[email protected]>
---
testcases/commands/unzip/unzip_tests.sh | 74
++++++++++++++++---------------
1 file changed, 39 insertions(+), 35 deletions(-)
diff --git a/testcases/commands/unzip/unzip_tests.sh
b/testcases/commands/unzip/unzip_tests.sh
index 9a7a7b5..b245c66 100755
--- a/testcases/commands/unzip/unzip_tests.sh
+++ b/testcases/commands/unzip/unzip_tests.sh
@@ -96,23 +96,29 @@ init()
chk_ifexists INIT unzip || return $RC
chk_ifexists INIT mkdir || return $RC
chk_ifexists INIT awk || return $RC
+ chk_ifexists INIT ls || return $RC
- # create expected output files. tst_unzip.exp
+ # create expected directory tree. tst_unzip.out.exp
cat > $PWD/tst_unzip.out.exp <<-EOF
- Archive: $1
- creating: tst_unzip.dir/
- creating: tst_unzip.dir/d.0/
- extracting: tst_unzip.dir/d.0/f.0
- extracting: tst_unzip.dir/d.0/f.1
- extracting: tst_unzip.dir/d.0/f.2
- creating: tst_unzip.dir/d.0/d.1/
- extracting: tst_unzip.dir/d.0/d.1/f.0
- extracting: tst_unzip.dir/d.0/d.1/f.1
- extracting: tst_unzip.dir/d.0/d.1/f.2
- creating: tst_unzip.dir/d.0/d.1/d.2/
- extracting: tst_unzip.dir/d.0/d.1/d.2/f.0
- extracting: tst_unzip.dir/d.0/d.1/d.2/f.1
- extracting: tst_unzip.dir/d.0/d.1/d.2/f.2
+ $PWD/tst_unzip.dir/:
+ d.0
+
+ $PWD/tst_unzip.dir/d.0:
+ d.1
+ f.0
+ f.1
+ f.2
+
+ $PWD/tst_unzip.dir/d.0/d.1:
+ d.2
+ f.0
+ f.1
+ f.2
+
+ $PWD/tst_unzip.dir/d.0/d.1/d.2:
+ f.0
+ f.1
+ f.2
EOF
return $RC
@@ -140,39 +146,37 @@ test01()
tst_resm TINFO "Test #1: unzip command un-compresses a .zip file."
- unzip "${zipfile}" > "$PWD/tst_unzip.out" || RC=$?
+ unzip "${zipfile}" || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL "$PWD/tst_unzip.out" \
"Test #1: unzip command failed. Return value = $RC.
Details:"
return $RC
else
- sort -o "$PWD/tst_unzip.out" "$PWD/tst_unzip.out"
- sort -o "$PWD/tst_unzip.out.exp" "$PWD/tst_unzip.out.exp"
-
- diff -iwB "$PWD/tst_unzip.out" "$PWD/tst_unzip.out.exp" >\
- "$PWD/tst_unzip.out.err" || RC=$?
-
- if [ $RC -ne 0 ]
+ tst_resm TINFO "Test #1: check if \"$PWD/tst_unzip.dir\"
exits."
+ if ! [ -d $PWD/tst_unzip.dir ]
then
- tst_res TFAIL "$PWD/tst_unzip.out.err" \
- "Test #1: unzip output differs from
expected output. Details"
+ tst_resm TFAIL "Test #1: unzip did not uncompress
the .zip file"
+ $((RC+1))
else
- tst_resm TINFO "Test #1: check if
\"$PWD/tst_unzip.dir\" exits."
- if ! [ -d $PWD/tst_unzip.dir ]
+ ls -R $PWD/tst_unzip.dir/ > "$PWD/tst_unzip.out" ||
RC=$?
+ if [ $RC -ne 0 ]
then
- tst_resm TFAIL \
- "Test #1: unzip did not uncompress
the .zip file"
- $((RC+1))
+ tst_res TFAIL "Test #1: ls command failed"
+ return $RC
else
- tst_resm TINFO \
- "Test #1: \"$PWD/tst_unzip.dir\"
was created by unzip"
- tst_resm TPASS \
- "Test #1: unzip can uncompress .zip file
correctly."
+ diff -iwB "$PWD/tst_unzip.out"
"$PWD/tst_unzip.out.exp" > "$PWD/tst_unzip.out.err" || RC=$?
+ if [ $RC -ne 0 ]
+ then
+ tst_res TFAIL
"$PWD/tst_unzip.out.err" \
+ "Test #1: unzip output
differs from expected output. Details"
+ else
+ tst_resm TINFO "Test #1:
\"$PWD/tst_unzip.dir\" was created by unzip"
+ tst_resm TPASS "Test #1: unzip can
uncompress .zip file correctly."
+ fi
fi
fi
fi
-
return $RC
}
Regards,
Siva Sankar Padhy
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list