Megatest

Diff
Login

Differences From Artifact [403df89532]:

To Artifact [2e6377ff4f]:


1
2
3








4
5
6
7
8
9
10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18



+
+
+
+
+
+
+
+







(require-extension test)

(define test-work-dir (current-directory))

;; read in all the _record files
(let ((files (glob "*_records.scm")))
  (for-each
   (lambda (file)
     (print "Loading " file)
     (load file))
   files))

(define conffile #f)
(test "Read a config" #t (hash-table? (read-config "test.config" #f #f)))
(test "Read a config that doesn't exist" #t (hash-table? (read-config "nada.config" #f #f)))

(set! conffile (read-config "test.config" #f #f))
(test "Get available diskspace" #t (number? (get-df "./")))
50
51
52
53
54
55
56
57

58
59
60
61

62
63
64
65
66
67
68
58
59
60
61
62
63
64

65
66
67
68

69
70
71
72
73
74
75
76







-
+



-
+







                                      (and (file-exists? "nada.sh")
    			                 (file-exists? "nada.csh"))))

(test "get all legal tests" (list "test1" "test2") (sort (get-all-legal-tests) string<=?))

(test "register-test, test info" "NOT_STARTED"
      (begin
	(tests:register-test *db* 1 "nada" "")
	(db:tests-register-test *db* 1 "nada" "")
	(vector-ref (db:get-test-info *db* 1 "nada" "") 3)))
(test #f "NOT_STARTED"    
      (begin
	(open-run-close tests:register-test #f 1 "nada" "")
	(open-run-close db:tests-register-test #f 1 "nada" "")
	(vector-ref (open-run-close db:get-test-info #f 1 "nada" "") 3)))

(test "get-keys" "SYSTEM" (vector-ref (car (db:get-keys *db*)) 0));; (key:get-fieldname (car (sort (db-get-keys *db*)(lambda (a b)(string>=? (vector-ref a 0)(vector-ref b 0)))))))

(define remargs (args:get-args
		 '("bar" "foo" ":runname" "bob" ":sysname" "ubuntu" ":fsname" "nfs" ":datapath" "blah/foo" "nada")
		 (list ":runname" ":state" ":status")
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
150
151
152
153
154
155
128
129
130
131
132
133
134
135
136
137
138



139
140
141
142
143
144
145
146

147
148


149
150
151
152
153
154

155
156
157
158
159
160
161
162
163
164
165







+



-
-
-
+
+
+
+




-
+

-
-
+
+




-
+










(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))

(set! *verbosity* 20)
(test "Run a test" #t (general-run-call 
		       "-runtests" 
		       "run a test"
		       (lambda (db target runname keys keynames keyvallst)
			 (let ((test-patts "runfirst"))
			   (runs:run-tests  db target runname test-patts user (make-hash-table))))))
		       (lambda (target runname keys keynames keyvallst)
			 (let ((test-patts "test1"))
			   (runs:run-tests target runname test-patts user (make-hash-table))
			   ))))

(change-directory test-work-dir)
(test "Add a step"  #t
      (begin
	(teststep-set-status! db 1 "runfirst" "firststep" "start" 0 '() "This is a comment")
	(db:teststep-set-status! db 1 "step1" "start" 0 "This is a comment" "mylogfile.html")
	(sleep 2)
	(teststep-set-status! db 1 "runfirst" "firststep" "end" "pass" '() "This is a different comment")
	(set! test-id (db:test-get-id (car (db-get-tests-for-run db 1 "runfirst" ""))))
	(db:teststep-set-status! db 1 "step1" "end" "pass" "This is a different comment" "finallogfile.html")
	(set! test-id (db:test-get-id (car (db:get-tests-for-run db 1 "test1" "" '() '()))))
	(number? test-id)))

(test "Get nice table for steps" "2.0s"
      (begin
	(vector-ref (hash-table-ref (db:get-steps-table db test-id) "firststep") 4)))
	(vector-ref (hash-table-ref (db:get-steps-table db test-id) "test1") 4)))

(hash-table-set! args:arg-hash ":runname" "rollup")

(test "Remove the rollup run" #t (begin (remove-runs) #t))
(test "Rollup the run(s)" #t (begin
			       (runs:rollup-run db keys)
			       #t))

;; ADD ME!!!! (db:get-prereqs-not-met *db* 1 '("runfirst") "" mode: 'normal)
;; ADD ME!!!! (rdb:get-tests-for-run *db* 1 "runfirst" #f '() '())