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
|
(include "run_records.scm")
(include "megatest-fossil-hash.scm")
(let ((debugcontrolf (conc (get-environment-variable "HOME") "/.megatestrc")))
(if (file-exists? debugcontrolf)
(load debugcontrolf)))
(define help (conc "
Megatest, documentation at http://www.kiatoa.com/fossils/megatest
version " megatest-version "
license GPL, Copyright Matt Welland 2006-2012
Usage: megatest [options]
-h : this help
-version : print megatest version (currently " megatest-version ")
Launching and managing runs
-runall : run all tests that are not state COMPLETED and status PASS,
CHECK or KILLED
-runtests tst1,tst2 ... : run tests
-remove-runs : remove the data for a run, requires :runname and -testpatt
Optionally use :state and :status
-set-state-status X,Y : set state to X and status to Y, requires controls per -remove-runs
-rerun FAIL,WARN... : force re-run for tests with specificed status(s)
-rollup : (currently disabled) fill run (set by :runname) with latest test(s)
from prior runs with same keys
-lock : lock run specified by target and runname
-unlock : unlock run specified by target and runname
-run-wait : wait on run specified by target and runname
Selectors (e.g. use for -runtests, -remove-runs, -set-state-status, -list-runs etc.)
-target key1/key2/... : run for key1, key2, etc.
-reqtarg key1/key2/... : run for key1, key2, etc. but key1/key2 must be in runconfig
-testpatt patt1/patt2,patt3/... : % is wildcard
:runname : required, name for this particular test run
|
>
>
>
<
<
>
>
|
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
|
(include "run_records.scm")
(include "megatest-fossil-hash.scm")
(let ((debugcontrolf (conc (get-environment-variable "HOME") "/.megatestrc")))
(if (file-exists? debugcontrolf)
(load debugcontrolf)))
;; Disabled help items
;; -rollup : (currently disabled) fill run (set by :runname) with latest test(s)
;; from prior runs with same keys
(define help (conc "
Megatest, documentation at http://www.kiatoa.com/fossils/megatest
version " megatest-version "
license GPL, Copyright Matt Welland 2006-2012
Usage: megatest [options]
-h : this help
-version : print megatest version (currently " megatest-version ")
Launching and managing runs
-runall : run all tests that are not state COMPLETED and status PASS,
CHECK or KILLED
-runtests tst1,tst2 ... : run tests
-remove-runs : remove the data for a run, requires :runname and -testpatt
Optionally use :state and :status
-set-state-status X,Y : set state to X and status to Y, requires controls per -remove-runs
-rerun FAIL,WARN... : force re-run for tests with specificed status(s)
-lock : lock run specified by target and runname
-unlock : unlock run specified by target and runname
-set-run-status status : sets status for run to status, requires -target and :runname
-get-run-status : gets status for run specified by target and runname
-run-wait : wait on run specified by target and runname
Selectors (e.g. use for -runtests, -remove-runs, -set-state-status, -list-runs etc.)
-target key1/key2/... : run for key1, key2, etc.
-reqtarg key1/key2/... : run for key1, key2, etc. but key1/key2 must be in runconfig
-testpatt patt1/patt2,patt3/... : % is wildcard
:runname : required, name for this particular test run
|
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
"-stop-server"
"-port"
"-extract-ods"
"-pathmod"
"-env2file"
"-setvars"
"-set-state-status"
"-debug" ;; for *verbosity* > 2
"-gen-megatest-test"
"-override-timeout"
"-test-files" ;; -test-paths is for listing all
"-load" ;; load and exectute a scheme file
"-dumpmode"
)
|
>
|
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
"-stop-server"
"-port"
"-extract-ods"
"-pathmod"
"-env2file"
"-setvars"
"-set-state-status"
"-set-run-status"
"-debug" ;; for *verbosity* > 2
"-gen-megatest-test"
"-override-timeout"
"-test-files" ;; -test-paths is for listing all
"-load" ;; load and exectute a scheme file
"-dumpmode"
)
|
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
;; misc queries
"-list-disks"
"-list-targets"
"-list-db-targets"
"-show-runconfig"
"-show-config"
"-show-cmdinfo"
;; queries
"-test-paths" ;; get path(s) to a test, ordered by youngest first
"-runall" ;; run all tests
"-remove-runs"
"-rebuild-db"
"-cleanup-db"
|
>
>
|
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
|
;; misc queries
"-list-disks"
"-list-targets"
"-list-db-targets"
"-show-runconfig"
"-show-config"
"-show-cmdinfo"
"-get-run-status"
;; queries
"-test-paths" ;; get path(s) to a test, ordered by youngest first
"-runall" ;; run all tests
"-remove-runs"
"-rebuild-db"
"-cleanup-db"
|
376
377
378
379
380
381
382
383
384
385
386
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
|
((http)
(set! *transport-type 'http)
(server:ensure-running)
(client:launch))
(else ;; (fs)
(set! *transport-type* 'fs)
(set! *megatest-db* (open-db))))))))))
;; (cond
;; ;; command line overrides other mechanisms
;; (transport-from-cmdln
;; (if (equal? transport-from-cmdln "fs")
;; (set! *transport-type* 'fs)
;; (begin
;; (server:ensure-running)
;; (client:launch))))
;; ;; cmdinfo is second priority
;; (transport-from-cmdinfo
;; (if (equal? transport-from-cmdinfo "fs")
;; (set! *transport-type* 'fs)
;; (begin
;; (server:ensure-running)
;; (client:launch))))
;; ;; config file is next highest priority for determinining transport
;; (transport-from-config
;; (if (equal? transport-from-config "fs")
;; (set! *transport-type* 'fs)
;; (begin
;; (server:ensure-running)
;; (client:launch))))
;; (else
;; (set! *transport-type* 'fs)))))))))
(if (or (args:get-arg "-list-servers")
(args:get-arg "-stop-server"))
(let ((tl (setup-for-run)))
(if tl
(let* ((servers (open-run-close tasks:get-all-servers tasks:open-db))
(fmtstr "~5a~12a~8a~20a~24a~10a~10a~10a~10a\n")
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
382
383
384
385
386
387
388
389
390
391
392
393
394
395
|
((http)
(set! *transport-type 'http)
(server:ensure-running)
(client:launch))
(else ;; (fs)
(set! *transport-type* 'fs)
(set! *megatest-db* (open-db))))))))))
(if (or (args:get-arg "-list-servers")
(args:get-arg "-stop-server"))
(let ((tl (setup-for-run)))
(if tl
(let* ((servers (open-run-close tasks:get-all-servers tasks:open-db))
(fmtstr "~5a~12a~8a~20a~24a~10a~10a~10a~10a\n")
|
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
|
(setenv (car kt) (cadr kt)))
key-vals))
(read-config "runconfigs.config" #f #t sections: sections))))
data))
(if (args:get-arg "-show-runconfig")
(let ((data (full-runconfigs-read)))
;; keep this one local
(cond
((not (args:get-arg "-dumpmode"))
(pp (hash-table->alist data)))
((string=? (args:get-arg "-dumpmode") "json")
(json-write data))
(else
(debug:print 0 "ERROR: -dumpmode of " (args:get-arg "-dumpmode") " not recognised")))
(set! *didsomething* #t)))
(if (args:get-arg "-show-config")
(let ((tl (setup-for-run))
(data *configdat*)) ;; (read-config "megatest.config" #f #t)))
;; keep this one local
(cond
((not (args:get-arg "-dumpmode"))
(pp (hash-table->alist data)))
((string=? (args:get-arg "-dumpmode") "json")
(json-write data))
(else
(debug:print 0 "ERROR: -dumpmode of " (args:get-arg "-dumpmode") " not recognised")))
(set! *didsomething* #t)))
(if (args:get-arg "-show-cmdinfo")
(if (getenv "MT_CMDINFO")
(let ((data (read (open-input-string (base64:base64-decode (getenv "MT_CMDINFO"))))))
(if (equal? (args:get-arg "-dumpmode") "json")
(json-write data)
(pp data))
|
>
>
|
|
|
|
|
|
|
|
|
>
>
|
>
|
465
466
467
468
469
470
471
472
473
474
475
476
477
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
|
(setenv (car kt) (cadr kt)))
key-vals))
(read-config "runconfigs.config" #f #t sections: sections))))
data))
(if (args:get-arg "-show-runconfig")
(let ((tl (setup-for-run)))
(push-directory *toppath*)
(let ((data (full-runconfigs-read)))
;; keep this one local
(cond
((not (args:get-arg "-dumpmode"))
(pp (hash-table->alist data)))
((string=? (args:get-arg "-dumpmode") "json")
(json-write data))
(else
(debug:print 0 "ERROR: -dumpmode of " (args:get-arg "-dumpmode") " not recognised")))
(set! *didsomething* #t))
(pop-directory)))
(if (args:get-arg "-show-config")
(let ((tl (setup-for-run))
(data *configdat*)) ;; (read-config "megatest.config" #f #t)))
(push-directory *toppath*)
;; keep this one local
(cond
((not (args:get-arg "-dumpmode"))
(pp (hash-table->alist data)))
((string=? (args:get-arg "-dumpmode") "json")
(json-write data))
(else
(debug:print 0 "ERROR: -dumpmode of " (args:get-arg "-dumpmode") " not recognised")))
(set! *didsomething* #t)
(pop-directory)))
(if (args:get-arg "-show-cmdinfo")
(if (getenv "MT_CMDINFO")
(let ((data (read (open-input-string (base64:base64-decode (getenv "MT_CMDINFO"))))))
(if (equal? (args:get-arg "-dumpmode") "json")
(json-write data)
(pp data))
|
564
565
566
567
568
569
570
571
572
573
574
575
576
577
|
(if (args:get-arg "-set-state-status")
(general-run-call
"-set-state-status"
"set state and status"
(lambda (target runname keys keyvals)
(operate-on 'set-state-status))))
;;======================================================================
;; Query runs
;;======================================================================
(if (or (args:get-arg "-list-runs")
(args:get-arg "-list-db-targets"))
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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
|
(if (args:get-arg "-set-state-status")
(general-run-call
"-set-state-status"
"set state and status"
(lambda (target runname keys keyvals)
(operate-on 'set-state-status))))
(if (or (args:get-arg "-set-run-status")
(args:get-arg "-get-run-status"))
(general-run-call
"-set-run-status"
"set run status"
(lambda (target runname keys keyvals)
(let* ((runsdat (cdb:remote-run db:get-runs-by-patt #f keys runname (or (args:get-arg "-target")
(args:get-arg "-reqtarg")) #f #f))
(header (vector-ref runsdat 0))
(rows (vector-ref runsdat 1)))
(if (null? rows)
(begin
(debug:print-info 0 "No matching run found.")
(exit 1))
(let* ((row (car (vector-ref runsdat 1)))
(run-id (db:get-value-by-header row header "id")))
(if (args:get-arg "-set-run-status")
(cdb:remote-run db:set-run-status #f run-id (args:get-arg "-set-run-status"))
(print (open-run-close db:get-run-status #f run-id))
)))))))
;;======================================================================
;; Query runs
;;======================================================================
(if (or (args:get-arg "-list-runs")
(args:get-arg "-list-db-targets"))
|