Megatest

Check-in [2fdd7fc00d]
Login
Overview
Comment:Moving to consistent loading of config files
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | envprocessing
Files: files | file ages | folders
SHA1: 2fdd7fc00d881023fe185d2bd5f14b6d2164c52f
User & Date: mrwellan on 2016-03-01 16:47:39
Other Links: branch diff | manifest | tags
Context
2016-04-26
16:49
Rebasing envprocessing branch; added common:get-linktree, generalized common:args-get-runname, added check to common:args-get-target for availability of *configdat* check-in: b036d63d1a user: mrwellan tags: rebase-envprocessing
2016-03-01
22:56
Refactored launch:setup-for-run into simpler launch:setup check-in: 2f8dca08bf user: matt tags: envprocessing
16:47
Moving to consistent loading of config files check-in: 2fdd7fc00d user: mrwellan tags: envprocessing
15:39
caching still not quite right but mostly working check-in: bc1e803285 user: mrwellan tags: envprocessing
Changes

Modified common.scm from [faa48a9ca2] to [be31830ee6].

447
448
449
450
451
452
453
454

455
456
457
458
459
460
461
			       rtestpatt)
			  args-testpatt)))
    (if rtestpatt (debug:print-info 0 "TESTPATT from runconfigs: " rtestpatt))
    testpatt))

(define (common:args-get-runname)
  (or (args:get-arg "-runname")
      (args:get-arg ":runname")))


(define (common:args-get-target #!key (split #f))
  (let* ((keys    (keys:config-get-fields *configdat*))
	 (numkeys (length keys))
	 (target  (if (args:get-arg "-reqtarg")
		      (args:get-arg "-reqtarg")
		      (if (args:get-arg "-target")







|
>







447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
			       rtestpatt)
			  args-testpatt)))
    (if rtestpatt (debug:print-info 0 "TESTPATT from runconfigs: " rtestpatt))
    testpatt))

(define (common:args-get-runname)
  (or (args:get-arg "-runname")
      (args:get-arg ":runname")
      (getenv "MT_RUNNAME")))

(define (common:args-get-target #!key (split #f))
  (let* ((keys    (keys:config-get-fields *configdat*))
	 (numkeys (length keys))
	 (target  (if (args:get-arg "-reqtarg")
		      (args:get-arg "-reqtarg")
		      (if (args:get-arg "-target")

Modified launch.scm from [1653398d09] to [a27e6f888d].

695
696
697
698
699
700
701



















702
703
704
705
706
707
708
			(rconfig  (conc fulldir "/.runconfig." megatest-version "-" megatest-fossil-hash)))
		    (if (file-exists? rconfig) ;; only cache megatest.config AFTER runconfigs has been cached
			(begin
			  (debug:print-info 0 "Caching megatest.config in " fulldir "/.megatest.cfg")
			  (configf:write-alist *configdat* tmpfile)
			  (system (conc "ln -sf " tmpfile " " targfile))))
		    )))))))




















(define (get-best-disk confdat testconfig)
  (let* ((disks   (or (and testconfig (hash-table-ref/default testconfig "disks" #f))
		      (hash-table-ref/default confdat "disks" #f)))
	 (minspace (let ((m (configf:lookup confdat "setup" "minspace")))
		     (string->number (or m "10000")))))
    (if disks 







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







695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
			(rconfig  (conc fulldir "/.runconfig." megatest-version "-" megatest-fossil-hash)))
		    (if (file-exists? rconfig) ;; only cache megatest.config AFTER runconfigs has been cached
			(begin
			  (debug:print-info 0 "Caching megatest.config in " fulldir "/.megatest.cfg")
			  (configf:write-alist *configdat* tmpfile)
			  (system (conc "ln -sf " tmpfile " " targfile))))
		    )))))))

;; gather available information, if legit read configs in this order:
;;
;;   if have cache;
;;      read it a return it
;;   else
;;     megatest.config     (do not cache)
;;     runconfigs.config   (cache if all vars avail)
;;     megatest.config     (cache if all vars avail)
;;
(define (launch:setup #!key (force #f))
  (let* ((runname  (common:args-get-runname))
	 (target   (common:args-get-target))
	 (linktree (or (getenv "MT_LINKTREE")
		       (if *configdat* (configf:lookup *configdat* "setup" "linktree") #f)))
	 (rundir   (if (and runname target linktree)(conc linktree "/" target "/" runname) #f))
	 (mtcachef (and rundir (conc rundir "/" ".megatest.cfg-"  megatest-version "-" megatest-fossil-hash)))
	 (rccachef (and rundir (conc rundir "/" ".runconfigs.cfg-"  megatest-version "-" megatest-fossil-hash))))
    #f))

(define (get-best-disk confdat testconfig)
  (let* ((disks   (or (and testconfig (hash-table-ref/default testconfig "disks" #f))
		      (hash-table-ref/default confdat "disks" #f)))
	 (minspace (let ((m (configf:lookup confdat "setup" "minspace")))
		     (string->number (or m "10000")))))
    (if disks