Fossil SCM

Add script to rewrite test output for easier comparison of output from different runs. Invoked with tclsh, the script reads either a file argument or stdin and writes to stdout.

preben 2023-11-17 17:47 UTC testing-improvements
Commit b3f89945a51be601a881945ca61f588501f39aa9bfe17f1698ecb11becf2608a
--- a/test/rewrite-test-output.tcl
+++ b/test/rewrite-test-output.tcl
@@ -0,0 +1,55 @@
1
+#!/usr/bin/env tclsh
2
+
3
+# Script to anonymise test results for comparison.
4
+# - Replaces hashes, pids and similar with fixed strings
5
+# - Rewrites temporary paths to standardise them in output
6
+
7
+# goes t$argc$argcusage: else {
8
+ if { $fname eq "-" } {
9
+ set fd stdin
10
+ } else {
11
+ set fd [open $fname r set collecting # Pick up test nae\*{5} End of# Test done
12
+ set testname ""
13
+regsub {^/.*?/(fossil )} $line {\1} line] } {
14
+ # Handle all fossil commands in one place
15
+
16
+ # We get varying amounts of lines for wiki "f13"
17
+collecting_f3 > 0 # Print a continuation line here.line is printed,\[...\]"
18
+ } elseif [regexp {^fossil wiki (?:create .* f13|)} $line] {
19
+}
20
+} elseif { $f}
21
+
22
+ # Hashes
23
+ regsub {^(f\2} line
24
+ regsub {^(foregsub $line {\1 HASH} line
25
+ regsub--technote )[0-9a-f]{21}$} $line {\1HASH} line
26
+ regsub {^(fossil json artifact) [0-9a-f]{64}regsub {^(fossil json wiki diff1 HASH2} line
27
+
28
+ # PIDs, Sequence numbers and seconds
29
+ regsub .*/th1-)\d+([.]tfossil http --inregsub -all { $line {/\1-PID-SEQ-SEC\2} line
30
+ }
31
+
32
+ # Tech notes ids
33
+ regsub $line {\1ID} line
34
+
35
+ # Special technote timestamp (mostly they are fixed)
36
+ regsub {^(fossil attachment add f11 --technote) [{}]} $line {\1} line
37
+
38
+ # Unversioned test has passowrds and ports
39
+ regsub $line {\1 $lineregsub $line {\1 LENGTH} line
40
+ regsub {^( \"authToken\":\")[0-9a-f]{40}/\d+\.\d+/(anonymous\")$} $line {\1SHA1/NOW/\2} line
41
+ regsuba-f]{40}%2F\d+\.\d+%2F(anonymous)$} $line {\1CODE=SHA1%2FNOW%2F\2} line
42
+ regsub)[0-9a-f]{40}/\d+\.\d+/(anonymous )} $line {\1SHA1/NOW/\2} line
43
+ regsub $line$testname eq "merge_renames" } {
44
+ regsub {^( (?:MERGED_WITH|BACKOUT)) [0-9a-f]{64}$unversioned" } {
45
+ regsub hashes, pids and similar w#!/usr/bin//.*?/uvtest_\d+_\d+\"} $line!/usr/bin/env tclsh
46
+
47
+# t to anonymise test\d+} $line {\1PID\2PID} line
48
+ }
49
+
50
+ # Some common lines not tied to fossil or $line {\1 PID \2} line
51
+
52
+ regsub -all {
53
+ puts "$line"
54
+ }
55
+}
--- a/test/rewrite-test-output.tcl
+++ b/test/rewrite-test-output.tcl
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/test/rewrite-test-output.tcl
+++ b/test/rewrite-test-output.tcl
@@ -0,0 +1,55 @@
1 #!/usr/bin/env tclsh
2
3 # Script to anonymise test results for comparison.
4 # - Replaces hashes, pids and similar with fixed strings
5 # - Rewrites temporary paths to standardise them in output
6
7 # goes t$argc$argcusage: else {
8 if { $fname eq "-" } {
9 set fd stdin
10 } else {
11 set fd [open $fname r set collecting # Pick up test nae\*{5} End of# Test done
12 set testname ""
13 regsub {^/.*?/(fossil )} $line {\1} line] } {
14 # Handle all fossil commands in one place
15
16 # We get varying amounts of lines for wiki "f13"
17 collecting_f3 > 0 # Print a continuation line here.line is printed,\[...\]"
18 } elseif [regexp {^fossil wiki (?:create .* f13|)} $line] {
19 }
20 } elseif { $f}
21
22 # Hashes
23 regsub {^(f\2} line
24 regsub {^(foregsub $line {\1 HASH} line
25 regsub--technote )[0-9a-f]{21}$} $line {\1HASH} line
26 regsub {^(fossil json artifact) [0-9a-f]{64}regsub {^(fossil json wiki diff1 HASH2} line
27
28 # PIDs, Sequence numbers and seconds
29 regsub .*/th1-)\d+([.]tfossil http --inregsub -all { $line {/\1-PID-SEQ-SEC\2} line
30 }
31
32 # Tech notes ids
33 regsub $line {\1ID} line
34
35 # Special technote timestamp (mostly they are fixed)
36 regsub {^(fossil attachment add f11 --technote) [{}]} $line {\1} line
37
38 # Unversioned test has passowrds and ports
39 regsub $line {\1 $lineregsub $line {\1 LENGTH} line
40 regsub {^( \"authToken\":\")[0-9a-f]{40}/\d+\.\d+/(anonymous\")$} $line {\1SHA1/NOW/\2} line
41 regsuba-f]{40}%2F\d+\.\d+%2F(anonymous)$} $line {\1CODE=SHA1%2FNOW%2F\2} line
42 regsub)[0-9a-f]{40}/\d+\.\d+/(anonymous )} $line {\1SHA1/NOW/\2} line
43 regsub $line$testname eq "merge_renames" } {
44 regsub {^( (?:MERGED_WITH|BACKOUT)) [0-9a-f]{64}$unversioned" } {
45 regsub hashes, pids and similar w#!/usr/bin//.*?/uvtest_\d+_\d+\"} $line!/usr/bin/env tclsh
46
47 # t to anonymise test\d+} $line {\1PID\2PID} line
48 }
49
50 # Some common lines not tied to fossil or $line {\1 PID \2} line
51
52 regsub -all {
53 puts "$line"
54 }
55 }

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button