Megatest

Diff
Login

Differences From Artifact [4932effef8]:

To Artifact [bc7da1c8f9]:


961
962
963
964
965
966
967
968
969
970
971
972



973
974
975
976
977
978



979
980
981
982
983
984
985
986
987
(define (common:false-on-exception thunk #!key (message #f))
  (handle-exceptions exn
                     (begin
                       (if message
                           (debug:print-info 0 *default-log-port* message))
                       #f) (thunk) ))

(define (common:file-exists? path-string)
  ;; this avoids stack dumps in the case where 

  ;;;; TODO: catch permission denied exceptions and emit appropriate warnings, eg:  system error while trying to access file: "/nfs/pdx/disks/icf_env_disk001/bjbarcla/gwa/issues/mtdev/randy-slow/reproduce/q...
  (common:false-on-exception (lambda () (file-exists? path-string))



                             message: (conc "Unable to access path: " path-string)
                             ))

(define (common:directory-exists? path-string)
  ;;;; TODO: catch permission denied exceptions and emit appropriate warnings, eg:  system error while trying to access file: "/nfs/pdx/disks/icf_env_disk001/bjbarcla/gwa/issues/mtdev/randy-slow/reproduce/q...
  (common:false-on-exception (lambda () (directory-exists? path-string))



                             message: (conc "Unable to access path: " path-string)
                             ))

;; does the directory exist and do we have write access?
;;
;;    returns the directory or #f
;;
(define (common:directory-writable? path-string)
  (handle-exceptions







|



|
>
>
>
|
<

|

|
>
>
>
|
<







961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976

977
978
979
980
981
982
983
984

985
986
987
988
989
990
991
(define (common:false-on-exception thunk #!key (message #f))
  (handle-exceptions exn
                     (begin
                       (if message
                           (debug:print-info 0 *default-log-port* message))
                       #f) (thunk) ))

(define (common:file-exists? path-string #!key (quiet-mode #f))
  ;; this avoids stack dumps in the case where 

  ;;;; TODO: catch permission denied exceptions and emit appropriate warnings, eg:  system error while trying to access file: "/nfs/pdx/disks/icf_env_disk001/bjbarcla/gwa/issues/mtdev/randy-slow/reproduce/q...
  (common:false-on-exception
   (lambda () (file-exists? path-string))
   message: (if quiet-mode
		#f
		(conc "Unable to access path: " path-string))))


(define (common:directory-exists? path-string #!key (quiet-mode #f))
  ;;;; TODO: catch permission denied exceptions and emit appropriate warnings, eg:  system error while trying to access file: "/nfs/pdx/disks/icf_env_disk001/bjbarcla/gwa/issues/mtdev/randy-slow/reproduce/q...
  (common:false-on-exception
   (lambda () (directory-exists? path-string))
   message: (if quiet-mode
		#f
		(conc "Unable to access path: " path-string))))


;; does the directory exist and do we have write access?
;;
;;    returns the directory or #f
;;
(define (common:directory-writable? path-string)
  (handle-exceptions
1091
1092
1093
1094
1095
1096
1097














1098
1099
1100
1101
1102
1103
1104















1105
1106
1107
1108
1109
1110
1111
				     #f))))))
	   (at-home  (or (equal? homehost currhost)
			 (equal? homehost bestadrs))))
      (set! *home-host* (cons homehost at-home))
      (mutex-unlock! *homehost-mutex*)
      *home-host*))))















;; am I on the homehost?
;;
(define (common:on-homehost?)
  (let ((hh (common:get-homehost)))
    (if hh
	(cdr hh)
	#f)))
















;; do we honor the caches of the config files?
;;
(define (common:use-cache?)
  (let ((res #t)) ;; priority by order of evaluation
    (if *configdat* ;; sillyness here. can't use setup/use-cache to know if we can use the cached files!
	(if (equal? (configf:lookup *configdat* "setup" "use-cache") "no")







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







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







1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
				     #f))))))
	   (at-home  (or (equal? homehost currhost)
			 (equal? homehost bestadrs))))
      (set! *home-host* (cons homehost at-home))
      (mutex-unlock! *homehost-mutex*)
      *home-host*))))

;; get homehost info for a given area - but only if .homehost file already exists
(define (common:minimal-get-homehost toppath)
  (let ((hh-file (conc toppath "/.homehost")))
    (if (common:file-exists? hh-file quiet-mode: #t)
	(with-input-from-file hh-file read-line)
	#f)))

;; are we on the given host?
(define (common:on-host? hh)
  (let* ((currhost (get-host-name))
	 (bestadrs (server:get-best-guess-address currhost)))
    (or (equal? hh currhost)
	(equal? hh bestadrs))))
    
;; am I on the homehost?
;;
(define (common:on-homehost?)
  (let ((hh (common:get-homehost)))
    (if hh
	(cdr hh)
	#f)))

;; minimal loading of megatest.config
;;
(define (common:simple-setup toppath #!key (cfgf-ovrd #f))
  (let* ((mtconfigf (or cfgf-ovrd "megatest.config"))
	 (mtconfdat (find-and-read-config
		     mtconfigf
		     ;; environ-patt: "env-override"
		     given-toppath: toppath
		     ;; pathenvvar: "MT_RUN_AREA_HOME"
		     ))
	 (mtconf    (if mtconfdat (car mtconfdat) #f)))
    (if mtconf
	(configf:section-var-set! mtconf "dyndat" "toppath" start-dir))
    mtconfdat))

;; do we honor the caches of the config files?
;;
(define (common:use-cache?)
  (let ((res #t)) ;; priority by order of evaluation
    (if *configdat* ;; sillyness here. can't use setup/use-cache to know if we can use the cached files!
	(if (equal? (configf:lookup *configdat* "setup" "use-cache") "no")