Megatest

Check-in [33295b94b3]
Login
Overview
Comment:Added basic template for getting changed runs. Fixed exit handling, exit promptly after cleanup
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.60
Files: files | file ages | folders
SHA1: 33295b94b34130cc0cf183e4651a4d071ca6bf59
User & Date: matt on 2015-05-28 06:57:31
Other Links: branch diff | manifest | tags
Context
2015-05-28
09:02
Completed -since support and reversed order of runs in the stats summary table check-in: b0d737abcc user: mrwellan tags: v1.60
06:57
Added basic template for getting changed runs. Fixed exit handling, exit promptly after cleanup check-in: 33295b94b3 user: matt tags: v1.60
00:18
Corrected exit delays, added attempted repair on discovering a corrupted db check-in: d125f9632a user: matt tags: v1.60
Changes

Modified common.scm from [005a48a275] to [c395efd7a6].

279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
					(begin
					  (sqlite3:interrupt! db)
					  (sqlite3:finalize! db #t)
					  (vector-set! *task-db* 0 #f)))))) "Cleanup db exit thread"))
	  (th2 (make-thread (lambda ()
			      (debug:print 4 "Attempting clean exit. Please be patient and wait a few seconds...")
			      (if no-hurry
				  (thread-sleep! 0.1) ;; give the clean up few seconds to do it's stuff
				  (thread-sleep! 4))
			      (debug:print 4 " ... done")
			      )
			    "clean exit")))
      (thread-start! th2)
      (thread-start! th1)
      (thread-join! th2))))

(define (std-signal-handler signum)
  ;; (signal-mask! signum)
  (set! *time-to-exit* #t)
  (debug:print 0 "ERROR: Received signal " signum " exiting promptly")
  ;; (std-exit-procedure) ;; shouldn't need this since we are exiting and it will be called anyway
  (exit))







|
|



|
|
|







279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
					(begin
					  (sqlite3:interrupt! db)
					  (sqlite3:finalize! db #t)
					  (vector-set! *task-db* 0 #f)))))) "Cleanup db exit thread"))
	  (th2 (make-thread (lambda ()
			      (debug:print 4 "Attempting clean exit. Please be patient and wait a few seconds...")
			      (if no-hurry
				  (thread-sleep! 5) ;; give the clean up few seconds to do it's stuff
				  (thread-sleep! 2))
			      (debug:print 4 " ... done")
			      )
			    "clean exit")))
      (thread-start! th1)
      (thread-start! th2)
      (thread-join! th1))))

(define (std-signal-handler signum)
  ;; (signal-mask! signum)
  (set! *time-to-exit* #t)
  (debug:print 0 "ERROR: Received signal " signum " exiting promptly")
  ;; (std-exit-procedure) ;; shouldn't need this since we are exiting and it will be called anyway
  (exit))

Modified megatest.scm from [134d7dd741] to [3bcf86d151].

125
126
127
128
129
130
131

132
133
134
135
136
137
138
  -list-db-targets        : list the target combinations used in the db
  -show-config            : dump the internal representation of the megatest.config file
  -show-runconfig         : dump the internal representation of the runconfigs.config file
  -dumpmode json          : dump in json format instead of sexpr
  -show-cmdinfo           : dump the command info for a test (run in test environment)
  -section sectionName
  -var varName            : for config and runconfig lookup value for sectionName varName


Misc 
  -start-dir path         : switch to this directory before running megatest
  -rebuild-db             : bring the database schema up to date
  -cleanup-db             : remove any orphan records, vacuum the db
  -import-megatest.db     : migrate a database from v1.55 series to v1.60 series
  -sync-to-megatest.db    : migrate data back to megatest.db







>







125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
  -list-db-targets        : list the target combinations used in the db
  -show-config            : dump the internal representation of the megatest.config file
  -show-runconfig         : dump the internal representation of the runconfigs.config file
  -dumpmode json          : dump in json format instead of sexpr
  -show-cmdinfo           : dump the command info for a test (run in test environment)
  -section sectionName
  -var varName            : for config and runconfig lookup value for sectionName varName
  -changed-runs-since N   : get list of runs changed since time N (Unix seconds)

Misc 
  -start-dir path         : switch to this directory before running megatest
  -rebuild-db             : bring the database schema up to date
  -cleanup-db             : remove any orphan records, vacuum the db
  -import-megatest.db     : migrate a database from v1.55 series to v1.60 series
  -sync-to-megatest.db    : migrate data back to megatest.db
241
242
243
244
245
246
247

248
249
250
251
252
253
254
			"-dumpmode"
			"-run-id"
			"-ping"
			"-refdb2dat"
			"-o"
			"-log"
			"-archive"

			) 
		 (list  "-h" "-help" "--help"
			"-version"
		        "-force"
		        "-xterm"
		        "-showkeys"
		        "-show-keys"







>







242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
			"-dumpmode"
			"-run-id"
			"-ping"
			"-refdb2dat"
			"-o"
			"-log"
			"-archive"
			"-changed-runs-since"
			) 
		 (list  "-h" "-help" "--help"
			"-version"
		        "-force"
		        "-xterm"
		        "-showkeys"
		        "-show-keys"
985
986
987
988
989
990
991






















992
993
994
995
996
997
998
						 (tdb:step-get-event_time step)))
				       steps)))))))))
		      tests)))))
	   runs)
	  (if (eq? dmode 'json)(json-write data))
	  (set! *didsomething* #t))))























;;======================================================================
;; full run
;;======================================================================

;; get lock in db for full run for this directory
;; for all tests with deps
;;   walk tree of tests to find head tasks







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
						 (tdb:step-get-event_time step)))
				       steps)))))))))
		      tests)))))
	   runs)
	  (if (eq? dmode 'json)(json-write data))
	  (set! *didsomething* #t))))

(if (and (args:get-arg "-changed-runs-since")
	 (launch:setup-for-run))
    (let* ((since-time (string->number (args:get-arg "-changed-runs-since")))
	   (dbdir      (db:dbfile-path #f)) ;; (configf:lookup *configdat* "setup" "dbdir"))
	   (alldbs     (glob (conc dbdir "/[0-9]*.db")))
	   (changed    (filter (lambda (dbfile)
				 (> (file-modification-time dbfile) since-time))
			       alldbs))
	   (run-ids    (delete-duplicates
			(map (lambda (dbfile)
			       (let* ((res (string-match ".*\\/(\\d)*\\.db" dbfile)))
				 (if res
				     (string->number (cadr res))
				     (begin
				       (debug:print 2 "ERROR: Failed to process " dbfile " for run-id")
				       0))))
			     changed))))
      ;; (rmt:get-tests-for-runs-mindata run-ids testpatt states status not-in)
      (print (sort run-ids <))
      (set! *didsomething* #t)))
      
      
;;======================================================================
;; full run
;;======================================================================

;; get lock in db for full run for this directory
;; for all tests with deps
;;   walk tree of tests to find head tasks