Megatest

Diff
Login

Differences From Artifact [381ac4c5d5]:

To Artifact [9183a72ed5]:


251
252
253
254
255
256
257
258

259
260
261



262
263
264
265
266
267
268
251
252
253
254
255
256
257

258



259
260
261
262
263
264
265
266
267
268







-
+
-
-
-
+
+
+








;;======================================================================
;;  U T I L S
;;======================================================================

;; given a mtutil param, return the old megatest equivalent
;;
(define (param-translate param)
(define (megatest-param->mtutil-param param)
  (or (alist-ref (string->symbol param)
                 (common:get-param-mapping flavor: 'switch-symbol))
      param))
  (let* ((mapping-alist (common:get-param-mapping flavor: 'switch-symbol)))
    (alist-ref (string->symbol param) mapping-alist eq? param)
    param))

(define (val->alist val)
  (let ((val-list (string-split-fields ";\\s*" val #:infix)))
    (if val-list
	(map (lambda (x)
	       (let ((f (string-split-fields "\\s*=\\s*" x #:infix)))
		 (case (length f)
956
957
958
959
960
961
962

963
964
965
966




967
968
969
970
971
972
973
974

975
976
977
978
979
980
981
956
957
958
959
960
961
962
963




964
965
966
967
968
969
970
971
972
973
974

975
976
977
978
979
980
981
982







+
-
-
-
-
+
+
+
+







-
+







		    runkeydats)))
	       (let ((res (configf:get-section torun contour))) ;; each contour / target
		 ;; (print "res=" res)
		 res))))
	  (hash-table-keys torun)))))))

(define (pkt->cmdline pkta)
  (let* ((param-mapping-alist (common:get-param-mapping flavor: 'switch-symbol))
  (let* ((action (or (lookup-action-by-key (alist-ref 'A pkta)) "noaction"))
	 (action-param (case (string->symbol action)
			 ((-set-state-status) (conc (alist-ref 'l pkta) " "))
			 (else ""))))
         (action        (or (lookup-action-by-key (alist-ref 'A pkta)) "noaction"))
	 (action-param  (case (string->symbol action)
                          ((-set-state-status) (conc (alist-ref 'l pkta) " "))
                          (else ""))))
    (fold (lambda (a res)
	    (let* ((key (car a)) ;; get the key name
		   (val (cdr a))
		   (par (or (lookup-param-by-key key)  ;; need to check also if it is a switch
			    (lookup-param-by-key key inlst: *switch-keys*))))
	      ;; (print "key: " key " val: " val " par: " par)
	      (if par
		  (conc res " " (param-translate par) " " val)
		  (conc res " " (alist-ref (string->symbol par) param-mapping-alist eq? par) " " val)
		  (if (alist-ref key *additional-cards*) ;; these cards do not translate to parameters or switches
		      res
		      (begin
			(print "ERROR: Unknown key in packet \"" key "\" with value \"" val "\"")
			res)))))
	  (conc "megatest " (if (not (member action '("sync")))
				(conc action " " action-param)