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
10 UNIT_LOG=$(ptest-runner 2> results.log )
11 if [ $? -eq 0 ] ; then
12 # grep: Get only the ptests results, no log
13 # sed 1: replace spaces by hyphens
14 # sed 2: remove any special character
15 # sed 3: find status and test name, wrap it in a lava-test-case call
16 # sh: execute the lava-test-case commands
17 test_pass=$(echo "$UNIT_LOG" | grep -e 'PASS' | wc -l)
18 test_fail=$(echo "$UNIT_LOG" | grep -e 'FAIL' | wc -l)
19 lava-test-case passed-commands --result PASS --measurement $test_pass --units pass
20 if ! [ x"0" = x"$test_fail"] ; then
21 lava-test-case failed-commands --result FAIL --measurement $test_fail --units fail
22 echo "$UNIT_LOG" | grep -e 'FAIL'
25 lava-test-case ptest-runner ptest-full --result fail
27 lava-test-set stop ptest-full
29 lava-test-case ptest-runtime --measurement $SECONDS --units seconds --result PASS
32 # Wait for LAVA to parse all the tests from stdout