Skip to content

Commit 1e4df67

Browse files
author
matt
committed
Add trimming of tests from launch list to cut down on irrelevant queries and speed up launching
1 parent cceb7c3 commit 1e4df67

File tree

3 files changed

+66
-14
lines changed

3 files changed

+66
-14
lines changed

runs.scm

+24-12
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@
209209
(if (not (null? test-names))
210210
(let loop ((hed (car test-names))
211211
(tal (cdr test-names))) ;; 'return-procs tells the config reader to prep running system but return a proc
212-
(let* ((config (test:get-testconfig hed 'return-procs))
212+
(let* ((config (tests:get-testconfig hed 'return-procs))
213213
(waitons (string-split (let ((w (config-lookup config "requirements" "waiton")))
214214
(if w w "")))))
215215
;; (items (items:get-items-from-config config)))
@@ -244,7 +244,7 @@
244244
(items:get-items-from-config config))
245245
(else #f))) ;; not iterated
246246
#f ;; itemsdat 5
247-
;; #f ;; spare
247+
#f ;; spare - used for item-path
248248
)))
249249
(for-each
250250
(lambda (waiton)
@@ -264,6 +264,7 @@
264264
(if *rpc:listener* (server:keep-running db))
265265
(debug:print 4 "INFO: All done by here")))
266266

267+
;; test-records is a hash table testname:item_path => vector < testname testconfig waitons priority items-info ... >
267268
(define (runs:run-tests-queue db run-id runname test-records keyvallst flags)
268269
;; At this point the list of parent tests is expanded
269270
;; NB// Should expand items here and then insert into the run queue.
@@ -277,7 +278,7 @@
277278
(tconfig (tests:testqueue-get-testconfig test-record))
278279
(waitons (tests:testqueue-get-waitons test-record))
279280
(priority (tests:testqueue-get-priority test-record))
280-
(itemdat (tests:testqueue-get-itemdat test-record))
281+
(itemdat (tests:testqueue-get-itemdat test-record)) ;; itemdat can be a string, list or #f
281282
(items (tests:testqueue-get-items test-record))
282283
(item-path (item-list->path itemdat)))
283284
(debug:print 6
@@ -297,7 +298,7 @@
297298
;; else the run is stuck, temporarily or permanently
298299
(let ((newtal (append tal (list hed))))
299300
;; couldn't run, take a breather
300-
(thread-sleep! 4)
301+
(thread-sleep! 0.5)
301302
(loop (car newtal)(cdr newtal))))))
302303

303304
;; case where an items came in as a list been processed
@@ -314,6 +315,9 @@
314315
(vector-copy! test-record newrec)
315316
newrec))
316317
(my-item-path (item-list->path my-itemdat))
318+
319+
;; 3/25/2012 - this match is *always* returning true I believe. Or is it the tests that are not being handled?
320+
;;
317321
(item-matches (if item-patts ;; here we are filtering for matches with -itempatt
318322
(let ((res #f)) ;; look through all the item-patts if defined, format is patt1,patt2,patt3 ... wildcard is %
319323
(for-each
@@ -326,9 +330,10 @@
326330
res)
327331
#t)))
328332
(if item-matches ;; yes, we want to process this item
329-
(let ((newtestname (conc hed "/" my-item-path)))
330-
(tests:testqueue-set-items! new-test-record #f)
331-
(tests:testqueue-set-itemdat! new-test-record my-itemdat)
333+
(let ((newtestname (conc hed "/" my-item-path))) ;; test names are unique on testname/item-path
334+
(tests:testqueue-set-items! new-test-record #f)
335+
(tests:testqueue-set-itemdat! new-test-record my-itemdat)
336+
(tests:testqueue-set-item_path! new-test-record my-item-path)
332337
(hash-table-set! test-records newtestname new-test-record)
333338
(set! tal (cons newtestname tal)))))) ;; since these are itemized create new test names testname/itempath
334339
items)
@@ -353,7 +358,7 @@
353358
(exit 1)))))
354359
(let ((newtal (append tal (list hed))))
355360
;; if can't run more tests, lets take a breather
356-
(thread-sleep! 1)
361+
(thread-sleep! 0.5)
357362
(loop (car newtal)(cdr newtal)))))
358363

359364
;; this case should not happen, added to help catch any bugs
@@ -366,9 +371,16 @@
366371
(begin
367372
;; FIXME!!!! THIS SHOULD NOT REQUIRE AN EXIT!!!!!!!
368373
(debug:print 1 "INFO: All tests launched")
369-
;; (exit 0)
370-
)
371-
(loop (car tal)(cdr tal))))))
374+
(thread-sleep! 0.5)
375+
;; FIXME! This harsh exit should not be necessary....
376+
(if (not *runremote*)(exit)) ;;
377+
#f) ;; return a #f as a hint that we are done
378+
;; Here we need to check that all the tests remaining to be run are eligible to run
379+
;; and are not blocked by failed
380+
(let ((newlst (tests:filter-non-runnable db run-id tal test-records))) ;; i.e. not FAIL, WAIVED, INCOMPLETE, PASS, KILLED,
381+
(thread-sleep! 0.5)
382+
(if (not (null? newlst))
383+
(loop (car newlst)(cdr newlst))))))))
372384

373385
;; parent-test is there as a placeholder for when parent-tests can be run as a setup step
374386
(define (run:test db run-id runname keyvallst test-record flags parent-test)
@@ -377,7 +389,7 @@
377389
(test-waitons (tests:testqueue-get-waitons test-record))
378390
(test-conf (tests:testqueue-get-testconfig test-record))
379391
(itemdat (tests:testqueue-get-itemdat test-record))
380-
(test-path (conc *toppath* "/tests/" test-name)) ;; could use test:get-testconfig here ...
392+
(test-path (conc *toppath* "/tests/" test-name)) ;; could use tests:get-testconfig here ...
381393
(force (hash-table-ref/default flags "-force" #f))
382394
(rerun (hash-table-ref/default flags "-rerun" #f))
383395
(keepgoing (hash-table-ref/default flags "-keepgoing" #f))

test_records.scm

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
;; make-vector-record tests testqueue testname testconfig waitons priority items
2-
(define (make-tests:testqueue)(make-vector 6 #f))
2+
(define (make-tests:testqueue)(make-vector 7 #f))
33
(define-inline (tests:testqueue-get-testname vec) (vector-ref vec 0))
44
(define-inline (tests:testqueue-get-testconfig vec) (vector-ref vec 1))
55
(define-inline (tests:testqueue-get-waitons vec) (vector-ref vec 2))
66
(define-inline (tests:testqueue-get-priority vec) (vector-ref vec 3))
77
;; items: #f=no items, list=list of items remaining, proc=need to call to get items
88
(define-inline (tests:testqueue-get-items vec) (vector-ref vec 4))
99
(define-inline (tests:testqueue-get-itemdat vec) (vector-ref vec 5))
10+
(define-inline (tests:testqueue-get-item_path vec) (vector-ref vec 6))
1011

1112
(define-inline (tests:testqueue-set-testname! vec val)(vector-set! vec 0 val))
1213
(define-inline (tests:testqueue-set-testconfig! vec val)(vector-set! vec 1 val))
1314
(define-inline (tests:testqueue-set-waitons! vec val)(vector-set! vec 2 val))
1415
(define-inline (tests:testqueue-set-priority! vec val)(vector-set! vec 3 val))
1516
(define-inline (tests:testqueue-set-items! vec val)(vector-set! vec 4 val))
1617
(define-inline (tests:testqueue-set-itemdat! vec val)(vector-set! vec 5 val))
18+
(define-inline (tests:testqueue-set-item_path! vec val)(vector-set! vec 6 val))
19+

tests.scm

+38-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@
287287
tests)
288288
res))
289289

290-
(define (test:get-testconfig test-name system-allowed)
290+
(define (tests:get-testconfig test-name system-allowed)
291291
(let* ((test-path (conc *toppath* "/tests/" test-name))
292292
(test-configf (conc test-path "/testconfig"))
293293
(testexists (and (file-exists? test-configf)(file-read-access? test-configf))))
@@ -339,6 +339,43 @@
339339
#t ;; if a is a higher priority than b then we are good to go
340340
#f))))))))
341341

342+
;; for each test:
343+
;;
344+
(define (tests:filter-non-runnable db run-id testkeynames testrecordshash)
345+
(let ((runnables '()))
346+
(for-each
347+
(lambda (testkeyname)
348+
(let* ((test-record (hash-table-ref testrecordshash testkeyname))
349+
(test-name (tests:testqueue-get-testname test-record))
350+
(itemdat (tests:testqueue-get-itemdat test-record))
351+
(item-path (tests:testqueue-get-item_path test-record))
352+
(waitons (tests:testqueue-get-waitons test-record))
353+
(keep-test #t)
354+
(tdat (db:get-test-info db run-id test-name item-path)))
355+
(if tdat
356+
(begin
357+
;; Look at the test state and status
358+
(if (or (member (db:test-get-status tdat)
359+
'("PASS" "WARN" "WAIVED" "CHECK"))
360+
(member (db:test-get-state tdat)
361+
'("INCOMPLETE" "KILLED")))
362+
(set! keep-test #f))
363+
364+
;; examine waitons for any fails. If it is FAIL or INCOMPLETE then eliminate this test
365+
;; from the runnable list
366+
(if keep-test
367+
(for-each (lambda (waiton)
368+
;; for now we are waiting only on the parent test
369+
(let ((wtdat (db:get-test-info db run-id waiton "")))
370+
(if (or (member (db:test-get-status wtdat)
371+
'("FAIL" "KILLED"))
372+
(member (db:test-get-state wtdat)
373+
'("INCOMPETE")))
374+
(set! keep-test #f)))) ;; no point in running this one again
375+
waitons))))
376+
(if keep-test (set! runnables (cons testkeyname runnables)))))
377+
testkeynames)
378+
runnables))
342379

343380
;;======================================================================
344381
;; test steps

0 commit comments

Comments
 (0)