Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -91,11 +91,12 @@ -update-meta : update the tests metadata for all tests -env2file fname : write the environment to fname.csh and fname.sh -setvars VAR1=val1,VAR2=val2 : Add environment variables to a run NB// these are overwritten by values set in config files. -archive : archive tests, use -target, :runname, -itempatt and -testpatt - -server : start the server (reduces contention on megatest.db) + -server -|hostname : start the server (reduces contention on megatest.db), use + - to automatically figure out hostname Spreadsheet generation -extract-ods fname.ods : extract an open document spreadsheet from the database -pathmod path : insert path, i.e. path/runame/itempath/logfile.html will clear the field if no rundir/testname/itempath/logfile @@ -151,10 +152,11 @@ ":value" ":expected" ":tol" ":units" ;; misc + "-server" "-extract-ods" "-pathmod" "-env2file" "-setvars" "-debug" ;; for *verbosity* > 2 @@ -178,11 +180,10 @@ "-keepgoing" "-usequeue" "-rebuild-db" "-rollup" "-update-meta" - "-server" "-v" ;; verbose 2, more than normal (normal is 1) "-q" ;; quiet 0, errors/warnings only ) args:arg-hash @@ -389,11 +390,11 @@ ;;====================================================================== (if (args:get-arg "-server") (let* ((toppath (setup-for-run)) (db (if toppath (open-db) #f))) (if db - (server:start db) + (server:start db (args:get-arg "-server")) (debug:print 0 "ERROR: Failed to setup for megatest")))) ;;;====================================================================== ;; Rollup into a run ;;====================================================================== Index: server.scm ================================================================== --- server.scm +++ server.scm @@ -31,21 +31,24 @@ (apply (eval (string->symbol proc)) params)) (if *runremote* (apply (eval (string->symbol (conc "remote:" procstr))) params) (eval (string->symbol procstr) params)))) -(define (server:start db) +(define (server:start db hostn) (debug:print 0 "Attempting to start the server ...") (let* ((rpc:listener (server:find-free-port-and-open (rpc:default-server-port))) (th1 (make-thread (cute (rpc:make-server rpc:listener) "rpc:server") 'rpc:server)) - (hostname (get-host-name)) - (ipaddr (hostname->ip hostname)) - (ipaddrstr (string-intersperse (map number->string (u8vector->list ipaddr)) ".")) - (ipaddrstr:port (conc ipaddrstr ":" (rpc:default-server-port)))) - (db:set-var db "SERVER" ipaddrstr:port) + (hostname (if (string=? "-" hostn) + (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))) @@ -93,11 +96,11 @@ (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=?;" ipaddrstr:port) + (sqlite3:execute db "DELETE FROM metadat WHERE var='SERVER' and val=?;" host:port) (sqlite3:finalize! db))) (thread-start! th1) (thread-join! th1))) ;; rpc:server))) (define (server:find-free-port-and-open port)