Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -171,18 +171,20 @@ (define-inline (db:test-get-item-path vec) (vector-ref vec 11)) (define-inline (db:test-get-run_duration vec) (vector-ref vec 12)) (define-inline (db:test-get-final_logf vec) (vector-ref vec 13)) (define-inline (db:test-get-comment vec) (vector-ref vec 14)) -(define (db-get-tests-for-run db run-id) - (let ((res '())) +(define (db-get-tests-for-run db run-id . params) + (let ((res '()) + (testpatt (if (or (null? params)(not (car params))) "%" (car params))) + (itempatt (if (> (length params) 1)(cadr params) "%"))) (sqlite3:for-each-row (lambda (id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration final-logf comment) (set! res (cons (vector id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration final-logf comment) res))) db - "SELECT id,run_id,testname,state,status,event_time,host,cpuload,diskfree,uname,rundir,item_path,run_duration,final_logf,comment FROM tests WHERE run_id=? ORDER BY id DESC;" - run-id) + "SELECT id,run_id,testname,state,status,event_time,host,cpuload,diskfree,uname,rundir,item_path,run_duration,final_logf,comment FROM tests WHERE run_id=? AND testname like ? AND item_path LIKE ? ORDER BY id DESC;" + run-id testpatt (if itempatt itempatt "%")) res)) (define (db:delete-test-step-records db run-id test-name) (sqlite3:execute db "DELETE FROM test_steps WHERE test_id in (SELECT id FROM tests WHERE run_id=? AND testname=?);" run-id test-name)) Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -9,11 +9,11 @@ (include "common.scm") (define megatest-version 1.01) (define help (conc " -Megatest, documentation at http://www.kiatoa.com/fossils/opensrc +Megatest, documentation at http://www.kiatoa.com/fossils/megatest version " megatest-version " license GPL, Copyright Matt Welland 2006-2011 Usage: megatest [options] -h : this help @@ -37,10 +37,12 @@ :state : required if updating step state; e.g. start, end, completed :status : required if updating step status; e.g. pass, fail, n/a 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 Misc -force : override some checks -xterm : start an xterm instead of launching the test @@ -67,10 +69,12 @@ ":item" ":runname" ":state" ":status" "-list-runs" + "-testpatt" + "-itempatt" "-setlog" "-runstep" "-logpro" "-remove-run" ) @@ -109,10 +113,12 @@ (if (args:get-arg "-list-runs") (let* ((db (begin (setup-for-run) (open-db))) (runpatt (args:get-arg "-list-runs")) + (testpatt (args:get-arg "-testpatt")) + (itempatt (args:get-arg "-itempatt")) (runsdat (db-get-runs db runpatt)) (runs (db:get-rows runsdat)) (header (db:get-header runsdat)) (keys (db-get-keys db)) (keynames (map key:get-fieldname keys))) @@ -124,11 +130,11 @@ (db-get-value-by-header run header x)) keynames) "/") "/" (db-get-value-by-header run header "runname")) (let ((run-id (db-get-value-by-header run header "id"))) - (let ((tests (db-get-tests-for-run db run-id))) + (let ((tests (db-get-tests-for-run db run-id testpatt itempatt))) ;; Each test (for-each (lambda (test) (format #t " Test: ~25a State: ~15a Status: ~15a Runtime: ~5@as Time: ~22a Host: ~10a\n"