Overview
Comment: | Basics for test control panel refactored |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | refactor-dashboard |
Files: | files | file ages | folders |
SHA1: |
b3b5a35df9430e6d1df283158ed9ce15 |
User & Date: | mrwellan on 2011-06-26 00:26:25 |
Other Links: | branch diff | manifest | tags |
Context
2011-06-26
| ||
12:46 | Basics for test control panel refactored check-in: ab9ec27636 user: mrwellan tags: refactor-dashboard | |
00:26 | Basics for test control panel refactored check-in: b3b5a35df9 user: mrwellan tags: refactor-dashboard | |
2011-06-25
| ||
20:45 | Basics for test control panel refactored check-in: 4269689842 user: mrwellan tags: refactor-dashboard | |
Changes
Modified dashboard-tests.scm from [85c9231672] to [5af85fd903].
︙ | ︙ | |||
33 34 35 36 37 38 39 | (let ((shell (if (get-environment-variable "SHELL") (conc "-e " (get-environment-variable "SHELL")) ""))) (system (conc "cd " rundir ";xterm -T \"" (string-translate testfullname "()" " ") "\" " shell "&"))) (message-window (conc "Directory " rundir " not found"))))) (refreshdat (lambda () | | > > > | | | | > > > | < < < < | > | | | | | | | | | | | | | > | | | > > > | < | > | > | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | (let ((shell (if (get-environment-variable "SHELL") (conc "-e " (get-environment-variable "SHELL")) ""))) (system (conc "cd " rundir ";xterm -T \"" (string-translate testfullname "()" " ") "\" " shell "&"))) (message-window (conc "Directory " rundir " not found"))))) (refreshdat (lambda () (let ((newtestdat (db:get-test-data-by-id db test-id))) (if newtestdat (begin (set! testdat newtestdat) (set! teststeps (db:get-steps-for-test db test-id)) (set! logfile (conc (db:test-get-rundir testdat) "/" (db:test-get-final_logf testdat))) (set! rundir (db:test-get-rundir testdat)) (set! testfullname (db:test-get-fullname testdat))) (begin (sqlite3:finalize! db) (exit 0)))))) (widgets (make-hash-table)) (self #f) (store-label (lambda (name lbl cmd) (hash-table-set! widgets name (lambda () (iup:attribute-set! lbl "TITLE" (cmd)))) lbl)) (store-button store-label)) (cond ((not testdat)(begin (print "ERROR: bad test info for " test-id)(exit 1))) ((not rundat)(begin (print "ERROR: found test info but there is a problem with the run info for " run-id)(exit 1))) (else ;; (test-set-status! db run-id test-name state status itemdat) (set! self (iup:dialog #:title testfullname (iup:hbox #:expand "BOTH" ;; Need a full height box for all the test steps (iup:vbox #:expand "VERTICAL" ;; The run and test info (iup:hbox #:expand "BOTH" (iup:frame #:title "Megatest Run Info" #:expand "VERTICAL" (iup:hbox #:expand "VERTICAL" (apply iup:vbox #:expand "VERTICAL" (append (map (lambda (keyval) (iup:label (conc (car keyval) " ") #:expand "HORIZONTAL")) keydat) (list (iup:label "runname ")))) (apply iup:vbox (append (map (lambda (keyval) (iup:label (cadr keyval) #:expand "HORIZONTAL")) keydat) (list (iup:label runname)(iup:label "" #:expand "VERTICAL")))))) (iup:frame #:title "Test Info" #:expand "VERTICAL" (iup:hbox #:expand "VERTICAL" (apply iup:vbox #:expand "VERTICAL" (append (map (lambda (val) (iup:label val #:expand "HORIZONTAL")) (list "Testname: " "Item path: " "Current state: " "Current status: " "Test comment: ")) (list (iup:label "" #:expand "VERTICAL")))) (apply iup:vbox #:expand "BOTH" (list (iup:label (db:test-get-testname testdat) #:expand "HORIZONTAL") (iup:label (db:test-get-item-path testdat) #:expand "HORIZONTAL") (store-label "teststate" (iup:label (db:test-get-state testdat) #:expand "HORIZONTAL") (lambda () (db:test-get-state testdat))) (let ((lbl (iup:button (db:test-get-status testdat) #:expand "HORIZONTAL")) (color (get-color-for-state-status (db:test-get-state testdat) (db:test-get-status testdat)))) (hash-table-set! widgets "teststatus" (lambda () (iup:attribute-set! lbl "BGCOLOR" color) (db:test-get-status testdat))) lbl) (store-label "testcomment" (iup:label "TestComment " #:expand "HORIZONTAL") (lambda () (db:test-get-comment testdat)))))))) ;; The run host info (iup:frame #:title "Remote host and Test Run Info" #:expand "HORIZONTAL" (iup:hbox #:expand "HORIZONTAL" (apply iup:vbox #:expand "VERTICAL" ;; The heading labels (append (map (lambda (val) (iup:label val #:expand "HORIZONTAL")) (list "Hostname: " "Uname -a: " "Disk free: " "CPU Load: " "Run duration: " "Logfile: ")) (iup:label "" #:expand "VERTICAL"))) (apply iup:vbox #:expand "VERTICAL" (list ;; NOTE: Yes, the host can change! (store-label "HostName" (iup:label (db:test-get-host testdat) #:expand "HORIZONTAL") (lambda ()(db:test-get-host testdat))) (store-label "Uname" (iup:label " " #:expand "HORIZONTAL") (lambda ()(db:test-get-uname testdat))) (store-label "DiskFree" (iup:label (conc (db:test-get-diskfree testdat)) #:expand "HORIZONTAL") (lambda ()(conc (db:test-get-diskfree testdat)))) (store-label "CPULoad" (iup:label (conc (db:test-get-cpuload testdat)) #:expand "HORIZONTAL") (lambda ()(conc (db:test-get-cpuload testdat)))) (store-label "RunDuration" (iup:label (conc (db:test-get-run_duration testdat)) #:expand "HORIZONTAL") (lambda ()(conc (db:test-get-run_duration testdat)))) (store-label "CPULoad" (iup:label (conc (db:test-get-final_logf testdat)) #:expand "HORIZONTAL") (lambda ()(conc (db:test-get-final_logf testdat)))))))) )))) (iup:show self) ;; Now start keeping the gui updated from the db (let loop ((i 0)) (thread-sleep! 0.1) (refreshdat) ;; update from the db here (thread-suspend! other-thread) ;; update the gui elements here (for-each (lambda (key) ;; (print "Updating " key) ((hash-table-ref widgets key))) (hash-table-keys widgets)) (thread-resume! other-thread) (loop i)))))) ;; ;; (iup:frame (iup:label (conc "TESTNAME:\n" testfullname) #:expand "YES"))) |
︙ | ︙ |
Modified dashboard.scm from [007854e6c0] to [241b3a33a0].
︙ | ︙ | |||
9 10 11 12 13 14 15 | ;; PURPOSE. ;;====================================================================== (use format) (require-library iup) (import (prefix iup iup:)) | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ;; PURPOSE. ;;====================================================================== (use format) (require-library iup) (import (prefix iup iup:)) (use canvas-draw) (use sqlite3 srfi-1 posix regex regex-case srfi-69) (import (prefix sqlite3 sqlite3:)) (include "margs.scm") (include "keys.scm") |
︙ | ︙ | |||
143 144 145 146 147 148 149 150 151 152 153 154 155 156 | (if (<= rown maxn) (let ((labl (vector-ref lftcol rown))) (iup:attribute-set! labl "TITLE" name))) (set! rown (+ 1 rown))) (if (> (length *alltestnamelst*) *start-test-offset*) (drop *alltestnamelst* *start-test-offset*) '())))) ;; *alltestnamelst*)))) (define (update-buttons uidat numruns numtests) (let* ((runs (if (> (length *allruns*) numruns) (take-right *allruns* numruns) (pad-list *allruns* numruns))) (lftcol (vector-ref uidat 0)) (tableheader (vector-ref uidat 1)) | > > > > > > > > > > > > > > > > | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | (if (<= rown maxn) (let ((labl (vector-ref lftcol rown))) (iup:attribute-set! labl "TITLE" name))) (set! rown (+ 1 rown))) (if (> (length *alltestnamelst*) *start-test-offset*) (drop *alltestnamelst* *start-test-offset*) '())))) ;; *alltestnamelst*)))) (define (get-color-for-state-status state status) (case (string->symbol state) ((COMPLETED) (if (equal? status "PASS") "70 249 73" (if (equal? status "WARN") "255 172 13" "223 33 49"))) ;; greenish orangeish redish ((LAUNCHED) "101 123 142") ((CHECK) "255 100 50") ((REMOTEHOSTSTART) "50 130 195") ((RUNNING) "9 131 232") ((KILLREQ) "39 82 206") ((KILLED) "234 101 17") (else "192 192 192"))) (define (update-buttons uidat numruns numtests) (let* ((runs (if (> (length *allruns*) numruns) (take-right *allruns* numruns) (pad-list *allruns* numruns))) (lftcol (vector-ref uidat 0)) (tableheader (vector-ref uidat 1)) |
︙ | ︙ | |||
187 188 189 190 191 192 193 | (lambda (rundat) (if (not rundat) ;; handle padded runs ;; ;; id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration (set! rundat (vector (make-vector 20 #f) '() (map (lambda (x) "") *keys*))));; 3))) (let* ((run (vector-ref rundat 0)) (testsdat (vector-ref rundat 1)) (key-val-dat (vector-ref rundat 2)) | | | | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | (lambda (rundat) (if (not rundat) ;; handle padded runs ;; ;; id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration (set! rundat (vector (make-vector 20 #f) '() (map (lambda (x) "") *keys*))));; 3))) (let* ((run (vector-ref rundat 0)) (testsdat (vector-ref rundat 1)) (key-val-dat (vector-ref rundat 2)) (run-id (db:get-value-by-header run *header* "id")) (testnames (delete-duplicates (append *alltestnamelst* (map test:test-get-fullname testsdat)))) ;; (take (pad-list testsdat numtests) numtests)) (key-vals (append key-val-dat (list (let ((x (db:get-value-by-header run *header* "runname"))) (if x x ""))))) (run-key (string-intersperse key-vals "\n"))) ;; (run-ht (hash-table-ref/default alldat run-key #f))) ;; fill in the run header key values (set! *alltestnamelst* testnames) (let ((rown 0) (headercol (vector-ref tableheader coln))) |
︙ | ︙ | |||
229 230 231 232 233 234 235 | (testfullname (test:test-get-fullname test)) (teststatus (db:test-get-status test)) (teststate (db:test-get-state test)) (teststart (db:test-get-event_time test)) (runtime (db:test-get-run_duration test)) (buttontxt (if (equal? teststate "COMPLETED") teststatus teststate)) (button (vector-ref columndat rown)) | | < < < < < < < < < < < < < | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | (testfullname (test:test-get-fullname test)) (teststatus (db:test-get-status test)) (teststate (db:test-get-state test)) (teststart (db:test-get-event_time test)) (runtime (db:test-get-run_duration test)) (buttontxt (if (equal? teststate "COMPLETED") teststatus teststate)) (button (vector-ref columndat rown)) (color (get-color-for-state-status teststate teststatus)) (curr-color (vector-ref buttondat 1)) ;; (iup:attribute button "BGCOLOR")) (curr-title (vector-ref buttondat 2))) ;; (iup:attribute button "TITLE"))) ;; (if (and (equal? teststate "RUNNING") ;; (> (- (current-seconds) (+ teststart runtime)) 100)) ;; if test has been dead for more than 100 seconds, call it dead (if (not (equal? curr-color color)) (iup:attribute-set! button "BGCOLOR" color)) |
︙ | ︙ |