Megatest

Check-in [54e87a5f54]
Login
Overview
Comment:Added all rmt calls of interest to basic invocations under test
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.60
Files: files | file ages | folders
SHA1: 54e87a5f54a04fbe1303e061b1f1e298d07891d7
User & Date: matt on 2015-09-01 21:44:56
Other Links: branch diff | manifest | tags
Context
2015-09-01
21:59
Added csv import back check-in: 9152525c34 user: matt tags: v1.60
21:44
Added all rmt calls of interest to basic invocations under test check-in: 54e87a5f54 user: matt tags: v1.60
00:53
Fixed update pass-fail counts, added more tests check-in: a458af98bb user: matt tags: v1.60
Changes

Modified api.scm from [7425d00411] to [6fba43c00b].

147
148
149
150
151
152
153

154
155
156
157
158
159
160
161
	    ((update-run-event_time)        (apply db:update-run-event_time dbstruct params))

	    ;; STEPS
	    ((teststep-set-status!)         (apply db:teststep-set-status! dbstruct params))

	    ;; TEST DATA
	    ((test-data-rollup)             (apply db:test-data-rollup dbstruct params))

	    ((csv->test-data)               (apply db:csv->test-data dbstruct params))

	    ;; MISC
	    ((sync-inmem->db)               (let ((run-id (car params)))
					      (db:sync-touched dbstruct run-id force-sync: #t)))
	    ((mark-incomplete)              (apply db:find-and-mark-incomplete dbstruct params))

	    ;; TESTMETA







>
|







147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
	    ((update-run-event_time)        (apply db:update-run-event_time dbstruct params))

	    ;; STEPS
	    ((teststep-set-status!)         (apply db:teststep-set-status! dbstruct params))

	    ;; TEST DATA
	    ((test-data-rollup)             (apply db:test-data-rollup dbstruct params))
	    ;; unfinished and unused
	    ;; ((csv->test-data)               (apply db:csv->test-data dbstruct params))

	    ;; MISC
	    ((sync-inmem->db)               (let ((run-id (car params)))
					      (db:sync-touched dbstruct run-id force-sync: #t)))
	    ((mark-incomplete)              (apply db:find-and-mark-incomplete dbstruct params))

	    ;; TESTMETA

Modified db.scm from [73b68d7608] to [ef0125019e].

2661
2662
2663
2664
2665
2666
2667


2668
2669
2670
2671
2672
2673
2674
             (SELECT count(id) FROM test_data WHERE test_id=? AND status like 'pass') AS pass_count;"
     test-id test-id)
    ;; Now rollup the counts to the central megatest.db
    (db:general-call dbdat 'pass-fail-counts (list pass-count fail-count test-id))
    ;; if the test is not FAIL then set status based on the fail and pass counts.
    (db:general-call dbdat 'test_data-pf-rollup (list test-id test-id test-id test-id))))



(define (db:csv->test-data dbstruct run-id test-id csvdata)
  (debug:print 4 "test-id " test-id ", csvdata: " csvdata)
  (let* ((dbdat   (db:get-db dbstruct run-id))
	 (db      (db:dbdat-get-db dbdat))
	 (csvlist (csv->list (make-csv-reader
			      (open-input-string csvdata)
			      '((strip-leading-whitespace? #t)







>
>







2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
             (SELECT count(id) FROM test_data WHERE test_id=? AND status like 'pass') AS pass_count;"
     test-id test-id)
    ;; Now rollup the counts to the central megatest.db
    (db:general-call dbdat 'pass-fail-counts (list pass-count fail-count test-id))
    ;; if the test is not FAIL then set status based on the fail and pass counts.
    (db:general-call dbdat 'test_data-pf-rollup (list test-id test-id test-id test-id))))

;; NOT USED!?
;;
(define (db:csv->test-data dbstruct run-id test-id csvdata)
  (debug:print 4 "test-id " test-id ", csvdata: " csvdata)
  (let* ((dbdat   (db:get-db dbstruct run-id))
	 (db      (db:dbdat-get-db dbdat))
	 (csvlist (csv->list (make-csv-reader
			      (open-input-string csvdata)
			      '((strip-leading-whitespace? #t)

Modified rmt.scm from [2a4800a8d6] to [fbcfa3f658].

669
670
671
672
673
674
675


676
677
678
679
680
681
682
683
684

(define (rmt:testmeta-update-field test-name fld val)
  (rmt:send-receive 'testmeta-update-field #f (list test-name fld val)))

(define (rmt:test-data-rollup run-id test-id status)
  (rmt:send-receive 'test-data-rollup run-id (list run-id test-id status)))



(define (rmt:csv->test-data run-id test-id csvdata)
  (rmt:send-receive 'csv->test-data run-id (list run-id test-id csvdata)))

;;======================================================================
;;  T A S K S
;;======================================================================

(define (rmt:tasks-find-task-queue-records target run-name test-patt state-patt action-patt)
  (rmt:send-receive 'find-task-queue-records #f (list target run-name test-patt state-patt action-patt)))







>
>
|
|







669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686

(define (rmt:testmeta-update-field test-name fld val)
  (rmt:send-receive 'testmeta-update-field #f (list test-name fld val)))

(define (rmt:test-data-rollup run-id test-id status)
  (rmt:send-receive 'test-data-rollup run-id (list run-id test-id status)))

;; Unfinished and unused
;;
;; (define (rmt:csv->test-data run-id test-id csvdata)
;;   (rmt:send-receive 'csv->test-data run-id (list run-id test-id csvdata)))

;;======================================================================
;;  T A S K S
;;======================================================================

(define (rmt:tasks-find-task-queue-records target run-name test-patt state-patt action-patt)
  (rmt:send-receive 'find-task-queue-records #f (list target run-name test-patt state-patt action-patt)))

Modified tests/unit.logpro from [64aefe97ac] to [e61bf35efe].










1
2
3
4
5
6
7









;; You should have at least one expect:required. This ensures that your process ran
(expect:required in "LogFileBody" > 0 "At least one PASS" #/\[.{0,4}PASS.{0,4}\]/)

;; You may need ignores to suppress false error or warning hits from the later expects
;; NOTE: Order is important here!
(expect:ignore   in "LogFileBody"  < 99 "Ignore the word error in comments" #/^\/\/.*error/)
(expect:warning  in "LogFileBody"  = 0 "Any warning" #/warn/)
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
;; Ignore initial errors
(trigger "ScriptStart" #/^Script started/)
(trigger "TestStart"   #/^megatest> \(/)
(section "startup"     "ScriptStart" "TestStart")

(expect:ignore in "startup" >= 0 "Ignore startup errors" #/error/i)

(expect:ignore in "LogFileBody" >= 0 "Ignore .so files with error in name" #/loading.*error.*\.so/)
; loading /usr/local/lib/chicken/7/type-errors.import.so ..
;; You should have at least one expect:required. This ensures that your process ran
(expect:required in "LogFileBody" > 0 "At least one PASS" #/\[.{0,4}PASS.{0,4}\]/)

;; You may need ignores to suppress false error or warning hits from the later expects
;; NOTE: Order is important here!
(expect:ignore   in "LogFileBody"  < 99 "Ignore the word error in comments" #/^\/\/.*error/)
(expect:warning  in "LogFileBody"  = 0 "Any warning" #/warn/)

Modified tests/unittests/misc.scm from [f0990d6344] to [5f4bb259a2].

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

;; test:match->sqlqry
(test #f "(testname GLOB 'a' AND item_path GLOB 'b') OR (testname LIKE 'a%' AND item_path LIKE '%') OR (testname GLOB '' AND item_path LIKE 'b%')"
      (tests:match->sqlqry "a/b,a%,/b%"))
(test #f "(testname GLOB 'a' AND item_path GLOB 'b') OR (testname LIKE 'a%' AND item_path LIKE '%') OR (testname LIKE '%' AND item_path LIKE 'b%')"
      (tests:match->sqlqry "a/b,a%,%/b%"))

(let ((cmd             "dunno")
      (run-id          1)
      (rid             1)
      (rawcmd          "dunno")
      (params          '())
      (duration        100)
      (connection-info (vector #f #f #f))
      (dat              "abc")







|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

;; test:match->sqlqry
(test #f "(testname GLOB 'a' AND item_path GLOB 'b') OR (testname LIKE 'a%' AND item_path LIKE '%') OR (testname GLOB '' AND item_path LIKE 'b%')"
      (tests:match->sqlqry "a/b,a%,/b%"))
(test #f "(testname GLOB 'a' AND item_path GLOB 'b') OR (testname LIKE 'a%' AND item_path LIKE '%') OR (testname LIKE '%' AND item_path LIKE 'b%')"
      (tests:match->sqlqry "a/b,a%,%/b%"))

(let* ((cmd             "dunno")
      (run-id          1)
      (rid             1)
      (rawcmd          "dunno")
      (params          '())
      (duration        100)
      (connection-info (vector #f #f #f))
      (dat              "abc")
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
      (statuspatt       "PA%")
      (keynames         '("SYSTEM" "RELEASE")) ;; "sysname" "fsname" "datapath"))
      (waitons          '("a" "b" "c"))
      (ref-item-path    "/d/e/f")
      (jobgroup         "anl")
      (runpatt          "run%")
      (keyvals          '(("SYSTEM" "a")("RELEASE" "b")))

      (user             "freddy")

      (count            100)
      (keypatts         '(("SYSTEM" "%a")("RELEASE" "%b")))
      (lock             #f)
      (unlock           #t)
      (run-status       "n/a")
      (runnamepatt      "b%")
      (targpatt         "%a/%b/c%")
      (fields           "id,runname")
      (ovr-deadtime     100)
      (teststep-name    "first")
      (state-in         "COMPLETED")
      (status-in        "FAIL")
      (comment          "This is a comment eh!")
      (logfile          "/tmp/alogfile.log")
      (categorypatt     "stats")
      (work-area        "/tmp")
      (fld              "voltage")
      (val              5)
      (csvdata          "id,meas,val\n1,voltage,2")
      (action-patt      "%")
      (param-key        "dunno")
      (testname         "atest")
      (dneeded          10000)
      (bdisk-id         1)







>

>






|









|







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
      (statuspatt       "PA%")
      (keynames         '("SYSTEM" "RELEASE")) ;; "sysname" "fsname" "datapath"))
      (waitons          '("a" "b" "c"))
      (ref-item-path    "/d/e/f")
      (jobgroup         "anl")
      (runpatt          "run%")
      (keyvals          '(("SYSTEM" "a")("RELEASE" "b")))
      (keys             (map car keyvals))
      (user             "freddy")
      (owner            "tommy")
      (count            100)
      (keypatts         '(("SYSTEM" "%a")("RELEASE" "%b")))
      (lock             #f)
      (unlock           #t)
      (run-status       "n/a")
      (runnamepatt      "b%")
      (targpatt         "%a/%b")
      (fields           "id,runname")
      (ovr-deadtime     100)
      (teststep-name    "first")
      (state-in         "COMPLETED")
      (status-in        "FAIL")
      (comment          "This is a comment eh!")
      (logfile          "/tmp/alogfile.log")
      (categorypatt     "stats")
      (work-area        "/tmp")
      (fld              "owner")
      (val              5)
      (csvdata          "id,meas,val\n1,voltage,2")
      (action-patt      "%")
      (param-key        "dunno")
      (testname         "atest")
      (dneeded          10000)
      (bdisk-id         1)
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
218
219
  (test #f 1  (rmt:register-run keyvals runname state status user))
  (test #f "myfirstrun" (rmt:get-run-name-from-id run-id))
  (test #f #t (begin (rmt:delete-run run-id) #t))
  (test #f #t (begin (rmt:delete-old-deleted-test-records) #t))
  (test #f #t (vector? (rmt:get-runs runpatt count offset keypatts)))
  (test #f '() (rmt:get-all-run-ids))
  (test #f '() (rmt:get-prev-run-ids run-id))
;; (test #f #f (rmt:lock/unlock-run run-id lock unlock user))
;; (test #f #f (rmt:get-run-status run-id))
;; (test #f #f (rmt:set-run-status run-id run-status msg: msg))
;; (test #f #f (rmt:update-run-event_time run-id))
;; (test #f #f (rmt:get-runs-by-patt  keys runnamepatt targpatt offset limit fields)) ;; fields of #f uses default)
;; (test #f #f (rmt:find-and-mark-incomplete run-id ovr-deadtime))
;; (test #f #f (rmt:find-and-mark-incomplete-all-runs ovr-deadtime: ovr-deadtime))
;; (test #f #f (rmt:get-previous-test-run-record run-id test-name item-path))
;; (test #f #f (rmt:teststep-set-status! run-id test-id teststep-name state-in status-in comment logfile))
;; (test #f #f (rmt:get-steps-for-test run-id test-id))
;; (test #f #f (rmt:read-test-data run-id test-id categorypatt work-area: work-area))
;; (test #f #f (rmt:testmeta-add-record testname))
;; (test #f #f (rmt:testmeta-get-record testname))
;; (test #f #f (rmt:testmeta-update-field test-name fld val))
;; (test #f #f (rmt:test-data-rollup run-id test-id status))

;; (test #f #f (rmt:csv->test-data run-id test-id csvdata))
;; (test #f #f (rmt:tasks-find-task-queue-records target run-name test-patt state-patt action-patt))
;; (test #f #f (rmt:tasks-add action owner target runname testpatt params))
;; (test #f #f (rmt:tasks-set-state-given-param-key param-key new-state))

;; 
;; (test #f #f (rmt:archive-get-allocations  testname itempath dneeded))
;; (test #f #f (rmt:archive-register-block-name bdisk-id archive-path))
;; (test #f #f (rmt:archive-allocate-testsuite/area-to-block block-id testsuite-name areakey))
;; (test #f #f (rmt:archive-register-disk bdisk-name bdisk-path df))
;; (test #f #f (rmt:test-set-archive-block-id run-id test-id archive-block-id))
  ;; (test #f #f (rmt:test-get-archive-block-info archive-block-id))
  
  ;; Defer these a little while ...
  ;;
  ;; (test #f #f (rmt:test-set-state-status-by-id run-id test-id newstate newstatus newcomment))
  ;; (test #f #f (rmt:synchash-get run-id proc synckey keynum params))
  ;; (test #f #f (rmt:send-receive cmd rid params #!key (attemptnum 1)) ;; start attemptnum at 1 so the modulo below works as expected)
  ;; (test #f #f (rmt:open-qry-close-locally cmd run-id params #!key (remretries 5)))
  ;; (test #f #f (apply rmt:general-call stmtname run-id params))
  ;; (test #f #f (rmt:sync-inmem->db run-id))
  ;; (test #f #f (rmt:sdb-qry qry val run-id))








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










<







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
218
219
220
221
222
  (test #f 1  (rmt:register-run keyvals runname state status user))
  (test #f "myfirstrun" (rmt:get-run-name-from-id run-id))
  (test #f #t (begin (rmt:delete-run run-id) #t))
  (test #f #t (begin (rmt:delete-old-deleted-test-records) #t))
  (test #f #t (vector? (rmt:get-runs runpatt count offset keypatts)))
  (test #f '() (rmt:get-all-run-ids))
  (test #f '() (rmt:get-prev-run-ids run-id))
  (test #f #t (begin (rmt:lock/unlock-run run-id lock unlock user) #t))
  (test #f #t (begin (rmt:set-run-status run-id "NONPASS" msg: msg) #t)) ;; run-status
  (test #f "NONPASS" (rmt:get-run-status run-id))
  (test #f #t (begin (rmt:update-run-event_time run-id) #t))
  (test #f (vector '("SYSTEM" "RELEASE" "id") '()) (rmt:get-runs-by-patt  keys runnamepatt targpatt offset limit '("id"))) ;; fields of #f uses default)
  (test #f #t (begin (rmt:find-and-mark-incomplete run-id ovr-deadtime) #t))
  (test #f #t (begin (rmt:find-and-mark-incomplete-all-runs ovr-deadtime: ovr-deadtime) #t))
  (test #f #f (rmt:get-previous-test-run-record run-id test-name item-path))
  (test #f #t (begin (rmt:teststep-set-status! run-id test-id teststep-name state-in status-in comment logfile) #t))
  (test #f #t (vector? (car (rmt:get-steps-for-test run-id test-id))))
  (test #f '() (rmt:read-test-data run-id test-id categorypatt work-area: work-area))
  (test #f #t (begin (rmt:testmeta-add-record testname) #t))
  (test #f (vector 1 "atest" "" "" "" "" "" "" "" "" "default") (rmt:testmeta-get-record testname))
  (test #f #t (begin (rmt:testmeta-update-field test-name fld val) #t))
  (test #f #t (rmt:test-data-rollup run-id test-id status))
  ;; disabled as the function is unfinished and unused
  ;; (test #f #f (rmt:csv->test-data run-id test-id csvdata))
  (test #f '() (rmt:tasks-find-task-queue-records target runname testpatt statepatt action-patt))
  (test #f #t (begin (rmt:tasks-add "action" owner target runname testpatt "params") #t))
  (test #f #t (begin (rmt:tasks-set-state-given-param-key param-key newstate) #t))
  (test #f #t (begin (rmt:test-set-state-status-by-id run-id test-id newstate newstatus newcomment) #t))
;; 
;; (test #f #f (rmt:archive-get-allocations  testname itempath dneeded))
;; (test #f #f (rmt:archive-register-block-name bdisk-id archive-path))
;; (test #f #f (rmt:archive-allocate-testsuite/area-to-block block-id testsuite-name areakey))
;; (test #f #f (rmt:archive-register-disk bdisk-name bdisk-path df))
;; (test #f #f (rmt:test-set-archive-block-id run-id test-id archive-block-id))
  ;; (test #f #f (rmt:test-get-archive-block-info archive-block-id))
  
  ;; Defer these a little while ...
  ;;

  ;; (test #f #f (rmt:synchash-get run-id proc synckey keynum params))
  ;; (test #f #f (rmt:send-receive cmd rid params #!key (attemptnum 1)) ;; start attemptnum at 1 so the modulo below works as expected)
  ;; (test #f #f (rmt:open-qry-close-locally cmd run-id params #!key (remretries 5)))
  ;; (test #f #f (apply rmt:general-call stmtname run-id params))
  ;; (test #f #f (rmt:sync-inmem->db run-id))
  ;; (test #f #f (rmt:sdb-qry qry val run-id))