public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] runltp: skipfile: skipped test cases should be visible as TCONF in results
@ 2017-12-20 13:03 Naresh Kamboju
  2017-12-20 14:02 ` Cyril Hrubis
  0 siblings, 1 reply; 7+ messages in thread
From: Naresh Kamboju @ 2017-12-20 13:03 UTC (permalink / raw)
  To: ltp

When we skip tests in LTP by 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.
when testcase_name listed in SKIPFILE the main alltests will get that
testcase_name followed by exit 32;

Example:
  SKIPFILE the user defined content
  $ cat SKIPFILE
  testcase_name

  $ ./runltp -f syscalls -S SKIPFILE

  The runtime generated alltests file gets as
  $ cat alltests
  testcase_name exit 32;

  The final results file shows as
  $ cat results
  testcase_name TCONF

The good practise with SKIPFILE is,
tests listed in a SKIPFILE should be a single testcase_name per line.
However, test script takes only first column by using awk {print $1}

We can add comments inside SKIPFILE starting with #
The script will ignore line starting with #

Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
---
 runltp        | 8 ++++----
 runltplite.sh | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/runltp b/runltp
index 8e40d67..302c4a7 100755
--- a/runltp
+++ b/runltp
@@ -692,10 +692,10 @@ 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
+    if [ -n "${SKIPFILE}" ]; then
+        for test_name in $(awk '{print $1}' "${SKIPFILE}"); do
+            case "${test_name}" in \#*) continue;; esac
+            sed -i "/\<${test_name}\>/c\\${test_name} exit 32;" alltests
         done
     fi
 
diff --git a/runltplite.sh b/runltplite.sh
index 9313649..17be009 100755
--- a/runltplite.sh
+++ b/runltplite.sh
@@ -316,10 +316,10 @@ main()
     }
 
     # 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
+    if [ -n "${SKIPFILE}" ]; then
+        for test_name in $(awk '{print $1}' "${SKIPFILE}"); do
+            case "${test_name}" in \#*) continue;; esac
+            sed -i "/\<${test_name}\>/c\\${test_name} exit 32;" alltests
         done
     fi
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [LTP] [PATCH] runltp: skipfile: skipped test cases should be visible as TCONF in results
@ 2017-12-12 10:17 Naresh Kamboju
  2017-12-19 12:59 ` Cyril Hrubis
  0 siblings, 1 reply; 7+ messages in thread
From: Naresh Kamboju @ 2017-12-12 10:17 UTC (permalink / raw)
  To: ltp

When we skip tests in LTP by 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.
when testcase_name listed in SKIPFILE the main alltests will get that
testcase_name followed by exit 32;

Example:
  SKIPFILE the user defined content
  $ cat SKIPFILE
  testcase_name

  $ ./runltp -f syscalls -S SKIPFILE

  The runtime generated alltests file gets as
  $ cat alltests
  testcase_name exit 32;

  The final results file shows as
  $ cat results
  testcase_name TCONF

The good practise with SKIPFILE is,
tests listed in a SKIPFILE should be a single testcase_name per line.
However, test script takes only first column by using awk {print $1}

We can add comments inside SKIPFILE starting with #
The script will ignore line starting with #

Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
---
 runltp        | 14 +++++++++-----
 runltplite.sh | 14 +++++++++-----
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/runltp b/runltp
index 8e40d67..10c5960 100755
--- a/runltp
+++ b/runltp
@@ -692,11 +692,15 @@ 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_line; do
+            case "${test_line}" in \#*) continue ;; esac
+            if [ -n "${test_line}" ]; then
+                # test_name is first column of each line in SKIPFILE
+                test_name=$(echo ${test_line} | awk '{print $1}')
+                sed -i "/\<${test_name}\>/c\\${test_name} exit 32;" alltests
+            fi
+        done < ${SKIPFILE}
     fi
 
     # check for required users and groups
diff --git a/runltplite.sh b/runltplite.sh
index 9313649..e05fb3f 100755
--- a/runltplite.sh
+++ b/runltplite.sh
@@ -316,11 +316,15 @@ main()
     }
 
     # 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_line; do
+            case "${test_line}" in \#*) continue ;; esac
+            if [ -n "${test_line}" ]; then
+                # test_name is first column of each line in SKIPFILE
+                test_name=$(echo ${test_line} | awk '{print $1}')
+                sed -i "/\<${test_name}\>/c\\${test_name} exit 32;" alltests
+            fi
+        done < ${SKIPFILE}
     fi
 
     # display versions of installed software
-- 
2.7.4


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

end of thread, other threads:[~2017-12-20 14:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-20 13:03 [LTP] [PATCH] runltp: skipfile: skipped test cases should be visible as TCONF in results Naresh Kamboju
2017-12-20 14:02 ` Cyril Hrubis
  -- strict thread matches above, loose matches on Subject: below --
2017-12-12 10:17 Naresh Kamboju
2017-12-19 12:59 ` Cyril Hrubis
2017-12-19 14:22   ` Naresh Kamboju
2017-12-20 10:28     ` Cyril Hrubis
2017-12-20 13:04       ` Naresh Kamboju

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