Megatest

Check-in [0add4d5d70]
Login
Overview
Comment:Partial checkin for fixes to -runstep
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0add4d5d70c81b86815f4a2304069d4ff1b3231d
User & Date: mrwellan on 2011-05-06 12:22:56
Other Links: manifest | tags
Context
2011-05-06
14:33
Couple more tweaks to -runstep check-in: adea88835b user: mrwellan tags: trunk
12:22
Partial checkin for fixes to -runstep check-in: 0add4d5d70 user: mrwellan tags: trunk
10:20
Missing fixes redone. runs:test-get-info -> db:test-get-info check-in: 772558f8b5 user: mrwellan tags: trunk
Changes

Modified megatest.scm from [2fe3656792] to [7b8d24e9fd].

48
49
50
51
52
53
54

55
56
57
58
59
60
61
  -xterm                  : start an xterm instead of launching the test

Helpers
  -runstep stepname  ...  : take leftover params as comand and execute as stepname
                            log will be in stepname.log
  -logpro file            : with -exec apply logpro file to stepname.log, creates
                            stepname.html and sets log to same


Called as " (string-intersperse (argv) " ")))

;;  -gui                    : start a gui interface
;;  -config fname           : override the runconfig file with fname

;; process args







>







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
  -xterm                  : start an xterm instead of launching the test

Helpers
  -runstep stepname  ...  : take leftover params as comand and execute as stepname
                            log will be in stepname.log
  -logpro file            : with -exec apply logpro file to stepname.log, creates
                            stepname.html and sets log to same
                            If using make use stepname_logpro.log as your target

Called as " (string-intersperse (argv) " ")))

;;  -gui                    : start a gui interface
;;  -config fname           : override the runconfig file with fname

;; process args
462
463
464
465
466
467
468
469
470
471
472
473
474
475

476
477
478







479
480
481
482
483

484
485
486
487
488
489


490
491
492
493
494
495
496
497
	      (test-set-status! db run-id test-name state status itemdat (args:get-arg "-m"))
	      (if (and state status)
		  (if (not (args:get-arg "-setlog"))
		      (begin
			(print "ERROR: You must specify :state and :status with every call to -test-status\n" help)
			(sqlite3:finalize! db)
			(exit 6)))))
	  (if (args:get-arg "-run-step")
	      (if (null? remargs)
		  (begin
		    (print "ERROR: nothing specified to run!")
		    (sqlite3:finalize! db)
		    (exit 6))
		  (let* ((logprofile (args:get-arg "-logpro"))

			 (cmd        (if (null? remargs) #f (car remargs)))
			 (params     (if cmd (cdr remargs) #f))
			 (exitstat   #f))







		    ;; mark the start of the test
		    (test-set-status! db run-id test-name "start" "n/a" itemdat (args:get-arg "-m"))
		    ;; close the db
		    (sqlite3:finalize! db)
		    ;; run the test step

		    (set! exitstat (process-run cmd params))
		    ;; re-open the db
		    (set! db (open-db)) 
		    ;; run logpro if applicable
		    (if logpro
			(let ((logfile (conc test-name ".html")))


			  (set! exitstat (process-run "logpro" logpro logfile))
			  (test-set-log! db run-id test-name itemdat logfile)))
		    (test-set-status! db run-id test-name "end" exitstat itemdat (args:get-arg "-m"))
		    (sqlite3:finalize! db)
		    (exit exitstat)
		    ;; open the db
		;; mark the end of the test
		)))







|






>

|
|
>
>
>
>
>
>
>





>
|


|

|
>
>
|







463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
	      (test-set-status! db run-id test-name state status itemdat (args:get-arg "-m"))
	      (if (and state status)
		  (if (not (args:get-arg "-setlog"))
		      (begin
			(print "ERROR: You must specify :state and :status with every call to -test-status\n" help)
			(sqlite3:finalize! db)
			(exit 6)))))
	  (if (args:get-arg "-runstep")
	      (if (null? remargs)
		  (begin
		    (print "ERROR: nothing specified to run!")
		    (sqlite3:finalize! db)
		    (exit 6))
		  (let* ((logprofile (args:get-arg "-logpro"))
			 (logfile    (conc test-name ".log"))
			 (cmd        (if (null? remargs) #f (car remargs)))
			 (params     (if cmd (cdr remargs) '()))
			 (exitstat   #f)
			 (shell      (last (string-split (get-environment-variable "SHELL") "/")))
			 (redir      (case (string->symbol shell)
				       ((tcsh csh ksh)    ">&")
				       ((zsh bash sh ash) "2>&1")))
			 (fullcmd    (string-intersperse 
				      (cons cmd (list params redir logfile))
				      " ")))
		    ;; mark the start of the test
		    (test-set-status! db run-id test-name "start" "n/a" itemdat (args:get-arg "-m"))
		    ;; close the db
		    (sqlite3:finalize! db)
		    ;; run the test step
		    (print "INFO: Running " fullcmd)
		    (set! exitstat (process-run fullcmd)) ;; cmd params))
		    ;; re-open the db
		    (set! db (open-db)) 
		    ;; run logpro if applicable ;; (process-run "ls" (list "/foo" "2>&1" "blah.log"))
		    (if logpro
			(let ((htmllogfile (conc test-name ".html"))
			      (cmd         (string-intersperse (list "logpro" logpro logfile "<" logfile ">" (conc test-name "_logpro.log")) " ")))
			  (print "INFO: running " cmd)
			  (set! exitstat (process-run cmd))
			  (test-set-log! db run-id test-name itemdat logfile)))
		    (test-set-status! db run-id test-name "end" exitstat itemdat (args:get-arg "-m"))
		    (sqlite3:finalize! db)
		    (exit exitstat)
		    ;; open the db
		;; mark the end of the test
		)))

Modified tests/megatest.config from [c2d2bae88c] to [36955f5b25].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[fields]
sysname TEXT
fsname TEXT
datapath TEXT

[setup]
# executable /home/matt/data/megatest/megatest
max_concurrent_jobs 5

[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






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
[fields]
sysname TEXT
fsname TEXT
datapath TEXT

[setup]
executable /nfs/ch/disks/ch_unienv_disk005/qa_mrwellan/interim/src/megatest/megatest
max_concurrent_jobs 5

[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

Modified tests/tests/runfirst/main.sh from [b6ac44a0c4] to [90abad0086].

1
2
3
4
5
6


7
#!/bin/bash

megatest -step wasting_time :state start :status n/a -m "This is a test step comment"
sleep 20
megatest -step wasting_time :state end :status $?



megatest -test-status :state COMPLETED :status PASS -setlog thelogfile.log -m "This is a test level comment"


|
|
|

>
>

1
2
3
4
5
6
7
8
9
#!/bin/bash

# megatest -step wasting_time :state start :status n/a -m "This is a test step comment"
# sleep 20
# megatest -step wasting_time :state end :status $?

megatest -runstep wasting_time -logpro wasting_time.logpro "sleep 20;echo all done eh?" -m "This is a test step comment"

megatest -test-status :state COMPLETED :status PASS -setlog thelogfile.log -m "This is a test level comment"