Index: launch.scm ================================================================== --- launch.scm +++ launch.scm @@ -34,10 +34,15 @@ ;; 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)) @@ -120,11 +125,12 @@ ))))) ;; 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" '()))) + (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)) @@ -135,24 +141,28 @@ (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!!! + (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) @@ -162,12 +172,23 @@ (mutex-unlock! m) (if (eq? pid-val 0) (begin (thread-sleep! 2) (processloop (+ i 1)))) - ))) - (if (not (null? tal)) + )) + (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 () ADDED tests/tests/eztest_fail/testconfig Index: tests/tests/eztest_fail/testconfig ================================================================== --- /dev/null +++ tests/tests/eztest_fail/testconfig @@ -0,0 +1,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 Index: tests/tests/eztest_pass/testconfig ================================================================== --- tests/tests/eztest_pass/testconfig +++ tests/tests/eztest_pass/testconfig @@ -1,9 +1,10 @@ [setup] [ezsteps] -lstmp ls /tmp +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. Index: utils/mt_ezstep ================================================================== --- utils/mt_ezstep +++ utils/mt_ezstep @@ -1,6 +1,6 @@ -#!/bin/bash -x +#!/bin/bash if [ "$MT_CMDINFO" == "" ];then echo "ERROR: $0 should be run within a megatest test environment" exit fi