Megatest

Check-in [0d6213c6ea]
Login
Overview
Comment:Added setting of env. vars prior to test launch. Bumping to 1.08
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0d6213c6ea8181d5718a6b13389f1fdbcc5355b9
User & Date: matt on 2011-05-18 00:00:35
Other Links: manifest | tags
Context
2011-05-23
23:35
Moved setting of various env vars to earlier point in time so they are available when the testconfig file is read. This means you can use MT_RUNNAME, MT_TEST_NAME etc. in [system .../some/script] calls check-in: b5bfe140e0 user: matt tags: trunk, v1.08
2011-05-18
00:00
Added setting of env. vars prior to test launch. Bumping to 1.08 check-in: 0d6213c6ea user: matt tags: trunk
2011-05-17
22:26
Release version 1.07, 0 maps to PASS, any other number maps to FAIL and any non number maps to itself in -test-status calls check-in: 2e763d09cf user: matt tags: trunk
Changes

Modified launch.scm from [4e0072fb2a] to [f989eab76a].

162
163
164
165
166
167
168





169
170
171
172
173

174
175
176
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182







+
+
+
+
+





+



    (test-set-status! db run-id test-name "LAUNCHED" "n/a" itemdat) ;; (if launch-results launch-results "FAILED"))
    ;; set 
    ;; set pre-launch-env-vars before launching, keep the vars in prevvals and put the envionment back when done
    (let* ((commonprevvals (alist->env-vars
			    (hash-table-ref/default *configdat* "env-override" '())))
	   (testprevvals   (alist->env-vars
			    (hash-table-ref/default test-conf "pre-launch-env-overrides" '())))
	   (miscprevvals   (alist->env-vars ;; consolidate this code with the code in megatest.scm for "-execute"
			    (append (list (list "MT_TEST_NAME" test-name)
					  (list "MT_ITEM_INFO" (conc itemdat)) 
					  (list "MT_RUNNAME"   (args:get-arg ":runname")))
				    itemdat)))
	   (launch-results (apply cmd-run-proc-each-line
				  (car fullcmd)
				  print
				  (cdr fullcmd)))) ;;  launcher fullcmd)));; (apply cmd-run-proc-each-line launcher print fullcmd))) ;; (cmd-run->list fullcmd))
      (print "Launching completed, updating db")
      (alist->env-vars miscprevvals)
      (alist->env-vars testprevvals)
      (alist->env-vars commonprevvals))))

Modified megatest.scm from [e62367af6c] to [7cb2676ef1].

1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18










-
+







;; Copyright 2006-2011, Matthew Welland.
;; 
;;  This program is made available under the GNU GPL version 2.0 or
;;  greater. See the accompanying file COPYING for details.
;; 
;;  This program is distributed WITHOUT ANY WARRANTY; without even the
;;  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;;  PURPOSE.

(include "common.scm")
(define megatest-version 1.07)
(define megatest-version 1.08)

(define help (conc "
Megatest, documentation at http://www.kiatoa.com/fossils/megatest
  version " megatest-version "
  license GPL, Copyright Matt Welland 2006-2011

Usage: megatest [options]

Modified runs.scm from [482f7844a7] to [1b01ab0bb7].

258
259
260
261
262
263
264

265
266
267
268
269
270
271
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272







+







		    (string->number max-concurrent-jobs)
		    (not (> num-running (string->number max-concurrent-jobs)))))
	   (run-one-test db test-name)
	   (print "WARNING: Max running jobs exceeded, current number running: " num-running 
		  ", max_concurrent_jobs: " max-concurrent-jobs))))
   test-names))

;; VERY INEFFICIENT! Move stuff that should be done once up to calling proc
(define (run-one-test db test-name)
  (print "Launching test " test-name)
  (let* ((test-path    (conc *toppath* "/tests/" test-name))
	 (test-configf (conc test-path "/testconfig"))
	 (testexists   (and (file-exists? test-configf)(file-read-access? test-configf)))
	 (test-conf    (if testexists (read-config test-configf) (make-hash-table)))
	 (waiton       (let ((w (config-lookup test-conf "requirements" "waiton")))
279
280
281
282
283
284
285

286
287
288
289
290
291
292
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294







+







	       (keys        (db-get-keys db))
	       (keyvallst   (keys->vallist keys #t))
	       (items       (hash-table-ref/default test-conf "items" #f))
	       (allitems    (item-assoc->item-list items))
	       (run-id      (register-run db keys)) ;;  test-name)))
	       (runconfigf  (conc  *toppath* "/runconfigs.config")))
	  ;; (print "items: ")(pp allitems)
	  (set-megatest-env-vars db run-id) ;; these may be needed by the launching process
	  (if (args:get-arg "-m")
	      (db:set-comment-for-run db run-id (args:get-arg "-m")))
	  (let loop ((itemdat (car allitems))
		     (tal     (cdr allitems)))
	    ;; (lambda (itemdat) ;;; ((ripeness "overripe") (temperature "cool") (season "summer"))
	    (let* ((item-path     (item-list->path itemdat)) ;; (string-intersperse (map cadr itemdat) "/"))
		   (new-test-path (string-intersperse (cons test-path (map cadr itemdat)) "/"))

Modified tests/megatest.config from [0d07485d64] to [2e6fd74c6d].

9
10
11
12
13
14
15





16
17
18
19
20
21
22
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27







+
+
+
+
+







runsdir /tmp/runs

[jobtools]
# ## launcher launches jobs, the job is managed on the target host
## by megatest, comment out launcher to run local
# workhosts localhost hermes
launcher nbfake

## use "xterm -e csi -- " as a launcher to examine the launch environment.
## exit with (exit)
## get a shell with (system "bash")
# launcher xterm -e csi --

[validvalues]
state start end completed
status pass fail n/a

# These are set before all tests, override them 
# in the testconfig [pre-launch-env-overrides] section