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
|
(let ((step-id (get-step-id dbconn test-id step-name)))
(rmt:step-set-state-status dbconn step-id "START" -1)
(thread-sleep! *stepdelay*)
(rmt:step-set-state-status dbconn step-id "END" 0)
(print" STEP: " step-name " done.")))
(if (< step-num *numsteps*)
(loop (+ step-num 1))))
(rmt:test-set-state-status dbconn test-id "COMPLETED" (if (> (random 10) 2) "PASS" "FAIL"))
(print "TEST: " test-name " done.")
test-id))
;; RUN A RUN
(define (run-run dbconn target run-name num-tests)
(rmt:create-run dbconn target run-name)
(let ((run-id (rmt:get-run-id dbconn target run-name)))
(let loop ((test-num 0))
(system (conc "NBFAKE_LOG=test-" test-num "-run-id-" run-id ".log NBFAKE_HOST=" *remotehost* " nbfake minimt runtest " run-id " test-" test-num))
(if (< test-num num-tests)
(loop (+ test-num 1))))))
;; Do what is asked
(let ((args (cdr (argv))))
(if (< (length args) 1)
(print
"Usage: minimt [options]" "
runtest run-id testname
runrun target runname")
(let ((cmd (car args))
(dbconn (rmt:open-create-db *homepath* "mt.db" init-db)))
(change-directory *homepath*)
(case (string->symbol cmd)
((runtest)
(let ((run-id (string->number (cadr args)))
(test-name (caddr args)))
(print "Launching test " test-name " for run-id " run-id)
(run-test dbconn run-id test-name)))
|
>
>
>
>
>
|
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
|
(let ((step-id (get-step-id dbconn test-id step-name)))
(rmt:step-set-state-status dbconn step-id "START" -1)
(thread-sleep! *stepdelay*)
(rmt:step-set-state-status dbconn step-id "END" 0)
(print" STEP: " step-name " done.")))
(if (< step-num *numsteps*)
(loop (+ step-num 1))))
;; we will do a large but bogus read to simulate the logic in Megatest
(rmt:test-get-tests dbconn `(,run-id) "%")
(rmt:test-set-state-status dbconn test-id "COMPLETED" (if (> (random 10) 2) "PASS" "FAIL"))
(print "TEST: " test-name " done.")
(print "Stats:")
(print-stats *stats*)
test-id))
;; RUN A RUN
(define (run-run dbconn target run-name num-tests)
(rmt:create-run dbconn target run-name)
(let ((run-id (rmt:get-run-id dbconn target run-name)))
(let loop ((test-num 0))
(system (conc "NBFAKE_LOG=test-" test-num "-run-id-" run-id ".log NBFAKE_HOST=" *remotehost* " nbfake minimt runtest " run-id " test-" test-num))
(if (< test-num num-tests)
(loop (+ test-num 1))))))
;; Do what is asked
(let ((args (cdr (argv))))
(if (< (length args) 1)
(print
"Usage: minimt [options]" "
runtest run-id testname
runrun target runname")
(let ((cmd (car args))
(dbconn (rmt:open-create-db *homepath* "mt.db" init-db)))
(thread-sleep! 0.5) ;; be sure the db is written out to disk? Should really not be needed.
(change-directory *homepath*)
(case (string->symbol cmd)
((runtest)
(let ((run-id (string->number (cadr args)))
(test-name (caddr args)))
(print "Launching test " test-name " for run-id " run-id)
(run-test dbconn run-id test-name)))
|
70
71
72
73
74
75
76
77
78
79
|
(lambda (target)
(let loop ((run-num 0))
(thread-sleep! *rundelay*)
(system (conc "NBFAKE_LOG=run-" target "-" run-num ".log nbfake minimt runrun " target " run-" run-num))
(if (< run-num *numruns*)
(loop (+ run-num 1)))))
*targets*))
(else
(print "Command: " cmd " not recognised. Run without params to see help.")))
(close-database (dbconn-dat-dbh dbconn)))))
|
>
>
|
75
76
77
78
79
80
81
82
83
84
85
86
|
(lambda (target)
(let loop ((run-num 0))
(thread-sleep! *rundelay*)
(system (conc "NBFAKE_LOG=run-" target "-" run-num ".log nbfake minimt runrun " target " run-" run-num))
(if (< run-num *numruns*)
(loop (+ run-num 1)))))
*targets*))
((server)
(start-server dbconn))
(else
(print "Command: " cmd " not recognised. Run without params to see help.")))
(close-database (dbconn-dat-dbh dbconn)))))
|