Index: dashboard-tests.scm ================================================================== --- dashboard-tests.scm +++ dashboard-tests.scm @@ -329,12 +329,12 @@ #:title "Test Steps" (let ((stepsdat ;;(iup:label "Test steps ........................................." ;; #:expand "YES" ;; #:size "200x150" ;; #:alignment "ALEFT:ATOP"))) - (iup:textbox #:action (lambda (obj char val) - #f) + (iup:textbox ;; #:action (lambda (obj char val) + ;; #f) #:expand "YES" #:multiline "YES" #:font "Courier New, -10" #:size "100x150"))) (hash-table-set! widgets "Test Steps" @@ -368,12 +368,12 @@ stepsdat)) ;; populate the Test Data panel (iup:frame #:title "Test Data" (let ((test-data - (iup:textbox #:action (lambda (obj char val) - #f) + (iup:textbox ;; #:action (lambda (obj char val) + ;; #f) #:expand "YES" #:multiline "YES" #:font "Courier New, -10" #:size "100x150"))) (hash-table-set! widgets "Test Data" Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -143,11 +143,12 @@ ((not mver) (print "Adding megatest-version to metadata") ;; Need to recreate the table (sqlite3:execute db "DROP TABLE IF EXISTS metadat;") (sqlite3:execute db "CREATE TABLE IF NOT EXISTS metadat (id INTEGER, var TEXT, val TEXT, CONSTRAINT metadat_constraint UNIQUE (var));") - (db:set-var db "MEGATEST_VERSION" 1.17)) + (db:set-var db "MEGATEST_VERSION" 1.17) + (patch-db)) ((< mver 1.21) (sqlite3:execute db "DROP TABLE IF EXISTS metadat;") (sqlite3:execute db "CREATE TABLE IF NOT EXISTS metadat (id INTEGER, var TEXT, val TEXT, CONSTRAINT metadat_constraint UNIQUE (var));") (db:set-var db "MEGATEST_VERSION" 1.21) ;; set before, just in case the changes are already applied @@ -156,11 +157,12 @@ (lambda (stmt) (sqlite3:execute db stmt)) (list "ALTER TABLE tests ADD COLUMN first_err TEXT;" "ALTER TABLE tests ADD COLUMN first_warn TEXT;" - ))) + )) + (patch-db)) ((< mver 1.24) (db:set-var db "MEGATEST_VERSION" 1.24) (sqlite3:execute db "DROP TABLE IF EXISTS test_data;") (sqlite3:execute db "DROP TABLE IF EXISTS test_meta;") (sqlite3:execute db test-meta-def) @@ -172,11 +174,12 @@ expected REAL, tol REAL, units TEXT, comment TEXT DEFAULT '', status TEXT DEFAULT 'n/a', - CONSTRAINT test_data UNIQUE (test_id,category,variable));")) + CONSTRAINT test_data UNIQUE (test_id,category,variable));") + (patch-db)) ((< mver megatest-version) (db:set-var db "MEGATEST_VERSION" megatest-version)))))) ;;====================================================================== ;; meta get and set vars @@ -557,11 +560,11 @@ ;; get a list of test_data records matching categorypatt (define (db:read-test-data db test-id categorypatt) (let ((res '())) (sqlite3:for-each-row (lambda (id test_id category variable value expected tol units comment status) - (set! res (cons res (vector id test_id category variable value expected tol units comment status)))) + (set! res (cons (vector id test_id category variable value expected tol units comment status) res))) db "SELECT id,test_id,category,variable,value,expected,tol,units,comment,status FROM test_data WHERE test_id=? AND category LIKE ? ORDER BY category,variable;" test-id categorypatt) (reverse res))) (define (db:load-test-data db run-id test-name itemdat) @@ -741,11 +744,12 @@ (keyqry (string-intersperse (map (lambda (p)(conc (car p) " like ? ")) keypatt-alist) " AND ")) (test-ids '()) (tempdir (conc "/tmp/" (current-user-name) "/" runspatt "_" (random 10000) "_" (current-process-id))) (runsheader (append (list "Runname") (map car keypatt-alist) - (list "Testname" + (list "Run Id" + "Testname" "Description" "Item Path" "State" "Status" "Final Log" @@ -762,24 +766,24 @@ "Iterated" "Diskfree" "Uname" "Rundir" "Host" - "Cpu Load" - "Run Id"))) - (results (list runsheader))) + "Cpu Load"))) + (results (list runsheader)) + (testdata-header (list "Run Id" "Testname" "Item Path" "Category" "Variable" "Value" "Expected" "Tol" "Units" "Status" "Comment"))) (debug:print 2 "Using " tempdir " for constructing the ods file") ;; "Expected Value" ;; "Value Found" ;; "Tolerance" (apply sqlite3:for-each-row (lambda (test-id . b) - (set! test-ids (cons test-id test-ids)) + (set! test-ids (cons test-id test-ids)) ;; test-id is now testname (set! results (append results (list b)))) ;; note, drop the test-id db (conc "SELECT - t.id,runname," keysstr ",t.testname,description, + t.testname,r.id,runname," keysstr ",t.testname,description, item_path,t.state,t.status, final_logf,run_duration, strftime('%m/%d/%Y %H:%M:%S',datetime(t.event_time,'unixepoch'),'localtime') first_err,first_warn,tm.tags,r.owner,t.comment, author, @@ -791,23 +795,24 @@ runspatt (map cadr keypatt-alist)) (set! results (list (cons "Runs" results))) ;; now, for each test, collect the test_data info and add a new sheet (for-each (lambda (test-id) - (let ((test-data '()) + (let ((test-data (list testdata-header)) (curr-test-name #f)) (sqlite3:for-each-row - (lambda (testname item_path category variable value comment status) + (lambda (run-id testname item-path category variable value expected tol units status comment) (set! curr-test-name testname) - (set! test-data (append test-data (list (list testname item_path category variable value comment status))))) + (set! test-data (append test-data (list (list run-id testname item-path category variable value expected tol units status comment))))) db - "SELECT testname,item_path,category,variable,td.value AS value,expected,tol,units,td.comment AS comment,td.status AS status FROM test_data AS td INNER JOIN tests ON tests.id=td.test_id WHERE test_id=?;" + ;; "SELECT run_id,testname,item_path,category,variable,td.value AS value,expected,tol,units,td.status AS status,td.comment AS comment FROM test_data AS td INNER JOIN tests ON tests.id=td.test_id WHERE test_id=?;" + "SELECT run_id,testname,item_path,category,variable,td.value AS value,expected,tol,units,td.status AS status,td.comment AS comment FROM test_data AS td INNER JOIN tests ON tests.id=td.test_id WHERE testname=?;" test-id) (if curr-test-name (set! results (append results (list (cons curr-test-name test-data))))) )) - test-ids) + (delete-duplicates test-ids)) (system (conc "mkdir -p " tempdir)) ;; (pp results) (ods:list->ods tempdir (if (string-match (regexp "^[/~]+.*") outputfile) ;; full path?