[LTP] [PATCH v1 1/1] runltp: Enable POSIX regex support for SKIPFILE (-S)

Jan Polensky japo@linux.ibm.com
Tue May 27 09:27:34 CEST 2025


Enhance the SKIPFILE (-S) option to support POSIX regular expressions, allowing
users to skip groups of tests using concise patterns instead of listing each
test individually.

Previous usage:
	cat > skip_file <<-EOF
		oom01  # reason foo
		oom03  # reason foo
		oom04  # reason foo
		oom05  # reason foo
		special_a # reason bar
		special_b # reason bar
	EOF

New usage:
	echo > skip_file <<-EOF
		oom0[13-5]  # reason foo
		spe.* # reason bar
	EOF

Note: The previous behavior remains fully supported for backward compatibility.

Signed-off-by: Jan Polensky <japo@linux.ibm.com>
---
 runltp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/runltp b/runltp
index 0d9062569141..c535775f2568 100755
--- a/runltp
+++ b/runltp
@@ -166,7 +166,7 @@ usage()
     -r LTPROOT      Fully qualified path where testsuite is installed.
     -R              Randomize test order.
     -s PATTERN      Only run test cases which match PATTERN.
-    -S SKIPFILE     Skip tests specified in SKIPFILE
+    -S SKIPFILE     Skip tests matching PATTERNs listed in SKIPFILE.
     -t DURATION     Execute the testsuite for given duration. Examples:
                       -t 60s = 60 seconds
                       -t 45m = 45 minutes
@@ -648,9 +648,9 @@ EOF

     # Blacklist or skip tests if a SKIPFILE was specified with -S
     if [ -n "${SKIPFILE}" ]; then
-        for test_name in $(awk '{print $1}' "${SKIPFILE}"); do
+        for test_name in $(awk '{gsub(/\./, "[^[:space:]]", $1); print $1}' "${SKIPFILE}"); do
             case "${test_name}" in \#*) continue;; esac
-            sed -i "/\<${test_name}\>/c\\${test_name} exit 32;" alltests
+            sed -i "s#\<\(${test_name}\)\>.*#\1 exit 32;#" alltests
         done
     fi

--
2.49.0



More information about the ltp mailing list