Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -1733,11 +1733,19 @@ (handle-exceptions exn #f (with-output-to-file fullpath (lambda ()(pp dat))))) #f)) - + +(define (common:raw-get-remote-host-load remote-host) + (handle-exceptions + exn + #f ;; more specific handling of errors needed + (with-input-from-pipe + (conc "ssh " remote-host " cat /proc/loadavg") + (lambda ()(list (read)(read)(read)))))) + ;; get cpu load by reading from /proc/loadavg, return all three values ;; (define (common:get-cpu-load remote-host) (handle-exceptions exn Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -2367,11 +2367,11 @@ (debug:print 0 *default-log-port* "Failed to create HTML output in " toppath "/lt/runs-index.html")) (set! *didsomething* #t))) (if (args:get-arg "-syscheck") (begin - (mutils:syscheck) + (mutils:syscheck common:raw-get-remote-host-load) (set! *didsomething* #t))) ;;====================================================================== ;; Exit and clean up ;;====================================================================== Index: mutils/mutils.scm ================================================================== --- mutils/mutils.scm +++ mutils/mutils.scm @@ -21,10 +21,11 @@ srfi-69 ;; ports extras regex posix + data-structures ) (define (mutils:hierhash-ref hh . keys) (if (null? keys) #f @@ -186,34 +187,49 @@ ;;====================================================================== ;; Other utils ;;====================================================================== -#;(define (check-write-create fpath) +(define (check-write-create fpath) (and (file-write-access? fpath) - (let ((fname (conc fpath "/junk ". (current-seconds) "-" (random 10000)))) - (print "trying to create/remove " fname) + (let ((fname (conc fpath "/.junk-" (current-seconds) "-" (random 10000)))) + ;;(print "trying to create/remove " fname) (handle-exceptions exn #f (begin (with-output-to-file fname (lambda () (print "You can delete this file"))) (delete-file fname) #t))))) + +;; (define (confirm-ssh-access-to-host hostname) + ;; do some sanity checks on the system ;; -(define (mutils:syscheck) +(define (mutils:syscheck proc) ;; current dir writeable and do megatest.config, runconfigs.config files exist/readable (print "Current directory " (current-directory) " writeable: " - (if #;(check-file-create ".") - (file-write-access? ".")"yes" "no")) + (if (check-write-create ".") "yes" "NO")) ;; home dir writeable + (print "Home directory " (get-environment-variable "HOME") " writeable: " + (if (check-write-create (get-environment-variable "HOME")) "yes" "NO")) ;; /tmp writeable + (print "/tmp directory writeable: " (if (check-write-create "/tmp") "yes" "NO")) ;; load configs + (print "$DISPLAY set: " (if (get-environment-variable "DISPLAY") + (conc (get-environment-variable "DISPLAY") " yes") + "NO")) + + (print "$DISPLAY accessible? " + (if (eq? (system "xdpyinfo -display $DISPLAY &>/dev/null;") 0) + "yes" "NO")) + + + ;; check load on homehost ;; each run disk read/write ;; link tree writeable ) )