Megatest

Hex Artifact Content
Login

Artifact aadffc4da1b2c47b5a3afe4cd6e1515b59e6d742:


0000: 0a 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 32 30  .;; Copyright 20
0010: 30 36 2d 32 30 31 31 2c 20 4d 61 74 74 68 65 77  06-2011, Matthew
0020: 20 57 65 6c 6c 61 6e 64 2e 0a 3b 3b 20 0a 3b 3b   Welland..;; .;;
0030: 20 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69    This program i
0040: 73 20 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65  s made available
0050: 20 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47   under the GNU G
0060: 50 4c 20 76 65 72 73 69 6f 6e 20 32 2e 30 20 6f  PL version 2.0 o
0070: 72 0a 3b 3b 20 20 67 72 65 61 74 65 72 2e 20 53  r.;;  greater. S
0080: 65 65 20 74 68 65 20 61 63 63 6f 6d 70 61 6e 79  ee the accompany
0090: 69 6e 67 20 66 69 6c 65 20 43 4f 50 59 49 4e 47  ing file COPYING
00a0: 20 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 3b 3b   for details..;;
00b0: 20 0a 3b 3b 20 20 54 68 69 73 20 70 72 6f 67 72   .;;  This progr
00c0: 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 65  am is distribute
00d0: 64 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41  d WITHOUT ANY WA
00e0: 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20  RRANTY; without 
00f0: 65 76 65 6e 20 74 68 65 0a 3b 3b 20 20 69 6d 70  even the.;;  imp
0100: 6c 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66  lied warranty of
0110: 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59   MERCHANTABILITY
0120: 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20   or FITNESS FOR 
0130: 41 20 50 41 52 54 49 43 55 4c 41 52 0a 3b 3b 20  A PARTICULAR.;; 
0140: 20 50 55 52 50 4f 53 45 2e 0a 0a 3b 3b 3d 3d 3d   PURPOSE...;;===
0150: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0160: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0170: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0180: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0190: 3d 3d 3d 0a 3b 3b 20 6c 61 75 6e 63 68 20 61 20  ===.;; launch a 
01a0: 74 61 73 6b 20 2d 20 74 68 69 73 20 72 75 6e 73  task - this runs
01b0: 20 6f 6e 20 74 68 65 20 6f 72 69 67 69 6e 61 74   on the originat
01c0: 69 6e 67 20 68 6f 73 74 2c 20 74 65 73 74 73 20  ing host, tests 
01d0: 74 68 65 6d 73 65 6c 76 65 73 0a 3b 3b 0a 3b 3b  themselves.;;.;;
01e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
01f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0200: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0210: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0220: 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20  ======..(define 
0230: 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 0a  (setup-for-run).
0240: 20 20 28 73 65 74 21 20 2a 63 6f 6e 66 69 67 69    (set! *configi
0250: 6e 66 6f 2a 20 28 66 69 6e 64 2d 61 6e 64 2d 72  nfo* (find-and-r
0260: 65 61 64 2d 63 6f 6e 66 69 67 20 28 69 66 20 28  ead-config (if (
0270: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 63  args:get-arg "-c
0280: 6f 6e 66 69 67 22 29 28 61 72 67 73 3a 67 65 74  onfig")(args:get
0290: 2d 61 72 67 20 22 2d 63 6f 6e 66 69 67 22 29 20  -arg "-config") 
02a0: 22 6d 65 67 61 74 65 73 74 2e 63 6f 6e 66 69 67  "megatest.config
02b0: 22 29 29 29 0a 20 20 28 73 65 74 21 20 2a 63 6f  "))).  (set! *co
02c0: 6e 66 69 67 64 61 74 2a 20 20 28 69 66 20 28 63  nfigdat*  (if (c
02d0: 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29  ar *configinfo*)
02e0: 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f  (car *configinfo
02f0: 2a 29 20 23 66 29 29 0a 20 20 28 73 65 74 21 20  *) #f)).  (set! 
0300: 2a 74 6f 70 70 61 74 68 2a 20 20 20 20 28 69 66  *toppath*    (if
0310: 20 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66   (car *configinf
0320: 6f 2a 29 28 63 61 64 72 20 2a 63 6f 6e 66 69 67  o*)(cadr *config
0330: 69 6e 66 6f 2a 29 20 23 66 29 29 0a 20 20 28 69  info*) #f)).  (i
0340: 66 20 2a 74 6f 70 70 61 74 68 2a 0a 20 20 20 20  f *toppath*.    
0350: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55    (setenv "MT_RU
0360: 4e 5f 41 52 45 41 5f 48 4f 4d 45 22 20 2a 74 6f  N_AREA_HOME" *to
0370: 70 70 61 74 68 2a 29 20 3b 3b 20 74 6f 20 62 65  ppath*) ;; to be
0380: 20 64 65 70 72 65 63 61 74 65 64 0a 20 20 20 20   deprecated.    
0390: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
03a0: 20 22 45 52 52 4f 52 3a 20 66 61 69 6c 65 64 20   "ERROR: failed 
03b0: 74 6f 20 66 69 6e 64 20 74 68 65 20 74 6f 70 20  to find the top 
03c0: 70 61 74 68 20 74 6f 20 79 6f 75 72 20 72 75 6e  path to your run
03d0: 20 73 65 74 75 70 2e 22 29 29 0a 20 20 2a 74 6f   setup.")).  *to
03e0: 70 70 61 74 68 2a 29 0a 0a 28 64 65 66 69 6e 65  ppath*)..(define
03f0: 20 28 67 65 74 2d 62 65 73 74 2d 64 69 73 6b 20   (get-best-disk 
0400: 63 6f 6e 66 64 61 74 29 0a 20 20 28 6c 65 74 2a  confdat).  (let*
0410: 20 28 28 64 69 73 6b 73 20 20 20 20 28 68 61 73   ((disks    (has
0420: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
0430: 75 6c 74 20 63 6f 6e 66 64 61 74 20 22 64 69 73  ult confdat "dis
0440: 6b 73 22 20 23 66 29 29 0a 09 20 28 62 65 73 74  ks" #f)).. (best
0450: 20 20 20 20 20 23 66 29 0a 09 20 28 62 65 73 74       #f).. (best
0460: 73 69 7a 65 20 30 29 29 0a 20 20 20 20 28 69 66  size 0)).    (if
0470: 20 64 69 73 6b 73 20 0a 09 28 66 6f 72 2d 65 61   disks ..(for-ea
0480: 63 68 20 0a 09 20 28 6c 61 6d 62 64 61 20 28 64  ch .. (lambda (d
0490: 69 73 6b 2d 6e 75 6d 29 0a 09 20 20 20 28 6c 65  isk-num)..   (le
04a0: 74 2a 20 28 28 64 69 72 70 61 74 68 20 20 20 20  t* ((dirpath    
04b0: 28 63 61 64 72 20 28 61 73 73 6f 63 20 64 69 73  (cadr (assoc dis
04c0: 6b 2d 6e 75 6d 20 64 69 73 6b 73 29 29 29 0a 09  k-num disks)))..
04d0: 09 20 20 28 66 72 65 65 73 70 63 20 20 20 20 28  .  (freespc    (
04e0: 69 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20 64  if (directory? d
04f0: 69 72 70 61 74 68 29 0a 09 09 09 09 20 20 28 67  irpath).....  (g
0500: 65 74 2d 64 66 20 64 69 72 70 61 74 68 29 0a 09  et-df dirpath)..
0510: 09 09 09 20 20 28 62 65 67 69 6e 0a 09 09 09 09  ...  (begin.....
0520: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
0530: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 70 61 74   0 "WARNING: pat
0540: 68 20 22 20 64 69 72 70 61 74 68 20 22 20 69 6e  h " dirpath " in
0550: 20 5b 64 69 73 6b 73 5d 20 73 65 63 74 69 6f 6e   [disks] section
0560: 20 6e 6f 74 20 76 61 6c 69 64 22 29 0a 09 09 09   not valid")....
0570: 09 20 20 20 20 30 29 29 29 29 0a 09 20 20 20 20  .    0))))..    
0580: 20 28 69 66 20 28 3e 20 66 72 65 65 73 70 63 20   (if (> freespc 
0590: 62 65 73 74 73 69 7a 65 29 0a 09 09 20 28 62 65  bestsize)... (be
05a0: 67 69 6e 0a 09 09 20 20 20 28 73 65 74 21 20 62  gin...   (set! b
05b0: 65 73 74 20 20 20 20 20 64 69 72 70 61 74 68 29  est     dirpath)
05c0: 0a 09 09 20 20 20 28 73 65 74 21 20 62 65 73 74  ...   (set! best
05d0: 73 69 7a 65 20 66 72 65 65 73 70 63 29 29 29 29  size freespc))))
05e0: 29 0a 09 20 28 6d 61 70 20 63 61 72 20 64 69 73  ).. (map car dis
05f0: 6b 73 29 29 29 0a 20 20 20 20 28 69 66 20 62 65  ks))).    (if be
0600: 73 74 0a 09 62 65 73 74 0a 09 28 62 65 67 69 6e  st..best..(begin
0610: 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
0620: 20 30 20 22 45 52 52 4f 52 3a 20 4e 6f 20 76 61   0 "ERROR: No va
0630: 6c 69 64 20 64 69 73 6b 73 20 66 6f 75 6e 64 20  lid disks found 
0640: 69 6e 20 6d 65 67 61 74 65 73 74 2e 63 6f 6e 66  in megatest.conf
0650: 69 67 2e 20 50 6c 65 61 73 65 20 61 64 64 20 73  ig. Please add s
0660: 6f 6d 65 20 74 6f 20 79 6f 75 72 20 5b 64 69 73  ome to your [dis
0670: 6b 73 5d 20 73 65 63 74 69 6f 6e 22 29 0a 09 20  ks] section").. 
0680: 20 28 65 78 69 74 20 31 29 29 29 29 29 0a 0a 28   (exit 1)))))..(
0690: 64 65 66 69 6e 65 20 28 63 72 65 61 74 65 2d 77  define (create-w
06a0: 6f 72 6b 2d 61 72 65 61 20 64 62 20 72 75 6e 2d  ork-area db run-
06b0: 69 64 20 74 65 73 74 2d 70 61 74 68 20 64 69 73  id test-path dis
06c0: 6b 2d 70 61 74 68 20 74 65 73 74 6e 61 6d 65 20  k-path testname 
06d0: 69 74 65 6d 64 61 74 29 0a 20 20 28 6c 65 74 2a  itemdat).  (let*
06e0: 20 28 28 72 75 6e 2d 69 6e 66 6f 20 28 64 62 3a   ((run-info (db:
06f0: 67 65 74 2d 72 75 6e 2d 69 6e 66 6f 20 64 62 20  get-run-info db 
0700: 72 75 6e 2d 69 64 29 29 0a 09 20 28 69 74 65 6d  run-id)).. (item
0710: 2d 70 61 74 68 20 28 6c 65 74 20 28 28 69 70 20  -path (let ((ip 
0720: 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68  (item-list->path
0730: 20 69 74 65 6d 64 61 74 29 29 29 0a 09 09 20 20   itemdat)))...  
0740: 20 20 20 20 28 69 66 20 28 65 71 75 61 6c 3f 20      (if (equal? 
0750: 69 70 20 22 22 29 20 22 22 20 28 63 6f 6e 63 20  ip "") "" (conc 
0760: 22 2f 22 20 69 70 29 29 29 29 0a 09 20 28 72 75  "/" ip)))).. (ru
0770: 6e 6e 61 6d 65 20 20 28 64 62 3a 67 65 74 2d 76  nname  (db:get-v
0780: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28  alue-by-header (
0790: 64 62 3a 67 65 74 2d 72 6f 77 20 72 75 6e 2d 69  db:get-row run-i
07a0: 6e 66 6f 29 0a 09 09 09 09 09 20 20 20 28 64 62  nfo)......   (db
07b0: 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e 2d  :get-header run-
07c0: 69 6e 66 6f 29 0a 09 09 09 09 09 20 20 20 22 72  info)......   "r
07d0: 75 6e 6e 61 6d 65 22 29 29 0a 09 20 28 6b 65 79  unname")).. (key
07e0: 2d 76 61 6c 73 20 28 67 65 74 2d 6b 65 79 2d 76  -vals (get-key-v
07f0: 61 6c 73 20 64 62 20 72 75 6e 2d 69 64 29 29 0a  als db run-id)).
0800: 09 20 28 6b 65 79 2d 73 74 72 20 20 28 73 74 72  . (key-str  (str
0810: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20  ing-intersperse 
0820: 6b 65 79 2d 76 61 6c 73 20 22 2f 22 29 29 0a 09  key-vals "/"))..
0830: 20 28 64 66 75 6c 6c 70 20 20 20 28 63 6f 6e 63   (dfullp   (conc
0840: 20 64 69 73 6b 2d 70 61 74 68 20 22 2f 22 20 6b   disk-path "/" k
0850: 65 79 2d 73 74 72 20 22 2f 22 20 72 75 6e 6e 61  ey-str "/" runna
0860: 6d 65 20 22 2f 22 20 74 65 73 74 6e 61 6d 65 0a  me "/" testname.
0870: 09 09 09 20 69 74 65 6d 2d 70 61 74 68 29 29 0a  ... item-path)).
0880: 09 20 28 74 6f 70 74 65 73 74 2d 70 61 74 68 20  . (toptest-path 
0890: 28 63 6f 6e 63 20 64 69 73 6b 2d 70 61 74 68 20  (conc disk-path 
08a0: 22 2f 22 20 6b 65 79 2d 73 74 72 20 22 2f 22 20  "/" key-str "/" 
08b0: 72 75 6e 6e 61 6d 65 20 22 2f 22 20 74 65 73 74  runname "/" test
08c0: 6e 61 6d 65 29 29 0a 09 20 28 72 75 6e 73 64 69  name)).. (runsdi
08d0: 72 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75  r  (config-looku
08e0: 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 73  p *configdat* "s
08f0: 65 74 75 70 22 20 22 72 75 6e 73 64 69 72 22 29  etup" "runsdir")
0900: 29 0a 09 20 28 6c 6e 6b 70 61 74 68 20 20 28 63  ).. (lnkpath  (c
0910: 6f 6e 63 20 28 69 66 20 72 75 6e 73 64 69 72 20  onc (if runsdir 
0920: 72 75 6e 73 64 69 72 20 28 63 6f 6e 63 20 2a 74  runsdir (conc *t
0930: 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 73 22 29  oppath* "/runs")
0940: 29 0a 09 09 09 20 22 2f 22 20 6b 65 79 2d 73 74  ).... "/" key-st
0950: 72 20 22 2f 22 20 72 75 6e 6e 61 6d 65 20 69 74  r "/" runname it
0960: 65 6d 2d 70 61 74 68 29 29 29 0a 20 20 20 20 3b  em-path))).    ;
0970: 3b 20 73 69 6e 63 65 20 74 68 69 73 20 69 73 20  ; since this is 
0980: 61 6e 20 69 74 65 72 61 74 65 64 20 74 65 73 74  an iterated test
0990: 20 74 68 69 73 20 69 73 20 61 73 20 67 6f 6f 64   this is as good
09a0: 20 61 20 70 6c 61 63 65 20 61 73 20 61 6e 79 20   a place as any 
09b0: 74 6f 0a 20 20 20 20 3b 3b 20 75 70 64 61 74 65  to.    ;; update
09c0: 20 74 68 65 20 74 6f 70 74 65 73 74 20 72 65 63   the toptest rec
09d0: 6f 72 64 20 77 69 74 68 20 69 74 73 20 6c 6f 63  ord with its loc
09e0: 61 74 69 6f 6e 20 72 75 6e 64 69 72 0a 20 20 20  ation rundir.   
09f0: 20 28 69 66 20 28 6e 6f 74 20 28 65 71 75 61 6c   (if (not (equal
0a00: 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 29  ? item-path ""))
0a10: 0a 09 28 64 62 3a 74 65 73 74 2d 73 65 74 2d 72  ..(db:test-set-r
0a20: 75 6e 64 69 72 21 20 64 62 20 72 75 6e 2d 69 64  undir! db run-id
0a30: 20 74 65 73 74 6e 61 6d 65 20 22 22 20 74 6f 70   testname "" top
0a40: 74 65 73 74 2d 70 61 74 68 29 29 0a 20 20 20 20  test-path)).    
0a50: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22  (debug:print 2 "
0a60: 53 65 74 74 69 6e 67 20 75 70 20 74 65 73 74 20  Setting up test 
0a70: 72 75 6e 20 61 72 65 61 22 29 0a 20 20 20 20 28  run area").    (
0a80: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 20  debug:print 2 " 
0a90: 2d 20 63 72 65 61 74 69 6e 67 20 72 75 6e 20 61  - creating run a
0aa0: 72 65 61 20 69 6e 20 22 20 64 66 75 6c 6c 70 29  rea in " dfullp)
0ab0: 0a 20 20 20 20 28 73 79 73 74 65 6d 20 20 28 63  .    (system  (c
0ac0: 6f 6e 63 20 22 6d 6b 64 69 72 20 2d 70 20 22 20  onc "mkdir -p " 
0ad0: 64 66 75 6c 6c 70 29 29 0a 20 20 20 20 28 64 65  dfullp)).    (de
0ae0: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 20 2d 20  bug:print 2 " - 
0af0: 63 72 65 61 74 69 6e 67 20 6c 69 6e 6b 20 66 72  creating link fr
0b00: 6f 6d 20 22 20 64 66 75 6c 6c 70 20 22 2f 22 20  om " dfullp "/" 
0b10: 74 65 73 74 6e 61 6d 65 20 22 20 74 6f 20 22 20  testname " to " 
0b20: 6c 6e 6b 70 61 74 68 29 0a 20 20 20 20 28 73 79  lnkpath).    (sy
0b30: 73 74 65 6d 20 20 28 63 6f 6e 63 20 22 6d 6b 64  stem  (conc "mkd
0b40: 69 72 20 2d 70 20 22 20 6c 6e 6b 70 61 74 68 29  ir -p " lnkpath)
0b50: 29 0a 0a 3b 3b 20 49 20 73 75 73 70 65 63 74 20  )..;; I suspect 
0b60: 74 68 69 73 20 73 65 63 74 69 6f 6e 20 77 61 73  this section was
0b70: 20 64 65 6c 65 74 69 6e 67 20 74 65 73 74 20 64   deleting test d
0b80: 69 72 65 63 74 6f 72 69 65 73 20 75 6e 64 65 72  irectories under
0b90: 20 73 6f 6d 65 20 0a 3b 3b 20 77 69 65 72 64 20   some .;; wierd 
0ba0: 73 69 74 61 74 69 6f 6e 73 0a 0a 3b 3b 20 20 20  sitations..;;   
0bb0: 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74   (if (file-exist
0bc0: 73 3f 20 28 63 6f 6e 63 20 6c 6e 6b 70 61 74 68  s? (conc lnkpath
0bd0: 20 22 2f 22 20 74 65 73 74 6e 61 6d 65 29 29 0a   "/" testname)).
0be0: 3b 3b 09 28 73 79 73 74 65 6d 20 28 63 6f 6e 63  ;;.(system (conc
0bf0: 20 22 72 6d 20 2d 66 20 22 20 6c 6e 6b 70 61 74   "rm -f " lnkpat
0c00: 68 20 22 2f 22 20 74 65 73 74 6e 61 6d 65 29 29  h "/" testname))
0c10: 29 0a 20 20 20 20 28 73 79 73 74 65 6d 20 20 28  ).    (system  (
0c20: 63 6f 6e 63 20 22 6c 6e 20 2d 73 66 20 22 20 64  conc "ln -sf " d
0c30: 66 75 6c 6c 70 20 22 20 22 20 6c 6e 6b 70 61 74  fullp " " lnkpat
0c40: 68 20 22 2f 22 20 74 65 73 74 6e 61 6d 65 29 29  h "/" testname))
0c50: 0a 20 20 20 20 28 69 66 20 28 64 69 72 65 63 74  .    (if (direct
0c60: 6f 72 79 3f 20 64 66 75 6c 6c 70 29 0a 09 28 62  ory? dfullp)..(b
0c70: 65 67 69 6e 0a 09 20 20 28 6c 65 74 2a 20 28 28  egin..  (let* ((
0c80: 63 6d 64 20 20 20 20 28 63 6f 6e 63 20 22 72 73  cmd    (conc "rs
0c90: 79 6e 63 20 2d 61 76 22 20 28 69 66 20 28 3e 20  ync -av" (if (> 
0ca0: 2a 76 65 72 62 6f 73 69 74 79 2a 20 31 29 20 22  *verbosity* 1) "
0cb0: 22 20 22 71 22 29 20 22 20 22 20 74 65 73 74 2d  " "q") " " test-
0cc0: 70 61 74 68 20 22 2f 20 22 20 64 66 75 6c 6c 70  path "/ " dfullp
0cd0: 20 22 2f 22 29 29 0a 09 09 20 28 73 74 61 74 75   "/"))... (statu
0ce0: 73 20 28 73 79 73 74 65 6d 20 63 6d 64 29 29 29  s (system cmd)))
0cf0: 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ..    (if (not (
0d00: 65 71 3f 20 73 74 61 74 75 73 20 30 29 29 0a 09  eq? status 0))..
0d10: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20  .(debug:print 2 
0d20: 22 45 52 52 4f 52 3a 20 70 72 6f 62 6c 65 6d 20  "ERROR: problem 
0d30: 77 69 74 68 20 72 75 6e 6e 69 6e 67 20 5c 22 22  with running \""
0d40: 20 63 6d 64 20 22 5c 22 22 29 29 29 0a 09 20 20   cmd "\"")))..  
0d50: 28 6c 69 73 74 20 64 66 75 6c 6c 70 20 74 6f 70  (list dfullp top
0d60: 74 65 73 74 2d 70 61 74 68 29 29 0a 09 28 6c 69  test-path))..(li
0d70: 73 74 20 23 66 20 23 66 29 29 29 29 0a 0a 3b 3b  st #f #f))))..;;
0d80: 20 31 2e 20 6c 6f 6f 6b 20 74 68 6f 75 67 68 20   1. look though 
0d90: 64 69 73 6b 73 20 6c 69 73 74 20 66 6f 72 20 64  disks list for d
0da0: 69 73 6b 20 77 69 74 68 20 6d 6f 73 74 20 73 70  isk with most sp
0db0: 61 63 65 0a 3b 3b 20 32 2e 20 63 72 65 61 74 65  ace.;; 2. create
0dc0: 20 72 75 6e 20 64 69 72 20 6f 6e 20 64 69 73 6b   run dir on disk
0dd0: 2c 20 70 61 74 68 20 6e 61 6d 65 20 69 73 20 6d  , path name is m
0de0: 65 61 6e 69 6e 67 66 75 6c 0a 3b 3b 20 33 2e 20  eaningful.;; 3. 
0df0: 63 72 65 61 74 65 20 6c 69 6e 6b 20 66 72 6f 6d  create link from
0e00: 20 72 75 6e 20 64 69 72 20 74 6f 20 6d 65 67 61   run dir to mega
0e10: 74 65 73 74 20 72 75 6e 73 20 61 72 65 61 20 0a  test runs area .
0e20: 3b 3b 20 34 2e 20 72 65 6d 6f 74 65 6c 79 20 72  ;; 4. remotely r
0e30: 75 6e 20 74 68 65 20 74 65 73 74 20 6f 6e 20 61  un the test on a
0e40: 6c 6c 6f 63 61 74 65 64 20 68 6f 73 74 0a 3b 3b  llocated host.;;
0e50: 20 20 20 20 2d 20 63 6f 75 6c 64 20 62 65 20 73      - could be s
0e60: 73 68 20 74 6f 20 68 6f 73 74 20 66 72 6f 6d 20  sh to host from 
0e70: 68 6f 73 74 73 20 74 61 62 6c 65 20 28 75 70 64  hosts table (upd
0e80: 61 74 65 20 72 65 67 75 6c 61 72 6c 79 20 77 69  ate regularly wi
0e90: 74 68 20 6c 6f 61 64 29 0a 3b 3b 20 20 20 20 2d  th load).;;    -
0ea0: 20 63 6f 75 6c 64 20 62 65 20 6e 65 74 62 61 74   could be netbat
0eb0: 63 68 0a 3b 3b 20 20 20 20 20 20 28 6c 61 75 6e  ch.;;      (laun
0ec0: 63 68 2d 74 65 73 74 20 64 62 20 28 63 61 64 72  ch-test db (cadr
0ed0: 20 73 74 61 74 75 73 29 20 74 65 73 74 2d 63 6f   status) test-co
0ee0: 6e 66 29 29 0a 28 64 65 66 69 6e 65 20 28 6c 61  nf)).(define (la
0ef0: 75 6e 63 68 2d 74 65 73 74 20 64 62 20 72 75 6e  unch-test db run
0f00: 2d 69 64 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65  -id test-conf ke
0f10: 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d  yvallst test-nam
0f20: 65 20 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d  e test-path item
0f30: 64 61 74 29 0a 20 20 28 63 68 61 6e 67 65 2d 64  dat).  (change-d
0f40: 69 72 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74  irectory *toppat
0f50: 68 2a 29 0a 20 20 28 6c 65 74 20 28 28 75 73 65  h*).  (let ((use
0f60: 73 68 65 6c 6c 20 20 20 28 63 6f 6e 66 69 67 2d  shell   (config-
0f70: 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61  lookup *configda
0f80: 74 2a 20 22 6a 6f 62 74 6f 6f 6c 73 22 20 20 20  t* "jobtools"   
0f90: 20 20 22 75 73 65 73 68 65 6c 6c 22 29 29 0a 09    "useshell"))..
0fa0: 28 6c 61 75 6e 63 68 65 72 20 20 20 28 63 6f 6e  (launcher   (con
0fb0: 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66  fig-lookup *conf
0fc0: 69 67 64 61 74 2a 20 22 6a 6f 62 74 6f 6f 6c 73  igdat* "jobtools
0fd0: 22 20 20 20 20 20 22 6c 61 75 6e 63 68 65 72 22  "     "launcher"
0fe0: 29 29 0a 09 28 72 75 6e 73 63 72 69 70 74 20 20  ))..(runscript  
0ff0: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74  (config-lookup t
1000: 65 73 74 2d 63 6f 6e 66 20 20 20 22 73 65 74 75  est-conf   "setu
1010: 70 22 20 20 20 20 20 20 20 20 22 72 75 6e 73 63  p"        "runsc
1020: 72 69 70 74 22 29 29 0a 09 28 64 69 73 6b 73 70  ript"))..(disksp
1030: 61 63 65 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f  ace  (config-loo
1040: 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 20 20  kup test-conf   
1050: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22  "requirements" "
1060: 64 69 73 6b 73 70 61 63 65 22 29 29 0a 09 28 6d  diskspace"))..(m
1070: 65 6d 6f 72 79 20 20 20 20 20 28 63 6f 6e 66 69  emory     (confi
1080: 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f  g-lookup test-co
1090: 6e 66 20 20 20 22 72 65 71 75 69 72 65 6d 65 6e  nf   "requiremen
10a0: 74 73 22 20 22 6d 65 6d 6f 72 79 22 29 29 0a 09  ts" "memory"))..
10b0: 28 68 6f 73 74 73 20 20 20 20 20 20 28 63 6f 6e  (hosts      (con
10c0: 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66  fig-lookup *conf
10d0: 69 67 64 61 74 2a 20 22 6a 6f 62 74 6f 6f 6c 73  igdat* "jobtools
10e0: 22 20 20 20 20 20 22 77 6f 72 6b 68 6f 73 74 73  "     "workhosts
10f0: 22 29 29 0a 09 28 72 65 6d 6f 74 65 2d 6d 65 67  "))..(remote-meg
1100: 61 74 65 73 74 20 28 63 6f 6e 66 69 67 2d 6c 6f  atest (config-lo
1110: 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a  okup *configdat*
1120: 20 22 73 65 74 75 70 22 20 22 65 78 65 63 75 74   "setup" "execut
1130: 61 62 6c 65 22 29 29 0a 09 28 6c 6f 63 61 6c 2d  able"))..(local-
1140: 6d 65 67 61 74 65 73 74 20 20 28 63 61 72 20 28  megatest  (car (
1150: 61 72 67 76 29 29 29 0a 09 3b 3b 20 28 69 74 65  argv)))..;; (ite
1160: 6d 2d 70 61 74 68 20 20 28 69 74 65 6d 2d 6c 69  m-path  (item-li
1170: 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74  st->path itemdat
1180: 29 29 20 74 65 73 74 2d 70 61 74 68 20 69 73 20  )) test-path is 
1190: 74 68 65 20 66 75 6c 6c 20 70 61 74 68 20 69 6e  the full path in
11a0: 63 6c 75 64 69 6e 67 20 74 68 65 20 69 74 65 6d  cluding the item
11b0: 2d 70 61 74 68 0a 09 28 77 6f 72 6b 2d 61 72 65  -path..(work-are
11c0: 61 20 20 23 66 29 0a 09 28 74 6f 70 74 65 73 74  a  #f)..(toptest
11d0: 2d 77 6f 72 6b 2d 61 72 65 61 20 23 66 29 20 3b  -work-area #f) ;
11e0: 3b 20 66 6f 72 20 69 74 65 72 61 74 65 64 20 74  ; for iterated t
11f0: 65 73 74 73 20 74 68 65 20 74 6f 70 20 74 65 73  ests the top tes
1200: 74 20 63 6f 6e 74 61 69 6e 73 20 64 61 74 61 20  t contains data 
1210: 72 65 6c 65 76 61 6e 74 20 66 6f 72 20 61 6c 6c  relevant for all
1220: 0a 09 28 64 69 73 6b 70 61 74 68 20 20 20 23 66  ..(diskpath   #f
1230: 29 0a 09 28 63 6d 64 70 61 72 6d 73 20 20 20 23  )..(cmdparms   #
1240: 66 29 0a 09 28 66 75 6c 6c 63 6d 64 20 20 20 20  f)..(fullcmd    
1250: 23 66 29 20 3b 3b 20 28 64 65 66 69 6e 65 20 61  #f) ;; (define a
1260: 20 28 77 69 74 68 2d 6f 75 74 70 75 74 2d 74 6f   (with-output-to
1270: 2d 73 74 72 69 6e 67 20 28 6c 61 6d 62 64 61 20  -string (lambda 
1280: 28 29 28 77 72 69 74 65 20 78 29 29 29 29 0a 09  ()(write x))))..
1290: 28 6d 74 2d 62 69 6e 64 69 72 2d 70 61 74 68 20  (mt-bindir-path 
12a0: 23 66 29 29 0a 20 20 20 20 28 69 66 20 68 6f 73  #f)).    (if hos
12b0: 74 73 20 28 73 65 74 21 20 68 6f 73 74 73 20 28  ts (set! hosts (
12c0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 68 6f 73  string-split hos
12d0: 74 73 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e  ts))).    (if (n
12e0: 6f 74 20 72 65 6d 6f 74 65 2d 6d 65 67 61 74 65  ot remote-megate
12f0: 73 74 29 28 73 65 74 21 20 72 65 6d 6f 74 65 2d  st)(set! remote-
1300: 6d 65 67 61 74 65 73 74 20 6c 6f 63 61 6c 2d 6d  megatest local-m
1310: 65 67 61 74 65 73 74 29 29 20 3b 3b 20 22 6d 65  egatest)) ;; "me
1320: 67 61 74 65 73 74 22 29 29 0a 20 20 20 20 28 73  gatest")).    (s
1330: 65 74 21 20 6d 74 2d 62 69 6e 64 69 72 2d 70 61  et! mt-bindir-pa
1340: 74 68 20 28 70 61 74 68 6e 61 6d 65 2d 64 69 72  th (pathname-dir
1350: 65 63 74 6f 72 79 20 72 65 6d 6f 74 65 2d 6d 65  ectory remote-me
1360: 67 61 74 65 73 74 29 29 0a 20 20 20 20 28 69 66  gatest)).    (if
1370: 20 6c 61 75 6e 63 68 65 72 20 28 73 65 74 21 20   launcher (set! 
1380: 6c 61 75 6e 63 68 65 72 20 28 73 74 72 69 6e 67  launcher (string
1390: 2d 73 70 6c 69 74 20 6c 61 75 6e 63 68 65 72 29  -split launcher)
13a0: 29 29 0a 20 20 20 20 3b 3b 20 73 65 74 20 75 70  )).    ;; set up
13b0: 20 74 68 65 20 72 75 6e 20 77 6f 72 6b 20 61 72   the run work ar
13c0: 65 61 20 66 6f 72 20 74 68 69 73 20 74 65 73 74  ea for this test
13d0: 0a 20 20 20 20 28 73 65 74 21 20 64 69 73 6b 70  .    (set! diskp
13e0: 61 74 68 20 28 67 65 74 2d 62 65 73 74 2d 64 69  ath (get-best-di
13f0: 73 6b 20 2a 63 6f 6e 66 69 67 64 61 74 2a 29 29  sk *configdat*))
1400: 0a 20 20 20 20 28 69 66 20 64 69 73 6b 70 61 74  .    (if diskpat
1410: 68 0a 09 28 6c 65 74 20 28 28 64 61 74 20 20 28  h..(let ((dat  (
1420: 63 72 65 61 74 65 2d 77 6f 72 6b 2d 61 72 65 61  create-work-area
1430: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d   db run-id test-
1440: 70 61 74 68 20 64 69 73 6b 70 61 74 68 20 74 65  path diskpath te
1450: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 64 61 74 29  st-name itemdat)
1460: 29 29 0a 09 20 20 28 73 65 74 21 20 77 6f 72 6b  ))..  (set! work
1470: 2d 61 72 65 61 20 28 63 61 72 20 64 61 74 29 29  -area (car dat))
1480: 0a 09 20 20 28 73 65 74 21 20 74 6f 70 74 65 73  ..  (set! toptes
1490: 74 2d 77 6f 72 6b 2d 61 72 65 61 20 28 63 61 64  t-work-area (cad
14a0: 72 20 64 61 74 29 29 29 0a 09 28 62 65 67 69 6e  r dat)))..(begin
14b0: 0a 09 20 20 28 73 65 74 21 20 77 6f 72 6b 2d 61  ..  (set! work-a
14c0: 72 65 61 20 74 65 73 74 2d 70 61 74 68 29 0a 09  rea test-path)..
14d0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
14e0: 20 22 57 41 52 4e 49 4e 47 3a 20 4e 6f 20 64 69   "WARNING: No di
14f0: 73 6b 20 77 6f 72 6b 20 61 72 65 61 20 73 70 65  sk work area spe
1500: 63 69 66 69 65 64 20 2d 20 72 75 6e 6e 69 6e 67  cified - running
1510: 20 69 6e 20 74 68 65 20 74 65 73 74 20 64 69 72   in the test dir
1520: 65 63 74 6f 72 79 22 29 29 29 0a 20 20 20 20 28  ectory"))).    (
1530: 73 65 74 21 20 63 6d 64 70 61 72 6d 73 20 28 62  set! cmdparms (b
1540: 61 73 65 36 34 3a 62 61 73 65 36 34 2d 65 6e 63  ase64:base64-enc
1550: 6f 64 65 20 28 77 69 74 68 2d 6f 75 74 70 75 74  ode (with-output
1560: 2d 74 6f 2d 73 74 72 69 6e 67 0a 09 09 09 09 20  -to-string..... 
1570: 20 20 20 28 6c 61 6d 62 64 61 20 28 29 20 3b 3b     (lambda () ;;
1580: 20 28 6c 69 73 74 20 27 68 6f 73 74 73 20 20 20   (list 'hosts   
1590: 20 20 68 6f 73 74 73 29 0a 09 09 09 09 20 20 20    hosts).....   
15a0: 20 20 20 28 77 72 69 74 65 20 28 6c 69 73 74 20     (write (list 
15b0: 28 6c 69 73 74 20 27 74 65 73 74 70 61 74 68 20  (list 'testpath 
15c0: 20 74 65 73 74 2d 70 61 74 68 29 0a 09 09 09 09   test-path).....
15d0: 09 09 20 20 20 28 6c 69 73 74 20 27 77 6f 72 6b  ..   (list 'work
15e0: 2d 61 72 65 61 20 77 6f 72 6b 2d 61 72 65 61 29  -area work-area)
15f0: 0a 09 09 09 09 09 09 20 20 20 28 6c 69 73 74 20  .......   (list 
1600: 27 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d  'test-name test-
1610: 6e 61 6d 65 29 20 0a 09 09 09 09 09 09 20 20 20  name) .......   
1620: 28 6c 69 73 74 20 27 72 75 6e 73 63 72 69 70 74  (list 'runscript
1630: 20 72 75 6e 73 63 72 69 70 74 29 20 0a 09 09 09   runscript) ....
1640: 09 09 09 20 20 20 28 6c 69 73 74 20 27 72 75 6e  ...   (list 'run
1650: 2d 69 64 20 20 20 20 72 75 6e 2d 69 64 20 20 20  -id    run-id   
1660: 29 0a 09 09 09 09 09 09 20 20 20 28 6c 69 73 74  ).......   (list
1670: 20 27 69 74 65 6d 64 61 74 20 20 20 69 74 65 6d   'itemdat   item
1680: 64 61 74 20 20 29 0a 09 09 09 09 09 09 20 20 20  dat  ).......   
1690: 28 6c 69 73 74 20 27 6d 65 67 61 74 65 73 74 20  (list 'megatest 
16a0: 20 72 65 6d 6f 74 65 2d 6d 65 67 61 74 65 73 74   remote-megatest
16b0: 29 0a 09 09 09 09 09 09 20 20 20 28 6c 69 73 74  ).......   (list
16c0: 20 27 65 6e 76 2d 6f 76 72 64 20 20 28 68 61 73   'env-ovrd  (has
16d0: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
16e0: 75 6c 74 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20  ult *configdat* 
16f0: 22 65 6e 76 2d 6f 76 65 72 72 69 64 65 22 20 27  "env-override" '
1700: 28 29 29 29 0a 09 09 09 09 09 09 20 20 20 28 6c  ())).......   (l
1710: 69 73 74 20 27 72 75 6e 6e 61 6d 65 20 20 20 28  ist 'runname   (
1720: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72  args:get-arg ":r
1730: 75 6e 6e 61 6d 65 22 29 29 0a 09 09 09 09 09 09  unname")).......
1740: 20 20 20 28 6c 69 73 74 20 27 6d 74 2d 62 69 6e     (list 'mt-bin
1750: 64 69 72 2d 70 61 74 68 20 6d 74 2d 62 69 6e 64  dir-path mt-bind
1760: 69 72 2d 70 61 74 68 29 29 29 29 29 29 29 20 3b  ir-path))))))) ;
1770: 3b 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73  ; (string-inters
1780: 70 65 72 73 65 20 6b 65 79 76 61 6c 6c 73 74 20  perse keyvallst 
1790: 22 20 22 29 29 29 29 0a 20 20 20 20 3b 3b 20 63  " ")))).    ;; c
17a0: 6c 65 61 6e 20 6f 75 74 20 73 74 65 70 20 72 65  lean out step re
17b0: 63 6f 72 64 73 20 66 72 6f 6d 20 70 72 65 76 69  cords from previ
17c0: 6f 75 73 20 72 75 6e 20 69 66 20 74 68 65 79 20  ous run if they 
17d0: 65 78 69 73 74 0a 20 20 20 20 28 64 62 3a 64 65  exist.    (db:de
17e0: 6c 65 74 65 2d 74 65 73 74 2d 73 74 65 70 2d 72  lete-test-step-r
17f0: 65 63 6f 72 64 73 20 64 62 20 72 75 6e 2d 69 64  ecords db run-id
1800: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 64   test-name itemd
1810: 61 74 29 0a 20 20 20 20 28 63 68 61 6e 67 65 2d  at).    (change-
1820: 64 69 72 65 63 74 6f 72 79 20 77 6f 72 6b 2d 61  directory work-a
1830: 72 65 61 29 20 3b 3b 20 73 6f 20 74 68 61 74 20  rea) ;; so that 
1840: 6c 6f 67 20 66 69 6c 65 73 20 66 72 6f 6d 20 74  log files from t
1850: 68 65 20 6c 61 75 6e 63 68 20 70 72 6f 63 65 73  he launch proces
1860: 73 20 64 6f 6e 27 74 20 63 6c 75 74 74 65 72 20  s don't clutter 
1870: 74 68 65 20 74 65 73 74 20 64 69 72 0a 20 20 20  the test dir.   
1880: 20 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 61 6e   (cond.     ((an
1890: 64 20 6c 61 75 6e 63 68 65 72 20 68 6f 73 74 73  d launcher hosts
18a0: 29 20 3b 3b 20 6d 75 73 74 20 62 65 20 75 73 69  ) ;; must be usi
18b0: 6e 67 20 73 73 68 20 68 6f 73 74 6e 61 6d 65 0a  ng ssh hostname.
18c0: 20 20 20 20 20 20 28 73 65 74 21 20 66 75 6c 6c        (set! full
18d0: 63 6d 64 20 28 61 70 70 65 6e 64 20 6c 61 75 6e  cmd (append laun
18e0: 63 68 65 72 20 28 63 61 72 20 68 6f 73 74 73 29  cher (car hosts)
18f0: 28 6c 69 73 74 20 72 65 6d 6f 74 65 2d 6d 65 67  (list remote-meg
1900: 61 74 65 73 74 20 22 2d 65 78 65 63 75 74 65 22  atest "-execute"
1910: 20 63 6d 64 70 61 72 6d 73 29 29 29 29 0a 20 20   cmdparms)))).  
1920: 20 20 20 28 6c 61 75 6e 63 68 65 72 0a 20 20 20     (launcher.   
1930: 20 20 20 28 73 65 74 21 20 66 75 6c 6c 63 6d 64     (set! fullcmd
1940: 20 28 61 70 70 65 6e 64 20 6c 61 75 6e 63 68 65   (append launche
1950: 72 20 28 6c 69 73 74 20 72 65 6d 6f 74 65 2d 6d  r (list remote-m
1960: 65 67 61 74 65 73 74 20 22 2d 65 78 65 63 75 74  egatest "-execut
1970: 65 22 20 63 6d 64 70 61 72 6d 73 29 29 29 29 0a  e" cmdparms)))).
1980: 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20       (else.     
1990: 20 28 73 65 74 21 20 66 75 6c 6c 63 6d 64 20 28   (set! fullcmd (
19a0: 6c 69 73 74 20 72 65 6d 6f 74 65 2d 6d 65 67 61  list remote-mega
19b0: 74 65 73 74 20 22 2d 65 78 65 63 75 74 65 22 20  test "-execute" 
19c0: 63 6d 64 70 61 72 6d 73 29 29 29 29 0a 20 20 20  cmdparms)))).   
19d0: 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61   (if (args:get-a
19e0: 72 67 20 22 2d 78 74 65 72 6d 22 29 28 73 65 74  rg "-xterm")(set
19f0: 21 20 66 75 6c 6c 63 6d 64 20 28 61 70 70 65 6e  ! fullcmd (appen
1a00: 64 20 66 75 6c 6c 63 6d 64 20 28 6c 69 73 74 20  d fullcmd (list 
1a10: 22 2d 78 74 65 72 6d 22 29 29 29 29 0a 20 20 20  "-xterm")))).   
1a20: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
1a30: 22 4c 61 75 6e 63 68 69 6e 67 20 6d 65 67 61 74  "Launching megat
1a40: 65 73 74 20 66 6f 72 20 74 65 73 74 20 22 20 74  est for test " t
1a50: 65 73 74 2d 6e 61 6d 65 20 22 20 69 6e 20 22 20  est-name " in " 
1a60: 77 6f 72 6b 2d 61 72 65 61 22 20 2e 2e 2e 22 29  work-area" ...")
1a70: 0a 20 20 20 20 28 74 65 73 74 2d 73 65 74 2d 73  .    (test-set-s
1a80: 74 61 74 75 73 21 20 64 62 20 72 75 6e 2d 69 64  tatus! db run-id
1a90: 20 74 65 73 74 2d 6e 61 6d 65 20 22 4c 41 55 4e   test-name "LAUN
1aa0: 43 48 45 44 22 20 22 6e 2f 61 22 20 69 74 65 6d  CHED" "n/a" item
1ab0: 64 61 74 29 20 3b 3b 20 28 69 66 20 6c 61 75 6e  dat) ;; (if laun
1ac0: 63 68 2d 72 65 73 75 6c 74 73 20 6c 61 75 6e 63  ch-results launc
1ad0: 68 2d 72 65 73 75 6c 74 73 20 22 46 41 49 4c 45  h-results "FAILE
1ae0: 44 22 29 29 0a 20 20 20 20 3b 3b 20 73 65 74 20  D")).    ;; set 
1af0: 0a 20 20 20 20 3b 3b 20 73 65 74 20 70 72 65 2d  .    ;; set pre-
1b00: 6c 61 75 6e 63 68 2d 65 6e 76 2d 76 61 72 73 20  launch-env-vars 
1b10: 62 65 66 6f 72 65 20 6c 61 75 6e 63 68 69 6e 67  before launching
1b20: 2c 20 6b 65 65 70 20 74 68 65 20 76 61 72 73 20  , keep the vars 
1b30: 69 6e 20 70 72 65 76 76 61 6c 73 20 61 6e 64 20  in prevvals and 
1b40: 70 75 74 20 74 68 65 20 65 6e 76 69 6f 6e 6d 65  put the envionme
1b50: 6e 74 20 62 61 63 6b 20 77 68 65 6e 20 64 6f 6e  nt back when don
1b60: 65 0a 20 20 20 20 28 6c 65 74 2a 20 28 28 63 6f  e.    (let* ((co
1b70: 6d 6d 6f 6e 70 72 65 76 76 61 6c 73 20 28 61 6c  mmonprevvals (al
1b80: 69 73 74 2d 3e 65 6e 76 2d 76 61 72 73 0a 09 09  ist->env-vars...
1b90: 09 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65  .    (hash-table
1ba0: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a 63 6f  -ref/default *co
1bb0: 6e 66 69 67 64 61 74 2a 20 22 65 6e 76 2d 6f 76  nfigdat* "env-ov
1bc0: 65 72 72 69 64 65 22 20 27 28 29 29 29 29 0a 09  erride" '())))..
1bd0: 20 20 20 28 74 65 73 74 70 72 65 76 76 61 6c 73     (testprevvals
1be0: 20 20 20 28 61 6c 69 73 74 2d 3e 65 6e 76 2d 76     (alist->env-v
1bf0: 61 72 73 0a 09 09 09 20 20 20 20 28 68 61 73 68  ars....    (hash
1c00: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
1c10: 6c 74 20 74 65 73 74 2d 63 6f 6e 66 20 22 70 72  lt test-conf "pr
1c20: 65 2d 6c 61 75 6e 63 68 2d 65 6e 76 2d 6f 76 65  e-launch-env-ove
1c30: 72 72 69 64 65 73 22 20 27 28 29 29 29 29 0a 09  rrides" '())))..
1c40: 20 20 20 28 6d 69 73 63 70 72 65 76 76 61 6c 73     (miscprevvals
1c50: 20 20 20 28 61 6c 69 73 74 2d 3e 65 6e 76 2d 76     (alist->env-v
1c60: 61 72 73 20 3b 3b 20 63 6f 6e 73 6f 6c 69 64 61  ars ;; consolida
1c70: 74 65 20 74 68 69 73 20 63 6f 64 65 20 77 69 74  te this code wit
1c80: 68 20 74 68 65 20 63 6f 64 65 20 69 6e 20 6d 65  h the code in me
1c90: 67 61 74 65 73 74 2e 73 63 6d 20 66 6f 72 20 22  gatest.scm for "
1ca0: 2d 65 78 65 63 75 74 65 22 0a 09 09 09 20 20 20  -execute"....   
1cb0: 20 28 61 70 70 65 6e 64 20 28 6c 69 73 74 20 28   (append (list (
1cc0: 6c 69 73 74 20 22 4d 54 5f 54 45 53 54 5f 4e 41  list "MT_TEST_NA
1cd0: 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 0a 09  ME" test-name)..
1ce0: 09 09 09 09 20 20 28 6c 69 73 74 20 22 4d 54 5f  ....  (list "MT_
1cf0: 49 54 45 4d 5f 49 4e 46 4f 22 20 28 63 6f 6e 63  ITEM_INFO" (conc
1d00: 20 69 74 65 6d 64 61 74 29 29 20 0a 09 09 09 09   itemdat)) .....
1d10: 09 20 20 28 6c 69 73 74 20 22 4d 54 5f 52 55 4e  .  (list "MT_RUN
1d20: 4e 41 4d 45 22 20 20 20 28 61 72 67 73 3a 67 65  NAME"   (args:ge
1d30: 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22  t-arg ":runname"
1d40: 29 29 29 0a 09 09 09 09 20 20 20 20 69 74 65 6d  ))).....    item
1d50: 64 61 74 29 29 29 0a 09 20 20 20 28 6c 61 75 6e  dat)))..   (laun
1d60: 63 68 2d 72 65 73 75 6c 74 73 20 28 61 70 70 6c  ch-results (appl
1d70: 79 20 63 6d 64 2d 72 75 6e 2d 70 72 6f 63 2d 65  y cmd-run-proc-e
1d80: 61 63 68 2d 6c 69 6e 65 0a 09 09 09 09 20 20 28  ach-line.....  (
1d90: 69 66 20 75 73 65 73 68 65 6c 6c 0a 09 09 09 09  if useshell.....
1da0: 20 20 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e        (string-in
1db0: 74 65 72 73 70 65 72 73 65 20 66 75 6c 6c 63 6d  tersperse fullcm
1dc0: 64 20 22 20 22 29 0a 09 09 09 09 20 20 20 20 20  d " ").....     
1dd0: 20 28 63 61 72 20 66 75 6c 6c 63 6d 64 29 29 0a   (car fullcmd)).
1de0: 09 09 09 09 20 20 70 72 69 6e 74 0a 09 09 09 09  ....  print.....
1df0: 20 20 28 69 66 20 75 73 65 73 68 65 6c 6c 0a 09    (if useshell..
1e00: 09 09 09 20 20 20 20 20 20 27 28 29 0a 09 09 09  ...      '()....
1e10: 09 20 20 20 20 20 20 28 63 64 72 20 66 75 6c 6c  .      (cdr full
1e20: 63 6d 64 29 29 29 29 29 20 3b 3b 20 20 6c 61 75  cmd))))) ;;  lau
1e30: 6e 63 68 65 72 20 66 75 6c 6c 63 6d 64 29 29 29  ncher fullcmd)))
1e40: 3b 3b 20 28 61 70 70 6c 79 20 63 6d 64 2d 72 75  ;; (apply cmd-ru
1e50: 6e 2d 70 72 6f 63 2d 65 61 63 68 2d 6c 69 6e 65  n-proc-each-line
1e60: 20 6c 61 75 6e 63 68 65 72 20 70 72 69 6e 74 20   launcher print 
1e70: 66 75 6c 6c 63 6d 64 29 29 29 20 3b 3b 20 28 63  fullcmd))) ;; (c
1e80: 6d 64 2d 72 75 6e 2d 3e 6c 69 73 74 20 66 75 6c  md-run->list ful
1e90: 6c 63 6d 64 29 29 0a 20 20 20 20 20 20 28 64 65  lcmd)).      (de
1ea0: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 4c 61 75  bug:print 2 "Lau
1eb0: 6e 63 68 69 6e 67 20 63 6f 6d 70 6c 65 74 65 64  nching completed
1ec0: 2c 20 75 70 64 61 74 69 6e 67 20 64 62 22 29 0a  , updating db").
1ed0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
1ee0: 6e 74 20 34 20 22 4c 61 75 6e 63 68 20 72 65 73  nt 4 "Launch res
1ef0: 75 6c 74 73 3a 20 22 20 6c 61 75 6e 63 68 2d 72  ults: " launch-r
1f00: 65 73 75 6c 74 73 29 0a 20 20 20 20 20 20 28 69  esults).      (i
1f10: 66 20 28 6e 6f 74 20 6c 61 75 6e 63 68 2d 72 65  f (not launch-re
1f20: 73 75 6c 74 73 29 0a 09 20 20 28 62 65 67 69 6e  sults)..  (begin
1f30: 0a 09 20 20 20 20 28 70 72 69 6e 74 20 22 45 52  ..    (print "ER
1f40: 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 72  ROR: Failed to r
1f50: 75 6e 20 22 20 28 73 74 72 69 6e 67 2d 69 6e 74  un " (string-int
1f60: 65 72 73 70 65 72 73 65 20 66 75 6c 6c 63 6d 64  ersperse fullcmd
1f70: 20 22 20 22 29 20 22 2c 20 65 78 69 74 69 6e 67   " ") ", exiting
1f80: 20 6e 6f 77 22 29 0a 09 20 20 20 20 28 73 71 6c   now")..    (sql
1f90: 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64  ite3:finalize! d
1fa0: 62 29 0a 09 20 20 20 20 3b 3b 20 67 6f 6f 64 20  b)..    ;; good 
1fb0: 6f 6c 65 20 22 65 78 69 74 22 20 73 65 65 6d 73  ole "exit" seems
1fc0: 20 6e 6f 74 20 74 6f 20 77 6f 72 6b 0a 09 20 20   not to work..  
1fd0: 20 20 3b 3b 20 28 5f 65 78 69 74 20 39 29 0a 09    ;; (_exit 9)..
1fe0: 20 20 20 20 3b 3b 20 62 75 74 20 74 68 69 73 20      ;; but this 
1ff0: 68 61 63 6b 20 77 69 6c 6c 20 77 6f 72 6b 21 20  hack will work! 
2000: 54 68 61 6e 6b 73 20 67 6f 20 74 6f 20 41 6c 61  Thanks go to Ala
2010: 6e 20 50 6f 73 74 20 6f 66 20 74 68 65 20 43 68  n Post of the Ch
2020: 69 63 6b 65 6e 20 65 6d 61 69 6c 20 6c 69 73 74  icken email list
2030: 0a 09 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 49 73  ..    ;; NB// Is
2040: 20 74 68 69 73 20 73 74 69 6c 6c 20 6e 65 65 64   this still need
2050: 65 64 3f 20 53 68 6f 75 6c 64 20 62 65 20 73 61  ed? Should be sa
2060: 66 65 20 74 6f 20 67 6f 20 62 61 63 6b 20 74 6f  fe to go back to
2070: 20 22 65 78 69 74 22 20 6e 6f 77 3f 0a 09 20 20   "exit" now?..  
2080: 20 20 28 70 72 6f 63 65 73 73 2d 73 69 67 6e 61    (process-signa
2090: 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 6f 63 65  l (current-proce
20a0: 73 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69  ss-id) signal/ki
20b0: 6c 6c 29 0a 09 20 20 20 20 29 29 0a 20 20 20 20  ll)..    )).    
20c0: 20 20 28 61 6c 69 73 74 2d 3e 65 6e 76 2d 76 61    (alist->env-va
20d0: 72 73 20 6d 69 73 63 70 72 65 76 76 61 6c 73 29  rs miscprevvals)
20e0: 0a 20 20 20 20 20 20 28 61 6c 69 73 74 2d 3e 65  .      (alist->e
20f0: 6e 76 2d 76 61 72 73 20 74 65 73 74 70 72 65 76  nv-vars testprev
2100: 76 61 6c 73 29 0a 20 20 20 20 20 20 28 61 6c 69  vals).      (ali
2110: 73 74 2d 3e 65 6e 76 2d 76 61 72 73 20 63 6f 6d  st->env-vars com
2120: 6d 6f 6e 70 72 65 76 76 61 6c 73 29 0a 20 20 20  monprevvals).   
2130: 20 20 20 6c 61 75 6e 63 68 2d 72 65 73 75 6c 74     launch-result
2140: 73 29 29 29 0a 0a                                s)))..