Megatest

Check-in [ec63f32f93]
Login
Overview
Comment:factored out subrun code in launch to subrun.scm
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 1.65-subrun-ancilliary-usecases
Files: files | file ages | folders
SHA1: ec63f32f9385262feb725180f289b5342f085c54
User & Date: bjbarcla on 2017-12-26 12:22:54
Other Links: branch diff | manifest | tags
Context
2017-12-26
16:14
restored launch functionality using subrun under updated subrun architecture check-in: b1363320bf user: bjbarcla tags: 1.65-subrun-ancilliary-usecases
12:22
factored out subrun code in launch to subrun.scm check-in: ec63f32f93 user: bjbarcla tags: 1.65-subrun-ancilliary-usecases
11:47
wip check-in: 29b61b765c user: bjbarcla tags: 1.65-subrun-ancilliary-usecases
Changes

Modified launch.scm from [a8e0155aa6] to [0c59c66c55].

16
17
18
19
20
21
22

23
24
25
26
27
28
29
(use regex regex-case base64 sqlite3 srfi-18 directory-utils posix-extras z3 call-with-environment-variables csv)
(use typed-records pathname-expand matchable)

(import (prefix base64 base64:))
(import (prefix sqlite3 sqlite3:))

(declare (unit launch))

(declare (uses common))
(declare (uses configf))
(declare (uses db))

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







>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(use regex regex-case base64 sqlite3 srfi-18 directory-utils posix-extras z3 call-with-environment-variables csv)
(use typed-records pathname-expand matchable)

(import (prefix base64 base64:))
(import (prefix sqlite3 sqlite3:))

(declare (unit launch))
(declare (uses subrun))
(declare (uses common))
(declare (uses configf))
(declare (uses db))

(include "common_records.scm")
(include "key_records.scm")
(include "db_records.scm")
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
	;; 2. unset MT_* vars
	;; 3. fix target
	;; 4. fix runname
	;; 5. fix testpatt or calculate it from contour
	;; 6. launch the run
	;; 7. roll up the run result and or roll up the logpro processed result
	(if (configf:lookup testconfig "subrun" "runwait") ;; we use runwait as the flag that a subrun is requested
            (subrun:initialize-toprun-test testconfig test-run-dir logpro)
	    (let* ((mt-cmd (subrun:launch-cmd test-run-dir)))
              (debug:print-info 0 *default-log-port* "Subrun command is \"" mt-cmd "\"")
              (set! ezsteps #t) ;; set the needed flag
	      (set! ezstepslst
                    (append (or ezstepslst '())
                            (list (list "subrun" (conc "{subrun=true} " mt-cmd)))))))








|







321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
	;; 2. unset MT_* vars
	;; 3. fix target
	;; 4. fix runname
	;; 5. fix testpatt or calculate it from contour
	;; 6. launch the run
	;; 7. roll up the run result and or roll up the logpro processed result
	(if (configf:lookup testconfig "subrun" "runwait") ;; we use runwait as the flag that a subrun is requested
            (subrun:initialize-toprun-test testconfig test-run-dir)
	    (let* ((mt-cmd (subrun:launch-cmd test-run-dir)))
              (debug:print-info 0 *default-log-port* "Subrun command is \"" mt-cmd "\"")
              (set! ezsteps #t) ;; set the needed flag
	      (set! ezstepslst
                    (append (or ezstepslst '())
                            (list (list "subrun" (conc "{subrun=true} " mt-cmd)))))))

Modified subrun.scm from [81bff98e26] to [7767e7bac6].

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
48
49


50
51
52
53
54
55
56
57
;;  PURPOSE.

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

(use (prefix sqlite3 sqlite3:) srfi-1 posix regex regex-case srfi-69 (srfi 18) 
     posix-extras directory-utils pathname-expand typed-records format)
(declare (unit subrun))
(declare (uses runs))
(declare (uses db))
(declare (uses common))
(declare (uses items))
(declare (uses runconfig))
(declare (uses tests))
(declare (uses server))
(declare (uses mt))
(declare (uses archive))
;; (declare (uses filedb))

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


(define (subrun:initialize-toprun-test test-run-dir testconfig)

  (let ((ra (configf:lookup testconfig "subrun" "run-area")))

    (when (not ra)      ;; when runarea is not set we default to *toppath*. However 
              ;; we need to force the setting in the testconfig so it will
          ;; be preserved in the testconfig.subrun file
      (configf:set-section-var testconfig "subrun" "runarea" *toppath*)
      )

  (configf:write-alist testconfig "testconfig.subrun") 
  )


(define (subrun:launch )





  )

;; set state/status of test item
;; fork off megatest
;; set state/status of test item
;;









|
|

|
|
|
|
|
|



|
|
|
|


|
>
|
>
|


|
<
|
|
<


|
|
|
|
>
>
|







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
48
49
50
51
52
53
54
55
56
57
58
59
;;  PURPOSE.

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

(use (prefix sqlite3 sqlite3:) srfi-1 posix regex regex-case srfi-69 (srfi 18) 
     posix-extras directory-utils pathname-expand typed-records format)
(declare (unit subrun))
;;(declare (uses runs))
;;(declare (uses db))
(declare (uses common))
;;(declare (uses items))
;;(declare (uses runconfig))
;;(declare (uses tests))
;;(declare (uses server))
;;(declare (uses mt))
;;(declare (uses archive))
;; (declare (uses filedb))

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


(define (subrun:initialize-toprun-test  testconfig test-run-dir)

  (let ((ra (configf:lookup testconfig "subrun" "run-area"))
        (logpro (configf:lookup testconfig "subrun" "logpro")))
  (when (not ra)      ;; when runarea is not set we default to *toppath*. However 
              ;; we need to force the setting in the testconfig so it will
          ;; be preserved in the testconfig.subrun file
      (configf:set-section-var testconfig "subrun" "runarea" *toppath*))

    (configf:set-section-var testconfig "logpro" "subrun" logpro) ;; append the logpro rules to the logpro section as stepname subrun
    (configf:write-alist testconfig "testconfig.subrun")))



(define (subrun:launch-cmd test-run-dir)
  (let ((log-prefix "run")
        (switches (subrun:selector+log-switches test-run-dir log-prefix))
        (run-wait #t)
        (cmd      (conc "megatest -run "switches" "
                        (if runwait "-run-wait " ""))))
    cmd))

;; set state/status of test item
;; fork off megatest
;; set state/status of test item
;;


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
                                            (defval     (alist-ref defvals switch equal?))
                                            (val        (or (configf:lookup subrunconfig switch)
                                                            defval)))
                                        (if val
                                            (list switch val)
                                            #f)))
                                    switch-def-alist)))
         (target        (or (alist-ref switch-alist "-target" equal?)
                            "NO-TARGET"))
         (runname       (or (alist-ref switch-alist "-runname" equal?)
                            "NO-RUNNAME"))
         (testpatt      (alist-ref switch-alist "-testpatt" equal?))
         (mode-patt     (alist-ref switch-alist "-modepatt" equal?))
         (tag-expr      (alist-ref switch-alist "-tagexpr" equal?))
         (compact-stem  (string-substitute "[/*]" "_"
                                           (conc
                                            target
                                            "-"
                                            runname
                                            "-" (or testpatt mode-patt tag-expr "NO-TESTPATT"))))
         (logfile       (conc
                         test-run-dir "/"
                         (or log-prefix "")
                         (if log-prefix "-" "")
                         compact-stem
                         ".log")))
    ;; note - get precmd from subrun section
    ;;   apply to submegatest commands
    
    (conc
     " -start-dir " run-area " "





     
     (string-intersperse
      (apply append
           (map (lambda (x) (list (car x) (cdr x))) switch-def-alist))
      " ")
     "-log " logfile)))








|

|

|
|
|

















>
>
>
>
>







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
                                            (defval     (alist-ref defvals switch equal?))
                                            (val        (or (configf:lookup subrunconfig switch)
                                                            defval)))
                                        (if val
                                            (list switch val)
                                            #f)))
                                    switch-def-alist)))
         (target        (or (alist-ref "-target" switch-alist  equal? #f) ;; want data-structures alist-ref, not alist-lib alist-ref
                            "NO-TARGET"))
         (runname       (or (alist-ref "-runname" switch-alist equal? #f)
                            "NO-RUNNAME"))
         (testpatt      (alist-ref "-testpatt" switch-alist equal? #f))
         (mode-patt     (alist-ref "-modepatt" switch-alist equal? #f))
         (tag-expr      (alist-ref "-tagexpr" switch-alist equal? #f))
         (compact-stem  (string-substitute "[/*]" "_"
                                           (conc
                                            target
                                            "-"
                                            runname
                                            "-" (or testpatt mode-patt tag-expr "NO-TESTPATT"))))
         (logfile       (conc
                         test-run-dir "/"
                         (or log-prefix "")
                         (if log-prefix "-" "")
                         compact-stem
                         ".log")))
    ;; note - get precmd from subrun section
    ;;   apply to submegatest commands
    
    (conc
     " -start-dir " run-area " "
     " -runname " runname " "
     " -target " target " "
     (if testpatt (conc "-testpatt " testpatt" ") "")
     (if modepatt (conc "-modepatt " modepatt" ") "")
     (if tag-expr (conc "-tag-expr " tag-expr" ") "")
     
     (string-intersperse
      (apply append
           (map (lambda (x) (list (car x) (cdr x))) switch-def-alist))
      " ")
     "-log " logfile)))