Megatest

Diff
Login

Differences From Artifact [3dcfc93438]:

To Artifact [d6ba0a847e]:


54
55
56
57
58
59
60



61

62
63
64
65
66
67








68
69
70
71
72
73
74
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







+
+
+
-
+



-
-
-
+
+
+
+
+
+
+
+







    (if enccmd
	(common:read-encoded-string enccmd)
	'())))

;;                       0           1              2              3
(defstruct launch:einf (pid #t)(exit-status #t)(exit-code #t)(rollup-status 0))

;; return (conc status ": " comment) from the final section so that
;;   the comment can be set in the step record in launch.scm
;;
(define (launch:load-logpro-dat stepname)
(define (launch:load-logpro-dat run-id test-id stepname)
  (let* ((dat  (read-config (conc stepname ".dat") #f #f))
	 (csvr (db:logpro-dat->csv dat stepname))
	 (csvt (let-values (( (fmt-cell fmt-record fmt-csv) (make-format ",")))
			   (fmt-csv (map list->csv-record csvr)))))
    (rmt:csv->test-data run-id test-id csvt)))

			   (fmt-csv (map list->csv-record csvr))))
	 (status (configf:lookup dat "final" "exit-status"))
	 (msg     (configf:lookup dat "final" "message")))
    (rmt:csv->test-data run-id test-id csvt)
    (cond
     ((equal? status "PASS") "PASS") ;; skip the message part if status is pass
     (status (conc (configf:lookup dat "final" "exit-status") ": " (configf:lookup dat "final" "message")))
     (else #f))))

(define (launch:runstep ezstep run-id test-id exit-info m tal testconfig)
  (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))
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152









153
154
155
156
157
158
159
146
147
148
149
150
151
152








153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168







-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+







			(if (eq? pid-val 0)
			    (begin
			      (thread-sleep! 2)
			      (processloop (+ i 1)))))
	    (debug:print-info 0 "logpro for step " stepname " exited with code " (launch:einf-exit-code exit-info))))) ;; (vector-ref exit-info 2)))))
    
    (let ((exinfo (launch:einf-exit-code exit-info)) ;; (vector-ref exit-info 2))
	  (logfna (if logpro-used (conc stepname ".html") "")))
      (rmt:teststep-set-status! run-id test-id stepname "end" exinfo #f logfna))
    (if logpro-used
	(let ((datfile (conc stepname ".dat")))
	  ;; load the .dat file into the test_data table if it exists
	  (if (file-exists? datfile)
	      (launch:load-logpro-dat stepname))
	(rmt:test-set-log! run-id test-id (conc stepname ".html"))))
	  (logfna (if logpro-used (conc stepname ".html") ""))
	  (comment #f))
      (if logpro-used
	  (let ((datfile (conc stepname ".dat")))
	    ;; load the .dat file into the test_data table if it exists
	    (if (file-exists? datfile)
		(set! comment (launch:load-logpro-dat run-id test-id stepname)))
	    (rmt:test-set-log! run-id test-id (conc stepname ".html"))))
      (rmt:teststep-set-status! run-id test-id stepname "end" exinfo comment logfna))
    ;; set the test final status
    (let* ((process-exit-status (launch:einf-exit-code exit-info)) ;; (vector-ref exit-info 2))
	   (this-step-status (cond
			      ((and (eq? process-exit-status 2) logpro-used) 'warn)   ;; logpro 2 = warnings
			      ((and (eq? process-exit-status 3) logpro-used) 'check)  ;; logpro 3 = check
			      ((and (eq? process-exit-status 4) logpro-used) 'waived) ;; logpro 4 = waived
			      ((and (eq? process-exit-status 5) logpro-used) 'abort)  ;; logpro 5 = abort
279
280
281
282
283
284
285
286

287
288
289
290
291
292
293
288
289
290
291
292
293
294

295
296
297
298
299
300
301
302







-
+







		       (prevstep #f))
	      ;; check exit-info (vector-ref exit-info 1)
	      (if (launch:einf-exit-status exit-info) ;; (vector-ref exit-info 1)
		  (let ((logpro-used (launch:runstep ezstep run-id test-id exit-info m tal testconfig))
			(stepname    (car ezstep)))
		    ;; if logpro-used read in the stepname.dat file
		    (if (and logpro-used (file-exists? (conc stepname ".dat")))
			(launch:load-logpro-dat stepname))
			(launch:load-logpro-dat run-id test-id stepname))
		    (if (steprun-good? logpro-used (launch:einf-exit-code exit-info))
			(if (not (null? tal))
			    (loop (car tal) (cdr tal) stepname))
			(debug:print 4 "WARNING: step " (car ezstep) " failed. Stopping")))
		  (debug:print 4 "WARNING: a prior step failed, stopping at " ezstep)))))))

(define (launch:monitor-job run-id test-id item-path fullrunscript ezsteps test-name tconfigreg exit-info m work-area runtlim misc-flags)