Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | From a7e722f974e2529d3e564d8d94c86cc8bdbc40e7 Mon Sep 17 00:00:00 2001 |
| 2 | From: Radu Patriu <radu.patriu@enea.com> |
| 3 | Date: Mon, 24 Mar 2014 16:33:19 +0200 |
| 4 | Subject: [PATCH] autotest: new testsuite option to enable automake test |
| 5 | result format |
| 6 | |
| 7 | * lib/autotest/general.m4: added "--am-fmt | -A" command line |
| 8 | parameter for testsuite script to enable "RESULT: testname" output; |
| 9 | will be used by yocto ptest packages. |
| 10 | |
| 11 | Upstream-Status: Pending |
| 12 | |
| 13 | Signed-off-by: Radu Patriu <radu.patriu@enea.com> |
| 14 | --- |
| 15 | lib/autotest/general.m4 | 39 +++++++++++++++++++++++++++++---------- |
| 16 | 1 file changed, 29 insertions(+), 10 deletions(-) |
| 17 | |
| 18 | diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4 |
| 19 | index 60c0352..c1f5a9b 100644 |
| 20 | --- a/lib/autotest/general.m4 |
| 21 | +++ b/lib/autotest/general.m4 |
| 22 | @@ -412,6 +412,9 @@ at_recheck= |
| 23 | # Whether a write failure occurred |
| 24 | at_write_fail=0 |
| 25 | |
| 26 | +# Automake result format "result: testname" |
| 27 | +at_am_fmt=false |
| 28 | + |
| 29 | # The directory we run the suite in. Default to . if no -C option. |
| 30 | at_dir=`pwd` |
| 31 | # An absolute reference to this testsuite script. |
| 32 | @@ -530,6 +533,10 @@ do |
| 33 | at_check_filter_trace=at_fn_filter_trace |
| 34 | ;; |
| 35 | |
| 36 | + --am-fmt | -A ) |
| 37 | + at_am_fmt=: |
| 38 | + ;; |
| 39 | + |
| 40 | [[0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]]) |
| 41 | at_fn_validate_ranges at_option |
| 42 | AS_VAR_APPEND([at_groups], ["$at_option$as_nl"]) |
| 43 | @@ -718,10 +725,10 @@ m4_divert_push([HELP_MODES])dnl |
| 44 | cat <<_ATEOF || at_write_fail=1 |
| 45 | |
| 46 | Operation modes: |
| 47 | - -h, --help print the help message, then exit |
| 48 | - -V, --version print version number, then exit |
| 49 | - -c, --clean remove all the files this test suite might create and exit |
| 50 | - -l, --list describes all the tests, or the selected TESTS |
| 51 | + -h, --help print the help message, then exit |
| 52 | + -V, --version print version number, then exit |
| 53 | + -c, --clean remove all the files this test suite might create and exit |
| 54 | + -l, --list describes all the tests, or the selected TESTS |
| 55 | _ATEOF |
| 56 | m4_divert_pop([HELP_MODES])dnl |
| 57 | m4_wrap([m4_divert_push([HELP_TUNING_BEGIN])dnl |
| 58 | @@ -747,6 +754,7 @@ Execution tuning: |
| 59 | -d, --debug inhibit clean up and top-level logging |
| 60 | [ default for debugging scripts] |
| 61 | -x, --trace enable tests shell tracing |
| 62 | + -A, --am-fmt automake result format "result: testname" |
| 63 | _ATEOF |
| 64 | m4_divert_pop([HELP_TUNING_BEGIN])])dnl |
| 65 | m4_divert_push([HELP_END])dnl |
| 66 | @@ -1162,7 +1170,9 @@ at_fn_group_banner () |
| 67 | [*]) at_desc_line="$[1]: " ;; |
| 68 | esac |
| 69 | AS_VAR_APPEND([at_desc_line], ["$[3]$[4]"]) |
| 70 | - $at_quiet AS_ECHO_N(["$at_desc_line"]) |
| 71 | + if ! $at_am_fmt; then |
| 72 | + $at_quiet AS_ECHO_N(["$at_desc_line"]) |
| 73 | + fi |
| 74 | echo "# -*- compilation -*-" >> "$at_group_log" |
| 75 | } |
| 76 | |
| 77 | @@ -1188,42 +1198,51 @@ _ATEOF |
| 78 | case $at_xfail:$at_status in |
| 79 | yes:0) |
| 80 | at_msg="UNEXPECTED PASS" |
| 81 | + at_am_msg="XPASS" |
| 82 | at_res=xpass |
| 83 | at_errexit=$at_errexit_p |
| 84 | at_color=$at_red |
| 85 | ;; |
| 86 | no:0) |
| 87 | at_msg="ok" |
| 88 | + at_am_msg="PASS" |
| 89 | at_res=pass |
| 90 | at_errexit=false |
| 91 | at_color=$at_grn |
| 92 | ;; |
| 93 | *:77) |
| 94 | at_msg='skipped ('`cat "$at_check_line_file"`')' |
| 95 | + at_am_msg="SKIP" |
| 96 | at_res=skip |
| 97 | at_errexit=false |
| 98 | at_color=$at_blu |
| 99 | ;; |
| 100 | no:* | *:99) |
| 101 | at_msg='FAILED ('`cat "$at_check_line_file"`')' |
| 102 | + at_am_msg="FAIL" |
| 103 | at_res=fail |
| 104 | at_errexit=$at_errexit_p |
| 105 | at_color=$at_red |
| 106 | ;; |
| 107 | yes:*) |
| 108 | at_msg='expected failure ('`cat "$at_check_line_file"`')' |
| 109 | + at_am_msg="XFAIL" |
| 110 | at_res=xfail |
| 111 | at_errexit=false |
| 112 | at_color=$at_lgn |
| 113 | ;; |
| 114 | esac |
| 115 | echo "$at_res" > "$at_job_dir/$at_res" |
| 116 | - # In parallel mode, output the summary line only afterwards. |
| 117 | - if test $at_jobs -ne 1 && test -n "$at_verbose"; then |
| 118 | - AS_ECHO(["$at_desc_line $at_color$at_msg$at_std"]) |
| 119 | + if $at_am_fmt; then |
| 120 | + AS_ECHO(["$at_am_msg: $at_desc"]) |
| 121 | else |
| 122 | - # Make sure there is a separator even with long titles. |
| 123 | - AS_ECHO([" $at_color$at_msg$at_std"]) |
| 124 | + # In parallel mode, output the summary line only afterwards. |
| 125 | + if test $at_jobs -ne 1 && test -n "$at_verbose"; then |
| 126 | + AS_ECHO(["$at_desc_line $at_color$at_msg$at_std"]) |
| 127 | + else |
| 128 | + # Make sure there is a separator even with long titles. |
| 129 | + AS_ECHO([" $at_color$at_msg$at_std"]) |
| 130 | + fi |
| 131 | fi |
| 132 | at_log_msg="$at_group. $at_desc ($at_setup_line): $at_msg" |
| 133 | case $at_status in |
| 134 | -- |
| 135 | 1.7.9.5 |
| 136 | |