Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -480,10 +480,34 @@ (define (db:test-set-rundir! db run-id testname item-path rundir) (sqlite3:execute db "UPDATE tests SET rundir=? WHERE run_id=? AND testname=? AND item_path=?;" rundir run-id testname item-path)) + +;; Misc. test related queries +(define (db:test-get-paths-matching db keyvallst runname keys keynames target) + ;; (print "keyvallst: " keyvallst ", runname: " runname) + ;; (print "keys: " keys " keynames: " keynames) + (let ((res '()) + (itempatt (if (args:get-arg "-itempatt")(args:get-arg "-itempatt") "%")) + (testpatt (if (args:get-arg "-testpatt")(args:get-arg "-testpatt") "%")) + (qrystr (string-intersperse + (map (lambda (key val) + (conc "r." key " like '" val "'")) + keynames + (string-split target "/")) + " AND "))) + ;; (print "qrystr: " qrystr) + (sqlite3:for-each-row + (lambda (p) + (set! res (cons p res))) + db + (conc "SELECT t.rundir FROM tests AS t INNER JOIN runs AS r ON t.run_id=r.id WHERE " + qrystr " AND r.runname LIKE '" runname "' AND item_path LIKE '" itempatt "' AND testname LIKE '" + testpatt "' ORDER BY t.event_time ASC;")) + res)) + ;;====================================================================== ;; Tests meta data ;;====================================================================== Index: launch.scm ================================================================== --- launch.scm +++ launch.scm @@ -217,20 +217,17 @@ " this-step-status: " this-step-status " overall-status: " overall-status " next-status: " next-status " rollup-status: " rollup-status) (case next-status ((warn) (set! rollup-status 2) - ;; (test-set-status! db run-id test-name "COMPLETED" "WARN" itemdat (test-set-status! db run-id test-name "RUNNING" "WARN" itemdat (if (eq? this-step-status 'warn) "Logpro warning found" #f) #f)) ((pass) - ;; (test-set-status! db run-id test-name "COMPLETED" "PASS" itemdat #f #f)) (test-set-status! db run-id test-name "RUNNING" "PASS" itemdat #f #f)) (else ;; 'fail (set! rollup-status 1) ;; force fail - ;; (test-set-status! db run-id test-name "COMPLETED" "FAIL" itemdat (conc "Failed at step " stepname) #f) (test-set-status! db run-id test-name "RUNNING" "FAIL" itemdat (conc "Failed at step " stepname) #f) )))) (if (and (steprun-good? logpro-used (vector-ref exit-info 2)) (not (null? tal))) (loop (car tal) (cdr tal) stepname))) Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -72,19 +72,18 @@ Queries -list-runs patt : list runs matching pattern \"patt\", % is the wildcard -testpatt patt : in list-runs show only these tests, % is the wildcard -itempatt patt : in list-runs show only tests with items that match patt -showkeys : show the keys used in this megatest setup + -test-paths targpatt : get the most recent test path(s) matching targpatt e.g. %/%... + returns list sorted by age ascending, see examples below Misc -force : override some checks - -xterm : start an xterm instead of launching the test -remove-runs : remove the data for a run, requires all fields be specified and :runname ,-testpatt and -itempatt and -testpatt - -keepgoing : continue running until no jobs are \"LAUNCHED\" or - \"NOT_STARTED\" -rerun FAIL,WARN... : re-run if called on a test that previously ran (nullified if -keepgoing is also specified) -rebuild-db : bring the database schema up to date -rollup : fill run (set by :runname) with latest test(s) from prior runs with same keys @@ -97,17 +96,22 @@ -pathmod path : insert path, i.e. path/runame/itempath/logfile.html will clear the field if no rundir/testname/itempath/logfile if it contains forward slashes the path will be converted to windows style -Helpers +Helpers (these only apply in test run mode) -runstep stepname ... : take remaining params as comand and execute as stepname log will be in stepname.log. Best to put command in quotes -logpro file : with -exec apply logpro file to stepname.log, creates stepname.html and sets log to same If using make use stepname_logpro.log as your target +Examples + +# Get test paths +megatest -test-paths -target ubuntu/n%/no% :runname w49% -testpatt test_mt% + Called as " (string-intersperse (argv) " "))) ;; -gui : start a gui interface ;; -config fname : override the runconfig file with fname @@ -158,10 +162,13 @@ "-test-status" "-set-values" "-load-test-data" "-summarize-items" "-gui" + ;; queries + "-test-paths" ;; get path(s) to a test, ordered by youngest first + "-runall" ;; run all tests "-remove-runs" "-keepgoing" "-usequeue" "-rebuild-db" @@ -380,10 +387,25 @@ (runs:rollup-run db keys (keys->alist keys "na") (args:get-arg ":runname") user)))) + +;;====================================================================== +;; Get paths to tests +;;====================================================================== +;; run all tests are are Not COMPLETED and PASS or CHECK +(if (args:get-arg "-test-paths") + (general-run-call + "-test-paths" + "Get paths to tests" + (lambda (db target runname keys keynames keyvallst) + (let* ((itempatt (args:get-arg "-itempatt")) + (paths (db:test-get-paths-matching db keyvallst runname keys keynames target))) + (for-each (lambda (path) + (print path)) + paths))))) ;;====================================================================== ;; Extract a spreadsheet from the runs database ;;======================================================================