3 REQUIREDPTESTS="acl attr cynara xmlsec1 libxml2 lua smack"
4 # NOT: systemd openssl openssh
5 # Check if ptest packages are installed
7 echo "Testing these components: $REQUIREDPTESTS"
9 command -v ptest-runner >/dev/null 2>&1
10 if [ $? -ne 0 ] ; then
11 lava-test-case ptest-installed --result SKIP
13 # Run ptests for specified packages
14 for unit in ${REQUIREDPTESTS}; do
15 lava-test-set start ptest-$unit
16 UNIT_LOG=$(ptest-runner ${unit} 2> /dev/null)
17 if [ $? -eq 0 ] ; then
18 # grep: Get only the ptests results, no log
19 # sed 1: replace spaces by hyphens
20 # sed 2: remove any special character
21 # sed 3: find status and test name, wrap it in a lava-test-case call
22 # sh: execute the lava-test-case commands
23 test_pass=$(echo "$UNIT_LOG" | grep -e 'PASS' | wc -l)
24 test_fail=$(echo "$UNIT_LOG" | grep -e 'FAIL' | wc -l)
25 lava-test-case ${unit}-passed-commands --result PASS --measurement $test_pass --units pass
26 if ! [ x"0" = x"$test_fail" ] ; then
27 lava-test-case ${unit}-failed-commands --result FAIL --measurement $test_fail --units fail
28 echo "$UNIT_LOG" | grep -e 'FAIL'
30 lava-test-set stop ptest-$unit
32 lava-test-case ptest-runner-${unit} --result fail
35 lava-test-case ptest-runtime --measurement $SECONDS --units seconds --result PASS
38 # Wait for LAVA to parse all the tests from stdout