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
60
61
62
63
64
65
66
67
68
69
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
|
;; |-1.db
;; |-<N>.db
;;
;;
;; Accessors for a dbstruct
;;
(define-inline (dbr:dbstruct-get-main vec) (vector-ref vec 0)) ;; ( db path )
(define-inline (dbr:dbstruct-get-strdb vec) (vector-ref vec 1)) ;; ( db path )
(define-inline (dbr:dbstruct-get-path vec) (vector-ref vec 2))
(define-inline (dbr:dbstruct-get-local vec) (vector-ref vec 3))
(define-inline (dbr:dbstruct-get-rundb vec) (vector-ref vec 4)) ;; ( db path )
(define-inline (dbr:dbstruct-get-inmem vec) (vector-ref vec 5)) ;; ( db #f )
(define-inline (dbr:dbstruct-get-mtime vec) (vector-ref vec 6))
(define-inline (dbr:dbstruct-get-rtime vec) (vector-ref vec 7))
(define-inline (dbr:dbstruct-get-stime vec) (vector-ref vec 8))
(define-inline (dbr:dbstruct-get-inuse vec) (vector-ref vec 9))
(define-inline (dbr:dbstruct-get-refdb vec) (vector-ref vec 10)) ;; ( db path )
(define-inline (dbr:dbstruct-get-locdbs vec) (vector-ref vec 11))
(define-inline (dbr:dbstruct-get-olddb vec) (vector-ref vec 12)) ;; ( db path )
;; (define-inline (dbr:dbstruct-get-main-path vec) (vector-ref vec 13))
;; (define-inline (dbr:dbstruct-get-rundb-path vec) (vector-ref vec 14))
;; (define-inline (dbr:dbstruct-get-run-id vec) (vector-ref vec 13))
(define-inline (dbr:dbstruct-set-main! vec val)(vector-set! vec 0 val))
(define-inline (dbr:dbstruct-set-strdb! vec val)(vector-set! vec 1 val))
(define-inline (dbr:dbstruct-set-path! vec val)(vector-set! vec 2 val))
(define-inline (dbr:dbstruct-set-local! vec val)(vector-set! vec 3 val))
(define-inline (dbr:dbstruct-set-rundb! vec val)(vector-set! vec 4 val))
(define-inline (dbr:dbstruct-set-inmem! vec val)(vector-set! vec 5 val))
(define-inline (dbr:dbstruct-set-mtime! vec val)(vector-set! vec 6 val))
(define-inline (dbr:dbstruct-set-rtime! vec val)(vector-set! vec 7 val))
(define-inline (dbr:dbstruct-set-stime! vec val)(vector-set! vec 8 val))
(define-inline (dbr:dbstruct-set-inuse! vec val)(vector-set! vec 9 val))
(define-inline (dbr:dbstruct-set-refdb! vec val)(vector-set! vec 10 val))
(define-inline (dbr:dbstruct-set-locdbs! vec val)(vector-set! vec 11 val))
(define-inline (dbr:dbstruct-set-olddb! vec val)(vector-set! vec 12 val))
(define-inline (dbr:dbstruct-set-main-path! vec val)(vector-set! vec 13 val))
(define-inline (dbr:dbstruct-set-rundb-path! vec val)(vector-set! vec 14 val))
; (define-inline (dbr:dbstruct-set-run-id! vec val)(vector-set! vec 13 val))
;; constructor for dbstruct
;;
(define (make-dbr:dbstruct #!key (path #f)(local #f))
(let ((v (make-vector 15 #f)))
(dbr:dbstruct-set-path! v path)
(dbr:dbstruct-set-local! v local)
(dbr:dbstruct-set-locdbs! v (make-hash-table))
v))
(define (dbr:dbstruct-get-localdb v run-id)
(hash-table-ref/default (dbr:dbstruct-get-locdbs v) run-id #f))
(define (dbr:dbstruct-set-localdb! v run-id db)
(hash-table-set! (dbr:dbstruct-get-locdbs v) run-id db))
(define (make-db:test)(make-vector 20))
(define-inline (db:test-get-id vec) (vector-ref vec 0))
(define-inline (db:test-get-run_id vec) (vector-ref vec 1))
(define-inline (db:test-get-testname vec) (vector-ref vec 2))
(define-inline (db:test-get-state vec) (vector-ref vec 3))
(define-inline (db:test-get-status vec) (vector-ref vec 4))
(define-inline (db:test-get-event_time vec) (vector-ref vec 5))
(define-inline (db:test-get-host vec) (vector-ref vec 6))
(define-inline (db:test-get-cpuload vec) (vector-ref vec 7))
(define-inline (db:test-get-diskfree vec) (vector-ref vec 8))
(define-inline (db:test-get-uname vec) (vector-ref vec 9))
;; (define-inline (db:test-get-rundir vec) (sdb:qry 'getstr (vector-ref vec 10)))
(define-inline (db:test-get-rundir vec) (vector-ref vec 10))
(define-inline (db:test-get-item-path vec) (vector-ref vec 11))
(define-inline (db:test-get-run_duration vec) (vector-ref vec 12))
(define-inline (db:test-get-final_logf vec) (vector-ref vec 13))
(define-inline (db:test-get-comment vec) (vector-ref vec 14))
(define-inline (db:test-get-process_id vec) (vector-ref vec 16))
(define-inline (db:test-get-archived vec) (vector-ref vec 17))
;; (define-inline (db:test-get-pass_count vec) (vector-ref vec 15))
;; (define-inline (db:test-get-fail_count vec) (vector-ref vec 16))
(define-inline (db:test-get-fullname vec)
(conc (db:test-get-testname vec) "/" (db:test-get-item-path vec)))
;; replace runs:make-full-test-name with this routine
(define (db:test-make-full-name testname itempath)
(if (equal? itempath "") testname (conc testname "/" itempath)))
(define-inline (db:test-get-first_err vec) (printable (vector-ref vec 15)))
(define-inline (db:test-get-first_warn vec) (printable (vector-ref vec 16)))
(define-inline (db:test-set-cpuload! vec val)(vector-set! vec 7 val))
(define-inline (db:test-set-diskfree! vec val)(vector-set! vec 8 val))
(define-inline (db:test-set-testname! vec val)(vector-set! vec 2 val))
(define-inline (db:test-set-state! vec val)(vector-set! vec 3 val))
(define-inline (db:test-set-status! vec val)(vector-set! vec 4 val))
(define-inline (db:test-set-run_duration! vec val)(vector-set! vec 12 val))
(define-inline (db:test-set-final_logf! vec val)(vector-set! vec 13 val))
;; Test record utility functions
;; Is a test a toplevel?
;;
(define (db:test-get-is-toplevel vec)
(and (equal? (db:test-get-item-path vec) "") ;; test is not an item
(equal? (db:test-get-uname vec) "n/a"))) ;; test has never been run
;; make-vector-record "" db mintest id run_id testname state status event_time item_path
;;
(define (make-db:mintest)(make-vector 7))
(define-inline (db:mintest-get-id vec) (vector-ref vec 0))
(define-inline (db:mintest-get-run_id vec) (vector-ref vec 1))
(define-inline (db:mintest-get-testname vec) (vector-ref vec 2))
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
|
<
|
<
<
<
|
|
|
|
|
>
>
>
|
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
>
|
|
>
|
|
<
|
|
>
>
|
|
|
|
|
|
|
|
|
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
60
61
62
63
64
65
66
67
68
69
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
;; |-1.db
;; |-<N>.db
;;
;;
;; Accessors for a dbstruct
;;
(use defstruct)
(defstruct dbr:dbstruct main strdb path local rundb inmem mtime rtime stime inuse refdb locdbs olddb rundb-path)
;; constructor for dbstruct
;;
(define (make-dbr:dbstruct-wrapper #!key (path #f)(local #f))
(let ((res (make-dbr:dbstruct)))
(dbr:dbstruct-path-set! res path)
(dbr:dbstruct-local-set! res local)
(dbr:dbstruct-locdbs-set! res (make-hash-table))
res))
;;; (define d1 (make-dbr:dbstruct))
;;; (dbr:dbstruct-main d1) ==> retrive value
;;; (dbr:dbstruct-main-set! d1 'def) ==> set value
;; (define-inline (dbr:dbstruct-get-main vec) (vector-ref vec 0)) ;; ( db path )
;; (define-inline (dbr:dbstruct-get-strdb vec) (vector-ref vec 1)) ;; ( db path )
;; (define-inline (dbr:dbstruct-get-path vec) (vector-ref vec 2))
;; (define-inline (dbr:dbstruct-get-local vec) (vector-ref vec 3))
;; (define-inline (dbr:dbstruct-get-rundb vec) (vector-ref vec 4)) ;; ( db path )
;; (define-inline (dbr:dbstruct-get-inmem vec) (vector-ref vec 5)) ;; ( db #f )
;; (define-inline (dbr:dbstruct-get-mtime vec) (vector-ref vec 6))
;; (define-inline (dbr:dbstruct-get-rtime vec) (vector-ref vec 7))
;; (define-inline (dbr:dbstruct-get-stime vec) (vector-ref vec 8))
;; (define-inline (dbr:dbstruct-get-inuse vec) (vector-ref vec 9))
;; (define-inline (dbr:dbstruct-get-refdb vec) (vector-ref vec 10)) ;; ( db path )
;; (define-inline (dbr:dbstruct-get-locdbs vec) (vector-ref vec 11))
;; (define-inline (dbr:dbstruct-get-olddb vec) (vector-ref vec 12)) ;; ( db path )
;; ;; (define-inline (dbr:dbstruct-get-main-path vec) (vector-ref vec 13))
;; ;; (define-inline (dbr:dbstruct-get-rundb-path vec) (vector-ref vec 14))
;; ;; (define-inline (dbr:dbstruct-get-run-id vec) (vector-ref vec 13))
;;
;; (define-inline (dbr:dbstruct-set-main! vec val)(vector-set! vec 0 val))
;; (define-inline (dbr:dbstruct-set-strdb! vec val)(vector-set! vec 1 val))
;; (define-inline (dbr:dbstruct-set-path! vec val)(vector-set! vec 2 val))
;; (define-inline (dbr:dbstruct-set-local! vec val)(vector-set! vec 3 val))
;; (define-inline (dbr:dbstruct-set-rundb! vec val)(vector-set! vec 4 val))
;; (define-inline (dbr:dbstruct-set-inmem! vec val)(vector-set! vec 5 val))
;; (define-inline (dbr:dbstruct-set-mtime! vec val)(vector-set! vec 6 val))
;; (define-inline (dbr:dbstruct-set-rtime! vec val)(vector-set! vec 7 val))
;; (define-inline (dbr:dbstruct-set-stime! vec val)(vector-set! vec 8 val))
;; (define-inline (dbr:dbstruct-set-inuse! vec val)(vector-set! vec 9 val))
;; (define-inline (dbr:dbstruct-set-refdb! vec val)(vector-set! vec 10 val))
;; (define-inline (dbr:dbstruct-set-locdbs! vec val)(vector-set! vec 11 val))
;; (define-inline (dbr:dbstruct-set-olddb! vec val)(vector-set! vec 12 val))
;; (define-inline (dbr:dbstruct-set-main-path! vec val)(vector-set! vec 13 val))
;; (define-inline (dbr:dbstruct-set-rundb-path! vec val)(vector-set! vec 14 val))
; (define-inline (dbr:dbstruct-set-run-id! vec val)(vector-set! vec 13 val))
;; constructor for dbstruct
;;
;; BB: commenting out following 3 methods since they are unused
;; (define (actual-make-dbr:dbstruct #!key (path #f)(local #f))
;; (make-dbr:dbstruct path: path local: local locdbs: (make-hash-table)))
(define (dbr:dbstruct-localdb v run-id)
(hash-table-ref/default (dbr:dbstruct-locdbs v) run-id #f))
(define (dbr:dbstruct-localdb-set! v run-id db)
(hash-table-set! (dbr:dbstruct-locdbs v) run-id db))
(defstruct db:test id run_id testname state status event_time host cpuload
diskfree uname rundir item-path run_duration final_logf
comment process_id pass_count fail_count archived )
;; BB: 16ww4.3 begin comment out
;; (define (make-db:test)(make-vector 20))
;; (define-inline (db:test-get-id vec) (vector-ref vec 0))
;; (define-inline (db:test-get-run_id vec) (vector-ref vec 1))
;; (define-inline (db:test-get-testname vec) (vector-ref vec 2))
;; (define-inline (db:test-get-state vec) (vector-ref vec 3))
;; (define-inline (db:test-get-status vec) (vector-ref vec 4))
;; (define-inline (db:test-get-event_time vec) (vector-ref vec 5))
;; (define-inline (db:test-get-host vec) (vector-ref vec 6))
;; (define-inline (db:test-get-cpuload vec) (vector-ref vec 7))
;; (define-inline (db:test-get-diskfree vec) (vector-ref vec 8))
;; (define-inline (db:test-get-uname vec) (vector-ref vec 9))
;; ;; (define-inline (db:test-get-rundir vec) (sdb:qry 'getstr (vector-ref vec 10)))
;; (define-inline (db:test-get-rundir vec) (vector-ref vec 10))
;; (define-inline (db:test-get-item-path vec) (vector-ref vec 11))
;; (define-inline (db:test-get-run_duration vec) (vector-ref vec 12))
;; (define-inline (db:test-get-final_logf vec) (vector-ref vec 13))
;; (define-inline (db:test-get-comment vec) (vector-ref vec 14))
;; (define-inline (db:test-get-process_id vec) (vector-ref vec 16))
;; (define-inline (db:test-get-archived vec) (vector-ref vec 17))
;; BB: 16ww4.3 end comment out
;; (define-inline (db:test-get-pass_count vec) (vector-ref vec 15))
;; (define-inline (db:test-get-fail_count vec) (vector-ref vec 16))
(define-inline (db:test-fullname struct)
(conc (db:test-testname struct) "/" (db:test-item-path struct)))
;; replace runs:make-full-test-name with this routine
(define (db:test-make-full-name testname itempath)
(if (equal? itempath "") testname (conc testname "/" itempath)))
;; BB: commenting out following unused items:
;(define-inline (db:test-get-first_err vec) (printable (vector-ref vec 15)))
;(define-inline (db:test-get-first_warn vec) (printable (vector-ref vec 16)))
;;(define-inline (db:test-set-cpuload! vec val)(vector-set! vec 7 val))
;;(define-inline (db:test-set-diskfree! vec val)(vector-set! vec 8 val))
;; BB: commenting out methods replaced by defstruct
;; (define-inline (db:test-set-testname! vec val)(vector-set! vec 2 val))
;; (define-inline (db:test-set-state! vec val)(vector-set! vec 3 val))
;; (define-inline (db:test-set-status! vec val)(vector-set! vec 4 val))
;; (define-inline (db:test-set-run_duration! vec val)(vector-set! vec 12 val))
;; (define-inline (db:test-set-final_logf! vec val)(vector-set! vec 13 val))
;; Test record utility functions
;; Is a test a toplevel?
;;
(define (db:test-get-is-toplevel struct)
(and (equal? (db:test-item-path struct) "") ;; test is not an item
(equal? (db:test-uname struct) "n/a"))) ;; test has never been run
;; make-vector-record "" db mintest id run_id testname state status event_time item_path
;;
(define (make-db:mintest)(make-vector 7))
(define-inline (db:mintest-get-id vec) (vector-ref vec 0))
(define-inline (db:mintest-get-run_id vec) (vector-ref vec 1))
(define-inline (db:mintest-get-testname vec) (vector-ref vec 2))
|