Overview
Comment: | Fixed mishandling of failed step in ezstep and added a test for failed case |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
93749b40da8a5efb6e8202320fda58aa |
User & Date: | matt on 2011-10-09 12:40:36 |
Other Links: | manifest | tags |
Context
2011-10-09
| ||
23:54 | Added toggles to hide tests based on PASS, FAIL etc. check-in: e2c3e19524 user: matt tags: trunk | |
12:40 | Fixed mishandling of failed step in ezstep and added a test for failed case check-in: 93749b40da user: matt tags: trunk | |
11:36 | Completed eztests, well, except for full validation of eztests check-in: 1b0a53f5b9 user: matt tags: trunk | |
Changes
Modified launch.scm from [085cab6512] to [bb212116ec].
︙ | ︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | ;; ezsteps were going to be coded as ;; stepname[,predstep1,predstep2 ...] [{VAR1=first,second,third}] command to execute ;; BUT ;; now are ;; stepname {VAR=first,second,third ...} command ... (define (launch:execute encoded-cmd) (let* ((cmdinfo (read (open-input-string (base64:base64-decode encoded-cmd))))) (setenv "MT_CMDINFO" encoded-cmd) (if (list? cmdinfo) ;; ((testpath /tmp/mrwellan/jazzmind/src/example_run/tests/sqlitespeed) (test-name sqlitespeed) (runscript runscript.rb) (db-host localhost) (run-id 1)) (let* ((testpath (assoc/default 'testpath cmdinfo)) (work-area (assoc/default 'work-area cmdinfo)) | > > > > > | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | ;; ezsteps were going to be coded as ;; stepname[,predstep1,predstep2 ...] [{VAR1=first,second,third}] command to execute ;; BUT ;; now are ;; stepname {VAR=first,second,third ...} command ... ;; given an exit code and whether or not logpro was used calculate OK/BAD ;; return #t if we are ok, #f otherwise (define (steprun-good? logpro exitcode) (or (eq? exitcode 0) (and logpro (eq? exitcode 2)))) (define (launch:execute encoded-cmd) (let* ((cmdinfo (read (open-input-string (base64:base64-decode encoded-cmd))))) (setenv "MT_CMDINFO" encoded-cmd) (if (list? cmdinfo) ;; ((testpath /tmp/mrwellan/jazzmind/src/example_run/tests/sqlitespeed) (test-name sqlitespeed) (runscript runscript.rb) (db-host localhost) (run-id 1)) (let* ((testpath (assoc/default 'testpath cmdinfo)) (work-area (assoc/default 'work-area cmdinfo)) |
︙ | ︙ | |||
118 119 120 121 122 123 124 | (thread-sleep! 2) (loop (+ i 1))) ))))) ;; then, if runscript ran ok (or did not get called) ;; do all the ezsteps (if any) (if ezsteps (let* ((testconfig (read-config (conc work-area "/testconfig") #f #t)) ;; FIXME??? is allow-system ok here? | | > | > > > > | > > > > > > > > > > > | | 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 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | (thread-sleep! 2) (loop (+ i 1))) ))))) ;; then, if runscript ran ok (or did not get called) ;; do all the ezsteps (if any) (if ezsteps (let* ((testconfig (read-config (conc work-area "/testconfig") #f #t)) ;; FIXME??? is allow-system ok here? (ezstepslst (hash-table-ref/default testconfig "ezsteps" '())) (db (open-db))) (if (not (file-exists? ".ezsteps"))(create-directory ".ezsteps")) ;; if ezsteps was defined then we are sure to have at least one step but check anyway (if (not (> (length ezstepslst) 0)) (debug:print 0 "ERROR: ezsteps defined but ezstepslst is zero length") (let loop ((ezstep (car ezstepslst)) (tal (cdr ezstepslst)) (prevstep #f)) ;; check exit-info (vector-ref exit-info 1) (if (vector-ref exit-info 1) (let* ((stepname (car ezstep)) ;; do stuff to run the step (stepinfo (cadr ezstep)) (stepparts (string-match (regexp "^(\\{([^\\}]*)\\}\\s*|)(.*)$") stepinfo)) (stepparms (list-ref stepparts 2)) ;; for future use, {VAR=1,2,3}, run step for each (stepcmd (list-ref stepparts 3)) (script "#!/bin/bash\n") ;; yep, we depend on bin/bash FIXME!!! (logpro-used #f)) ;; NB// can safely assume we are in test-area directory (debug:print 4 "ezsteps:\n stepname: " stepname " stepinfo: " stepinfo " stepparts: " stepparts " stepparms: " stepparms " stepcmd: " stepcmd) (if (file-exists? (conc stepname ".logpro"))(set! logpro-used #t)) ;; first source the previous environment (if (and prevstep (file-exists? prevstep)) (set! script (conc script "source .ezsteps/" prevstep ".sh"))) ;; call the command using mt_ezstep (set! script (conc script "mt_ezstep " stepname " " stepcmd "\n")) (debug:print 4 "script: " script) (teststep-set-status! db run-id test-name stepname "start" "-" itemdat #f) ;; now launch (let ((pid (process-run script))) (let processloop ((i 0)) (let-values (((pid-val exit-status exit-code)(process-wait pid #t))) (mutex-lock! m) (vector-set! exit-info 0 pid) (vector-set! exit-info 1 exit-status) (vector-set! exit-info 2 exit-code) (mutex-unlock! m) (if (eq? pid-val 0) (begin (thread-sleep! 2) (processloop (+ i 1)))) )) (teststep-set-status! db run-id test-name stepname "end" (vector-ref exit-info 2) itemdat #f) (cond ;; WARN from logpro ((and (eq? (vector-ref exit-info 1) 2) logpro-used) (test-set-status! db run-id test-name "COMPLETE" "WARN" itemdat "Logpro warning found" #f)) ((eq? (vector-ref exit-info 1) 0) (test-set-status! db run-id test-name "COMPLETE" "PASS" itemdat #f #f)) (else (test-set-status! db run-id test-name "COMPLETE" "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))) (debug:print 4 "WARNING: a prior step failed, stopping at " ezstep)))))))) (monitorjob (lambda () (let* ((start-seconds (current-seconds)) (calc-minutes (lambda () (inexact->exact (round |
︙ | ︙ |
Added tests/tests/eztest_fail/testconfig version [869f3145d8].
> > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | [setup] [ezsteps] lookittmp ls /tmp lookithome ls /home lookitnada ls /nada lookitusr ls /usr [test_meta] author matt owner bob description This test runs a single ezstep which is expected to pass, no logpro file. tags first,single reviewed 09/10/2011, by Matt |
Modified tests/tests/eztest_pass/testconfig from [fb08d0b50f] to [55e83172e9].
1 2 3 | [setup] [ezsteps] | | > | 1 2 3 4 5 6 7 8 9 10 11 12 | [setup] [ezsteps] lookittmp ls /tmp lookithome ls /home [test_meta] author matt owner bob description This test runs a single ezstep which is expected to pass, no logpro file. tags first,single |
︙ | ︙ |
Modified utils/mt_ezstep from [8f412827c1] to [3ac68c5b77].
|
| | | 1 2 3 4 5 6 7 8 | #!/bin/bash if [ "$MT_CMDINFO" == "" ];then echo "ERROR: $0 should be run within a megatest test environment" exit fi # Purpose: This is for the [ezsteps] secton in your testconfig file. |
︙ | ︙ |