diff options
author | Arthur She <arthur.she@linaro.org> | 2019-06-10 13:33:54 -0700 |
---|---|---|
committer | mwasilew <milosz.wasilewski@linaro.org> | 2019-06-17 08:51:25 +0100 |
commit | fbdba65b6708925ebc703147da986b1e56940a99 (patch) | |
tree | bb9ea89f60ad668f7d1bb212d311e7b5c70c9861 | |
parent | e7f9f1cb1ed193e17c5ad6fac102feb0064010e7 (diff) |
igt: print igt test result with python script
Signed-off-by: Arthur She <arthur.she@linaro.org>
-rw-r--r-- | automated/linux/igt/igt-chamelium-test.yaml | 6 | ||||
-rwxr-xr-x | automated/linux/igt/print-test-result.py | 39 |
2 files changed, 41 insertions, 4 deletions
diff --git a/automated/linux/igt/igt-chamelium-test.yaml b/automated/linux/igt/igt-chamelium-test.yaml index dd4ddd54..efbe39df 100644 --- a/automated/linux/igt/igt-chamelium-test.yaml +++ b/automated/linux/igt/igt-chamelium-test.yaml @@ -33,13 +33,11 @@ run: - if [ -n "${TEST_LIST}" ]; then TL="-t ${TEST_LIST}"; fi - ./igt-chamelium-test.sh -c ${CHAMELIUM_IP} -h ${HDMI_DEV_NAME} -d ${IGT_DIR} ${TL} # Dump igt test result and upload artifact to Artifactorial - - ifconfig; pwd; ls - - if [ -n "`which html2text`" -a -d "/usr/share/igt-gpu-tools/results/html/" ]; then - - ls /usr/share/igt-gpu-tools/results + - ifconfig; pwd; ls -l - echo "**********************************************"; - echo "************ Dump IGT test result ************"; - echo "**********************************************"; - - ls /usr/share/igt-gpu-tools/results/html/results/*|sort -r|xargs html2text; fi + - bzcat /usr/share/igt-gpu-tools/results/results.json.bz2 | python print-test-result.py - if [ -n "${ARTIFACTORIAL_TOKEN}" -a -n "${ARTIFACTORIAL_URL}" ]; then - UPLOAD_TOOL="../../utils/upload-to-artifactorial.sh" - if [ -d "/root/dump-frames/" -a -n "`ls /root/dump-frames/`" ]; then echo "Got error frames.." ; tar -C /root -zcf dump-frames.tar.gz dump-frames/; diff --git a/automated/linux/igt/print-test-result.py b/automated/linux/igt/print-test-result.py new file mode 100755 index 00000000..5eefd6fc --- /dev/null +++ b/automated/linux/igt/print-test-result.py @@ -0,0 +1,39 @@ +#!/usr/bin/python +import argparse +import sys +import json + + +def print_result(results): + try: + for test, content in results['tests'].iteritems(): + print '<LAVA_SIGNAL_STARTTC %s>' % test + print '************************************************************************************************************************************' + print '%-15s %s' % ('Test:', test) + print '%-15s %s' % ('Result:', content['result']) + print '%-15s %s' % ('Command:', content['command']) + print '%-15s %s' % ('Environment:', content['environment']) + print '%-15s %s' % ('Returncode:', content['returncode']) + print '%-15s %s' % ('Stdout:', content['out'].replace('\n', '\n ')) + print '%-15s %s' % ('Stderr:', content['err'].replace('\n', '\n ')) + print '%-15s %s' % ('dmesg:', content['dmesg'].replace('\n', '\n ')) + print '<LAVA_SIGNAL_TESTCASE TEST_CASE_ID=%s RESULT=%s>' % (test, content['result']) + print '<LAVA_SIGNAL_ENDTC %s>' % test + except KeyError: + print "Error: Can not find required data" + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument("-f", + "--json-file", + nargs='?', + default=sys.stdin, + type=argparse.FileType('r'), + help="Test result file in json format") + + args = parser.parse_args() + with args.json_file as data: + results = json.load(data) + + print_result(results) |