1
2
3
4
5
6
7
8
|
1
2
3
4
5
6
7
8
|
-
+
|
#!/bin/sh
#!/bin/sh
# \
exec wapptclsh "$0" ${1+"$@"}
# package required wapp
source [file join [file dirname [info script]] wapp.tcl]
# Read the data from the releasetest_data.tcl script.
|
︙ | | |
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
# G(tcl) - Use Tcl from this directory for builds.
# G(jobs) - How many sub-processes to run simultaneously.
#
set G(platform) $::tcl_platform(os)-$::tcl_platform(machine)
set G(test) Normal
set G(keep) 0
set G(msvc) 0
set G(tcl) ""
set G(tcl) [::tcl::pkgconfig get libdir,install]
set G(jobs) 3
set G(debug) 0
proc wapptest_init {} {
global G
set lSave [list platform test keep msvc tcl jobs]
set lSave [list platform test keep msvc tcl jobs debug]
foreach k $lSave { set A($k) $G($k) }
array unset G
foreach k $lSave { set G($k) $A($k) }
# The root of the SQLite source tree.
set G(srcdir) [file dirname [file dirname [info script]]]
# releasetest.tcl script
set G(releaseTest) [file join [file dirname [info script]] releasetest.tcl]
set G(sqlite_version) "unknown"
# Either "config", "running" or "stopped":
set G(state) "config"
set G(host) "(unknown host)"
catch { set G(host) [exec hostname] }
set G(hostname) "(unknown host)"
catch { set G(hostname) [exec hostname] }
set G(host) $G(hostname)
append G(host) " $::tcl_platform(os) $::tcl_platform(osVersion)"
append G(host) " $::tcl_platform(machine) $::tcl_platform(byteOrder)"
}
# Check to see if there are uncommitted changes in the SQLite source
# directory. Return true if there are, or false otherwise.
#
proc check_uncommitted {} {
global G
set ret 0
set pwd [pwd]
cd $G(srcdir)
if {[catch {exec fossil changes} res]==0 && [string trim $res]!=""} {
set ret 1
}
cd $pwd
return $ret
}
proc generate_fossil_info {} {
global G
set pwd [pwd]
cd $G(srcdir)
if {[catch {exec fossil info} r1]} return
if {[catch {exec fossil changes} r2]} return
cd $pwd
foreach line [split $r1 "\n"] {
if {[regexp {^checkout: *(.*)$} $line -> co]} {
wapp-trim { <br> %html($co) }
}
}
if {[string trim $r2]!=""} {
wapp-trim {
<br><span class=warning>
WARNING: Uncommitted changes in checkout
</span>
}
}
}
# If the application is in "config" state, set the contents of the
# ::G(test_array) global to reflect the tests that will be run. If the
# app is in some other state ("running" or "stopped"), this command
# is a no-op.
#
proc set_test_array {} {
|
︙ | | |
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
set target testfixture.exe
}
}
}
}
lappend G(test_array) [dict create config $config target $target]
set exclude [list checksymbols valgrindtest fuzzoomtest]
if {$G(debug) && !($target in $exclude)} {
set debug_idx [lsearch -glob $::Configs($config) -DSQLITE_DEBUG*]
set xtarget $target
regsub -all {fulltest[a-z]*} $xtarget test xtarget
if {$debug_idx<0} {
lappend G(test_array) [
dict create config $config-(Debug) target $target
]
} else {
lappend G(test_array) [
dict create config $config-(NDebug) target $xtarget
]
}
}
}
}
}
proc count_tests_and_errors {name logfile} {
global G
|
︙ | | |
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
|
set G(test.$name.start) [clock seconds]
set fd [open "|[info nameofexecutable] $G(releaseTest) --slave" r+]
set G(test.$name.channel) $fd
fconfigure $fd -blocking 0
fileevent $fd readable [list slave_fileevent $name]
puts $fd [list 0 $G(msvc) 0 $G(keep)]
set wtcl ""
if {$G(tcl)!=""} { set wtcl "--with-tcl=$G(tcl)" }
# If this configuration is named <name>-(Debug) or <name>-(NDebug),
# then add or remove the SQLITE_DEBUG option from the base
# configuration before running the test.
if {[regexp -- {(.*)-(\(.*\))} $name -> head tail]} {
set opts $::Configs($head)
if {$tail=="(Debug)"} {
append opts " -DSQLITE_DEBUG=1 -DSQLITE_EXTRA_IFNULLROW=1"
} else {
regsub { *-DSQLITE_MEMDEBUG[^ ]* *} $opts { } opts
regsub { *-DSQLITE_DEBUG[^ ]* *} $opts { } opts
}
} else {
set opts $::Configs($name)
}
set L [make_test_suite $G(msvc) "" $name $target $::Configs($name)]
set L [make_test_suite $G(msvc) $wtcl $name $target $opts]
puts $fd $L
flush $fd
set G(test.$name.log) [file join [lindex $L 1] test.log]
incr nLaunch -1
}
}
}
|
︙ | | |
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
|
-
+
+
-
+
-
-
-
-
+
+
-
-
-
+
-
-
+
-
-
-
-
+
+
+
|
wapp-trim { </select> }
}
proc generate_main_page {{extra {}}} {
global G
set_test_array
# <meta http-equiv="refresh" content="5; URL=/">
set hostname $G(hostname)
wapp-trim {
<html>
<head>
<title> %html($hostname): wapptest.tcl </title>
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
}
# If the checkout contains uncommitted changs, put a warning at the top
set host $G(host)
# of the page.
if {[check_uncommitted]} {
wapp-trim {
<div class=warning>
wapp-trim {
<div class="border">%string($host)
WARNING: Uncommitted changes in checkout.
</div>
}
}
}
generate_fossil_info
set host $G(host)
wapp-trim {
<div class=div>%string($host)</div>
<div class=div id=controls>
<form action="control" method="post" name="control">
</div>
<div class="border" id=controls>
<form action="control" method="post" name="control">
}
# Build the "platform" select widget.
set lOpt [array names ::Platforms]
generate_select_widget Platform control_platform $lOpt $G(platform)
# Build the "test" select widget.
|
︙ | | |
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
|
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
|
+
+
-
+
-
+
|
<label> Tcl: </label>
<input id="control_tcl" name="control_tcl"></input>
<label> Keep files: </label>
<input id="control_keep" name="control_keep" type=checkbox value=1>
</input>
<label> Use MSVC: </label>
<input id="control_msvc" name="control_msvc" type=checkbox value=1>
<label> Debug tests: </label>
<input id="control_debug" name="control_debug" type=checkbox value=1>
</input>
}
wapp-trim {
</form>
}
wapp-trim {
</div>
<div class=div2 id=tests>
<div id=tests>
}
wapp-page-tests
set script "script/$G(state).js"
wapp-trim {
</div>
<script src=%string($script)></script>
</body>
</html>
}
}
proc wapp-default {} {
generate_main_page
}
proc wapp-page-tests {} {
global G
wapp-trim { <table> }
wapp-trim { <table class="border" width=100%> }
foreach t $G(test_array) {
set config [dict get $t config]
set target [dict get $t target]
set class "testwait"
set seconds ""
|
︙ | | |
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
|
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
|
-
-
-
-
+
+
+
+
-
-
+
|
set hr [format %.2d [expr $seconds / 3600]]
set sec [format %.2d [expr $seconds % 60]]
set seconds "$hr:$min:$sec"
}
wapp-trim {
<tr class=%string($class)>
<td class=testfield> %html($config)
<td class=testfield> %html($target)
<td class=testfield> %html($seconds)
<td class=testfield>
<td class="nowrap"> %html($config)
<td class="padleft nowrap"> %html($target)
<td class="padleft nowrap"> %html($seconds)
<td class="padleft nowrap">
}
if {[info exists G(test.$config.log)]} {
set log $G(test.$config.log)
set uri "log/$log"
wapp-trim {
<a href=%url($uri)> %html($log) </a>
}
}
if {[info exists G(test.$config.errmsg)] && $G(test.$config.errmsg)!=""} {
set errmsg $G(test.$config.errmsg)
wapp-trim {
<tr class=testfail>
<td class=testfield>
<td class=testfield colspan=3> %html($errmsg)
<td> <td class="padleft" colspan=3> %html($errmsg)
}
}
}
wapp-trim { </table> }
if {[info exists G(result)]} {
|
︙ | | |
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
|
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
|
-
-
+
+
|
# URI: /control
#
# Whenever the form at the top of the application page is submitted, it
# is submitted here.
#
proc wapp-page-control {} {
global G
catch { puts [wapp-param control_msvc] }
if {$::G(state)=="config"} {
set lControls [list platform test tcl jobs keep msvc]
set lControls [list platform test tcl jobs keep msvc debug]
set G(msvc) 0
set G(keep) 0
set G(debug) 0
} else {
set lControls [list jobs]
}
foreach v $lControls {
if {[wapp-param-exists control_$v]} {
set G($v) [wapp-param control_$v]
}
|
︙ | | |
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
|
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
|
-
-
-
-
-
-
+
+
-
-
-
-
-
+
+
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
+
-
+
+
+
+
|
# URI: /style.css
#
# Return the stylesheet for the application main page.
#
proc wapp-page-style.css {} {
wapp-subst {
.div {
border: 3px groove #444444;
margin: 1em;
padding: 1em;
}
/* The boxes with black borders use this class */
.border {
border: 3px groove #444444;
padding: 1em;
margin-top: 1em;
margin-bottom: 1em;
}
.div2 {
margin: 1em;
}
table {
/* Float to the right (used for the Run/Stop/Reset button) */
.right { float: right; }
padding: 1em;
width:100%;
border: 3px groove #444444;
}
/* Style for the large red warning at the top of the page */
.warning {
text-align:center;
color: red;
font-size: 2em;
font-weight: bold;
}
.testfield {
padding-right: 10ex;
white-space: nowrap;
}
.testwait {}
.testrunning { color: blue }
.testdone { color: green }
.testfail { color: red }
/* Styles used by cells in the test table */
.padleft { padding-left: 5ex; }
.nowrap { white-space: nowrap; }
/* Styles for individual tests, depending on the outcome */
.testwait { }
.testrunning { color: blue }
.testdone { color: green }
.testfail { color: red }
.right { float: right; }
}
}
# URI: /script/${state}.js
#
# The last part of this URI is always "config.js", "running.js" or
# "stopped.js", depending on the state of the application. It returns
# the javascript part of the front-end for the requested state to the
# browser.
#
proc wapp-page-script {} {
regexp {[^/]*$} [wapp-param REQUEST_URI] script
set tcl $::G(tcl)
set keep $::G(keep)
set msvc $::G(msvc)
set debug $::G(debug)
wapp-subst {
var lElem = \["control_platform", "control_test", "control_msvc",
"control_jobs"
"control_jobs", "control_debug"
\];
lElem.forEach(function(e) {
var elem = document.getElementById(e);
elem.addEventListener("change", function() { control.submit() } );
})
elem = document.getElementById("control_tcl");
elem.value = "%string($tcl)"
elem = document.getElementById("control_keep");
elem.checked = %string($keep);
elem = document.getElementById("control_msvc");
elem.checked = %string($msvc);
elem = document.getElementById("control_debug");
elem.checked = %string($debug);
}
if {$script != "config.js"} {
wapp-subst {
var lElem = \["control_platform", "control_test",
"control_tcl", "control_keep", "control_msvc"
\];
|
︙ | | |