Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -1,26 +1,32 @@ -# $(glob *.scm) did not work as I expected it to!? + +PREFIX=. FILES=$(shell ls *.scm) +HELPERS=$(addprefix $(PREFIX)/bin/,mt_laststep mt_runstep) megatest: $(FILES) csc megatest.scm dashboard: $(FILES) csc dashboard.scm $(PREFIX)/bin/megatest : megatest @echo Installing to PREFIX=$(PREFIX), use ^C to cancel and change - sleep 5 + sleep 2 cp megatest $(PREFIX)/bin/megatest - cp utils/mt_* $(PREFIX)/bin - chmod a+x $(PREFIX)/bin/mt_* + +$(HELPERS) : utils/mt_* + cp $< $@ + chmod a+x $@ # install dashboard as dboard so wrapper script can be called dashboard $(PREFIX)/bin/dboard : dashboard $(FILES) cp dashboard $(PREFIX)/bin/dboard + utils/mk_dashboard_wrapper $(PREFIX) > $(PREFIX)/bin/dashboard + chmod a+x $(PREFIX)/bin/dashboard -install : $(PREFIX)/bin/megatest $(PREFIX)/bin/dboard +install : $(PREFIX)/bin/megatest $(PREFIX)/bin/dboard $(PREFIX)/bin/dashboard $(HELPERS) test: tests/tests.scm cd tests;csi -I .. -b -n tests.scm Index: dashboard-tests.scm ================================================================== --- dashboard-tests.scm +++ dashboard-tests.scm @@ -187,11 +187,11 @@ #:expand "YES")) (apply iup:hbox (iup:label "STATE:" #:size "30x") (let* ((btns (map (lambda (state) (let ((btn (iup:button state - #:expand "YES" #:size "70x" + #:expand "YES" #:size "50x" #:font "Courier New, -10" #:action (lambda (x) (db:test-set-state-status-by-id *db* test-id state #f #f) (db:test-set-state! testdat state))))) btn)) (list "COMPLETED" "NOT_STARTED" "RUNNING" "REMOTEHOSTSTART" "KILLED" "KILLREQ")))) @@ -207,11 +207,11 @@ btns)) (apply iup:hbox (iup:label "STATUS:" #:size "30x") (let* ((btns (map (lambda (status) (let ((btn (iup:button status - #:expand "YES" #:size "70x" + #:expand "YES" #:size "50x" #:font "Courier New, -10" #:action (lambda (x) (db:test-set-state-status-by-id *db* test-id #f status #f) (db:test-set-status! testdat status))))) btn)) (list "PASS" "WARN" "FAIL" "CHECK" "n/a" "WAIVED")))) @@ -346,15 +346,15 @@ (host-info-panel testdat store-label) ;; The controls (iup:frame #:title "Actions" (iup:vbox (iup:hbox - (iup:button "View Log" #:action viewlog #:size "120x") - (iup:button "Start Xterm" #:action xterm #:size "120x") - (iup:button "Run Test" #:action run-test #:size "120x") - (iup:button "Clean Test" #:action remove-test #:size "120x") - (iup:button "Close" #:action (lambda (x)(exit)) #:size "120x")) + (iup:button "View Log" #:action viewlog #:size "80x") + (iup:button "Start Xterm" #:action xterm #:size "80x") + (iup:button "Run Test" #:action run-test #:size "80x") + (iup:button "Clean Test" #:action remove-test #:size "80x") + (iup:button "Close" #:action (lambda (x)(exit)) #:size "80x")) (apply iup:hbox (list command-text-box command-launch-button)))) (set-fields-panel test-id testdat) (iup:hbox @@ -367,11 +367,11 @@ (iup:textbox ;; #:action (lambda (obj char val) ;; #f) #:expand "YES" #:multiline "YES" #:font "Courier New, -10" - #:size "100x150"))) + #:size "60x100"))) (hash-table-set! widgets "Test Steps" (lambda (testdat) (let* ((currval (iup:attribute stepsdat "VALUE")) ;; "TITLE")) (fmtstr "~20a~10a~10a~12a~15a") (comprsteps (db:get-steps-table db test-id)) @@ -408,11 +408,11 @@ (iup:textbox ;; #:action (lambda (obj char val) ;; #f) #:expand "YES" #:multiline "YES" #:font "Courier New, -10" - #:size "100x150"))) + #:size "100x100"))) (hash-table-set! widgets "Test Data" (lambda (testdat) ;; (let* ((currval (iup:attribute test-data "VALUE")) ;; "TITLE")) (fmtstr "~10a~10a~10a~10a~7a~7a~6a~a") ;; category,variable,value,expected,tol,units,comment (newval (string-intersperse Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -532,32 +532,40 @@ (if (and (string? s)(or (string-match (regexp "^\\s*$") s) (string-match (regexp "^n/a$") s))) #f s)))) ;; if specified on the input then use, else calculate ;; look up expected,tol,units from previous best fit test if they are all either #f or '' - (debug:print 4 "category: " category ", variable: " variable ", value: " value - ", expected: " expected ", tol: " tol ", units: " units ", status: " status ", comment: " comment) + (debug:print 4 "BEFORE: category: " category " variable: " variable " value: " value + ", expected: " expected " tol: " tol " units: " units " status: " status " comment: " comment) + (if (and (or (not expected)(equal? expected "")) (or (not tol) (equal? expected "")) (or (not units) (equal? expected ""))) (let-values (((new-expected new-tol new-units)(db:get-prev-tol-for-test db test-id category variable))) (set! expected new-expected) (set! tol new-tol) (set! units new-units))) + + (debug:print 4 "AFTER: category: " category " variable: " variable " value: " value + ", expected: " expected " tol: " tol " units: " units " status: " status " comment: " comment) ;; calculate status if NOT specified (if (and (not status)(number? expected)(number? value)) ;; need expected and value to be numbers (if (number? tol) ;; if tol is a number then we do the standard comparison - (let ((max-val (+ expected tol)) - (min-val (- expected tol))) - (set! status (if (and (>= value min-val)(<= value max-val)) "pass" "fail"))) + (let* ((max-val (+ expected tol)) + (min-val (- expected tol)) + (result (and (>= value min-val)(<= value max-val)))) + (debug:print 4 "max-val: " max-val " min-val: " min-val " result: " result) + (set! status (if result "pass" "fail"))) (set! status ;; NB// need to assess each one (i.e. not return operator since need to act if not valid op. (case (string->symbol tol) ;; tol should be >, <, >=, <= ((>) (if (> value expected) "pass" "fail")) ((<) (if (< value expected) "pass" "fail")) ((>=) (if (>= value expected) "pass" "fail")) ((<=) (if (<= value expected) "pass" "fail")) (else (conc "ERROR: bad tol comparator " tol)))))) + (debug:print 4 "AFTER2: category: " category " variable: " variable " value: " value + ", expected: " expected " tol: " tol " units: " units " status: " status " comment: " comment) (sqlite3:execute db "INSERT OR REPLACE INTO test_data (test_id,category,variable,value,expected,tol,units,comment,status) VALUES (?,?,?,?,?,?,?,?,?);" test-id category variable value expected tol units (if comment comment "") status))) csvlist))) ;; get a list of test_data records matching categorypatt ADDED utils/mk_dashboard_wrapper Index: utils/mk_dashboard_wrapper ================================================================== --- /dev/null +++ utils/mk_dashboard_wrapper @@ -0,0 +1,11 @@ +#!/bin/bash + +prefix=$1 +echo "#!/bin/bash" +if [ $LD_LIBRARY_PATH != "" ];then + echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH" +fi + +dboard=`realpath $prefix/bin/dboard` + +echo "$dboard \$*" Index: utils/mt_laststep ================================================================== --- utils/mt_laststep +++ utils/mt_laststep @@ -1,6 +1,11 @@ #!/bin/bash + +if [ $MT_CMDINFO == "" ];then + echo "ERROR: $0 should be run within a megatest test environment" + exit +fi # Purpose: run a step, record start and end with exit codes, if sucessful # update test status with PASS, else update with FAIL # # Call like this: