Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -428,5 +428,8 @@ arora docs/manual/megatest_manual.html targets: @grep : Makefile | perl -ne '/^([A-Za-z0-9_-]+):/ && print "$$1\n"' + +unit : + cd tests;make unit Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -648,11 +648,11 @@ ;; (define (common:simple-file-lock fname #!key (expire-time 300)) (if (common:file-exists? fname) (if (> (- (current-seconds)(file-modification-time fname)) expire-time) (begin - (delete-file* fname) + (handle-exceptions exn #f (delete-file* fname)) (common:simple-file-lock fname expire-time: expire-time)) #f) (let ((key-string (conc (get-host-name) "-" (current-process-id)))) (with-output-to-file fname (lambda () Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -359,10 +359,14 @@ ;; return #t when all items in waitors-upon list are represented in test-patt, #f otherwise. (define (runs:testpatts-mention-waitors-upon? test-patt waitors-upon) (null? (tests:filter-test-names-not-matched waitors-upon test-patt))) +;;====================================================================== +;; runs:run-tests is called from megatest.scm and itself +;;====================================================================== +;; ;; test-names: Comma separated patterns same as test-patts but used in selection ;; of tests to run. The item portions are not respected. ;; FIXME: error out if /patt specified ;; (define (runs:run-tests target runname test-patts user flags #!key (run-count 1)) ;; test-names @@ -735,10 +739,14 @@ ;; tal - list of never visited tests ;; prefer next hed to be from reg than tal. (define runs:nothing-left-in-queue-count 0) +;;====================================================================== +;; runs:expand-items is called by runs:run-tests-queue +;;====================================================================== +;; ;; return value of runs:expand-items is passed back to runs-tests-queue and is fed to named loop with this signature: ;; (let loop ((hed (car sorted-test-names)) ;; (tal (cdr sorted-test-names)) ;; (reg '()) ;; registered, put these at the head of tal ;; (reruns '())) @@ -1315,10 +1323,14 @@ ;; every time though the loop increment the test/itempatt val. ;; when the min is > max-allowed and none running then force exit ;; (define *max-tries-hash* (make-hash-table)) +;;====================================================================== +;; runs:run-tests-queue is called by runs:run-tests +;;====================================================================== +;; ;; test-records is a hash table testname:item_path => vector < testname testconfig waitons priority items-info ... > (define (runs:run-tests-queue run-id runname test-records keyvals flags test-patts required-tests reglen-in all-tests-registry) ;; At this point the list of parent tests is expanded ;; NB// Should expand items here and then insert into the run queue. (debug:print 5 *default-log-port* "test-records: " test-records ", flags: " (hash-table->alist flags)) @@ -1384,12 +1396,10 @@ (let loop ((hed (car sorted-test-names)) (tal (cdr sorted-test-names)) (reg '()) ;; registered, put these at the head of tal (reruns '())) - - (runs:incremental-print-results run-id) (if (not (null? reruns))(debug:print-info 4 *default-log-port* "reruns=" reruns)) ;; Here we mark any old defunct tests as incomplete. Do this every fifteen minutes Index: tests/Makefile ================================================================== --- tests/Makefile +++ tests/Makefile @@ -43,10 +43,13 @@ # test1 test2 test3 test4 test5 test6 test7 test8 test9 unit : all-rmt.log all-api.log # basicserver.log runs.log misc.log tests.log +# inter dependencies on the unit tests, I wish these could be "suggestions" +all-rmt.log : all-api.log + rel : cd release;dashboard -rows 25 & ## basicserver.log : unittests/basicserver.scm ## script -c "./rununittest.sh basicserver $(DEBUG)" basicserver.log @@ -105,11 +108,11 @@ cd fullrun;sleep 5;$(MEGATEST) -preclean -runtests % -target ubuntu/nfs/sleep60 :runname $(RUNNAME)_ac -debug $(DEBUG) $(LOGGING) > ac.log 2> ac.log & cd fullrun;sleep 8;$(MEGATEST) -preclean -runtests % -target ubuntu/nfs/sleep240 :runname $(RUNNAME)_ad -debug $(DEBUG) $(LOGGING) > ad.log 2> ad.log & # cd fullrun;sleep 0;$(MEGATEST) -preclean -runtests % -target $(TARGET) :runname $(RUNNAME)_af -debug $(DEBUG) $(LOGGING) > af.log 2> af.log & # MUST ADD THIS BACK IN ASAP!!!! - # cd fullrun;sleep 10;$(MEGATEST) -run-wait -target $(TARGET) :runname % -testpatt % :state RUNNING,LAUNCHED,NOT_STARTED,REMOTEHOSTSTART;echo ALL DONE +# cd fullrun;sleep 10;$(MEGATEST) -run-wait -target $(TARGET) :runname % -testpatt % :state RUNNING,LAUNCHED,NOT_STARTED,REMOTEHOSTSTART;echo ALL DONE test6: fullprep cd fullrun;$(MEGATEST) -preclean -runtests runfirst -testpatt %/1 -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_itempatt -v cd fullrun;$(MEGATEST) -preclean -runtests runfirst -testpatt %blahha% -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_itempatt -debug 10 cd fullrun;$(MEGATEST) -rollup :runname newrun -target ubuntu/nfs/none -debug 10 Index: tests/unittests/all-rmt.scm ================================================================== --- tests/unittests/all-rmt.scm +++ tests/unittests/all-rmt.scm @@ -32,14 +32,47 @@ ;; DEF - deferred (print "start dir: " (current-directory)) (define toppath (current-directory)) -(test #f #t (string?(server:start-and-wait *toppath*))) + +(test #f #f (server:check-if-running toppath)) ;; these are used by server:start-and-wait +(test #f #t (list? (server:get-list toppath))) +(test #f '() (server:get-best '())) +(test #f #t (common:simple-file-lock-and-wait "test.lock" expire-time: 15)) +(test #f "test.lock" (common:simple-file-release-lock "test.lock")) +(test #f #t (server:get-best-guess-address (get-host-name))) +(test #f #t (string? (common:get-homehost))) + +;; clean out any old running servers +;; +(let ((servers (server:get-list toppath))) + (print "Known servers: " servers) + (if (not (null? servers)) + (begin + (for-each + (lambda (server) + (let ((pid (list-ref server 4))) + (thread-start! + (make-thread + (lambda () + (print "Attempting to kill server: " server) + (print "Attempting to kill pid " pid) + (system (conc "kill " pid)) + (thread-sleep! 2) + (system (conc "kill -9 " pid))) + (conc pid))))) + servers) + (thread-sleep! 2)))) +;; let's start up a server the mechanical way +(system "nbfake megatest -server -") +(thread-sleep! 2) +;; (test #f #t (string? (server:start-and-wait *toppath*))) (test "setup for run" #t (begin (launch:setup) (string? (getenv "MT_RUN_AREA_HOME")))) +(test #f #t (client:setup-http toppath)) (test #f #t (vector? (client:setup toppath))) (test #f #t (vector? (rmt:get-connection-info toppath))) ;; TODO: push areapath down. (test #f #t (string? (server:check-if-running "."))) ;; DEF (test #f #f (rmt:send-receive-no-auto-client-setup *runremote* 'get-keys #f '()))