Megatest

Diff
Login

Differences From Artifact [6d3f9a01cd]:

To Artifact [2c5f13a26c]:


2888
2889
2890
2891
2892
2893
2894











2895
2896
2897
2898
2899

2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909

2910



2911
2912
2913
2914
2915
2916
2917







+
+
+
+
+
+
+
+
+
+
+




-
+
-
-
-







;; foo,bal,   1.2,  1.2, <   ,     ,Check for overload
;; foo,alb,   1.2,  1.2, <=  , Amps,This is the high power circuit test
;; foo,abl,   1.2,  1.3, 0.1
;; foo,bra,   1.2, pass, silly stuff
;; faz,bar,    10,  8mA,     ,     ,"this is a comment"
;; EOF


(define (db:csv->list-safe csvdata)
  (if (string? csvdata)
      (csv->list (make-csv-reader
		  (open-input-string csvdata)
		  '((strip-leading-whitespace? #t)
		    (strip-trailing-whitespace? #t))))      
      (begin
	(debug:print 0 *default-log-port* "ERROR: received non-string data for csv")
	'())))

(define (db:csv->test-data dbstruct run-id test-id csvdata)
  (debug:print 4 *default-log-port* "test-id " test-id ", csvdata: " csvdata)
  (let* ((dbdat   (db:get-db dbstruct run-id))
	 (db      (db:dbdat-get-db dbdat))
	 (csvlist (csv->list (make-csv-reader
	 (csvlist (db:csv->list-safe csvdata)))
			      (open-input-string csvdata)
			      '((strip-leading-whitespace? #t)
				(strip-trailing-whitespace? #t)))))) ;; (csv->list csvdata)))
    (for-each
     (lambda (csvrow)
       (let* ((padded-row  (take (append csvrow (list #f #f #f #f #f #f #f #f #f)) 9))
	      (category    (list-ref padded-row 0))
	      (variable    (list-ref padded-row 1))
	      (value       (any->number-if-possible (list-ref padded-row 2)))
	      (expected    (any->number-if-possible (list-ref padded-row 3)))