Megatest

Check-in [5a3f936c46]
Login
Overview
Comment:Fixed some linktree issues and backed out some changes made to support contours as a native variable
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.64-new-pkts
Files: files | file ages | folders
SHA1: 5a3f936c4606e9a9af0625521f8b7abad38e8863
User & Date: matt on 2017-03-19 18:57:27
Other Links: branch diff | manifest | tags
Context
2017-03-20
12:50
Merged in homehost-protection patch check-in: 25c202aa9d user: matt tags: v1.64-new-pkts
2017-03-19
18:57
Fixed some linktree issues and backed out some changes made to support contours as a native variable check-in: 5a3f936c46 user: matt tags: v1.64-new-pkts
2017-03-16
23:59
Don't attempt to set special internal megatest variables (i.e. with : as part of the variable name) as environment variables check-in: 6da617e856 user: matt tags: v1.64-new-pkts
Changes

Modified common.scm from [dec88d9803] to [bfa5c880cd].

31
32
33
34
35
36
37


38
39


40
41
42
43
44
45





46
47
48
49
50
51
52
31
32
33
34
35
36
37
38
39


40
41






42
43
44
45
46
47
48
49
50
51
52
53







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







;; (define (exit . code)
;;   (if (null? code)
;;       (old-exit)
;;       (old-exit code)))

(define getenv get-environment-variable)
(define (safe-setenv key val)
  (if (substring-index ":" key) ;; variables containing : are for internal use and cannot be environment variables.
      (debug:print-error 4 *default-log-port* "skip setting internal use only variables containing \":\"")
  (if (and (string? val)
	   (string? key)
      (if (and (string? val)
	       (string? key))
	   (not (substring-index ":" key))) ;; variables containing : are for internal use and cannot be environment variables.
      (handle-exceptions
       exn
       (debug:print-error 0 *default-log-port* "bad value for setenv, key=" key ", value=" val)
       (setenv key val))
      (debug:print-error 0 *default-log-port* "bad value for setenv, key=" key ", value=" val)))
	  (handle-exceptions
	      exn
	      (debug:print-error 0 *default-log-port* "bad value for setenv, key=" key ", value=" val)
	    (setenv key val))
	  (debug:print-error 0 *default-log-port* "bad value for setenv, key=" key ", value=" val))))

(define home (getenv "HOME"))
(define user (getenv "USER"))

;; GLOBAL GLETCHES

;; CONTEXTS
1617
1618
1619
1620
1621
1622
1623
1624


1625
1626
1627
1628
1629
1630
1631
1618
1619
1620
1621
1622
1623
1624

1625
1626
1627
1628
1629
1630
1631
1632
1633







-
+
+







       (lambda ()
          (for-each (lambda (keyval)
		      (let* ((key (car keyval))
			     (val (cdr keyval))
			     (delim (if (string-search whitesp val) 
					"\""
					"")))
			(print (if (member key ignorevars)
			(print (if (or (member key ignorevars)
				       (string-search ":" key)) ;; internal only values to be skipped.
				   "# export "
				   "export ")
			       key "=" delim (mungeval val) delim)))
                    envvars)))))

;; set some env vars from an alist, return an alist with original values
;; (("VAR" "value") ...)

Modified launch.scm from [93db933159] to [116c16af2f].

740
741
742
743
744
745
746
747

748
749
750
751
752
753
754
740
741
742
743
744
745
746

747
748
749
750
751
752
753
754







-
+







	res)))

(define (launch:setup-body #!key (force #f) (areapath #f))
  (let* ((toppath  (or *toppath* areapath (getenv "MT_RUN_AREA_HOME"))) ;; preserve toppath
	 (runname  (common:args-get-runname))
	 (target   (common:args-get-target exit-if-bad: #t))
	 (linktree (common:get-linktree))
	 (contour  (args:get-arg "-contour"))
	 (contour  #f) ;; NOT READY FOR THIS (args:get-arg "-contour"))
	 (sections (if target (list "default" target) #f)) ;; for runconfigs
	 (mtconfig (or (args:get-arg "-config") "megatest.config")) ;; allow overriding megatest.config 
	 (rundir   (if (and runname target linktree)(conc linktree (if contour (conc "/" contour) "") "/" target "/" runname) #f))
	 (mtcachef (and rundir (conc rundir "/" ".megatest.cfg-"  megatest-version "-" megatest-fossil-hash)))
	 (rccachef (and rundir (conc rundir "/" ".runconfigs.cfg-"  megatest-version "-" megatest-fossil-hash)))
	 (cancreate (and rundir (file-exists? rundir)(file-write-access? rundir)))
         (cxt       (hash-table-ref/default *contexts* toppath #f)))
798
799
800
801
802
803
804

805
806
807
808




809
810
811
812
813
814
815
798
799
800
801
802
803
804
805




806
807
808
809
810
811
812
813
814
815
816







+
-
-
-
-
+
+
+
+







		  (begin
		    (debug:print-error 0 *default-log-port* "you are not in a megatest area!")
		    (exit 1)))
	      (setenv "MT_RUN_AREA_HOME" *toppath*)
	      ;; the seed read is done, now read runconfigs, cache it then read megatest.config one more time and cache it
	      (let* ((keys         (rmt:get-keys))
		     (key-vals     (keys:target->keyval keys target))
		     (linktree     (common:get-linktree))
		     (linktree     (or (getenv "MT_LINKTREE")
				       (if *configdat*
					   (configf:lookup *configdat* "setup" "linktree")
					   (conc *toppath* "/lt"))))
					; (or (getenv "MT_LINKTREE")
					;     (if *configdat*
					; 	   (configf:lookup *configdat* "setup" "linktree")
					; 	   (conc *toppath* "/lt"))))
		     (second-pass  (find-and-read-config
				    mtconfig
				    environ-patt: "env-override"
				    given-toppath: toppath
				    pathenvvar: "MT_RUN_AREA_HOME"))
		     (runconfigdat (begin     ;; this read of the runconfigs will see any adjustments made by re-reading megatest.config
				     (for-each (lambda (kt)
916
917
918
919
920
921
922
923

924
925
926
927
928
929
930
917
918
919
920
921
922
923

924
925
926
927
928
929
930
931







-
+







(define (create-work-area run-id run-info keyvals test-id test-src-path disk-path testname itemdat #!key (remtries 2))
  (let* ((item-path (if (string? itemdat) itemdat (item-list->path itemdat))) ;; if pass in string - just use it
	 (runname   (if (string? run-info) ;; if we pass in a string as run-info use it as run-name.
			run-info
			(db:get-value-by-header (db:get-rows run-info)
						(db:get-header run-info)
						"runname")))
	 (contour   (args:get-arg "-contour"))
	 (contour   #f) ;; NOT READY FOR THIS (args:get-arg "-contour"))
	 ;; convert back to db: from rdb: - this is always run at server end
	 (target   (string-intersperse (map cadr keyvals) "/"))

	 (not-iterated  (equal? "" item-path))

	 ;; all tests are found at <rundir>/test-base or <linkdir>/test-base
	 (testtop-base (conc target "/" runname "/" testname))
1089
1090
1091
1092
1093
1094
1095
1096

1097
1098
1099
1100
1101
1102
1103
1090
1091
1092
1093
1094
1095
1096

1097
1098
1099
1100
1101
1102
1103
1104







-
+







;; 4. remotely run the test on allocated host
;;    - could be ssh to host from hosts table (update regularly with load)
;;    - could be netbatch
;;      (launch-test db (cadr status) test-conf))
(define (launch-test test-id run-id run-info keyvals runname test-conf test-name test-path itemdat params)
  (mutex-lock! *launch-setup-mutex*) ;; setting variables and processing the testconfig is NOT thread-safe, reuse the launch-setup mutex
  (let* ((item-path       (item-list->path itemdat))
	 (contour         (args:get-arg "-contour")))
	 (contour         #f)) ;; NOT READY FOR THIS (args:get-arg "-contour")))
    (let loop ((delta        (- (current-seconds) *last-launch*))
	       (launch-delay (string->number (or (configf:lookup *configdat* "setup" "launch-delay") "5"))))
      (if (> launch-delay delta)
	  (begin
	    (debug:print-info 0 *default-log-port* "Delaying launch of " test-name " for " (- launch-delay delta) " seconds")
	    (thread-sleep! (- launch-delay delta))
	    (loop (- (current-seconds) *last-launch*) launch-delay))))

Modified runconfigs.config from [bc209cef2e] to [beb35b097a].








1
2
3
4
5
6
7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
+
+
+
+
+
+
+







# To get emacs font highlighing in the various megatest configs do this:
#
# Install emacs-goodies-el:
#    sudo apt install emacs-goodies-el
# Add to your ~/.emacs file:
#    (add-to-list 'auto-mode-alist '("config\\'" . conf-space-mode))
#

# example of a cron entry to run sync using db spec pgdb, with pgdb setting in file local.config
#
[a/b/c]
all:scheduled:sync     cron=  0/5 * * * *;dbdest=pgdb;appendconf=/mfs/matt/.sysmaint/local.config

# tip will be replaced with hashkey?