Megatest

Check-in [fbca8a30c8]
Login
Overview
Comment:Fixed couple tests
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | test-specific-db
Files: files | file ages | folders
SHA1: fbca8a30c8b7118c3ff980b35a2d056f05848af3
User & Date: matt on 2012-10-04 16:08:38
Other Links: branch diff | manifest | tags
Context
2012-10-04
16:17
Merged with earlier edits check-in: 902282795a user: matt tags: test-specific-db
16:08
Fixed couple tests check-in: fbca8a30c8 user: matt tags: test-specific-db
2012-10-03
17:10
Fixed typo check-in: df9927b712 user: mrwellan tags: test-specific-db
Changes

Modified megatest.scm from [b0572d4f5a] to [1c46bfdb07].

791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
(if (args:get-arg "-repl")
    (let* ((toppath (setup-for-run))
	   (db      (if toppath (open-db) #f)))
      (if db
	  (begin
	    (set! *db* db)
	    (if (not (args:get-arg "-server"))
		(server:client-setup db))
	    (import readline)
	    (import apropos)
	    (gnu-history-install-file-manager
	     (string-append
	      (or (get-environment-variable "HOME") ".") "/.megatest_history"))
	    (current-input-port (make-gnu-readline-port "megatest> "))
	    (repl)))







|







791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
(if (args:get-arg "-repl")
    (let* ((toppath (setup-for-run))
	   (db      (if toppath (open-db) #f)))
      (if db
	  (begin
	    (set! *db* db)
	    (if (not (args:get-arg "-server"))
		(server:client-setup))
	    (import readline)
	    (import apropos)
	    (gnu-history-install-file-manager
	     (string-append
	      (or (get-environment-variable "HOME") ".") "/.megatest_history"))
	    (current-input-port (make-gnu-readline-port "megatest> "))
	    (repl)))

Modified tests/tests.scm from [403df89532] to [ca5a9de19f].

50
51
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67
68
                                      (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" "")
	(vector-ref (db:get-test-info *db* 1 "nada" "") 3)))

(test #f "NOT_STARTED"    
      (begin
	(open-run-close 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")







|

>


|







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
                                      (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
	(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 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")
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
(sqlite3#finalize! *tdb*)

;; (test "Remove the rollup run" #t (begin (remove-runs) #t))

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

(change-directory test-work-dir)
(test "Add a step"  #t
      (begin
	(teststep-set-status! db 1 "runfirst" "firststep" "start" 0 '() "This is a comment")
	(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" ""))))



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

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







|

|




|

|
|
>
>
>







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
(sqlite3#finalize! *tdb*)

;; (test "Remove the rollup run" #t (begin (remove-runs) #t))

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

(change-directory test-work-dir)
(test "Add a step"  #t
      (begin
	(db:teststep-set-status! db 1 "runfirst" "firststep" "start" 0 '() "This is a comment")
	(sleep 2)
	(db:teststep-set-status! db 1 "runfirst" "firststep" "end" "pass" '() "This is a different comment")
	(set! test-id (vector-ref (car (let ((tests (open-run-close db:get-tests-for-run #f 1 "runfirst" "" '() '())))
					 (print "tests: " tests)
					 tests))
				  0))
	(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)))

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