Parcourir la source

Support t., o., and r. prefixes for assert data

Alois Mahdal il y a 6 ans
Parent
révision
8532b0f97e

+ 8
- 7
src/jat.sh.skel Voir le fichier

@@ -171,7 +171,7 @@ jat__cmd() {
171 171
         __jat__etype=FAIL
172 172
     fi
173 173
     __jat__assert $__jat__etype "$__jat__hint" "${__jat__beids[@]}" \
174
-        -- "CMDLINE=${__jat__cmd[*]}" "ES_EXPR=$__jat__o_es" "ES=$__jat__r_es"
174
+        -- "t.cmd=${__jat__cmd[*]}" "o.es_expr=$__jat__o_es" "r.es=$__jat__r_es"
175 175
     return "$__jat__r_es"
176 176
 }
177 177
 
@@ -217,11 +217,11 @@ jat__cmp() {
217 217
     case $cmpes in
218 218
         0)
219 219
             __jat__assert PASS "$hint" "${beids[@]}" \
220
-                -- "RVAL=$RVal" "OP=$Op" "OVAL=$OVal"
220
+                -- "r.val=$RVal" "t.op=$Op" "o.val=$OVal"
221 221
             ;;
222 222
         1)
223 223
             __jat__assert FAIL "$hint" "${beids[@]}" \
224
-                -- "RVAL=$RVal" "OP=$Op" "OVAL=$OVal"
224
+                -- "r.val=$RVal" "t.op=$Op" "o.val=$OVal"
225 225
             ;;
226 226
         *)
227 227
             __jat__usage "bad syntax: $RVal $Op $OVal"
@@ -301,7 +301,7 @@ jat__eval() {
301 301
         __jat__etype=FAIL
302 302
     fi
303 303
     __jat__assert $__jat__etype "$__jat__hint" "${__jat__beids[@]}" \
304
-        -- "CODE=$__jat__code" "ES_EXPR=$__jat__o_es" "ES=$__jat__r_es"
304
+        -- "t.code=$__jat__code" "o.es_expr=$__jat__o_es" "r.es=$__jat__r_es"
305 305
     return "$__jat__r_es"
306 306
 }
307 307
 
@@ -784,8 +784,9 @@ __jat__log_event() {
784 784
     # You can provide any amount of KEY=VALUE pairs, meaning of which
785 785
     # is specific to every assert function.  (The assert function name
786 786
     # is auto-detected and logged so that you can infer KEY meanings
787
-    # later.)
788
-    #
787
+    # later.)  Each KEY must be simple word, except that prefixes of
788
+    # `t.`, `r.`, and `o.` are allowed to signify that the value logged
789
+    # is relevant to test method, result or oracle, respectively.
789 790
     local etype=$1; shift
790 791
     local hint=$1;    shift
791 792
     local arg
@@ -1176,7 +1177,7 @@ __jat__valid_pair() {
1176 1177
     # True if $1 is a valid BEID
1177 1178
     #
1178 1179
     local tainted=$1
1179
-    grep -qx '[[:alpha:]_][[:alnum:]_]*=.*' <<<"$tainted"
1180
+    grep -qx '\([tor][.]\)\?[[:alpha:]_][[:alnum:]_]*=.*' <<<"$tainted"
1180 1181
 }
1181 1182
 
1182 1183
 __jat__yamls() {

+ 6
- 6
tests/basic/oracle/ylog_both.stdout Voir le fichier

@@ -48,11 +48,11 @@ events:
48 48
             true is true
49 49
         beids: []
50 50
         data:
51
-            CMDLINE: |
51
+            t.cmd: |
52 52
                 true
53
-            ES_EXPR: |
53
+            o.es_expr: |
54 54
                 0
55
-            ES: |
55
+            r.es: |
56 56
                 0
57 57
         phase:
58 58
             id: phasid-1
@@ -78,11 +78,11 @@ events:
78 78
             false is true
79 79
         beids: []
80 80
         data:
81
-            CMDLINE: |
81
+            t.cmd: |
82 82
                 false
83
-            ES_EXPR: |
83
+            o.es_expr: |
84 84
                 0
85
-            ES: |
85
+            r.es: |
86 86
                 1
87 87
         phase:
88 88
             id: phasid-1

+ 6
- 6
tests/basic/oracle/ylog_fail.stdout Voir le fichier

@@ -48,11 +48,11 @@ events:
48 48
             true is false
49 49
         beids: []
50 50
         data:
51
-            CMDLINE: |
51
+            t.cmd: |
52 52
                 true
53
-            ES_EXPR: |
53
+            o.es_expr: |
54 54
                 1
55
-            ES: |
55
+            r.es: |
56 56
                 0
57 57
         phase:
58 58
             id: phasid-1
@@ -78,11 +78,11 @@ events:
78 78
             false is true
79 79
         beids: []
80 80
         data:
81
-            CMDLINE: |
81
+            t.cmd: |
82 82
                 false
83
-            ES_EXPR: |
83
+            o.es_expr: |
84 84
                 0
85
-            ES: |
85
+            r.es: |
86 86
                 1
87 87
         phase:
88 88
             id: phasid-1

+ 6
- 6
tests/basic/oracle/ylog_pass.stdout Voir le fichier

@@ -48,11 +48,11 @@ events:
48 48
             true is true
49 49
         beids: []
50 50
         data:
51
-            CMDLINE: |
51
+            t.cmd: |
52 52
                 true
53
-            ES_EXPR: |
53
+            o.es_expr: |
54 54
                 0
55
-            ES: |
55
+            r.es: |
56 56
                 0
57 57
         phase:
58 58
             id: phasid-1
@@ -78,11 +78,11 @@ events:
78 78
             false is false
79 79
         beids: []
80 80
         data:
81
-            CMDLINE: |
81
+            t.cmd: |
82 82
                 false
83
-            ES_EXPR: |
83
+            o.es_expr: |
84 84
                 1
85
-            ES: |
85
+            r.es: |
86 86
                 1
87 87
         phase:
88 88
             id: phasid-1