Megatest

Check-in [a1e072dbd2]
Login
Overview
Comment:Incrementally putting stuff back in place for re-written runs.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | reorg-runs-code
Files: files | file ages | folders
SHA1: a1e072dbd222ec1864e67a6f38e8e81c59e4456d
User & Date: matt on 2011-11-20 23:13:08
Other Links: branch diff | manifest | tags
Context
2011-11-23
22:57
Documentation updates check-in: e7b8c589d6 user: matt tags: reorg-runs-code
2011-11-20
23:13
Incrementally putting stuff back in place for re-written runs. check-in: a1e072dbd2 user: matt tags: reorg-runs-code
22:39
Fixed compilation check-in: ddc42ef201 user: matt tags: reorg-runs-code
Changes

Modified configf.scm from [e31d2a9565] to [a8e7a14c9a].

89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
								      (if (null? res)
									  ""
									  (string-intersperse res " "))))))
						    (hash-table-set! res curr-section-name 
								     (config:assoc-safe-add alist
											    key 
											    (if (eq? allow-system 'return-procs)
												val
												(val))))
						    (loop (read-line inp) curr-section-name #f #f))
						  (loop (read-line inp) curr-section-name #f #f)))
	       (key-val-pr ( x key val      ) (let* ((alist   (hash-table-ref/default res curr-section-name '()))
						     (envar   (and environ-patt (string-match (regexp environ-patt) curr-section-name)))
						     (realval (if envar
								 (config:eval-string-in-environment val)
								 val)))







|
|







89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
								      (if (null? res)
									  ""
									  (string-intersperse res " "))))))
						    (hash-table-set! res curr-section-name 
								     (config:assoc-safe-add alist
											    key 
											    (if (eq? allow-system 'return-procs)
												val-proc
												(val-proc))))
						    (loop (read-line inp) curr-section-name #f #f))
						  (loop (read-line inp) curr-section-name #f #f)))
	       (key-val-pr ( x key val      ) (let* ((alist   (hash-table-ref/default res curr-section-name '()))
						     (envar   (and environ-patt (string-match (regexp environ-patt) curr-section-name)))
						     (realval (if envar
								 (config:eval-string-in-environment val)
								 val)))

Modified items.scm from [b49fc1c23e] to [c4333570bf].

125
126
127
128
129
130
131
132
133




134
135
136
137
138
139
140
141
142
143
    (if valid-values
	(if (member item valid-values)
	    item #f)
	item)))

(define (items:get-items-from-config tconfig)
  (let* (;; db is always at *toppath*/db/megatest.db
	 (items       (hash-table-ref/default test-conf "items" '()))
	 (itemstable  (hash-table-ref/default test-conf "itemstable" '()))




	 (allitems    (if (or (not (null? items))(not (null? itemstable)))
			  (append (item-assoc->item-list items)
				  (item-table->item-list itemstable))
			  '(()))))
    allitems))

;; (pp (item-assoc->item-list itemdat))


	







|
|
>
>
>
>
|
|
|
|
<





125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141

142
143
144
145
146
    (if valid-values
	(if (member item valid-values)
	    item #f)
	item)))

(define (items:get-items-from-config tconfig)
  (let* (;; db is always at *toppath*/db/megatest.db
	 (items       (hash-table-ref/default tconfig "items" '()))
	 (itemstable  (hash-table-ref/default tconfig "itemstable" '())))
    (if (procedure? items)
	(set! items (items)))
    (if (procedure? itemstable)
	(set! itemstable (itemstable)))
    (if (or (not (null? items))(not (null? itemstable)))
	(append (item-assoc->item-list items)
		(item-table->item-list itemstable))
	'(()))))


;; (pp (item-assoc->item-list itemdat))


	

Added monitor.scm version [6e7a5682b5].



















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
;; 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.

;;  strftime('%m/%d/%Y %H:%M:%S','now','localtime')

(use sqlite3 srfi-1 posix regex regex-case srfi-69 dot-locking)
(import (prefix sqlite3 sqlite3:))

(declare (unit runs))
(declare (uses db))
(declare (uses common))
(declare (uses items))
(declare (uses runconfig))

(include "common_records.scm")
(include "key_records.scm")
(include "db_records.scm")
(include "run_records.scm")

Modified runs.scm from [9e5179a7af] to [40f0efb0b5].

197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
     ;; now remove duplicates
    (set! test-names (delete-duplicates test-names))

    (debug:print 0 "INFO: test names " test-names)

    ;; on the first pass or call to run-tests set FAILS to NOT_STARTED if
    ;; -keepgoing is specified
    (if (and (eq? *passnum* 0)
	     keepgoing)
	(begin
	  ;; have to delete test records where NOT_STARTED since they can cause -keepgoing to 
	  ;; get stuck due to becoming inaccessible from a failed test. I.e. if test B depends 
	  ;; on test A but test B reached the point on being registered as NOT_STARTED and test
	  ;; A failed for some reason then on re-run using -keepgoing the run can never complete.
	  (db:delete-tests-in-state db run-id "NOT_STARTED")
	  (db:set-tests-state-status db run-id test-names #f "FAIL" "NOT_STARTED" "FAIL")))

    ;; now add non-directly referenced dependencies (i.e. waiton)
    (if (not (null? test-names))
	(let loop ((hed (car test-names))
		   (tal (cdr test-names)))         ;; 'return-procs tells the config reader to prep running system but return a proc
	  (let* ((config  (test:get-testconfig hed 'return-procs))
		 (waitons (string-split (let ((w (config-lookup config "requirements" "waiton")))
					  (if w w ""))))
		 (items   (items:get-items-from-config config)))
	    (if (not (hash-table-ref/default test-records hed #f))
		(hash-table-set! test-records hed (vector hed config waitons (config-lookup "requirements" "priority") #f)))
	    (for-each 
	     (lambda (waiton)
	       (if (and waiton (not (member waiton test-names)))
		   (begin
		     (set! required-tests (cons waiton required-tests))
		     (set! test-names (append test-names (list waiton))))))
	     waitons)
	    (let ((remtests (delete-duplicates (append waitons tal))))
	      (if (not (null? remtests))
		  (loop (car remtests)(cdr remtests)))))))

    (if (not (null? required-tests))
	(debug:print 1 "INFO: Adding " required-tests " to the run queue"))
    ;; NOTE: these are all parent tests, items are not expanded yet.
    (runs:run-tests-queue test-records)))

(define (runs:run-tests-queue  test-records keyvallist)
    ;; At this point the list of parent tests is expanded 
    ;; NB// Should expand items here and then insert into the run queue.
    (let ((sorted-testnames (tests:sort-by-priority-and-waiton test-records)))
      (let loop (; (numtimes 0) ;; shouldn't need this
		 (hed         (car sorted-test-names))
		 (tal         (cdr sorted-test-names)))
	(let* ((test-record (hash-table-ref test-records hed))
	       (tconfig     (tests:testqueue-get-testconfig test-record))
	       (waitons     (tests:testqueue-get-waitons    test-record))
	       (priority    (tests:testqueue-get-priority   test-record))
	       (itemdat     (tests:testqueue-get-itemdat    test-record))
	       (items       (tests:testqueue-get-items      test-record))
	       (item-path   (item-list->path itemdat)))
	  (cond







|
<














|
|

|














|








|







197
198
199
200
201
202
203
204

205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
     ;; now remove duplicates
    (set! test-names (delete-duplicates test-names))

    (debug:print 0 "INFO: test names " test-names)

    ;; on the first pass or call to run-tests set FAILS to NOT_STARTED if
    ;; -keepgoing is specified
    (if (eq? *passnum* 0)

	(begin
	  ;; have to delete test records where NOT_STARTED since they can cause -keepgoing to 
	  ;; get stuck due to becoming inaccessible from a failed test. I.e. if test B depends 
	  ;; on test A but test B reached the point on being registered as NOT_STARTED and test
	  ;; A failed for some reason then on re-run using -keepgoing the run can never complete.
	  (db:delete-tests-in-state db run-id "NOT_STARTED")
	  (db:set-tests-state-status db run-id test-names #f "FAIL" "NOT_STARTED" "FAIL")))

    ;; now add non-directly referenced dependencies (i.e. waiton)
    (if (not (null? test-names))
	(let loop ((hed (car test-names))
		   (tal (cdr test-names)))         ;; 'return-procs tells the config reader to prep running system but return a proc
	  (let* ((config  (test:get-testconfig hed 'return-procs))
		 (waitons (string-split (let ((w (config-lookup config "requirements" "waiton")))
					  (if w w "")))))
;;		 (items   (items:get-items-from-config config)))
	    (if (not (hash-table-ref/default test-records hed #f))
		(hash-table-set! test-records hed (vector hed config waitons (config-lookup config "requirements" "priority") #f)))
	    (for-each 
	     (lambda (waiton)
	       (if (and waiton (not (member waiton test-names)))
		   (begin
		     (set! required-tests (cons waiton required-tests))
		     (set! test-names (append test-names (list waiton))))))
	     waitons)
	    (let ((remtests (delete-duplicates (append waitons tal))))
	      (if (not (null? remtests))
		  (loop (car remtests)(cdr remtests)))))))

    (if (not (null? required-tests))
	(debug:print 1 "INFO: Adding " required-tests " to the run queue"))
    ;; NOTE: these are all parent tests, items are not expanded yet.
    (runs:run-tests-queue test-records keyvallist)))

(define (runs:run-tests-queue  test-records keyvallist)
    ;; At this point the list of parent tests is expanded 
    ;; NB// Should expand items here and then insert into the run queue.
    (let ((sorted-testnames (tests:sort-by-priority-and-waiton test-records)))
      (let loop (; (numtimes 0) ;; shouldn't need this
		 (hed         (car sorted-test-names))
		 (tal         (cdr sorted-test-names)))
	(let* ((test-record (hash-table-ref test-records hed))                         WHERE TO DO: (items:get-items-from-config config)
	       (tconfig     (tests:testqueue-get-testconfig test-record))
	       (waitons     (tests:testqueue-get-waitons    test-record))
	       (priority    (tests:testqueue-get-priority   test-record))
	       (itemdat     (tests:testqueue-get-itemdat    test-record))
	       (items       (tests:testqueue-get-items      test-record))
	       (item-path   (item-list->path itemdat)))
	  (cond
297
298
299
300
301
302
303

304
305
306
307
308
309
310
	    (loop (car tal)(cdr tal)))

	   ;; if items is a proc then need to evaluate, get the list and loop - but only do that if 
	   ;; resources exist to kick off the job
	   ((procedure? items)
	    (if (runs:can-run-more-tests db test-record)
		(let ((items-list (items)))

		  (if (list? items-list)
		      (begin
			(tests:testqueue-set-items test-record items-list)
			(loop hed tal))
		      (begin
			(debug:print 0 "ERROR: The proc from reading the setup did not yield a list - please report this")
			(exit 1))))







>







296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
	    (loop (car tal)(cdr tal)))

	   ;; if items is a proc then need to evaluate, get the list and loop - but only do that if 
	   ;; resources exist to kick off the job
	   ((procedure? items)
	    (if (runs:can-run-more-tests db test-record)
		(let ((items-list (items)))
		      
		  (if (list? items-list)
		      (begin
			(tests:testqueue-set-items test-record items-list)
			(loop hed tal))
		      (begin
			(debug:print 0 "ERROR: The proc from reading the setup did not yield a list - please report this")
			(exit 1))))