Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -497,11 +497,49 @@ #t (begin (debug:print 0 "WARNING: Max running jobs exceeded, current number running: " num-running ", max_concurrent_jobs: " max-concurrent-jobs) #f))))) + +(define (test:get-testconfig test-name system-allowed) + (let* ((test-path (conc *toppath* "/tests/" test-name)) + (test-configf (conc test-path "/testconfig")) + (testexists (and (file-exists? test-configf)(file-read-access? test-configf)))) + (if testexists + (read-config test-configf #f system-allowed) + #f))) +;; sort tests by priority and waiton +;; Move test specific stuff to a test unit FIXME one of these days +(define (tests:sort-by-priority-and-waiton test-names) + (let ((testdetails (make-hash-table)) + (mungepriority (lambda (priority) + (if priority + (let ((tmp (any->number priority))) + (if tmp tmp (begin (debug:print 0 "ERROR: bad priority value " priority ", using 0") 0))) + 0)))) + (for-each (lambda (test-name) + (let ((test-config (test:get-testconfig test-name #f))) + (if test-config (hash-table-set! testdetails test-name test-config)))) + test-names) + (sort + (hash-table-keys testdetails) ;; avoid dealing with deleted tests, look at the hash table + (lambda (a b) + (let* ((tconf-a (hash-table-ref testdetails a)) + (tconf-b (hash-table-ref testdetails b)) + (a-waiton (config-lookup tconf-a "requirements" "waiton")) + (b-waiton (config-lookup tconf-b "requirements" "waiton")) + (a-priority (mungepriority (config-lookup tconf-a "requirements" "priority"))) + (b-priority (mungepriority (config-lookup tconf-b "requirements" "priority")))) + (if (and a-waiton (equal? a-waiton b)) + #f ;; cannot have a which is waiting on b happening before b + (if (and b-waiton (equal? b-waiton a)) + #t ;; this is the correct order, b is waiting on a and b is before a + (if (> a-priority b-priority) + #t ;; if a is a higher priority than b then we are good to go + #f)))))))) + (define (run-tests db test-names) (let* ((keys (db-get-keys db)) (keyvallst (keys->vallist keys #t)) (run-id (register-run db keys)) ;; test-name))) (deferred '())) ;; delay running these since they have a waiton clause @@ -523,11 +561,11 @@ (if (runs:can-run-more-tests db) (run-one-test db run-id test-name keyvallst) ;; add some delay ;(sleep 2) )) - test-names) + (tests:sort-by-priority-and-waiton test-names)) ;; (run-waiting-tests db) (if (args:get-arg "-keepgoing") (let ((estrem (db:estimated-tests-remaining db run-id))) (if (and (> estrem 0) (eq? *globalexitstatus* 0)) @@ -543,11 +581,11 @@ ;; All these vars might be referenced by the testconfig file reader (setenv "MT_TEST_NAME" test-name) ;; (setenv "MT_RUNNAME" (args:get-arg ":runname")) (set-megatest-env-vars db run-id) ;; these may be needed by the launching process (change-directory *toppath*) - (let* ((test-path (conc *toppath* "/tests/" test-name)) + (let* ((test-path (conc *toppath* "/tests/" test-name)) ;; could use test:get-testconfig here ... (test-configf (conc test-path "/testconfig")) (testexists (and (file-exists? test-configf)(file-read-access? test-configf))) (test-conf (if testexists (read-config test-configf #f #t) (make-hash-table))) (waiton (let ((w (config-lookup test-conf "requirements" "waiton"))) (if (string? w)(string-split w)'()))) Index: tests/tests/exit_1/testconfig ================================================================== --- tests/tests/exit_1/testconfig +++ tests/tests/exit_1/testconfig @@ -1,7 +1,10 @@ [setup] runscript main.sh + +[requirements] +priority 9 [test_meta] author matt owner bob description This test checks that a multi-lineitem test with mix of pass and non-fail rolls up a PASS Index: tests/tests/eztest_fail/testconfig ================================================================== --- tests/tests/eztest_fail/testconfig +++ tests/tests/eztest_fail/testconfig @@ -1,6 +1,9 @@ [setup] + +[requirements] +priority 10 [ezsteps] lookittmp ls /tmp lookithome ls /home lookitnada ls /nada ADDED tests/tests/priority_1/testconfig Index: tests/tests/priority_1/testconfig ================================================================== --- /dev/null +++ tests/tests/priority_1/testconfig @@ -0,0 +1,13 @@ +[setup] +runscript main.sh + +[requirements] +priority 1 + +[test_meta] +author matt +owner bob +description This test checks that a multi-lineitem test with mix of pass and non-fail rolls up a PASS + +tags first,single +reviewed 09/10/2011, by Matt ADDED tests/tests/priority_10/testconfig Index: tests/tests/priority_10/testconfig ================================================================== --- /dev/null +++ tests/tests/priority_10/testconfig @@ -0,0 +1,13 @@ +[setup] +runscript main.sh + +[requirements] +priority 10 + +[test_meta] +author matt +owner bob +description This test checks that a multi-lineitem test with mix of pass and non-fail rolls up a PASS + +tags first,single +reviewed 09/10/2011, by Matt ADDED tests/tests/priority_10_waiton_1/testconfig Index: tests/tests/priority_10_waiton_1/testconfig ================================================================== --- /dev/null +++ tests/tests/priority_10_waiton_1/testconfig @@ -0,0 +1,14 @@ +[setup] +runscript main.sh + +[requirements] +priority 10 +waiton priority_1 + +[test_meta] +author matt +owner bob +description This test checks that a multi-lineitem test with mix of pass and non-fail rolls up a PASS + +tags first,single +reviewed 09/10/2011, by Matt ADDED tests/tests/priority_2/testconfig Index: tests/tests/priority_2/testconfig ================================================================== --- /dev/null +++ tests/tests/priority_2/testconfig @@ -0,0 +1,13 @@ +[setup] +runscript main.sh + +[requirements] +priority 2 + +[test_meta] +author matt +owner bob +description This test checks that a multi-lineitem test with mix of pass and non-fail rolls up a PASS + +tags first,single +reviewed 09/10/2011, by Matt ADDED tests/tests/priority_3/testconfig Index: tests/tests/priority_3/testconfig ================================================================== --- /dev/null +++ tests/tests/priority_3/testconfig @@ -0,0 +1,14 @@ +[setup] +runscript main.sh + +[requirements] +priority 3 + + +[test_meta] +author matt +owner bob +description This test checks that a multi-lineitem test with mix of pass and non-fail rolls up a PASS + +tags first,single +reviewed 09/10/2011, by Matt ADDED tests/tests/priority_4/testconfig Index: tests/tests/priority_4/testconfig ================================================================== --- /dev/null +++ tests/tests/priority_4/testconfig @@ -0,0 +1,13 @@ +[setup] +runscript main.sh + +[requirements] +priority 4 + +[test_meta] +author matt +owner bob +description This test checks that a multi-lineitem test with mix of pass and non-fail rolls up a PASS + +tags first,single +reviewed 09/10/2011, by Matt ADDED tests/tests/priority_5/testconfig Index: tests/tests/priority_5/testconfig ================================================================== --- /dev/null +++ tests/tests/priority_5/testconfig @@ -0,0 +1,13 @@ +[setup] +runscript main.sh + +[requirements] +priority 5 + +[test_meta] +author matt +owner bob +description This test checks that a multi-lineitem test with mix of pass and non-fail rolls up a PASS + +tags first,single +reviewed 09/10/2011, by Matt ADDED tests/tests/priority_6/testconfig Index: tests/tests/priority_6/testconfig ================================================================== --- /dev/null +++ tests/tests/priority_6/testconfig @@ -0,0 +1,13 @@ +[setup] +runscript main.sh + +[requirements] +priority 6 + +[test_meta] +author matt +owner bob +description This test checks that a multi-lineitem test with mix of pass and non-fail rolls up a PASS + +tags first,single +reviewed 09/10/2011, by Matt ADDED tests/tests/priority_7/testconfig Index: tests/tests/priority_7/testconfig ================================================================== --- /dev/null +++ tests/tests/priority_7/testconfig @@ -0,0 +1,13 @@ +[setup] +runscript main.sh + +[requirements] +priority 7 + +[test_meta] +author matt +owner bob +description This test checks that a multi-lineitem test with mix of pass and non-fail rolls up a PASS + +tags first,single +reviewed 09/10/2011, by Matt ADDED tests/tests/priority_8/testconfig Index: tests/tests/priority_8/testconfig ================================================================== --- /dev/null +++ tests/tests/priority_8/testconfig @@ -0,0 +1,13 @@ +[setup] +runscript main.sh + +[requirements] +priority 8 + +[test_meta] +author matt +owner bob +description This test checks that a multi-lineitem test with mix of pass and non-fail rolls up a PASS + +tags first,single +reviewed 09/10/2011, by Matt ADDED tests/tests/priority_9/testconfig Index: tests/tests/priority_9/testconfig ================================================================== --- /dev/null +++ tests/tests/priority_9/testconfig @@ -0,0 +1,13 @@ +[setup] +runscript main.sh + +[requirements] +priority 9 + +[test_meta] +author matt +owner bob +description This test checks that a multi-lineitem test with mix of pass and non-fail rolls up a PASS + +tags first,single +reviewed 09/10/2011, by Matt