Skip to contentSkip to conversation

Showing skipped tests in results?

RFC In review Dan Rue 3 participants 4 messages Dec 5, 2017 – Dec 8, 2017

lore
Share & tools
lore

Dan Rue

author
#0 lore raw

Hello!

Before I submit any patches, I wanted to run this idea by the community for advice.

When we skip tests in LTP using "./runltp -S SKIPFILE", they get removed from the test list completely, leaving no trace in the results. Meanwhile, tests that are not able to run due to configuration show up as a "CONF" in the results file.

From our perspective, this is not ideal because we want to see tests that are explicitly skipped as skipped in the results. Ideally, tests that are skipped will still show up in the results as a SKIP.

It looks like there's some precedent in runltp for prepending a string to a test name that can then later be picked up and interpreted by individual tests.

Specifically, I noticed that if you use -I ITERATIONS to run tests multiple times, it will prepend an iteration count and number in alltests:

$ cat alltests
1_ITERATION_gzip01 gzip_tests.sh
2_ITERATION_gzip01 gzip_tests.sh
3_ITERATION_gzip01 gzip_tests.sh

Which made me wonder if we could use a similar convention for SKIP, rather than just removing the test from alltests (what currently happens).

So for example, if you skip gzip01, the alltests file would end up with something like: SKIP_gzip01 gzip_tests.sh

When I try that, it actually runs gzip01 still. I thought it would fail. Which means that something is stripping the "SKIP_" (and throwing it away).

I looked a bit and I'm guessing we'd need to patch lib/parse_opts.c and then probably stuff in testcases/lib (but maybe not).

Any feedback on the concept or the implementation is really appreciated. Thank you!

Dan

#1 lore raw

Hi!

Quoted 26 lines

When we skip tests in LTP using "./runltp -S SKIPFILE", they get removed from the test list completely, leaving no trace in the results. Meanwhile, tests that are not able to run due to configuration show up as a "CONF" in the results file.

From our perspective, this is not ideal because we want to see tests that are explicitly skipped as skipped in the results. Ideally, tests that are skipped will still show up in the results as a SKIP.

It looks like there's some precedent in runltp for prepending a string to a test name that can then later be picked up and interpreted by individual tests.

Specifically, I noticed that if you use -I ITERATIONS to run tests multiple times, it will prepend an iteration count and number in alltests:

$ cat alltests
1_ITERATION_gzip01 gzip_tests.sh
2_ITERATION_gzip01 gzip_tests.sh
3_ITERATION_gzip01 gzip_tests.sh

Which made me wonder if we could use a similar convention for SKIP, rather than just removing the test from alltests (what currently happens).

Quoted 6 lines

So for example, if you skip gzip01, the alltests file would end up with something like: SKIP_gzip01 gzip_tests.sh

When I try that, it actually runs gzip01 still. I thought it would fail. Which means that something is stripping the "SKIP_" (and throwing it away).

I think that you misunderstand how things works, the first string on each line in the alltests file that is parsed by ltp-pan is just test name that appears in the test result file, it does not affect anything but that.

I guess that the easiest solution would be replacing the actuall command that is supposed to be executed with something that just reports skipped status.

Quick hack would be replacing these with something that just returns the right exit value:

gzip01 gzip_tests.hs -> gzip01 exit 32

Something like this should mark the gzip01 as TCONF in test results, would that suffice for your purpose?

This should be as easy as changing the sed command from delete to replace in the runltp script.

Signature · 2 lines
Cyril Hrubis
[email protected]
#2 lore raw

RFC 1/1 Showing skipped tests in results?

Quoted 39 lines · Cyril Hrubis

Hi!

Quoted 26 lines

When we skip tests in LTP using "./runltp -S SKIPFILE", they get removed from the test list completely, leaving no trace in the results. Meanwhile, tests that are not able to run due to configuration show up as a "CONF" in the results file.

From our perspective, this is not ideal because we want to see tests that are explicitly skipped as skipped in the results. Ideally, tests that are skipped will still show up in the results as a SKIP.

It looks like there's some precedent in runltp for prepending a string to a test name that can then later be picked up and interpreted by individual tests.

Specifically, I noticed that if you use -I ITERATIONS to run tests multiple times, it will prepend an iteration count and number in alltests:

$ cat alltests
1_ITERATION_gzip01 gzip_tests.sh
2_ITERATION_gzip01 gzip_tests.sh
3_ITERATION_gzip01 gzip_tests.sh

Which made me wonder if we could use a similar convention for SKIP, rather than just removing the test from alltests (what currently happens).

Quoted 6 lines

So for example, if you skip gzip01, the alltests file would end up with something like: SKIP_gzip01 gzip_tests.sh

When I try that, it actually runs gzip01 still. I thought it would fail. Which means that something is stripping the "SKIP_" (and throwing it away).

I think that you misunderstand how things works, the first string on each line in the alltests file that is parsed by ltp-pan is just test name that appears in the test result file, it does not affect anything but that.

Quoted 8 lines

I guess that the easiest solution would be replacing the actuall command that is supposed to be executed with something that just reports skipped status.

Quick hack would be replacing these with something that just returns the right exit value:

gzip01 gzip_tests.hs -> gzip01 exit 32

Not working.
the second argument is expected to be a file.

gzip01 gzip_tests.hs -> gzip01 skip.sh
should work.
We have to create skip.sh inside ltp
skip.sh contains single line exit 32

Which is the right place holder to host skip.sh ?

Quoted 6 lines

Something like this should mark the gzip01 as TCONF in test results, would that suffice for your purpose?

This should be as easy as changing the sed command from delete to replace in the runltp script.

OTOH,
I have noticed one more problem with sed with updated script.

Issues:
1. Want to skip only "testcase" write inside skipfile and run ./ltp-skip.sh

testcase is replaced by testcase skip.sh ( = TCONF ) which is expected. testcase_64 is replaced by testcase skip.sh which is incorrect testcase name testcase_16 is replaced by testcase skip.sh which is incorrect testcase name testcase_xxxx is replaced by testcase skip.sh which is incorrect testcase name

alltests 2017-12-07 23:54:53.188657734 +0530 renamed from alltests.org 2017-12-07 22:41:46.373419820 +0530 +2 -2
diff -Narub alltests.org  alltests
@@ -272,8 +272,8 @@
 fcntl33_64 fcntl33_64
 fcntl34 fcntl34
 fcntl34_64 fcntl34_64
-fcntl35 fcntl35
-fcntl35_64 fcntl35_64
+fcntl35 skip.sh
+fcntl35 skip.sh
 fcntl36 fcntl36
 fcntl36_64 fcntl36_64
 

2. The skipfile have limitation of
testcase_name should be a single word in SKIPFILE

Feature is
We can added comments inside SKIPFILE starting with # The script will ignore line starting with #

From c3e77bbaf03e126de15524f817960740a8c94e1b Mon Sep 17 00:00:00 2001
From: Naresh Kamboju <[email protected]>
Date: Thu, 7 Dec 2017 23:14:44 +0530
Subject: [PATCH] runltp: SKIPFILE: skip test cases should be visible as TCONF
in results

When we skip tests in LTP using "./runltp -S SKIPFILE", they get removed from the test list completely, leaving no trace in the results.

This patch will add SKIPFILE listed test cases names to results as TCONF testcase_name -> testcase_name skip.sh

---
 runltp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
runltp +7 -5
index 8e40d67..f206fe1 100755
@@ -692,11 +692,13 @@ main()
     fi
 
     # Blacklist or skip tests if a SKIPFILE was specified with -S
-    if [ -n "$SKIPFILE" ]
-    then
-        for file in $( cat $SKIPFILE ); do
-            sed -i "/^$file[ \t]/d" ${TMP}/alltests
-        done
+    if [ -n "${SKIPFILE}" ]; then
+        while read -r test_name; do
+            case "${test_name}" in \#*) continue ;; esac
+            if [ ${test_name} ]; then
+                sed -i "/${test_name}/c\\${test_name} skip.sh" alltests
+            fi
+        done < ${SKIPFILE}
     fi
 
     # check for required users and groups
Signature · 3 lines
2.7.4

- Naresh
Quoted 7 lines

--
Cyril Hrubis
[email protected]

--
Mailing list info: https://lists.linux.it/listinfo/ltp

#3 lore raw

Hi!

Quoted 9 lines
Quoted 9 lines

I think that you misunderstand how things works, the first string on each line in the alltests file that is parsed by ltp-pan is just test name that appears in the test result file, it does not affect anything but that.

I guess that the easiest solution would be replacing the actuall command that is supposed to be executed with something that just reports skipped status.

Quoted 6 lines
Quoted 4 lines

Quick hack would be replacing these with something that just returns the right exit value:

gzip01 gzip_tests.hs -> gzip01 exit 32

Not working.
the second argument is expected to be a file.

Not a true, I've looked to the ltp-pan.c and it does crude heuristic that decides if the second part of the line is supposed to be binary name or a shell script, if it finds any shell redirection characters or semicolon then it's executed as a script.

Quoted 4 lines

gzip01 gzip_tests.hs -> gzip01 skip.sh
should work.
We have to create skip.sh inside ltp
skip.sh contains single line exit 32

gzip01 foo -> gzip01 exit 32;

That one actually works.

Quoted 6 lines

OTOH,
I have noticed one more problem with sed with updated script.

Issues:
1. Want to skip only "testcase" write inside skipfile and run ./ltp-skip.sh

Which script are you referring to? There is no ltp-skip.sh in LTP source code tree.

Quoted 9 lines

testcase is replaced by testcase skip.sh ( = TCONF ) which is expected. testcase_64 is replaced by testcase skip.sh which is incorrect testcase name testcase_16 is replaced by testcase skip.sh which is incorrect testcase name testcase_xxxx is replaced by testcase skip.sh which is incorrect testcase name

diff -Narub alltests.org alltests

alltests 2017-12-07 23:54:53.188657734 +0530 line 278

Quoted 9 lines
alltests 2017-12-07 23:54:53.188657734 +0530 renamed from alltests.org 2017-12-07 22:41:46.373419820 +0530 +2 -2
@@ -272,8 +272,8 @@
 fcntl33_64 fcntl33_64
 fcntl34 fcntl34
 fcntl34_64 fcntl34_64
-fcntl35 fcntl35
-fcntl35_64 fcntl35_64
+fcntl35 skip.sh
+fcntl35 skip.sh
 fcntl36 fcntl36
 fcntl36_64 fcntl36_64

That is beacuse you have broken the mathing pattern in your patch, the original one that just deleted the line matched whitespace after the name.

Quoted 6 lines

2. The skipfile have limitation of
testcase_name should be a single word in SKIPFILE

Feature is
We can added comments inside SKIPFILE starting with # The script will ignore line starting with #

I'm okay with adding comments to skipfile.

Quoted 27 lines

From c3e77bbaf03e126de15524f817960740a8c94e1b Mon Sep 17 00:00:00 2001
From: Naresh Kamboju <[email protected]>
Date: Thu, 7 Dec 2017 23:14:44 +0530
Subject: [PATCH] runltp: SKIPFILE: skip test cases should be visible as TCONF
in results

When we skip tests in LTP using "./runltp -S SKIPFILE", they get removed from the test list completely, leaving no trace in the results.

This patch will add SKIPFILE listed test cases names to results as TCONF testcase_name -> testcase_name skip.sh

---
 runltp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
runltp +0 -2
index 8e40d67..f206fe1 100755
@@ -692,11 +692,13 @@ main()
     fi
 
     # Blacklist or skip tests if a SKIPFILE was specified with -S
-    if [ -n "$SKIPFILE" ]
-    then

runltp main() · line 701

Quoted 10 lines
runltp +7 -3
-        for file in $( cat $SKIPFILE ); do
-            sed -i "/^$file[ \t]/d" ${TMP}/alltests
-        done
+    if [ -n "${SKIPFILE}" ]; then
+        while read -r test_name; do
+            case "${test_name}" in \#*) continue ;; esac
+            if [ ${test_name} ]; then
+                sed -i "/${test_name}/c\\${test_name} skip.sh" alltests
+            fi
+        done < ${SKIPFILE}

Apart from the broken sed matching regular expression and the skip.sh that can be replaced with 'exit 32;' this looks reasonably good.

Signature · 2 lines
Cyril Hrubis
[email protected]