Ver código fonte

Add support for showing test/suite version

Not very useful alone, but already good to read version of a test suite
or test, given that path is passed as well.
Alois Mahdal 6 anos atrás
pai
commit
948a4060b4

+ 5
- 1
src/libexec/jattool-runtest Ver arquivo

28
     #
28
     #
29
     # Wrap in boilerplate and run test code in $1
29
     # Wrap in boilerplate and run test code in $1
30
     #
30
     #
31
-    JAT__TEST_ID=$TestId jattool qrun "./test"
31
+    JAT__TEST_ID=$TestId \
32
+    JAT__TEST_VERSION=$TestVersion \
33
+        jattool qrun "./test"
32
 }
34
 }
33
 
35
 
34
 JATS__PATH=${JATS__PATH:-/usr/share/jat/suite}
36
 JATS__PATH=${JATS__PATH:-/usr/share/jat/suite}
55
     local TestHome
57
     local TestHome
56
     local TestTmp
58
     local TestTmp
57
     local TestId
59
     local TestId
60
+    local TestVersion
58
     local Timeout
61
     local Timeout
59
     local keeptmp=false
62
     local keeptmp=false
60
     local es=0
63
     local es=0
83
     esac
86
     esac
84
     test -f "$TestHome/test" \
87
     test -f "$TestHome/test" \
85
      || die "test body not found: $TestHome/test"
88
      || die "test body not found: $TestHome/test"
89
+    TestVersion=$(jattool tfind -f version "$TestHome")
86
     TestTmp=$(mktemp -dt jattool-runtest.XXXXXXXX)
90
     TestTmp=$(mktemp -dt jattool-runtest.XXXXXXXX)
87
     debug -v TestHome TestId TestTmp
91
     debug -v TestHome TestId TestTmp
88
     cp -ar "$TestHome"/* "$TestTmp" \
92
     cp -ar "$TestHome"/* "$TestTmp" \

+ 6
- 1
src/libexec/jattool-sfind Ver arquivo

10
         -- \
10
         -- \
11
             "Discover test in suite located at PATH"                         \
11
             "Discover test in suite located at PATH"                         \
12
         -o                                                                   \
12
         -o                                                                   \
13
-            "-f FMT     Print test name in format FMT. 'id' or 'path'."    \
13
+            "-f FMT     Print test name in format FMT. 'id', 'version' or"   \
14
+            "           'path'."                                             \
14
         --                                                                   \
15
         --                                                                   \
15
             "Test body should consist of asserts and/or phases documented"   \
16
             "Test body should consist of asserts and/or phases documented"   \
16
             "in jat.sh Shellfu module; use \`sfdoc jat\` to access its"    \
17
             "in jat.sh Shellfu module; use \`sfdoc jat\` to access its"    \
39
         sut_url)        dvalue="https://example.org/anonsut" ;;
40
         sut_url)        dvalue="https://example.org/anonsut" ;;
40
         url)            dvalue="https://$(sprop domain)/$(sprop ns)" ;;
41
         url)            dvalue="https://$(sprop domain)/$(sprop ns)" ;;
41
         format)         : ;;
42
         format)         : ;;
43
+        version)        dvalue="0.0.0+0._jats_no_version_" ;;
42
         *)              warn "unknown property: $pname"; return 2 ;;
44
         *)              warn "unknown property: $pname"; return 2 ;;
43
     esac
45
     esac
44
     pvalue=$(cat "$fpath" 2>/dev/null)
46
     pvalue=$(cat "$fpath" 2>/dev/null)
79
                 path)
81
                 path)
80
                     echo "$SuiteDir"
82
                     echo "$SuiteDir"
81
                     ;;
83
                     ;;
84
+                version)
85
+                    sprop version
86
+                    ;;
82
             esac
87
             esac
83
         done
88
         done
84
 }
89
 }

+ 4
- 2
src/libexec/jattool-tfind Ver arquivo

10
         -- \
10
         -- \
11
             "Discover all JATS tests under directory PATH."                  \
11
             "Discover all JATS tests under directory PATH."                  \
12
         -o                                                                   \
12
         -o                                                                   \
13
-            "-f FMT     Print test name in format FMT. 'id' or 'path'."
13
+            "-f FMT     Print test name in format FMT. 'id', 'version' or"   \
14
+            "           'path'."
14
 }
15
 }
15
 
16
 
16
 discover() {
17
 discover() {
32
             case $Fmt in
33
             case $Fmt in
33
                 path) echo "$s_dir/$t_rpath" ;;
34
                 path) echo "$s_dir/$t_rpath" ;;
34
                 id) echo "$s_id$t_rpath"   ;;
35
                 id) echo "$s_id$t_rpath"   ;;
36
+                version) jattool sfind -f version "$s_dir" ;;
35
             esac
37
             esac
36
         done
38
         done
37
 }
39
 }
60
     esac done
62
     esac done
61
     FindDirs=("$@")
63
     FindDirs=("$@")
62
     case $Fmt in
64
     case $Fmt in
63
-        id|path) : ;;
65
+        id|version|path) : ;;
64
         *) usage -w "unknown FMT: $Fmt" ;;
66
         *) usage -w "unknown FMT: $Fmt" ;;
65
     esac
67
     esac
66
     debug -v FindDirs Fmt
68
     debug -v FindDirs Fmt