Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -28,11 +28,11 @@ ezsteps.scm lock-queue.scm sdb.scm rmt.scm api.scm \ subrun.scm portlogger.scm archive.scm env.scm \ diff-report.scm cgisetup/models/pgdb.scm # module source files -MSRCFILES = adjutant.scm mutils.scm +MSRCFILES = adjutant.scm mutils.scm mttop.scm # ftail.scm rmtmod.scm commonmod.scm removed # MSRCFILES = ducttape-lib.scm pkts.scm stml2.scm cookie.scm mutils.scm \ # mtargs.scm commonmod.scm dbmod.scm adjutant.scm ulex.scm \ # rmtmod.scm apimod.scm Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -45,10 +45,13 @@ (declare (uses mutils)) (import mutils) (declare (uses adjutant)) (import adjutant) + +(declare (uses mttop)) +(import mttop) ;; (declare (uses ftail)) ;; (import ftail) (define *db* #f) ;; this is only for the repl, do not use in general!!!! @@ -109,10 +112,11 @@ Usage: megatest [options] -h : this help -manual : show the Megatest user manual -version : print megatest version (currently " megatest-version ") + help : help for the new Megatest interface Launching and managing runs -run : run all tests or as specified by -testpatt -remove-runs : remove the data for a run, requires -runname and -testpatt Optionally use :state and :status, use -keep-records to remove only @@ -275,10 +279,14 @@ Version " megatest-version ", built from " megatest-fossil-hash )) ;; -gui : start a gui interface ;; -config fname : override the runconfigs file with fname + +(mttop-run (command-line-arguments) + '("help")) + ;; process args (define remargs (args:get-args (argv) (list "-runtests" ;; run a specific test "-config" ;; override the config file name @@ -927,11 +935,14 @@ (let loop ((wait-count 0)) (if (< wait-count 10) ;; 6 x 10 seconds = one minute (let* ((dat (rmt:no-sync-take-job host-type))) (match dat ((id ht vars exekey cmdline state event-time last-update) - (system cmdline) + (call-with-environment-variables + vars + (lambda () + (system cmdline))) (loop 0)) (else (thread-sleep! 10) (loop (+ wait-count 1))))) (print "I'm bored. Exiting."))) ADDED mttop.scm Index: mttop.scm ================================================================== --- /dev/null +++ mttop.scm @@ -0,0 +1,55 @@ +;; Copyright 2006-2011, Matthew Welland. +;; +;; This program is made available under the GNU GPL version 2.0 or +;; greater. See the accompanying file COPYING for details. +;; +;; This program is distributed WITHOUT ANY WARRANTY; without even the +;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +;; PURPOSE. + +;; This is from the perl world, a hash of hashes is a super easy way to keep a handle on +;; lots of disparate data +;; + +(declare (unit mttop)) + +(module mttop + * + +(import chicken scheme + ;; data-structures posix + srfi-1 + ;; srfi-13 + srfi-69 + ports + extras + regex + posix + data-structures + matchable + ) + +(define (str-is-cmd cmd all-cmds) + (let* ((rx (regexp (conc "^" cmd ".*"))) + (mx (filter string? (map (lambda (x) + (let ((res (string-match rx x))) + (if res (car res) #f))) + all-cmds)))) + (if (eq? (length mx) 1) ;; have a command + (car mx) + #f))) + +(define (mttop-run args all-cmds) + ;; any path through this call must end in exit if it is NOT an old Megatest call + (if (null? args) + #f ;; continue on and do the old Megatest stuff + (let ((cmd (str-is-cmd (car args) all-cmds))) + (if cmd + (begin + (case (string->symbol cmd) + ((help)(print "New help")) + (else (print "Command " cmd " is not implemented yet."))) + (exit)) ;; always exit here + #f)))) ;; or continue on to Megatest old stuff here + +)