3 # Check if ptest packages are installed
4 command -v ptest-runner >/dev/null 2>&1
6 lava-test-case ptest-installed --result SKIP
8 # Run ptests for specified packages
9 lava-test-set start ptest-full
11 UNIT_LOG=$(ptest-runner 2> results.log )
12 if [ $? -eq 0 ] ; then
13 # grep: Get only the ptests results, no log
14 # sed 1: replace spaces by hyphens
15 # sed 2: remove any special character
16 # sed 3: find status and test name, wrap it in a lava-test-case call
17 # sh: execute the lava-test-case commands
18 test_pass=$(echo "$UNIT_LOG" | grep -e 'PASS' | wc -l)
19 test_fail=$(echo "$UNIT_LOG" | grep -e 'FAIL' | wc -l)
20 lava-test-case passed-commands --result PASS --measurement $test_pass --units pass
21 if ! [ x"0" = x"$test_fail" ] ; then
22 lava-test-case failed-commands --result FAIL --measurement $test_fail --units fail
23 echo "$UNIT_LOG" | grep -e 'FAIL'
26 lava-test-case ptest-runner ptest-full --result fail
29 lava-test-set stop ptest-full
31 lava-test-case ptest-runtime --measurement $SECONDS --units seconds --result PASS
34 # Wait for LAVA to parse all the tests from stdout