233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
|
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
+
+
-
+
|
; (hash-table-set! args:arg-hash "-keepgoing" #t)
(hash-table-set! args:arg-hash "-itempatt" "%")
(hash-table-set! args:arg-hash "-testpatt" "%")
(hash-table-set! args:arg-hash "-target" "ubuntu/r1.2")
(test "Setup for a run" #t (begin (setup-for-run) #t))
(define *tdb* #f)
(define keyvals #f)
(test "target->keyval" #t (let ((kv (keys:target->keyval keys (args:get-arg "-target"))))
(set! keyvals kv)(list? keyvals)))
(define testdbpath (conc "/tmp/" (getenv "USER") "/megatest_testing"))
(system (conc "rm -f " testdbpath "/testdat.db;mkdir -p " testdbpath))
(print "Using " testdbpath " for test db")
(test #f #t (let ((db (open-test-db testdbpath)))
(set! *tdb* db)
(sqlite3#database? db)))
(sqlite3#finalize! *tdb*)
;; (test "Remove the rollup run" #t (begin (remove-runs) #t))
(define tconfig #f)
(test "get a testconfig" #t (let ((tconf (tests:get-testconfig "test1" 'return-procs)))
(set! tconfig tconf)
(hash-table? tconf)))
(db:clean-all-caches)
(set! *verbosity* (list 0 1 2))
(test #f #t (set-megatest-env-vars 1 inkeys: keys))
(test #f #t (setup-env-defaults "runconfigs.config" 1 *already-seen-runconfig-info* keys keyvals "pre-launch-env-vars"))
(test "set-megatest-env-vars"
"ubuntu"
(begin
(set-megatest-env-vars 1 inkeys: keys)
(get-environment-variable "SYSTEM")))
(test "setup-env-defaults"
"see this variable"
(begin
(setup-env-defaults "runconfigs.config" 1 *already-seen-runconfig-info* keys keyvals "pre-launch-env-vars")
(get-environment-variable "ALLTESTS")))
(test #f "ubuntu" (car (keys:target-set-args keys (args:get-arg "-target") args:arg-hash)))
(define rinfo #f)
(test "get-run-info" #f (vector? (vector-ref (let ((rinf (cdb:remote-run db:get-run-info #f 1)))
(set! rinfo rinf)
rinf) 0)))
(test "get-key-vals" "SYSTEM" (car (cdb:remote-run db:get-key-vals #f 1)))
(test "tests:sort-by" '() (tests:sort-by-priority-and-waiton (make-hash-table)))
(test "update-test_meta" "test1" (begin
(runs:update-test_meta "test1" tconfig)
(let ((dat (cdb:remote-run db:testmeta-get-record #f "test1")))
(vector-ref dat 1))))
(define test-path "tests/test1")
(define disk-path #f)
(test "get-best-disk" #t (string? (file-exists? (let ((d (get-best-disk *configdat*)))
(set! disk-path d)
d))))
(test "create-work-area" #t (symbolic-link? (car (create-work-area 1 rinfo keyvals 1 test-path disk-path "test1" '()))))
(test #f "" (item-list->path '()))
(test "launch-test" #t (string? (file-exists? (launch-test 1 1 rinfo keyvals "run1" tconfig "test1" test-path '() (make-hash-table)))))
(test "Run a test" #t (general-run-call
"-runtests"
"run a test"
(lambda (target runname keys keyvallst)
(let ((test-patts "test%"))
;; (runs:run-tests target runname test-patts user (make-hash-table))
;; (run:test run-id run-info key-vals runname test-record flags parent-test)
;; (set! *verbosity* 22) ;; (list 0 1 2))
(run:test 1 ;; run-id
#f ;; run-info is yet only a dream
keyvallst ;; (keys:target->keyval keys target)
(args:get-arg ":runname")
(vector
"run1" ;; runname
(vector ;; test_records.scm tests:testqueue
"test1" ;; testname
tconfig ;; testconfig
'() ;; waitons
0 ;; priority
#f ;; items
#f ;; itemsdat
#f ;; spare
"" ;; itempath
)
args:arg-hash ;; flags (e.g. -itemspatt)
#f)
;; (set! *verbosity* 0)
#f)))))
))))
(test "server stop" #f (let ((hostname (car *runremote*))
(port (cadr *runremote*)))
|