Megatest

Diff
Login

Differences From Artifact [ed22148f79]:

To Artifact [606a86810a]:


43
44
45
46
47
48
49


50
51
52
53
54
55
56
			     (get-host-name) 
			     hostn))
	 (ipaddrstr      (if (string=? "-" hostn)
			     (string-intersperse (map number->string (u8vector->list (hostname->ip hostname))) ".")
			     #f))
	 (host:port      (conc (if ipaddrstr ipaddrstr hostname) ":" (rpc:default-server-port))))
    (db:set-var db "SERVER" host:port)


    (rpc:publish-procedure! 
     'remote:run 
     (lambda (procstr . params)
       (server:autoremote procstr params)))

    ;;======================================================================
    ;; db specials here







>
>







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
			     (get-host-name) 
			     hostn))
	 (ipaddrstr      (if (string=? "-" hostn)
			     (string-intersperse (map number->string (u8vector->list (hostname->ip hostname))) ".")
			     #f))
	 (host:port      (conc (if ipaddrstr ipaddrstr hostname) ":" (rpc:default-server-port))))
    (db:set-var db "SERVER" host:port)

    ;; can use this to run most anything at the remote
    (rpc:publish-procedure! 
     'remote:run 
     (lambda (procstr . params)
       (server:autoremote procstr params)))

    ;;======================================================================
    ;; db specials here
88
89
90
91
92
93
94
95
96
97
98




















































































99
100
101
102
103
104
105

    (rpc:publish-procedure!
     'rdb:test-set-comment 
     (lambda (run-id test-name item-path comment)
       (db:test-set-comment db run-id test-name item-path comment)))
    
    (rpc:publish-procedure!
     'rpc:test-set-log!
     (lambda (run-id test-name item-path logf)
       (db:test-set-log! db run-id test-name item-path logf)))





















































































    (set! *rpc:listener* rpc:listener)
    (on-exit (lambda ()
	       (sqlite3:execute db "DELETE FROM metadat WHERE var='SERVER' and val=?;" host:port)
	       (sqlite3:finalize! db)))
    (thread-start! th1)
    (thread-join! th1))) ;; rpc:server)))








|



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191

    (rpc:publish-procedure!
     'rdb:test-set-comment 
     (lambda (run-id test-name item-path comment)
       (db:test-set-comment db run-id test-name item-path comment)))
    
    (rpc:publish-procedure!
     'rdb:test-set-log!
     (lambda (run-id test-name item-path logf)
       (db:test-set-log! db run-id test-name item-path logf)))

    (rpc:publish-procedure!
     'serve:get-toppath
     (lambda ()
       *toppath*))

    (rpc:publish-procedure!
     'serve:login
     (lambda (toppath)
       (if (equal? *toppath* toppath)
	   (begin
	     (debug:print 2 "INFO: login successful")
	     #t)
	   #f)))	     
    
    (rpc:publish-procedure!
     'rdb:get-runs
     (lambda (runnamepatt numruns startrunoffset keypatts)
       (db:get-runs db runnamepatt numruns startrunoffset keypatts)))

    (rpc:publish-procedure!
     'rdb:get-tests-for-run 
     (lambda (run-id testpatt itempatt states statuses)
       (db:get-tests-for-run db run-id testpatt itempatt states statuses)))

    (rpc:publish-procedure!
     'rdb:get-keys
     (lambda ()
       (db:get-keys db)))

    (rpc:publish-procedure!
     'rdb:get-num-runs
     (lambda (runpatt)
       (db:get-num-runs db runpatt)))

    (rpc:publish-procedure!
     'rdb:test-set-state-status-by-id
     (lambda (test-id newstate newstatus newcomment)
       (db:test-set-state-status-by-id db test-id newstate newstatus newcomment)))

    (rpc:publish-procedure!
     'rdb:get-key-val-pairs
     (lambda (run-id)
       (db:get-key-val-pairs db run-id)))

    (rpc:publish-procedure!
     'rdb:get-key-vals
     (lambda (run-id)
       (db:get-key-vals db run-id)))

    (rpc:publish-procedure!
     'rdb:testmeta-get-record
     (lambda (run-id)
       (db:testmeta-get-record db run-id)))

    (rpc:publish-procedure!
     'rdb:get-test-data-by-id
     (lambda (test-id)
       (db:get-test-data-by-id db test-id)))

    (rpc:publish-procedure!
     'rdb:get-run-info
     (lambda (run-id)
       (db:get-run-info db run-id)))

    (rpc:publish-procedure!
     'rdb:get-steps-for-test
     (lambda (test-id)
       (db:get-steps-for-test db test-id)))

    (rpc:publish-procedure!
     'rdb:get-steps-table
     (lambda (test-id)
       (db:get-steps-table db test-id)))

    (rpc:publish-procedure!
     'rdb:read-test-data
     (lambda (test-id categorypatt)
       (db:read-test-data db test-id categorypatt)))

    (rpc:publish-procedure!
     'rdb:get-test-info
     (lambda (run-id testname item-path)
       (db:get-test-info db  run-id testname item-path)))

    (set! *rpc:listener* rpc:listener)
    (on-exit (lambda ()
	       (sqlite3:execute db "DELETE FROM metadat WHERE var='SERVER' and val=?;" host:port)
	       (sqlite3:finalize! db)))
    (thread-start! th1)
    (thread-join! th1))) ;; rpc:server)))

115
116
117
118
119
120
121

122




123









124
(define (server:client-setup db)
  (let* ((hostinfo (db:get-var db "SERVER"))
	 (hostdat  (if hostinfo (string-split hostinfo ":")))
	 (host     (if hostinfo (car hostdat)))
	 (port     (if (and hostinfo (> (length hostdat) 1))(cadr hostdat) #f)))
    (if (and port
	     (string->number port))

	(debug:print 2 "INFO: Setting up to connect to host " host ":" port))




    (set! *runremote* (if port (vector host (string->number port)) #f))))

















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

201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
(define (server:client-setup db)
  (let* ((hostinfo (db:get-var db "SERVER"))
	 (hostdat  (if hostinfo (string-split hostinfo ":")))
	 (host     (if hostinfo (car hostdat)))
	 (port     (if (and hostinfo (> (length hostdat) 1))(cadr hostdat) #f)))
    (if (and port
	     (string->number port))
	(let ((portn (string->number port)))
	  (debug:print 2 "INFO: Setting up to connect to host " host ":" port)
	 (handle-exceptions
	  exn
	  (begin
	    (print "Exception: " exn)
	    (set! *runremote* #f))
	   (if (and (not (args:get-arg "-server")) ;; no point in the server using the server using the server
		    ((rpc:procedure 'serve:login host portn) *toppath*))
	       (begin
		 (debug:print 2 "INFO: Connected to " host ":" port)
		 (set! *runremote* (vector host portn)))
	       (begin
		 (debug:print 2 "INFO: Failed to connect to " host ":" port)
		 (set! *runremote* #f)))))
	(debug:print 2 "INFO: no server available"))))