Megatest

Check-in [d85a8b185b]
Login
Overview
Comment:Partially implemented, fully documented new itemmap mechanism
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.60
Files: files | file ages | folders
SHA1: d85a8b185bf035b094b8d9b9abac9d13d01dc1f0
User & Date: matt on 2015-09-12 00:19:35
Other Links: branch diff | manifest | tags
Context
2015-09-12
00:22
Added missing png file check-in: e3e07ee085 user: matt tags: v1.60
00:20
Merged v1.60 to bring in documentation check-in: d2a2e7f397 user: matt tags: trunk
00:19
Partially implemented, fully documented new itemmap mechanism check-in: d85a8b185b user: matt tags: v1.60
2015-09-10
23:03
Added some documentation on forthcoming itemmap section. check-in: 0667dc8f63 user: matt tags: v1.60, v1.6023_ww37.5a
Changes

Modified db.scm from [bdb2d67cdd] to [5bb794bf74].

3264
3265
3266
3267
3268
3269
3270


3271
3272


3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
		  res))))

;;======================================================================
;; M I S C   M A N A G E M E N T   I T E M S 
;;======================================================================

;; A routine to map itempaths using a itemmap


(define (db:compare-itempaths patha pathb itemmap)
  (debug:print-info 6 "ITEMMAP is " itemmap)


  (if itemmap
      (let ((pathb-mapped (db:multi-pattern-apply pathb itemmap)))
	(debug:print-info 6 "ITEMMAP is " itemmap ", path: " pathb ", mapped path: " pathb-mapped)
	(equal? patha pathb-mapped))
      (equal? patha pathb)))

;; (let* ((mapparts    (string-split itemmap))
;; 	     (pattern     (car mapparts))
;; 	     (replacement (if (> (length mapparts) 1) (cadr mapparts) "")))
;; 	(if replacement
;; 	    (equal? (string-substitute pattern replacement patha)
;; 		    (string-substitute pattern replacement pathb))
;; 	    (equal? (string-substitute pattern "" patha)
;; 		    (string-substitute pattern "" pathb))))

;; A routine to convert test/itempath using a itemmap
;; NOTE: to process only an itempath (i.e. no prepended testname)
;;       just call db:multi-pattern-apply
;;
(define (db:convert-test-itempath path-in itemmap)
  (debug:print-info 6 "ITEMMAP is " itemmap)







>
>
|
|
>
>
|
|
|
|
|
<
<
<
<
<
<
<
<
<







3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281









3282
3283
3284
3285
3286
3287
3288
		  res))))

;;======================================================================
;; M I S C   M A N A G E M E N T   I T E M S 
;;======================================================================

;; A routine to map itempaths using a itemmap
;; patha and pathb must be strings or this will fail
;;
(define (db:compare-itempaths patha pathb itemmaps)
  (debug:print-info 6 "ITEMMAPS: " itemmaps)
  (let* ((testname-a (car (string-split patha "/")))
	 (itemmap    (tests:lookup-itemmap itemmaps testname-a)))
    (if itemmap
	(let ((pathb-mapped (db:multi-pattern-apply pathb itemmap)))
	  (debug:print-info 6 "ITEMMAP is " itemmap ", path: " pathb ", mapped path: " pathb-mapped)
	  (equal? patha pathb-mapped))
	(equal? patha pathb))))










;; A routine to convert test/itempath using a itemmap
;; NOTE: to process only an itempath (i.e. no prepended testname)
;;       just call db:multi-pattern-apply
;;
(define (db:convert-test-itempath path-in itemmap)
  (debug:print-info 6 "ITEMMAP is " itemmap)
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
;;    if prereq test with itempath=ref-item-path and COMPLETED with PASS, WARN, CHECK, or WAIVED then prereq is met
;;
;; Note: mode 'normal means that tests must be COMPLETED and ok (i.e. PASS, WARN, CHECK, SKIP or WAIVED)
;;       mode 'toplevel means that tests must be COMPLETED only
;;       mode 'itemmatch or 'itemwait means that tests items must be COMPLETED and (PASS|WARN|WAIVED|CHECK) [[ NB// NOT IMPLEMENTED YET ]]
;; 
;; (define (db:get-prereqs-not-met dbstruct run-id waitons ref-item-path mode)
(define (db:get-prereqs-not-met dbstruct run-id waitons ref-item-path mode itemmap) ;; #!key (mode '(normal))(itemmap #f))
  (if (or (not waitons)
	  (null? waitons))
      '()
      (let* ((unmet-pre-reqs '())
	     (result         '()))
	(for-each 
	 (lambda (waitontest-name)







|







3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
;;    if prereq test with itempath=ref-item-path and COMPLETED with PASS, WARN, CHECK, or WAIVED then prereq is met
;;
;; Note: mode 'normal means that tests must be COMPLETED and ok (i.e. PASS, WARN, CHECK, SKIP or WAIVED)
;;       mode 'toplevel means that tests must be COMPLETED only
;;       mode 'itemmatch or 'itemwait means that tests items must be COMPLETED and (PASS|WARN|WAIVED|CHECK) [[ NB// NOT IMPLEMENTED YET ]]
;; 
;; (define (db:get-prereqs-not-met dbstruct run-id waitons ref-item-path mode)
(define (db:get-prereqs-not-met dbstruct run-id waitons ref-item-path mode itemmaps) ;; #!key (mode '(normal))(itemmap #f))
  (if (or (not waitons)
	  (null? waitons))
      '()
      (let* ((unmet-pre-reqs '())
	     (result         '()))
	(for-each 
	 (lambda (waitontest-name)
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
		(let* ((state             (db:test-get-state test))
		       (status            (db:test-get-status test))
		       (item-path         (db:test-get-item-path test))
		       (is-completed      (equal? state "COMPLETED"))
		       (is-running        (equal? state "RUNNING"))
		       (is-killed         (equal? state "KILLED"))
		       (is-ok             (member status '("PASS" "WARN" "CHECK" "WAIVED" "SKIP")))
		       (same-itempath     (db:compare-itempaths item-path ref-item-path itemmap))) ;; (equal? ref-item-path item-path)))
		  (set! ever-seen #t)
		  (cond
		   ;; case 1, non-item (parent test) is 
		   ((and (equal? item-path "") ;; this is the parent test of the waiton being examined
			 is-completed
			 (or is-ok (not (null? (lset-intersection eq? mode '(toplevel)))))) ;;  itemmatch itemwait))))))
		    (set! parent-waiton-met #t))
		   ;; Special case for toplevel and KILLED
		   ((and (equal? item-path "") ;; this is the parent test
			 is-killed
			 (member 'toplevel mode))
		    (set! parent-waiton-met #t))
		   ;; For itemwait mode IFF the previous matching item is good the set parent-waiton-met
		   ((and (not (null? (lset-intersection eq? mode '(itemmatch itemwait))))
			 ;; (not (equal? item-path "")) ;; this applies to both top level (to allow launching of next batch) and items
			 same-itempath)
		    (if (and is-completed is-ok)
			(set! item-waiton-met #t))
		    (if (and (equal? item-path "")
			     (or is-completed is-running));; this is the parent, set it to run if completed or running
			(set! parent-waiton-met #t)))







|













|







3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
		(let* ((state             (db:test-get-state test))
		       (status            (db:test-get-status test))
		       (item-path         (db:test-get-item-path test))
		       (is-completed      (equal? state "COMPLETED"))
		       (is-running        (equal? state "RUNNING"))
		       (is-killed         (equal? state "KILLED"))
		       (is-ok             (member status '("PASS" "WARN" "CHECK" "WAIVED" "SKIP")))
		       (same-itempath     (db:compare-itempaths item-path ref-item-path itemmaps))) ;; (equal? ref-item-path item-path)))
		  (set! ever-seen #t)
		  (cond
		   ;; case 1, non-item (parent test) is 
		   ((and (equal? item-path "") ;; this is the parent test of the waiton being examined
			 is-completed
			 (or is-ok (not (null? (lset-intersection eq? mode '(toplevel)))))) ;;  itemmatch itemwait))))))
		    (set! parent-waiton-met #t))
		   ;; Special case for toplevel and KILLED
		   ((and (equal? item-path "") ;; this is the parent test
			 is-killed
			 (member 'toplevel mode))
		    (set! parent-waiton-met #t))
		   ;; For itemwait mode IFF the previous matching item is good the set parent-waiton-met
		   ((and (not (null? (lset-intersection eq? mode '(itemmatch itemwait)))) ;; how is that different from (member mode '(itemmatch itemwait)) ?????
			 ;; (not (equal? item-path "")) ;; this applies to both top level (to allow launching of next batch) and items
			 same-itempath)
		    (if (and is-completed is-ok)
			(set! item-waiton-met #t))
		    (if (and (equal? item-path "")
			     (or is-completed is-running));; this is the parent, set it to run if completed or running
			(set! parent-waiton-met #t)))

Modified docs/manual/Makefile from [1dcb0e5ef2] to [e2d37f7054].

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




28
29

# in a makefile recipe, $< denotes the first dependency; $@ the target

# design_spec.html : $(SRCFILES) $(CSVFILES)
#         asciidoc -b html5 -a icons -a iconsdir=$(DISPATH)/images/icons -a toc2 design_spec.txt
#

all : server.ps megatest_manual.html client.ps

megatest_manual.html : megatest_manual.txt getting_started.txt writing_tests.txt reference.txt ../plan.txt howto.txt *png
	asciidoc  -b html5 -a icons -a iconsdir=$(DISPATH)/images/icons -a toc2 megatest_manual.txt
#	dos2unix megatest_manual.html

server.ps : server.dot
	dot -Tps server.dot > server.ps

client.ps : client.dot
	dot -Tps client.dot > client.ps





clean:
	rm -f megatest_manual.html







|











>
>
>
>


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

# in a makefile recipe, $< denotes the first dependency; $@ the target

# design_spec.html : $(SRCFILES) $(CSVFILES)
#         asciidoc -b html5 -a icons -a iconsdir=$(DISPATH)/images/icons -a toc2 design_spec.txt
#

all : server.ps megatest_manual.html client.ps complex-itemmap.png

megatest_manual.html : megatest_manual.txt getting_started.txt writing_tests.txt reference.txt ../plan.txt howto.txt *png
	asciidoc  -b html5 -a icons -a iconsdir=$(DISPATH)/images/icons -a toc2 megatest_manual.txt
#	dos2unix megatest_manual.html

server.ps : server.dot
	dot -Tps server.dot > server.ps

client.ps : client.dot
	dot -Tps client.dot > client.ps

complex-itemmap.png : complex-itemmap.dot
	dot -Tpng complex-itemmap.dot -o complex-itemmap.png
	dot -Tpdf complex-itemmap.dot -o complex-itemmap.pdf

clean:
	rm -f megatest_manual.html

Modified docs/manual/complex-itemmap.dot from [8da3aa8d08] to [1ce1e37196].

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
26
27

28

29
30
31
32
33
34
35
digraph G {

    // put client after server so server_start node is visible
    //
    subgraph cluster_2 {
        node [style=filled,shape=box];
	
	"test1"                  -> test2;
	runremote_lookup_server  -> login_attempt [label="have server"];
	runremote_lookup_server  -> monitordb_lookup_server [label="no server"];





	monitordb_lookup_server  -> login_attempt [label="have server"];
	monitordb_lookup_server  -> server_start_remote [label="no server"];



	server_start_remote      -> delay_2_sec;



	delay_2_sec              -> runremote_lookup_server;

	login_attempt            -> "rmt:send-receive_start" [label="login sucessful"];
	"rmt:send-receive_start" -> "rmt:send-receive_start";



	"rmt:send-receive_start" -> runremote_lookup_server [label=exception];
	login_attempt            -> clear_runremote [label="login failed"];

	"remove_running > 5s"    -> runremote_lookup_server;


	subgraph cluster_3 {
		node [style=filled];

		clear_runremote          -> "remove_running > 5s";

	}

        label = "client:setup";
        color=green;
    }

}




|


|
|
|
>
>
|
>
>
|
<
>
>
|
|
>
>
>
|
|
|
|
|
>
>
|
<
|
|
>
|
|

>
|
>


|




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
26
27
28
29
30
31

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
digraph G {

    // put client after server so server_start node is visible
    //
    subgraph cluster_1 {
        node [style=filled,shape=box];
	
	subgraph cluster_3 {
		node [style=filled];
		label = "Test B";
		"B/bb/2";
		"B/bb/1";
	}
	subgraph cluster_2 {
		node [style=filled];
		label = "Test A";

		"A/aa/2";
		"A/aa/1" [color=cyan];
	}
	subgraph cluster_4 {
		node [style=filled];
		label = "Test C";
		"C/1/aa" [color=cyan];
		"A/aa/1" -> "C/1/aa";
		"B/bb/1" -> "C/1/bb";
		"A/aa/2" -> "C/2/aa";
		"B/bb/2" -> "C/2/bb";
	}
	subgraph cluster_5 {
		node [style=filled];
		label = "Test D";

		 "D/1/res" [color=cyan];
		"C/1/aa" -> "D/1/res";
		"C/2/aa" -> "D/2/res";
	}
	subgraph cluster_6 {
		node [style=filled];
		label = "Test E";
		"C/1/bb" -> "E/1/res";
		"C/2/bb" -> "E/2/res";
	}

        label = "Complex Itemmapping";
        color=green;
    }

}

Modified docs/manual/itemmap.fig from [b4d6c529cd] to [3b4d1aa45b].

86
87
88
89
90
91
92















93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108



109
110
111
112
113
114
115

116
117
118


119
120
121
122
123
124
125
126
127


128
129
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
	 5490 4950 5490 5085 5985 5085 5985 4590 5850 4590
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
	 5625 5085 5625 5220 6120 5220 6120 4725 5985 4725
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
	 5760 5220 5760 5355 6255 5355 6255 4860 6120 4860
-6















2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 5355 4455 4500 3600
2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 5400 1800 4500 2700
2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 3600 3600 2700 4500
2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 3510 2610 2790 1890
2 2 0 2 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
	 1530 675 3060 675 3060 5580 1530 5580 1530 675
2 2 0 2 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
	 3195 675 4815 675 4815 5580 3195 5580 3195 675



2 2 0 2 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
	 4950 675 6660 675 6660 5580 4950 5580 4950 675
2 2 0 2 7 7 50 -1 -1 0.000 0 0 -1 0 0 5
	 0 45 8550 45 8550 7245 0 7245 0 45
2 1 0 2 23 7 50 -1 -1 0.000 0 0 -1 1 0 3
	0 0 1.00 60.00 120.00
	 5040 6300 4050 5175 4050 3690

2 1 0 2 23 7 50 -1 -1 0.000 0 0 -1 1 0 3
	0 0 1.00 60.00 120.00
	 1080 5850 1080 2115 1755 1530


4 0 0 50 -1 0 16 0.0000 4 135 360 1935 4725 TstB\001
4 0 0 50 -1 0 16 0.0000 4 135 360 5445 1170 TstC\001
4 0 0 50 -1 0 16 0.0000 4 135 360 5445 4770 TstD\001
4 0 0 50 -1 0 16 0.0000 4 135 360 3600 2970 TstE\001
4 0 0 50 -1 0 16 0.0000 4 135 360 1845 1170 TstA\001
4 0 0 50 -1 0 16 0.0000 4 180 1260 900 6210 [requirements]\001
4 0 0 50 -1 0 16 0.0000 4 135 990 900 6405 waiton TstE\001
4 0 0 50 -1 0 16 0.0000 4 180 2070 900 6600 itemap foo/(\\d+) \\1/bar\001
4 0 0 50 -1 0 16 0.0000 4 180 810 5220 6165 [itemmap]\001


4 0 0 50 -1 0 16 0.0000 4 150 1260 5220 6360 TstC  .*/ foo/\001
4 0 0 50 -1 0 16 0.0000 4 165 1080 5220 6555 TstD ab/ xy/\001







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
















>
>
>


<
<


<
>


|
>
>
|
|
|
|
|
|
|
|
|
>
>
|
|
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128


129
130

131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
	 5490 4950 5490 5085 5985 5085 5985 4590 5850 4590
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
	 5625 5085 5625 5220 6120 5220 6120 4725 5985 4725
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
	 5760 5220 5760 5355 6255 5355 6255 4860 6120 4860
-6
6 6840 2790 8910 3420
4 0 0 50 -1 0 12 0.0000 4 180 1260 6840 2970 [requirements]\001
4 0 0 50 -1 0 12 0.0000 4 135 990 6840 3165 waiton TstE\001
4 0 0 50 -1 0 12 0.0000 4 180 2070 6840 3360 itemap foo/(\\d+) \\1/bar\001
-6
6 6840 6345 8910 6975
4 0 0 50 -1 0 12 0.0000 4 180 1260 6840 6525 [requirements]\001
4 0 0 50 -1 0 12 0.0000 4 135 990 6840 6720 waiton TstE\001
4 0 0 50 -1 0 12 0.0000 4 180 2070 6840 6915 itemap baz/(\\d+) \\1/bar\001
-6
6 3600 6570 4860 7200
4 0 0 50 -1 0 12 0.0000 4 180 810 3600 6750 [itemmap]\001
4 0 0 50 -1 0 12 0.0000 4 150 1260 3600 6945 TstA  .*/ foo/\001
4 0 0 50 -1 0 12 0.0000 4 165 1080 3600 7140 TstB ab/ xy/\001
-6
2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 5355 4455 4500 3600
2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 5400 1800 4500 2700
2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 3600 3600 2700 4500
2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 3510 2610 2790 1890
2 2 0 2 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
	 1530 675 3060 675 3060 5580 1530 5580 1530 675
2 2 0 2 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
	 3195 675 4815 675 4815 5580 3195 5580 3195 675
2 1 0 2 23 7 50 -1 -1 0.000 0 0 -1 1 0 3
	0 0 1.00 60.00 120.00
	 4050 5850 4050 5175 4050 3690
2 2 0 2 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
	 4950 675 6660 675 6660 5580 4950 5580 4950 675


2 1 0 2 23 7 50 -1 -1 0.000 0 0 -1 1 0 3
	0 0 1.00 60.00 120.00

	 7065 2700 7065 2160 6390 1575
2 1 0 2 23 7 50 -1 -1 0.000 0 0 -1 1 0 3
	0 0 1.00 60.00 120.00
	 7065 6255 7065 5715 6390 5130
2 2 0 2 7 7 50 -1 -1 0.000 0 0 -1 0 0 5
	 900 0 9000 0 9000 7425 900 7425 900 0
4 0 0 50 -1 0 12 0.0000 4 135 360 1935 4725 TstB\001
4 0 0 50 -1 0 12 0.0000 4 135 360 5445 1170 TstC\001
4 0 0 50 -1 0 12 0.0000 4 135 360 5445 4770 TstD\001
4 0 0 50 -1 0 12 0.0000 4 135 360 3600 2970 TstE\001
4 0 0 50 -1 0 12 0.0000 4 135 360 1845 1170 TstA\001
4 0 0 50 -1 0 12 0.0000 4 135 720 5085 450 runthird\001
4 0 0 50 -1 0 12 0.0000 4 135 810 3330 405 runsecond\001
4 0 0 50 -1 0 12 0.0000 4 135 720 1575 405 runfirst\001
4 0 0 50 -1 0 12 0.0000 4 150 1260 6750 1005 2. TstE starts\001
4 0 0 50 -1 0 12 0.0000 4 150 1800 6750 1215 3. TstC & TstD start\001
4 0 0 50 -1 0 12 0.0000 4 150 1800 6750 810 1. TstA & TstB start\001
4 0 0 50 -1 0 12 0.0000 4 180 1260 3600 6165 [requirements]\001
4 0 0 50 -1 0 12 0.0000 4 135 1440 3600 6360 waiton TstA TstB\001

Modified docs/manual/itemmap.png from [9f6330a663] to [85e9ca25ab].

cannot compute difference between binary files

Modified docs/manual/megatest_manual.html from [a1bf732e9f] to [9f68ad88dd].

1250
1251
1252
1253
1254
1255
1256
1257
1258
1259























































1260
1261
1262
1263
1264
1265
1266
</div></div>
</div>
<div class="sect3">
<h4 id="_complex_mappings">Complex mappings</h4>
<div class="paragraph"><p>Complex mappings can be handled with the [itemmap] section</p></div>
<div class="imageblock">
<div class="content">
<img src="itemmap.png" alt="itemmap.png">
</div>
</div>























































<div class="listingblock">
<div class="title">Autogeneration waiton list for dynamic flow dependency trees</div>
<div class="content monospaced">
<pre>[requirements]
# With a toplevel test you may wish to generate your list
# of tests to run dynamically
#







|


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







1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
</div></div>
</div>
<div class="sect3">
<h4 id="_complex_mappings">Complex mappings</h4>
<div class="paragraph"><p>Complex mappings can be handled with the [itemmap] section</p></div>
<div class="imageblock">
<div class="content">
<img src="complex-itemmap.png" alt="complex-itemmap.png">
</div>
</div>
<div class="paragraph"><p>Example:</p></div>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
Request to run D/1/res
</p>
</li>
<li>
<p>
Megatest calculates all posible items for Test C and filters down to: C/1/aa
</p>
</li>
<li>
<p>
Full list to be run is now: D/1/res, C/1/aa
</p>
</li>
<li>
<p>
Megatest calculates all posible items for Test A and filters down to: A/aa/1
</p>
</li>
<li>
<p>
Full list to be run is now: D/1/res, C/1/aa, A/aa/1
</p>
</li>
</ol></div>
<div class="listingblock">
<div class="title">Testconfig for Test C</div>
<div class="content monospaced">
<pre>[requirements]
waiton A B

[itemmap]
A (\d+)/aa aa/\1
B (\d+)/bb bb/\1</pre>
</div></div>
<div class="listingblock">
<div class="title">Testconfig for Test D</div>
<div class="content monospaced">
<pre>[requirements]
waiton C
itemmap (\d+)/res \1/aa</pre>
</div></div>
<div class="listingblock">
<div class="title">Testconfig for Test E</div>
<div class="content monospaced">
<pre>[requirements]
waiton C
itemmap (\d+)/res \1/bb</pre>
</div></div>
</div>
<div class="sect3">
<h4 id="_dynamic_flow_dependency_tree">Dynamic Flow Dependency Tree</h4>
<div class="listingblock">
<div class="title">Autogeneration waiton list for dynamic flow dependency trees</div>
<div class="content monospaced">
<pre>[requirements]
# With a toplevel test you may wish to generate your list
# of tests to run dynamically
#

Modified docs/manual/reference.txt from [8254610d8c] to [6bca5ae941].

166
167
168
169
170
171
172
173

174

175

































176
177
178
179
180
181
182
-------------------

Complex mappings
^^^^^^^^^^^^^^^^

Complex mappings can be handled with the [itemmap] section

image::itemmap.png[]



.Complex mapping from 

































.Autogeneration waiton list for dynamic flow dependency trees
-------------------
[requirements]
# With a toplevel test you may wish to generate your list 
# of tests to run dynamically
#
# waiton #{shell get-valid-tests-to-run.sh}







|
>

>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
-------------------

Complex mappings
^^^^^^^^^^^^^^^^

Complex mappings can be handled with the [itemmap] section

// image::itemmap.png[]
image::complex-itemmap.png[]

Example:

. Request to run D/1/res
. Megatest calculates all posible items for Test C and filters down to: C/1/aa
. Full list to be run is now: D/1/res, C/1/aa
. Megatest calculates all posible items for Test A and filters down to: A/aa/1
. Full list to be run is now: D/1/res, C/1/aa, A/aa/1

.Testconfig for Test C
----------------------
[requirements]
waiton A B

[itemmap]
A (\d+)/aa aa/\1
B (\d+)/bb bb/\1
----------------------

.Testconfig for Test D
----------------------
[requirements]
waiton C
itemmap (\d+)/res \1/aa
----------------------

.Testconfig for Test E
----------------------
[requirements]
waiton C
itemmap (\d+)/res \1/bb
----------------------

Dynamic Flow Dependency Tree
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.Autogeneration waiton list for dynamic flow dependency trees
-------------------
[requirements]
# With a toplevel test you may wish to generate your list 
# of tests to run dynamically
#
# waiton #{shell get-valid-tests-to-run.sh}

Modified megatest-version.scm from [84dff703f2] to [c4b7aef33f].

1
2
3
4
5
6
7
;; Always use two or four digit decimal
;; 1.01, 1.02...1.10,1.11,1,1101 ... 1.99,2.00..

(declare (unit megatest-version))

(define megatest-version 1.6023)






|

1
2
3
4
5
6
7
;; Always use two or four digit decimal
;; 1.01, 1.02...1.10,1.11,1,1101 ... 1.99,2.00..

(declare (unit megatest-version))

(define megatest-version 1.6024)

Modified mt.scm from [50f726c0ec] to [d7eb2f40fc].

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
	    (debug:print-info 4 "More than " limit " tests, have " (length full-list) " tests so far.")
	    (loop (rmt:get-tests-for-run run-id testpatt states status new-offset limit not-in sort-by sort-order qryvals)
		  full-list
		  new-offset
		  limit))
	  full-list))))

(define (mt:lazy-get-prereqs-not-met run-id waitons ref-item-path #!key (mode '(normal))(itemmap #f) )
  (let* ((key    (list run-id waitons ref-item-path mode))
	 (res    (hash-table-ref/default *pre-reqs-met-cache* key #f))
	 (useres (let ((last-time (if (vector? res) (vector-ref res 0) #f)))
		   (if last-time
		       (< (current-seconds)(+ last-time 5))
		       #f))))
    (if useres
	(let ((result (vector-ref res 1)))
	  (debug:print 4 "Using lazy value res: " result)
	  result)
	(let ((newres (rmt:get-prereqs-not-met run-id waitons ref-item-path mode: mode itemmap: itemmap)))
;;	(let ((newres (db:get-prereqs-not-met run-id waitons ref-item-path mode: mode itemmap: itemmap)))
	  (hash-table-set! *pre-reqs-met-cache* key (vector (current-seconds) newres))
	  newres))))

(define (mt:get-run-stats dbstruct run-id)
;;  Get run stats from local access, move this ... but where?
  (db:get-run-stats dbstruct run-id))








|










|
<







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98

99
100
101
102
103
104
105
	    (debug:print-info 4 "More than " limit " tests, have " (length full-list) " tests so far.")
	    (loop (rmt:get-tests-for-run run-id testpatt states status new-offset limit not-in sort-by sort-order qryvals)
		  full-list
		  new-offset
		  limit))
	  full-list))))

(define (mt:lazy-get-prereqs-not-met run-id waitons ref-item-path #!key (mode '(normal))(itemmaps #f) )
  (let* ((key    (list run-id waitons ref-item-path mode))
	 (res    (hash-table-ref/default *pre-reqs-met-cache* key #f))
	 (useres (let ((last-time (if (vector? res) (vector-ref res 0) #f)))
		   (if last-time
		       (< (current-seconds)(+ last-time 5))
		       #f))))
    (if useres
	(let ((result (vector-ref res 1)))
	  (debug:print 4 "Using lazy value res: " result)
	  result)
	(let ((newres (rmt:get-prereqs-not-met run-id waitons ref-item-path mode: mode itemmaps: itemmaps)))

	  (hash-table-set! *pre-reqs-met-cache* key (vector (current-seconds) newres))
	  newres))))

(define (mt:get-run-stats dbstruct run-id)
;;  Get run stats from local access, move this ... but where?
  (db:get-run-stats dbstruct run-id))

Modified rmt.scm from [2a4800a8d6] to [7c256785ed].

502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
	   (map (lambda (run-id)
		  (rmt:send-receive 'test-get-paths-matching-keynames-target-new run-id (list run-id keynames target res testpatt statepatt statuspatt runname)))
	   run-ids))))

;; (define (rmt:get-run-ids-matching keynames target res)
;;   (rmt:send-receive #f 'get-run-ids-matching (list keynames target res)))

(define (rmt:get-prereqs-not-met run-id waitons ref-item-path #!key (mode '(normal))(itemmap #f))
  (rmt:send-receive 'get-prereqs-not-met run-id (list run-id waitons ref-item-path mode itemmap)))

(define (rmt:get-count-tests-running-for-run-id run-id)
  (rmt:send-receive 'get-count-tests-running-for-run-id run-id (list run-id)))

;; Statistical queries

(define (rmt:get-count-tests-running run-id)







|
|







502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
	   (map (lambda (run-id)
		  (rmt:send-receive 'test-get-paths-matching-keynames-target-new run-id (list run-id keynames target res testpatt statepatt statuspatt runname)))
	   run-ids))))

;; (define (rmt:get-run-ids-matching keynames target res)
;;   (rmt:send-receive #f 'get-run-ids-matching (list keynames target res)))

(define (rmt:get-prereqs-not-met run-id waitons ref-item-path #!key (mode '(normal))(itemmaps #f))
  (rmt:send-receive 'get-prereqs-not-met run-id (list run-id waitons ref-item-path mode itemmaps)))

(define (rmt:get-count-tests-running-for-run-id run-id)
  (rmt:send-receive 'get-count-tests-running-for-run-id run-id (list run-id)))

;; Statistical queries

(define (rmt:get-count-tests-running run-id)

Modified runs.scm from [7ecdac9bcf] to [e714363b54].

421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
	     (lambda (waiton)
	       (if (and waiton (not (member waiton test-names)))
		   (let* ((waiton-record   (hash-table-ref/default test-records waiton #f))
			  (waiton-tconfig  (if waiton-record (vector-ref waiton-record 1) #f))
			  (waiton-itemized (and waiton-tconfig
						(or (hash-table-ref/default waiton-tconfig "items" #f)
						    (hash-table-ref/default waiton-tconfig "itemstable" #f))))
			  (itemmap         (configf:lookup config "requirements" "itemmap"))
			  (new-test-patts  (tests:extend-test-patts test-patts hed waiton itemmap)))
		     (debug:print-info 0 "Test " waiton " has " (if waiton-record "a" "no") " waiton-record and" (if waiton-itemized " " " no ") "items")
		     ;; need to account for test-patt here, if I am test "a", selected with a test-patt of "hed/b%"
		     ;; and we are waiting on "waiton" we need to add "waiton/,waiton/b%" to test-patt
		     ;; is this satisfied by merely appending "/" to the waiton name added to the list?
		     ;;
		     ;; This approach causes all of the items in an upstream test to be run 








|
|







421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
	     (lambda (waiton)
	       (if (and waiton (not (member waiton test-names)))
		   (let* ((waiton-record   (hash-table-ref/default test-records waiton #f))
			  (waiton-tconfig  (if waiton-record (vector-ref waiton-record 1) #f))
			  (waiton-itemized (and waiton-tconfig
						(or (hash-table-ref/default waiton-tconfig "items" #f)
						    (hash-table-ref/default waiton-tconfig "itemstable" #f))))
			  (itemmaps        (tests:get-itemmaps config));; (configf:lookup config "requirements" "itemmap"))
			  (new-test-patts  (tests:extend-test-patts test-patts hed waiton itemmaps)))
		     (debug:print-info 0 "Test " waiton " has " (if waiton-record "a" "no") " waiton-record and" (if waiton-itemized " " " no ") "items")
		     ;; need to account for test-patt here, if I am test "a", selected with a test-patt of "hed/b%"
		     ;; and we are waiting on "waiton" we need to add "waiton/,waiton/b%" to test-patt
		     ;; is this satisfied by merely appending "/" to the waiton name added to the list?
		     ;;
		     ;; This approach causes all of the items in an upstream test to be run 

557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
      (cdr reg)
      (if (null? tal) ;; if tal is null and reg not full then '() as reg contents moved to tal
	  '()
	  reg)))

(define runs:nothing-left-in-queue-count 0)

(define (runs:expand-items hed tal reg reruns regfull newtal jobgroup max-concurrent-jobs run-id waitons item-path testmode test-record can-run-more items runname tconfig reglen test-registry test-records itemmap)
  (let* ((loop-list       (list hed tal reg reruns))
	 (prereqs-not-met (rmt:get-prereqs-not-met run-id waitons item-path mode: testmode itemmap: itemmap))
	 ;; (prereqs-not-met (mt:lazy-get-prereqs-not-met run-id waitons item-path mode: testmode itemmap: itemmap))
	 (fails           (runs:calc-fails prereqs-not-met))
	 (prereq-fails    (runs:calc-prereq-fail prereqs-not-met))
	 (non-completed   (runs:calc-not-completed prereqs-not-met))
	 (runnables       (runs:calc-runnable prereqs-not-met)))
    (debug:print-info 4 "START OF INNER COND #2 "
		      "\n can-run-more:    " can-run-more







|

|







557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
      (cdr reg)
      (if (null? tal) ;; if tal is null and reg not full then '() as reg contents moved to tal
	  '()
	  reg)))

(define runs:nothing-left-in-queue-count 0)

(define (runs:expand-items hed tal reg reruns regfull newtal jobgroup max-concurrent-jobs run-id waitons item-path testmode test-record can-run-more items runname tconfig reglen test-registry test-records itemmaps)
  (let* ((loop-list       (list hed tal reg reruns))
	 (prereqs-not-met (rmt:get-prereqs-not-met run-id waitons item-path mode: testmode itemmaps: itemmaps))
	 ;; (prereqs-not-met (mt:lazy-get-prereqs-not-met run-id waitons item-path mode: testmode itemmap: itemmap))
	 (fails           (runs:calc-fails prereqs-not-met))
	 (prereq-fails    (runs:calc-prereq-fail prereqs-not-met))
	 (non-completed   (runs:calc-not-completed prereqs-not-met))
	 (runnables       (runs:calc-runnable prereqs-not-met)))
    (debug:print-info 4 "START OF INNER COND #2 "
		      "\n can-run-more:    " can-run-more
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
		 (conc test-name (if (equal? item-path "") "" "/") item-path ":" test-state "/" test-status)))
	      ((string? t)
	       t)
	      (else 
	       (conc t))))
	   inlst)))

(define (runs:process-expanded-tests hed tal reg reruns reglen regfull test-record runname test-name item-path jobgroup max-concurrent-jobs run-id waitons item-path testmode test-patts required-tests test-registry registry-mutex flags keyvals run-info newtal all-tests-registry itemmap)
  (let* ((run-limits-info         (runs:can-run-more-tests run-id jobgroup max-concurrent-jobs)) ;; look at the test jobgroup and tot jobs running
	 (have-resources          (car run-limits-info))
	 (num-running             (list-ref run-limits-info 1))
	 (num-running-in-jobgroup (list-ref run-limits-info 2)) 
	 (max-concurrent-jobs     (list-ref run-limits-info 3))
	 (job-group-limit         (list-ref run-limits-info 4))
	 (prereqs-not-met         (rmt:get-prereqs-not-met run-id waitons item-path mode: testmode itemmap: itemmap))
	 ;; (prereqs-not-met         (mt:lazy-get-prereqs-not-met run-id waitons item-path mode: testmode itemmap: itemmap))
	 (fails                   (runs:calc-fails prereqs-not-met))
	 (non-completed           (filter (lambda (x)             ;; remove hed from not completed list, duh, of course it is not completed!
					    (not (equal? x hed)))
					  (runs:calc-not-completed prereqs-not-met)))
	 (loop-list               (list hed tal reg reruns))
	 ;; configure the load runner







|






|







740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
		 (conc test-name (if (equal? item-path "") "" "/") item-path ":" test-state "/" test-status)))
	      ((string? t)
	       t)
	      (else 
	       (conc t))))
	   inlst)))

(define (runs:process-expanded-tests hed tal reg reruns reglen regfull test-record runname test-name item-path jobgroup max-concurrent-jobs run-id waitons item-path testmode test-patts required-tests test-registry registry-mutex flags keyvals run-info newtal all-tests-registry itemmaps)
  (let* ((run-limits-info         (runs:can-run-more-tests run-id jobgroup max-concurrent-jobs)) ;; look at the test jobgroup and tot jobs running
	 (have-resources          (car run-limits-info))
	 (num-running             (list-ref run-limits-info 1))
	 (num-running-in-jobgroup (list-ref run-limits-info 2)) 
	 (max-concurrent-jobs     (list-ref run-limits-info 3))
	 (job-group-limit         (list-ref run-limits-info 4))
	 (prereqs-not-met         (rmt:get-prereqs-not-met run-id waitons item-path mode: testmode itemmaps: itemmaps))
	 ;; (prereqs-not-met         (mt:lazy-get-prereqs-not-met run-id waitons item-path mode: testmode itemmap: itemmap))
	 (fails                   (runs:calc-fails prereqs-not-met))
	 (non-completed           (filter (lambda (x)             ;; remove hed from not completed list, duh, of course it is not completed!
					    (not (equal? x hed)))
					  (runs:calc-not-completed prereqs-not-met)))
	 (loop-list               (list hed tal reg reruns))
	 ;; configure the load runner
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
      ;; (print "Top of loop, hed=" hed ", tal=" tal " ,reruns=" reruns)
      (let* ((test-record (hash-table-ref test-records hed))
	     (test-name   (tests:testqueue-get-testname test-record))
	     (tconfig     (tests:testqueue-get-testconfig test-record))
	     (jobgroup    (config-lookup tconfig "test_meta" "jobgroup"))
	     (testmode    (let ((m (config-lookup tconfig "requirements" "mode")))
			    (if m (map string->symbol (string-split m)) '(normal))))
	     (itemmap     (configf:lookup tconfig "requirements" "itemmap"))
	     (waitons     (tests:testqueue-get-waitons    test-record))
	     (priority    (tests:testqueue-get-priority   test-record))
	     (itemdat     (tests:testqueue-get-itemdat    test-record)) ;; itemdat can be a string, list or #f
	     (items       (tests:testqueue-get-items      test-record))
	     (item-path   (item-list->path itemdat))
	     (tfullname   (db:test-make-full-name test-name item-path))
	     (newtal      (append tal (list hed)))







|







1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
      ;; (print "Top of loop, hed=" hed ", tal=" tal " ,reruns=" reruns)
      (let* ((test-record (hash-table-ref test-records hed))
	     (test-name   (tests:testqueue-get-testname test-record))
	     (tconfig     (tests:testqueue-get-testconfig test-record))
	     (jobgroup    (config-lookup tconfig "test_meta" "jobgroup"))
	     (testmode    (let ((m (config-lookup tconfig "requirements" "mode")))
			    (if m (map string->symbol (string-split m)) '(normal))))
	     (itemmaps    (tests:get-itemmaps tconfig)) ;;  (configf:lookup tconfig "requirements" "itemmap"))
	     (waitons     (tests:testqueue-get-waitons    test-record))
	     (priority    (tests:testqueue-get-priority   test-record))
	     (itemdat     (tests:testqueue-get-itemdat    test-record)) ;; itemdat can be a string, list or #f
	     (items       (tests:testqueue-get-items      test-record))
	     (item-path   (item-list->path itemdat))
	     (tfullname   (db:test-make-full-name test-name item-path))
	     (newtal      (append tal (list hed)))
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
	 ;; items is #f then the test is ok to be handed off to launch (but not before)
	 ;; 
	 ((not items)
	  (debug:print-info 4 "OUTER COND: (not items)")
	  (if (and (not (tests:match test-patts (tests:testqueue-get-testname test-record) item-path required: required-tests))
		   (not (null? tal)))
	      (loop (car tal)(cdr tal) reg reruns))
	  (let ((loop-list (runs:process-expanded-tests hed tal reg reruns reglen regfull test-record runname test-name item-path jobgroup max-concurrent-jobs run-id waitons item-path testmode test-patts required-tests test-registry registry-mutex flags keyvals run-info newtal all-tests-registry itemmap)))
	    (if loop-list (apply loop loop-list))))

	 ;; items processed into a list but not came in as a list been processed
	 ;;
	 ((and (list? items)     ;; thus we know our items are already calculated
	       (not   itemdat))  ;; and not yet expanded into the list of things to be done
	  (debug:print-info 4 "OUTER COND: (and (list? items)(not itemdat))")







|







1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
	 ;; items is #f then the test is ok to be handed off to launch (but not before)
	 ;; 
	 ((not items)
	  (debug:print-info 4 "OUTER COND: (not items)")
	  (if (and (not (tests:match test-patts (tests:testqueue-get-testname test-record) item-path required: required-tests))
		   (not (null? tal)))
	      (loop (car tal)(cdr tal) reg reruns))
	  (let ((loop-list (runs:process-expanded-tests hed tal reg reruns reglen regfull test-record runname test-name item-path jobgroup max-concurrent-jobs run-id waitons item-path testmode test-patts required-tests test-registry registry-mutex flags keyvals run-info newtal all-tests-registry itemmaps)))
	    (if loop-list (apply loop loop-list))))

	 ;; items processed into a list but not came in as a list been processed
	 ;;
	 ((and (list? items)     ;; thus we know our items are already calculated
	       (not   itemdat))  ;; and not yet expanded into the list of things to be done
	  (debug:print-info 4 "OUTER COND: (and (list? items)(not itemdat))")
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
	 ;; if items is a proc then need to run items:get-items-from-config, get the list and loop 
	 ;;    - but only do that if resources exist to kick off the job
	 ;; EXPAND ITEMS
	 ((or (procedure? items)(eq? items 'have-procedure))
	  (let ((can-run-more    (runs:can-run-more-tests run-id jobgroup max-concurrent-jobs)))
	    (if (and (list? can-run-more)
		     (car can-run-more))
		(let ((loop-list (runs:expand-items hed tal reg reruns regfull newtal jobgroup max-concurrent-jobs run-id waitons item-path testmode test-record can-run-more items runname tconfig reglen test-registry test-records itemmap)))
		  (if loop-list
		      (apply loop loop-list)))
		;; if can't run more just loop with next possible test
		(loop (car newtal)(cdr newtal) reg reruns))))
	    
	 ;; this case should not happen, added to help catch any bugs
	 ((and (list? items) itemdat)







|







1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
	 ;; if items is a proc then need to run items:get-items-from-config, get the list and loop 
	 ;;    - but only do that if resources exist to kick off the job
	 ;; EXPAND ITEMS
	 ((or (procedure? items)(eq? items 'have-procedure))
	  (let ((can-run-more    (runs:can-run-more-tests run-id jobgroup max-concurrent-jobs)))
	    (if (and (list? can-run-more)
		     (car can-run-more))
		(let ((loop-list (runs:expand-items hed tal reg reruns regfull newtal jobgroup max-concurrent-jobs run-id waitons item-path testmode test-record can-run-more items runname tconfig reglen test-registry test-records itemmaps)))
		  (if loop-list
		      (apply loop loop-list)))
		;; if can't run more just loop with next possible test
		(loop (car newtal)(cdr newtal) reg reruns))))
	    
	 ;; this case should not happen, added to help catch any bugs
	 ((and (list? items) itemdat)

Modified tests.scm from [e0e808f287] to [4e99e09e2a].

70
71
72
73
74
75
76




























77
78
79
80
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96

(define (tests:filter-test-names test-names test-patts)
  (delete-duplicates
   (filter (lambda (testname)
	     (tests:match test-patts testname #f))
	   test-names)))





























;; given test-b that is waiting on test-a extend test-patt appropriately
;;
;;  genlib/testconfig               sim/testconfig
;;  genlib/sch                      sim/sch/cell1
;;
;;  [requirements]                  [requirements]
;;                                  mode itemwait
;;                                  # trim off the cell to determine what to run for genlib
;;                                  itemmap /.*
;;
;;                                  test-a is waiting on test-b so we need to create a pattern for test-b given test-a and itemmap
(define (tests:extend-test-patts test-patt test-b test-a itemmap)

  (let* ((patts      (string-split test-patt ","))
	 (test-b-len (+ (string-length test-b) 1))
	 (patts-b    (map (lambda (x)
			    (let* ((modpatt (if itemmap (db:convert-test-itempath x itemmap) x)) 
				   (newpatt (conc test-a "/" (substring modpatt test-b-len (string-length modpatt)))))
				         ;; (conc test-a "/," test-a "/" (substring modpatt test-b-len (string-length modpatt)))))
			      ;; (print "in map, x=" x ", newpatt=" newpatt)
			      newpatt))







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











|
>
|







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125

(define (tests:filter-test-names test-names test-patts)
  (delete-duplicates
   (filter (lambda (testname)
	     (tests:match test-patts testname #f))
	   test-names)))

;; itemmap is a list of testname patterns to maps
;;     test1 .*/bar/(\d+) foo/\1
;;     %     foo/([^/]+)  \1/bar
;;
;; # NOTE: the line with the single % could be the result of
;; #       itemmap entry in requirements (legacy). The itemmap
;; #       requirements entry is deprecated
;;
(define (tests:get-itemmaps tconfig)
  (let ((base-itemmap  (configf:lookup tconfig "requirements" "itemmap"))
	(itemmap-table (configf:get-section tconfig "itemmap")))
    (append (if base-itemmap
		(list (cons "%" base-itemmap))
		'())
	    (if itemmap-table
		itemmap-table
		'()))))

;; given a list of itemmaps (testname . map), return the first match
;;
(define (tests:lookup-itemmap itemmaps testname)
  (let ((best-matches (filter (lambda (itemmap)
				(tests:match (car itemmap) testname))
			      itemmaps)))
    (if (null? best-matches)
	#f
	(car best-matches))))
					     
;; given test-b that is waiting on test-a extend test-patt appropriately
;;
;;  genlib/testconfig               sim/testconfig
;;  genlib/sch                      sim/sch/cell1
;;
;;  [requirements]                  [requirements]
;;                                  mode itemwait
;;                                  # trim off the cell to determine what to run for genlib
;;                                  itemmap /.*
;;
;;                                  test-a is waiting on test-b so we need to create a pattern for test-b given test-a and itemmap
(define (tests:extend-test-patts test-patt test-b test-a itemmaps)
  (let* ((itemmap    (tests:lookup-itemmap itemmaps test-b))
	 (patts      (string-split test-patt ","))
	 (test-b-len (+ (string-length test-b) 1))
	 (patts-b    (map (lambda (x)
			    (let* ((modpatt (if itemmap (db:convert-test-itempath x itemmap) x)) 
				   (newpatt (conc test-a "/" (substring modpatt test-b-len (string-length modpatt)))))
				         ;; (conc test-a "/," test-a "/" (substring modpatt test-b-len (string-length modpatt)))))
			      ;; (print "in map, x=" x ", newpatt=" newpatt)
			      newpatt))