util-linux: Add ptest

(From OE-Core rev: 705a369e5f48dc75f2db4ef814f63d11c2285058)

Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Tudor Florea
2015-12-03 04:08:00 +01:00
committed by Richard Purdie
parent dbd02bda78
commit 6f837cc142
8 changed files with 192 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
Ptest needs buildtest-TESTS and runtest-TESTS targets.
serial-tests is required to generate those targets.
Revert run.sh script accordingly to serialize running tests
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Upstream-Status: Inappropriate
diff -ruN a/configure.ac b/configure.ac
--- a/configure.ac 2014-05-27 12:37:42.119772658 +0200
+++ b/configure.ac 2014-05-27 12:41:46.225573272 +0200
@@ -10,7 +10,7 @@
dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run
dnl the compiler (like AC_PROG_LIBTOOL) to avoid autoconf errors.
AC_USE_SYSTEM_EXTENSIONS
-AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax dist-bzip2 no-dist-gzip dist-xz -Wno-portability subdir-objects])
+AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax dist-bzip2 no-dist-gzip dist-xz -Wno-portability subdir-objects serial-tests])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])

View File

@@ -0,0 +1,57 @@
Avoid unsupported grep options
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Upstream-Status: Pending
diff -ruN a/ts/ipcs/headers b/ts/ipcs/headers
--- a/tests/ts/ipcs/headers 2013-09-04 11:03:36.118613250 +0200
+++ b/teste/ts/ipcs/headers 2013-09-04 11:03:27.906958437 +0200
@@ -22,35 +22,35 @@
ts_init "$*"
ts_log "test: shm headers"
-$TS_CMD_IPCS -m -t | grep --after-context=1 "^---" >> $TS_OUTPUT
-$TS_CMD_IPCS -m -p | grep --after-context=1 "^---" >> $TS_OUTPUT
-$TS_CMD_IPCS -m -c | grep --after-context=1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -m -t | grep -A 1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -m -p | grep -A 1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -m -c | grep -A 1 "^---" >> $TS_OUTPUT
$TS_CMD_IPCS -m -l | grep "^---" >> $TS_OUTPUT
$TS_CMD_IPCS -m -u | grep "^---" >> $TS_OUTPUT
echo >> $TS_OUTPUT
ts_log "test: mesg headers"
-$TS_CMD_IPCS -q -t | grep --after-context=1 "^---" >> $TS_OUTPUT
-$TS_CMD_IPCS -q -p | grep --after-context=1 "^---" >> $TS_OUTPUT
-$TS_CMD_IPCS -q -c | grep --after-context=1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -q -t | grep -A 1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -q -p | grep -A 1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -q -c | grep -A 1 "^---" >> $TS_OUTPUT
$TS_CMD_IPCS -q -l | grep "^---" >> $TS_OUTPUT
$TS_CMD_IPCS -q -u | grep "^---" >> $TS_OUTPUT
echo >> $TS_OUTPUT
ts_log "test: sem headers"
-$TS_CMD_IPCS -s -t | grep --after-context=1 "^---" >> $TS_OUTPUT
-$TS_CMD_IPCS -s -p | grep --after-context=1 "^---" >> $TS_OUTPUT
-$TS_CMD_IPCS -s -c | grep --after-context=1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -s -t | grep -A 1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -s -p | grep -A 1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -s -c | grep -A 1 "^---" >> $TS_OUTPUT
$TS_CMD_IPCS -s -l | grep "^---" >> $TS_OUTPUT
$TS_CMD_IPCS -s -u | grep "^---" >> $TS_OUTPUT
echo >> $TS_OUTPUT
ts_log "test: all headers"
-$TS_CMD_IPCS -a | grep --after-context=1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -a | grep -A 1 "^---" >> $TS_OUTPUT
-$TS_CMD_IPCS -a -t | grep --after-context=1 "^---" >> $TS_OUTPUT
-$TS_CMD_IPCS -a -p | grep --after-context=1 "^---" >> $TS_OUTPUT
-$TS_CMD_IPCS -a -c | grep --after-context=1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -a -t | grep -A 1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -a -p | grep -A 1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -a -c | grep -A 1 "^---" >> $TS_OUTPUT
$TS_CMD_IPCS -a -l | grep "^---" >> $TS_OUTPUT
$TS_CMD_IPCS -a -u | grep "^---" >> $TS_OUTPUT

View File

@@ -0,0 +1,20 @@
Avoid unsupported sleep parameter
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Upstream-Status: Pending
diff -ruN a/simple b/simple
--- a/tests/ts/tailf/simple 2015-11-12 11:34:49.971817130 +0200
+++ b/tests/ts/tailf/simple 2013-11-12 11:34:37.876325128 +0200
@@ -27,9 +27,9 @@
$TS_CMD_TAILF $INPUT > $TS_OUTPUT 2>&1 &
-sleep 0.5
+sleep 1
echo {0..9} >> $INPUT
-sleep 0.5
+sleep 1
rm -f $INPUT

View File

@@ -0,0 +1,18 @@
Display testname for subtest
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Upstream-Status: Pending
diff -ruN a/functions.sh b/functions.sh
--- a/tests/functions.sh 2015-11-12 21:32:02.434542124 +0100
+++ b/tests/functions.sh 2015-11-12 21:40:37.095317280 +0100
@@ -297,7 +297,7 @@
if [ "$TS_PARALLEL" == "yes" ]; then
TS_TITLE=$(printf "%13s: %-30s ...\n%16s: %-27s ..." "$TS_COMPONENT" "$TS_DESC" "" "$TS_SUBNAME")
else
- TS_TITLE=$(printf "%16s: %-27s ..." "" "$TS_SUBNAME")
+ TS_TITLE=$(printf "%13s: %-30s ..." "$TS_COMPONENT" "$TS_SUBNAME")
echo -n "$TS_TITLE"
fi
}

View File

@@ -0,0 +1,17 @@
Define TESTS variable
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Upstream-Status: Pending
diff -ruN a/Makefile.am b/Makefile.am
--- a/Makefile.am 2015-11-12 20:29:46.778396936 +0100
+++ b/Makefile.am 2015-11-12 20:32:24.342450279 +0100
@@ -48,7 +48,7 @@
dist_bashcompletion_DATA =
check_PROGRAMS =
dist_check_SCRIPTS =
-TESTS =
+TESTS = $(check_PROGRAMS)
PATHFILES =

View File

@@ -0,0 +1,25 @@
#!/bin/sh
cd tests || exit 1
comps=$(find ts/ -type f -perm -111 -regex ".*/[^\.~]*" | sort)
echo
echo "-------------------- util-linux regression tests --------------------"
echo
echo " For development purpose only. "
echo " Don't execute on production system! "
echo
res=0
count=0
for ts in $comps;
do
$ts | sed '{
s/^\(.*\):\(.*\) \.\.\. OK$/PASS: \1:\2/
s/^\(.*\):\(.*\) \.\.\. FAILED \(.*\)$/FAIL: \1:\2 \3/
s/^\(.*\):\(.*\) \.\.\. SKIPPED \(.*\)$/SKIP: \1:\2 \3/
}'
done