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
|
;; ./rununittest.sh all-rmt 1
;; Definitions:
;; NTN - no test needed
;; DEP - function is deprecated, no point in testing
;; NED - function nested under others, no test needed.
;; DEF - deferred
(print "start dir: " (current-directory))
(define toppath (current-directory))
(test #f #f (server:check-if-running toppath)) ;; these are used by server:start-and-wait
(test #f #t (list? (server:get-list toppath)))
(test #f '() (server:get-best '()))
(test #f #t (common:simple-file-lock-and-wait "test.lock" expire-time: 15))
(test #f "test.lock" (common:simple-file-release-lock "test.lock"))
(test #f #t (server:get-best-guess-address (get-host-name)))
(test #f #t (string? (common:get-homehost)))
;; clean out any old running servers
;;
(let ((servers (server:get-list toppath)))
(print "Known servers: " servers)
(if (not (null? servers))
(begin
(for-each
(lambda (server)
(let ((pid (list-ref server 4)))
(thread-start!
(make-thread
(lambda ()
(print "Attempting to kill server: " server)
(print "Attempting to kill pid " pid)
(system (conc "kill " pid))
(thread-sleep! 2)
(system (conc "kill -9 " pid)))
(conc pid)))))
servers)
(thread-sleep! 2))))
;; let's start up a server the mechanical way
(system "nbfake megatest -server -")
(thread-sleep! 2)
;; (test #f #t (string? (server:start-and-wait *toppath*)))
(test "setup for run" #t (begin (launch:setup)
(string? (getenv "MT_RUN_AREA_HOME"))))
(test #f #t (client:setup-http toppath))
(test #f #t (vector? (client:setup toppath)))
(test #f #t (vector? (rmt:get-connection-info toppath))) ;; TODO: push areapath down.
(test #f #t (string? (server:check-if-running ".")))
;; DEF (test #f #f (rmt:send-receive-no-auto-client-setup *runremote* 'get-keys #f '()))
;; DEF (rmt:kill-server run-id)
;; DEF (rmt:start-server run-id)
(test #f '(#t "successful login")(rmt:login #f))
;; DEF (rmt:login-no-auto-client-setup connection-info)
(test #f #t (pair? (rmt:get-latest-host-load (get-host-name))))
;; get-latest-host-load does a lookup in the db, it won't return a useful value unless
;; a test ran recently on host
(test-batch rmt:get-latest-host-load
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
>
>
|
|
|
|
|
|
|
>
|
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
|
;; ./rununittest.sh all-rmt 1
;; Definitions:
;; NTN - no test needed
;; DEP - function is deprecated, no point in testing
;; NED - function nested under others, no test needed.
;; DEF - deferred
(import commonmod)
(import dbmod)
(import rmtmod)
(use matchable)
(use trace)
(trace
rmt:login
db:login
rmt:send-receive
rmt:send-receive-no-auto-client-setup
rmtmod:calc-ro-mode
create-remote-record
rmt:open-qry-close-locally
common:force-server?
server:check-if-running
server:record->id
extras-case-11
extras-transport-failed
extras-transport-succeded
http-transport:close-connections
http-transport:client-api-send-receive
)
(print "start dir: " (current-directory))
(define toppath (current-directory))
(test #f #f (server:check-if-running toppath)) ;; these are used by server:start-and-wait
(test #f #t (list? (server:get-list toppath)))
(test #f '() (server:get-best '()))
(test #f '() (server:get-rand-best toppath))
(test #f #t (common:simple-file-lock-and-wait "test.lock" expire-time: 15))
(test #f "test.lock" (common:simple-file-release-lock "test.lock"))
(test #f #t (string? (server:get-best-guess-address (get-host-name))))
(test #f #t (string? (car (common:get-homehost))))
;; clean out any old running servers
;;
(let ((servers (server:get-list toppath)))
(print "Known servers: " servers)
(if (not (null? servers))
(begin
(for-each
(lambda (server)
(let ((pid (list-ref server 2)))
(thread-start!
(make-thread
(lambda ()
(if (number? pid)
(begin
(print "Attempting to kill server: " server)
(print "Attempting to kill pid " pid)
(system (conc "kill " pid))
(thread-sleep! 2)
(system (conc "kill -9 " pid)))))
(conc pid)))))
servers)
(thread-sleep! 2))))
;; let's start up a server the mechanical way
(system "nbfake megatest -server -")
(thread-sleep! 2)
;; (test #f #t (string? (server:start-and-wait *toppath*)))
(test "setup for run" #t (begin (launch:setup)
(string? (getenv "MT_RUN_AREA_HOME"))))
(test #f #t (string? (vector-ref (client:setup-http toppath) 0)))
(test #f #t (vector? (client:setup toppath)))
(test #f #t (vector? (rmt:get-connection-info toppath))) ;; TODO: push areapath down.
(test #f #t (list? (server:check-if-running toppath)))
;; DEF (test #f #f (rmt:send-receive-no-auto-client-setup *runremote* 'get-keys #f '()))
;; DEF (rmt:kill-server run-id)
;; DEF (rmt:start-server run-id)
(test #f #t (string? (client:get-signature)))
(test #f '(#t "successful login")(rmt:login #f))
;; DEF (rmt:login-no-auto-client-setup connection-info)
(test #f #t (pair? (rmt:get-latest-host-load (get-host-name))))
;; get-latest-host-load does a lookup in the db, it won't return a useful value unless
;; a test ran recently on host
(test-batch rmt:get-latest-host-load
|