Megatest

Hex Artifact Content
Login

Artifact e2c0215978cb5bca6ccd9c6d0ac5da1eb0b84ec1:


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 75 73 65 20 72 65 67  ======..(use reg
0230: 65 78 20 72 65 67 65 78 2d 63 61 73 65 20 62 61  ex regex-case ba
0240: 73 65 36 34 20 73 71 6c 69 74 65 33 29 0a 28 69  se64 sqlite3).(i
0250: 6d 70 6f 72 74 20 28 70 72 65 66 69 78 20 62 61  mport (prefix ba
0260: 73 65 36 34 20 62 61 73 65 36 34 3a 29 29 0a 28  se64 base64:)).(
0270: 69 6d 70 6f 72 74 20 28 70 72 65 66 69 78 20 73  import (prefix s
0280: 71 6c 69 74 65 33 20 73 71 6c 69 74 65 33 3a 29  qlite3 sqlite3:)
0290: 29 0a 0a 28 64 65 63 6c 61 72 65 20 28 75 6e 69  )..(declare (uni
02a0: 74 20 6c 61 75 6e 63 68 29 29 0a 28 64 65 63 6c  t launch)).(decl
02b0: 61 72 65 20 28 75 73 65 73 20 63 6f 6d 6d 6f 6e  are (uses common
02c0: 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75 73 65  )).(declare (use
02d0: 73 20 63 6f 6e 66 69 67 66 29 29 0a 28 64 65 63  s configf)).(dec
02e0: 6c 61 72 65 20 28 75 73 65 73 20 64 62 29 29 0a  lare (uses db)).
02f0: 0a 28 69 6e 63 6c 75 64 65 20 22 63 6f 6d 6d 6f  .(include "commo
0300: 6e 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a  n_records.scm").
0310: 28 69 6e 63 6c 75 64 65 20 22 6b 65 79 5f 72 65  (include "key_re
0320: 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 69 6e 63  cords.scm").(inc
0330: 6c 75 64 65 20 22 64 62 5f 72 65 63 6f 72 64 73  lude "db_records
0340: 2e 73 63 6d 22 29 0a 0a 28 64 65 66 69 6e 65 20  .scm")..(define 
0350: 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 0a  (setup-for-run).
0360: 20 20 28 73 65 74 21 20 2a 63 6f 6e 66 69 67 69    (set! *configi
0370: 6e 66 6f 2a 20 28 66 69 6e 64 2d 61 6e 64 2d 72  nfo* (find-and-r
0380: 65 61 64 2d 63 6f 6e 66 69 67 20 28 69 66 20 28  ead-config (if (
0390: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 63  args:get-arg "-c
03a0: 6f 6e 66 69 67 22 29 28 61 72 67 73 3a 67 65 74  onfig")(args:get
03b0: 2d 61 72 67 20 22 2d 63 6f 6e 66 69 67 22 29 20  -arg "-config") 
03c0: 22 6d 65 67 61 74 65 73 74 2e 63 6f 6e 66 69 67  "megatest.config
03d0: 22 29 29 29 0a 20 20 28 73 65 74 21 20 2a 63 6f  "))).  (set! *co
03e0: 6e 66 69 67 64 61 74 2a 20 20 28 69 66 20 28 63  nfigdat*  (if (c
03f0: 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29  ar *configinfo*)
0400: 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f  (car *configinfo
0410: 2a 29 20 23 66 29 29 0a 20 20 28 73 65 74 21 20  *) #f)).  (set! 
0420: 2a 74 6f 70 70 61 74 68 2a 20 20 20 20 28 69 66  *toppath*    (if
0430: 20 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66   (car *configinf
0440: 6f 2a 29 28 63 61 64 72 20 2a 63 6f 6e 66 69 67  o*)(cadr *config
0450: 69 6e 66 6f 2a 29 20 23 66 29 29 0a 20 20 28 69  info*) #f)).  (i
0460: 66 20 2a 74 6f 70 70 61 74 68 2a 0a 20 20 20 20  f *toppath*.    
0470: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55    (setenv "MT_RU
0480: 4e 5f 41 52 45 41 5f 48 4f 4d 45 22 20 2a 74 6f  N_AREA_HOME" *to
0490: 70 70 61 74 68 2a 29 20 3b 3b 20 74 6f 20 62 65  ppath*) ;; to be
04a0: 20 64 65 70 72 65 63 61 74 65 64 0a 20 20 20 20   deprecated.    
04b0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
04c0: 20 22 45 52 52 4f 52 3a 20 66 61 69 6c 65 64 20   "ERROR: failed 
04d0: 74 6f 20 66 69 6e 64 20 74 68 65 20 74 6f 70 20  to find the top 
04e0: 70 61 74 68 20 74 6f 20 79 6f 75 72 20 72 75 6e  path to your run
04f0: 20 73 65 74 75 70 2e 22 29 29 0a 20 20 2a 74 6f   setup.")).  *to
0500: 70 70 61 74 68 2a 29 0a 0a 28 64 65 66 69 6e 65  ppath*)..(define
0510: 20 28 67 65 74 2d 62 65 73 74 2d 64 69 73 6b 20   (get-best-disk 
0520: 63 6f 6e 66 64 61 74 29 0a 20 20 28 6c 65 74 2a  confdat).  (let*
0530: 20 28 28 64 69 73 6b 73 20 20 20 20 28 68 61 73   ((disks    (has
0540: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
0550: 75 6c 74 20 63 6f 6e 66 64 61 74 20 22 64 69 73  ult confdat "dis
0560: 6b 73 22 20 23 66 29 29 0a 09 20 28 62 65 73 74  ks" #f)).. (best
0570: 20 20 20 20 20 23 66 29 0a 09 20 28 62 65 73 74       #f).. (best
0580: 73 69 7a 65 20 30 29 29 0a 20 20 20 20 28 69 66  size 0)).    (if
0590: 20 64 69 73 6b 73 20 0a 09 28 66 6f 72 2d 65 61   disks ..(for-ea
05a0: 63 68 20 0a 09 20 28 6c 61 6d 62 64 61 20 28 64  ch .. (lambda (d
05b0: 69 73 6b 2d 6e 75 6d 29 0a 09 20 20 20 28 6c 65  isk-num)..   (le
05c0: 74 2a 20 28 28 64 69 72 70 61 74 68 20 20 20 20  t* ((dirpath    
05d0: 28 63 61 64 72 20 28 61 73 73 6f 63 20 64 69 73  (cadr (assoc dis
05e0: 6b 2d 6e 75 6d 20 64 69 73 6b 73 29 29 29 0a 09  k-num disks)))..
05f0: 09 20 20 28 66 72 65 65 73 70 63 20 20 20 20 28  .  (freespc    (
0600: 69 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20 64  if (directory? d
0610: 69 72 70 61 74 68 29 0a 09 09 09 09 20 20 28 67  irpath).....  (g
0620: 65 74 2d 64 66 20 64 69 72 70 61 74 68 29 0a 09  et-df dirpath)..
0630: 09 09 09 20 20 28 62 65 67 69 6e 0a 09 09 09 09  ...  (begin.....
0640: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
0650: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 70 61 74   0 "WARNING: pat
0660: 68 20 22 20 64 69 72 70 61 74 68 20 22 20 69 6e  h " dirpath " in
0670: 20 5b 64 69 73 6b 73 5d 20 73 65 63 74 69 6f 6e   [disks] section
0680: 20 6e 6f 74 20 76 61 6c 69 64 22 29 0a 09 09 09   not valid")....
0690: 09 20 20 20 20 30 29 29 29 29 0a 09 20 20 20 20  .    0))))..    
06a0: 20 28 69 66 20 28 3e 20 66 72 65 65 73 70 63 20   (if (> freespc 
06b0: 62 65 73 74 73 69 7a 65 29 0a 09 09 20 28 62 65  bestsize)... (be
06c0: 67 69 6e 0a 09 09 20 20 20 28 73 65 74 21 20 62  gin...   (set! b
06d0: 65 73 74 20 20 20 20 20 64 69 72 70 61 74 68 29  est     dirpath)
06e0: 0a 09 09 20 20 20 28 73 65 74 21 20 62 65 73 74  ...   (set! best
06f0: 73 69 7a 65 20 66 72 65 65 73 70 63 29 29 29 29  size freespc))))
0700: 29 0a 09 20 28 6d 61 70 20 63 61 72 20 64 69 73  ).. (map car dis
0710: 6b 73 29 29 29 0a 20 20 20 20 28 69 66 20 62 65  ks))).    (if be
0720: 73 74 0a 09 62 65 73 74 0a 09 28 62 65 67 69 6e  st..best..(begin
0730: 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
0740: 20 30 20 22 45 52 52 4f 52 3a 20 4e 6f 20 76 61   0 "ERROR: No va
0750: 6c 69 64 20 64 69 73 6b 73 20 66 6f 75 6e 64 20  lid disks found 
0760: 69 6e 20 6d 65 67 61 74 65 73 74 2e 63 6f 6e 66  in megatest.conf
0770: 69 67 2e 20 50 6c 65 61 73 65 20 61 64 64 20 73  ig. Please add s
0780: 6f 6d 65 20 74 6f 20 79 6f 75 72 20 5b 64 69 73  ome to your [dis
0790: 6b 73 5d 20 73 65 63 74 69 6f 6e 22 29 0a 09 20  ks] section").. 
07a0: 20 28 65 78 69 74 20 31 29 29 29 29 29 0a 0a 28   (exit 1)))))..(
07b0: 64 65 66 69 6e 65 20 28 63 72 65 61 74 65 2d 77  define (create-w
07c0: 6f 72 6b 2d 61 72 65 61 20 64 62 20 72 75 6e 2d  ork-area db run-
07d0: 69 64 20 74 65 73 74 2d 70 61 74 68 20 64 69 73  id test-path dis
07e0: 6b 2d 70 61 74 68 20 74 65 73 74 6e 61 6d 65 20  k-path testname 
07f0: 69 74 65 6d 64 61 74 29 0a 20 20 28 6c 65 74 2a  itemdat).  (let*
0800: 20 28 28 72 75 6e 2d 69 6e 66 6f 20 28 64 62 3a   ((run-info (db:
0810: 67 65 74 2d 72 75 6e 2d 69 6e 66 6f 20 64 62 20  get-run-info db 
0820: 72 75 6e 2d 69 64 29 29 0a 09 20 28 69 74 65 6d  run-id)).. (item
0830: 2d 70 61 74 68 20 28 6c 65 74 20 28 28 69 70 20  -path (let ((ip 
0840: 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68  (item-list->path
0850: 20 69 74 65 6d 64 61 74 29 29 29 0a 09 09 20 20   itemdat)))...  
0860: 20 20 20 20 28 69 66 20 28 65 71 75 61 6c 3f 20      (if (equal? 
0870: 69 70 20 22 22 29 20 22 22 20 28 63 6f 6e 63 20  ip "") "" (conc 
0880: 22 2f 22 20 69 70 29 29 29 29 0a 09 20 28 72 75  "/" ip)))).. (ru
0890: 6e 6e 61 6d 65 20 20 28 64 62 3a 67 65 74 2d 76  nname  (db:get-v
08a0: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28  alue-by-header (
08b0: 64 62 3a 67 65 74 2d 72 6f 77 20 72 75 6e 2d 69  db:get-row run-i
08c0: 6e 66 6f 29 0a 09 09 09 09 09 20 20 20 28 64 62  nfo)......   (db
08d0: 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e 2d  :get-header run-
08e0: 69 6e 66 6f 29 0a 09 09 09 09 09 20 20 20 22 72  info)......   "r
08f0: 75 6e 6e 61 6d 65 22 29 29 0a 09 20 28 6b 65 79  unname")).. (key
0900: 2d 76 61 6c 73 20 28 67 65 74 2d 6b 65 79 2d 76  -vals (get-key-v
0910: 61 6c 73 20 64 62 20 72 75 6e 2d 69 64 29 29 0a  als db run-id)).
0920: 09 20 28 6b 65 79 2d 73 74 72 20 20 28 73 74 72  . (key-str  (str
0930: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20  ing-intersperse 
0940: 6b 65 79 2d 76 61 6c 73 20 22 2f 22 29 29 0a 09  key-vals "/"))..
0950: 20 28 64 66 75 6c 6c 70 20 20 20 28 63 6f 6e 63   (dfullp   (conc
0960: 20 64 69 73 6b 2d 70 61 74 68 20 22 2f 22 20 6b   disk-path "/" k
0970: 65 79 2d 73 74 72 20 22 2f 22 20 72 75 6e 6e 61  ey-str "/" runna
0980: 6d 65 20 22 2f 22 20 74 65 73 74 6e 61 6d 65 0a  me "/" testname.
0990: 09 09 09 20 69 74 65 6d 2d 70 61 74 68 29 29 0a  ... item-path)).
09a0: 09 20 28 74 6f 70 74 65 73 74 2d 70 61 74 68 20  . (toptest-path 
09b0: 28 63 6f 6e 63 20 64 69 73 6b 2d 70 61 74 68 20  (conc disk-path 
09c0: 22 2f 22 20 6b 65 79 2d 73 74 72 20 22 2f 22 20  "/" key-str "/" 
09d0: 72 75 6e 6e 61 6d 65 20 22 2f 22 20 74 65 73 74  runname "/" test
09e0: 6e 61 6d 65 29 29 0a 09 20 28 72 75 6e 73 64 69  name)).. (runsdi
09f0: 72 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75  r  (config-looku
0a00: 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 73  p *configdat* "s
0a10: 65 74 75 70 22 20 22 72 75 6e 73 64 69 72 22 29  etup" "runsdir")
0a20: 29 0a 09 20 28 6c 6e 6b 70 61 74 68 20 20 28 63  ).. (lnkpath  (c
0a30: 6f 6e 63 20 28 69 66 20 72 75 6e 73 64 69 72 20  onc (if runsdir 
0a40: 72 75 6e 73 64 69 72 20 28 63 6f 6e 63 20 2a 74  runsdir (conc *t
0a50: 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 73 22 29  oppath* "/runs")
0a60: 29 0a 09 09 09 20 22 2f 22 20 6b 65 79 2d 73 74  ).... "/" key-st
0a70: 72 20 22 2f 22 20 72 75 6e 6e 61 6d 65 20 69 74  r "/" runname it
0a80: 65 6d 2d 70 61 74 68 29 29 29 0a 20 20 20 20 3b  em-path))).    ;
0a90: 3b 20 73 69 6e 63 65 20 74 68 69 73 20 69 73 20  ; since this is 
0aa0: 61 6e 20 69 74 65 72 61 74 65 64 20 74 65 73 74  an iterated test
0ab0: 20 74 68 69 73 20 69 73 20 61 73 20 67 6f 6f 64   this is as good
0ac0: 20 61 20 70 6c 61 63 65 20 61 73 20 61 6e 79 20   a place as any 
0ad0: 74 6f 0a 20 20 20 20 3b 3b 20 75 70 64 61 74 65  to.    ;; update
0ae0: 20 74 68 65 20 74 6f 70 74 65 73 74 20 72 65 63   the toptest rec
0af0: 6f 72 64 20 77 69 74 68 20 69 74 73 20 6c 6f 63  ord with its loc
0b00: 61 74 69 6f 6e 20 72 75 6e 64 69 72 0a 20 20 20  ation rundir.   
0b10: 20 28 69 66 20 28 6e 6f 74 20 28 65 71 75 61 6c   (if (not (equal
0b20: 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 29  ? item-path ""))
0b30: 0a 09 28 64 62 3a 74 65 73 74 2d 73 65 74 2d 72  ..(db:test-set-r
0b40: 75 6e 64 69 72 21 20 64 62 20 72 75 6e 2d 69 64  undir! db run-id
0b50: 20 74 65 73 74 6e 61 6d 65 20 22 22 20 74 6f 70   testname "" top
0b60: 74 65 73 74 2d 70 61 74 68 29 29 0a 20 20 20 20  test-path)).    
0b70: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22  (debug:print 2 "
0b80: 53 65 74 74 69 6e 67 20 75 70 20 74 65 73 74 20  Setting up test 
0b90: 72 75 6e 20 61 72 65 61 22 29 0a 20 20 20 20 28  run area").    (
0ba0: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 20  debug:print 2 " 
0bb0: 2d 20 63 72 65 61 74 69 6e 67 20 72 75 6e 20 61  - creating run a
0bc0: 72 65 61 20 69 6e 20 22 20 64 66 75 6c 6c 70 29  rea in " dfullp)
0bd0: 0a 20 20 20 20 28 73 79 73 74 65 6d 20 20 28 63  .    (system  (c
0be0: 6f 6e 63 20 22 6d 6b 64 69 72 20 2d 70 20 22 20  onc "mkdir -p " 
0bf0: 64 66 75 6c 6c 70 29 29 0a 20 20 20 20 28 64 65  dfullp)).    (de
0c00: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 20 2d 20  bug:print 2 " - 
0c10: 63 72 65 61 74 69 6e 67 20 6c 69 6e 6b 20 66 72  creating link fr
0c20: 6f 6d 20 22 20 64 66 75 6c 6c 70 20 22 2f 22 20  om " dfullp "/" 
0c30: 74 65 73 74 6e 61 6d 65 20 22 20 74 6f 20 22 20  testname " to " 
0c40: 6c 6e 6b 70 61 74 68 29 0a 20 20 20 20 28 73 79  lnkpath).    (sy
0c50: 73 74 65 6d 20 20 28 63 6f 6e 63 20 22 6d 6b 64  stem  (conc "mkd
0c60: 69 72 20 2d 70 20 22 20 6c 6e 6b 70 61 74 68 29  ir -p " lnkpath)
0c70: 29 0a 0a 3b 3b 20 49 20 73 75 73 70 65 63 74 20  )..;; I suspect 
0c80: 74 68 69 73 20 73 65 63 74 69 6f 6e 20 77 61 73  this section was
0c90: 20 64 65 6c 65 74 69 6e 67 20 74 65 73 74 20 64   deleting test d
0ca0: 69 72 65 63 74 6f 72 69 65 73 20 75 6e 64 65 72  irectories under
0cb0: 20 73 6f 6d 65 20 0a 3b 3b 20 77 69 65 72 64 20   some .;; wierd 
0cc0: 73 69 74 61 74 69 6f 6e 73 0a 0a 3b 3b 20 20 20  sitations..;;   
0cd0: 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74   (if (file-exist
0ce0: 73 3f 20 28 63 6f 6e 63 20 6c 6e 6b 70 61 74 68  s? (conc lnkpath
0cf0: 20 22 2f 22 20 74 65 73 74 6e 61 6d 65 29 29 0a   "/" testname)).
0d00: 3b 3b 09 28 73 79 73 74 65 6d 20 28 63 6f 6e 63  ;;.(system (conc
0d10: 20 22 72 6d 20 2d 66 20 22 20 6c 6e 6b 70 61 74   "rm -f " lnkpat
0d20: 68 20 22 2f 22 20 74 65 73 74 6e 61 6d 65 29 29  h "/" testname))
0d30: 29 0a 20 20 20 20 28 73 79 73 74 65 6d 20 20 28  ).    (system  (
0d40: 63 6f 6e 63 20 22 6c 6e 20 2d 73 66 20 22 20 64  conc "ln -sf " d
0d50: 66 75 6c 6c 70 20 22 20 22 20 6c 6e 6b 70 61 74  fullp " " lnkpat
0d60: 68 20 22 2f 22 20 74 65 73 74 6e 61 6d 65 29 29  h "/" testname))
0d70: 0a 20 20 20 20 28 69 66 20 28 64 69 72 65 63 74  .    (if (direct
0d80: 6f 72 79 3f 20 64 66 75 6c 6c 70 29 0a 09 28 62  ory? dfullp)..(b
0d90: 65 67 69 6e 0a 09 20 20 28 6c 65 74 2a 20 28 28  egin..  (let* ((
0da0: 63 6d 64 20 20 20 20 28 63 6f 6e 63 20 22 72 73  cmd    (conc "rs
0db0: 79 6e 63 20 2d 61 76 22 20 28 69 66 20 28 3e 20  ync -av" (if (> 
0dc0: 2a 76 65 72 62 6f 73 69 74 79 2a 20 31 29 20 22  *verbosity* 1) "
0dd0: 22 20 22 71 22 29 20 22 20 22 20 74 65 73 74 2d  " "q") " " test-
0de0: 70 61 74 68 20 22 2f 20 22 20 64 66 75 6c 6c 70  path "/ " dfullp
0df0: 20 22 2f 22 29 29 0a 09 09 20 28 73 74 61 74 75   "/"))... (statu
0e00: 73 20 28 73 79 73 74 65 6d 20 63 6d 64 29 29 29  s (system cmd)))
0e10: 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ..    (if (not (
0e20: 65 71 3f 20 73 74 61 74 75 73 20 30 29 29 0a 09  eq? status 0))..
0e30: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20  .(debug:print 2 
0e40: 22 45 52 52 4f 52 3a 20 70 72 6f 62 6c 65 6d 20  "ERROR: problem 
0e50: 77 69 74 68 20 72 75 6e 6e 69 6e 67 20 5c 22 22  with running \""
0e60: 20 63 6d 64 20 22 5c 22 22 29 29 29 0a 09 20 20   cmd "\"")))..  
0e70: 28 6c 69 73 74 20 64 66 75 6c 6c 70 20 74 6f 70  (list dfullp top
0e80: 74 65 73 74 2d 70 61 74 68 29 29 0a 09 28 6c 69  test-path))..(li
0e90: 73 74 20 23 66 20 23 66 29 29 29 29 0a 0a 3b 3b  st #f #f))))..;;
0ea0: 20 31 2e 20 6c 6f 6f 6b 20 74 68 6f 75 67 68 20   1. look though 
0eb0: 64 69 73 6b 73 20 6c 69 73 74 20 66 6f 72 20 64  disks list for d
0ec0: 69 73 6b 20 77 69 74 68 20 6d 6f 73 74 20 73 70  isk with most sp
0ed0: 61 63 65 0a 3b 3b 20 32 2e 20 63 72 65 61 74 65  ace.;; 2. create
0ee0: 20 72 75 6e 20 64 69 72 20 6f 6e 20 64 69 73 6b   run dir on disk
0ef0: 2c 20 70 61 74 68 20 6e 61 6d 65 20 69 73 20 6d  , path name is m
0f00: 65 61 6e 69 6e 67 66 75 6c 0a 3b 3b 20 33 2e 20  eaningful.;; 3. 
0f10: 63 72 65 61 74 65 20 6c 69 6e 6b 20 66 72 6f 6d  create link from
0f20: 20 72 75 6e 20 64 69 72 20 74 6f 20 6d 65 67 61   run dir to mega
0f30: 74 65 73 74 20 72 75 6e 73 20 61 72 65 61 20 0a  test runs area .
0f40: 3b 3b 20 34 2e 20 72 65 6d 6f 74 65 6c 79 20 72  ;; 4. remotely r
0f50: 75 6e 20 74 68 65 20 74 65 73 74 20 6f 6e 20 61  un the test on a
0f60: 6c 6c 6f 63 61 74 65 64 20 68 6f 73 74 0a 3b 3b  llocated host.;;
0f70: 20 20 20 20 2d 20 63 6f 75 6c 64 20 62 65 20 73      - could be s
0f80: 73 68 20 74 6f 20 68 6f 73 74 20 66 72 6f 6d 20  sh to host from 
0f90: 68 6f 73 74 73 20 74 61 62 6c 65 20 28 75 70 64  hosts table (upd
0fa0: 61 74 65 20 72 65 67 75 6c 61 72 6c 79 20 77 69  ate regularly wi
0fb0: 74 68 20 6c 6f 61 64 29 0a 3b 3b 20 20 20 20 2d  th load).;;    -
0fc0: 20 63 6f 75 6c 64 20 62 65 20 6e 65 74 62 61 74   could be netbat
0fd0: 63 68 0a 3b 3b 20 20 20 20 20 20 28 6c 61 75 6e  ch.;;      (laun
0fe0: 63 68 2d 74 65 73 74 20 64 62 20 28 63 61 64 72  ch-test db (cadr
0ff0: 20 73 74 61 74 75 73 29 20 74 65 73 74 2d 63 6f   status) test-co
1000: 6e 66 29 29 0a 28 64 65 66 69 6e 65 20 28 6c 61  nf)).(define (la
1010: 75 6e 63 68 2d 74 65 73 74 20 64 62 20 72 75 6e  unch-test db run
1020: 2d 69 64 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65  -id test-conf ke
1030: 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d  yvallst test-nam
1040: 65 20 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d  e test-path item
1050: 64 61 74 29 0a 20 20 28 63 68 61 6e 67 65 2d 64  dat).  (change-d
1060: 69 72 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74  irectory *toppat
1070: 68 2a 29 0a 20 20 28 6c 65 74 20 28 28 75 73 65  h*).  (let ((use
1080: 73 68 65 6c 6c 20 20 20 28 63 6f 6e 66 69 67 2d  shell   (config-
1090: 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61  lookup *configda
10a0: 74 2a 20 22 6a 6f 62 74 6f 6f 6c 73 22 20 20 20  t* "jobtools"   
10b0: 20 20 22 75 73 65 73 68 65 6c 6c 22 29 29 0a 09    "useshell"))..
10c0: 28 6c 61 75 6e 63 68 65 72 20 20 20 28 63 6f 6e  (launcher   (con
10d0: 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66  fig-lookup *conf
10e0: 69 67 64 61 74 2a 20 22 6a 6f 62 74 6f 6f 6c 73  igdat* "jobtools
10f0: 22 20 20 20 20 20 22 6c 61 75 6e 63 68 65 72 22  "     "launcher"
1100: 29 29 0a 09 28 72 75 6e 73 63 72 69 70 74 20 20  ))..(runscript  
1110: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74  (config-lookup t
1120: 65 73 74 2d 63 6f 6e 66 20 20 20 22 73 65 74 75  est-conf   "setu
1130: 70 22 20 20 20 20 20 20 20 20 22 72 75 6e 73 63  p"        "runsc
1140: 72 69 70 74 22 29 29 0a 09 28 64 69 73 6b 73 70  ript"))..(disksp
1150: 61 63 65 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f  ace  (config-loo
1160: 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 20 20  kup test-conf   
1170: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22  "requirements" "
1180: 64 69 73 6b 73 70 61 63 65 22 29 29 0a 09 28 6d  diskspace"))..(m
1190: 65 6d 6f 72 79 20 20 20 20 20 28 63 6f 6e 66 69  emory     (confi
11a0: 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f  g-lookup test-co
11b0: 6e 66 20 20 20 22 72 65 71 75 69 72 65 6d 65 6e  nf   "requiremen
11c0: 74 73 22 20 22 6d 65 6d 6f 72 79 22 29 29 0a 09  ts" "memory"))..
11d0: 28 68 6f 73 74 73 20 20 20 20 20 20 28 63 6f 6e  (hosts      (con
11e0: 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66  fig-lookup *conf
11f0: 69 67 64 61 74 2a 20 22 6a 6f 62 74 6f 6f 6c 73  igdat* "jobtools
1200: 22 20 20 20 20 20 22 77 6f 72 6b 68 6f 73 74 73  "     "workhosts
1210: 22 29 29 0a 09 28 72 65 6d 6f 74 65 2d 6d 65 67  "))..(remote-meg
1220: 61 74 65 73 74 20 28 63 6f 6e 66 69 67 2d 6c 6f  atest (config-lo
1230: 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a  okup *configdat*
1240: 20 22 73 65 74 75 70 22 20 22 65 78 65 63 75 74   "setup" "execut
1250: 61 62 6c 65 22 29 29 0a 09 28 6c 6f 63 61 6c 2d  able"))..(local-
1260: 6d 65 67 61 74 65 73 74 20 20 28 63 61 72 20 28  megatest  (car (
1270: 61 72 67 76 29 29 29 0a 09 3b 3b 20 28 69 74 65  argv)))..;; (ite
1280: 6d 2d 70 61 74 68 20 20 28 69 74 65 6d 2d 6c 69  m-path  (item-li
1290: 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74  st->path itemdat
12a0: 29 29 20 74 65 73 74 2d 70 61 74 68 20 69 73 20  )) test-path is 
12b0: 74 68 65 20 66 75 6c 6c 20 70 61 74 68 20 69 6e  the full path in
12c0: 63 6c 75 64 69 6e 67 20 74 68 65 20 69 74 65 6d  cluding the item
12d0: 2d 70 61 74 68 0a 09 28 77 6f 72 6b 2d 61 72 65  -path..(work-are
12e0: 61 20 20 23 66 29 0a 09 28 74 6f 70 74 65 73 74  a  #f)..(toptest
12f0: 2d 77 6f 72 6b 2d 61 72 65 61 20 23 66 29 20 3b  -work-area #f) ;
1300: 3b 20 66 6f 72 20 69 74 65 72 61 74 65 64 20 74  ; for iterated t
1310: 65 73 74 73 20 74 68 65 20 74 6f 70 20 74 65 73  ests the top tes
1320: 74 20 63 6f 6e 74 61 69 6e 73 20 64 61 74 61 20  t contains data 
1330: 72 65 6c 65 76 61 6e 74 20 66 6f 72 20 61 6c 6c  relevant for all
1340: 0a 09 28 64 69 73 6b 70 61 74 68 20 20 20 23 66  ..(diskpath   #f
1350: 29 0a 09 28 63 6d 64 70 61 72 6d 73 20 20 20 23  )..(cmdparms   #
1360: 66 29 0a 09 28 66 75 6c 6c 63 6d 64 20 20 20 20  f)..(fullcmd    
1370: 23 66 29 20 3b 3b 20 28 64 65 66 69 6e 65 20 61  #f) ;; (define a
1380: 20 28 77 69 74 68 2d 6f 75 74 70 75 74 2d 74 6f   (with-output-to
1390: 2d 73 74 72 69 6e 67 20 28 6c 61 6d 62 64 61 20  -string (lambda 
13a0: 28 29 28 77 72 69 74 65 20 78 29 29 29 29 0a 09  ()(write x))))..
13b0: 28 6d 74 2d 62 69 6e 64 69 72 2d 70 61 74 68 20  (mt-bindir-path 
13c0: 23 66 29 29 0a 20 20 20 20 28 69 66 20 68 6f 73  #f)).    (if hos
13d0: 74 73 20 28 73 65 74 21 20 68 6f 73 74 73 20 28  ts (set! hosts (
13e0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 68 6f 73  string-split hos
13f0: 74 73 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e  ts))).    (if (n
1400: 6f 74 20 72 65 6d 6f 74 65 2d 6d 65 67 61 74 65  ot remote-megate
1410: 73 74 29 28 73 65 74 21 20 72 65 6d 6f 74 65 2d  st)(set! remote-
1420: 6d 65 67 61 74 65 73 74 20 6c 6f 63 61 6c 2d 6d  megatest local-m
1430: 65 67 61 74 65 73 74 29 29 20 3b 3b 20 22 6d 65  egatest)) ;; "me
1440: 67 61 74 65 73 74 22 29 29 0a 20 20 20 20 28 73  gatest")).    (s
1450: 65 74 21 20 6d 74 2d 62 69 6e 64 69 72 2d 70 61  et! mt-bindir-pa
1460: 74 68 20 28 70 61 74 68 6e 61 6d 65 2d 64 69 72  th (pathname-dir
1470: 65 63 74 6f 72 79 20 72 65 6d 6f 74 65 2d 6d 65  ectory remote-me
1480: 67 61 74 65 73 74 29 29 0a 20 20 20 20 28 69 66  gatest)).    (if
1490: 20 6c 61 75 6e 63 68 65 72 20 28 73 65 74 21 20   launcher (set! 
14a0: 6c 61 75 6e 63 68 65 72 20 28 73 74 72 69 6e 67  launcher (string
14b0: 2d 73 70 6c 69 74 20 6c 61 75 6e 63 68 65 72 29  -split launcher)
14c0: 29 29 0a 20 20 20 20 3b 3b 20 73 65 74 20 75 70  )).    ;; set up
14d0: 20 74 68 65 20 72 75 6e 20 77 6f 72 6b 20 61 72   the run work ar
14e0: 65 61 20 66 6f 72 20 74 68 69 73 20 74 65 73 74  ea for this test
14f0: 0a 20 20 20 20 28 73 65 74 21 20 64 69 73 6b 70  .    (set! diskp
1500: 61 74 68 20 28 67 65 74 2d 62 65 73 74 2d 64 69  ath (get-best-di
1510: 73 6b 20 2a 63 6f 6e 66 69 67 64 61 74 2a 29 29  sk *configdat*))
1520: 0a 20 20 20 20 28 69 66 20 64 69 73 6b 70 61 74  .    (if diskpat
1530: 68 0a 09 28 6c 65 74 20 28 28 64 61 74 20 20 28  h..(let ((dat  (
1540: 63 72 65 61 74 65 2d 77 6f 72 6b 2d 61 72 65 61  create-work-area
1550: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d   db run-id test-
1560: 70 61 74 68 20 64 69 73 6b 70 61 74 68 20 74 65  path diskpath te
1570: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 64 61 74 29  st-name itemdat)
1580: 29 29 0a 09 20 20 28 73 65 74 21 20 77 6f 72 6b  ))..  (set! work
1590: 2d 61 72 65 61 20 28 63 61 72 20 64 61 74 29 29  -area (car dat))
15a0: 0a 09 20 20 28 73 65 74 21 20 74 6f 70 74 65 73  ..  (set! toptes
15b0: 74 2d 77 6f 72 6b 2d 61 72 65 61 20 28 63 61 64  t-work-area (cad
15c0: 72 20 64 61 74 29 29 29 0a 09 28 62 65 67 69 6e  r dat)))..(begin
15d0: 0a 09 20 20 28 73 65 74 21 20 77 6f 72 6b 2d 61  ..  (set! work-a
15e0: 72 65 61 20 74 65 73 74 2d 70 61 74 68 29 0a 09  rea test-path)..
15f0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
1600: 20 22 57 41 52 4e 49 4e 47 3a 20 4e 6f 20 64 69   "WARNING: No di
1610: 73 6b 20 77 6f 72 6b 20 61 72 65 61 20 73 70 65  sk work area spe
1620: 63 69 66 69 65 64 20 2d 20 72 75 6e 6e 69 6e 67  cified - running
1630: 20 69 6e 20 74 68 65 20 74 65 73 74 20 64 69 72   in the test dir
1640: 65 63 74 6f 72 79 22 29 29 29 0a 20 20 20 20 28  ectory"))).    (
1650: 73 65 74 21 20 63 6d 64 70 61 72 6d 73 20 28 62  set! cmdparms (b
1660: 61 73 65 36 34 3a 62 61 73 65 36 34 2d 65 6e 63  ase64:base64-enc
1670: 6f 64 65 20 28 77 69 74 68 2d 6f 75 74 70 75 74  ode (with-output
1680: 2d 74 6f 2d 73 74 72 69 6e 67 0a 09 09 09 09 20  -to-string..... 
1690: 20 20 20 28 6c 61 6d 62 64 61 20 28 29 20 3b 3b     (lambda () ;;
16a0: 20 28 6c 69 73 74 20 27 68 6f 73 74 73 20 20 20   (list 'hosts   
16b0: 20 20 68 6f 73 74 73 29 0a 09 09 09 09 20 20 20    hosts).....   
16c0: 20 20 20 28 77 72 69 74 65 20 28 6c 69 73 74 20     (write (list 
16d0: 28 6c 69 73 74 20 27 74 65 73 74 70 61 74 68 20  (list 'testpath 
16e0: 20 74 65 73 74 2d 70 61 74 68 29 0a 09 09 09 09   test-path).....
16f0: 09 09 20 20 20 28 6c 69 73 74 20 27 77 6f 72 6b  ..   (list 'work
1700: 2d 61 72 65 61 20 77 6f 72 6b 2d 61 72 65 61 29  -area work-area)
1710: 0a 09 09 09 09 09 09 20 20 20 28 6c 69 73 74 20  .......   (list 
1720: 27 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d  'test-name test-
1730: 6e 61 6d 65 29 20 0a 09 09 09 09 09 09 20 20 20  name) .......   
1740: 28 6c 69 73 74 20 27 72 75 6e 73 63 72 69 70 74  (list 'runscript
1750: 20 72 75 6e 73 63 72 69 70 74 29 20 0a 09 09 09   runscript) ....
1760: 09 09 09 20 20 20 28 6c 69 73 74 20 27 72 75 6e  ...   (list 'run
1770: 2d 69 64 20 20 20 20 72 75 6e 2d 69 64 20 20 20  -id    run-id   
1780: 29 0a 09 09 09 09 09 09 20 20 20 28 6c 69 73 74  ).......   (list
1790: 20 27 69 74 65 6d 64 61 74 20 20 20 69 74 65 6d   'itemdat   item
17a0: 64 61 74 20 20 29 0a 09 09 09 09 09 09 20 20 20  dat  ).......   
17b0: 28 6c 69 73 74 20 27 6d 65 67 61 74 65 73 74 20  (list 'megatest 
17c0: 20 72 65 6d 6f 74 65 2d 6d 65 67 61 74 65 73 74   remote-megatest
17d0: 29 0a 09 09 09 09 09 09 20 20 20 28 6c 69 73 74  ).......   (list
17e0: 20 27 65 6e 76 2d 6f 76 72 64 20 20 28 68 61 73   'env-ovrd  (has
17f0: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
1800: 75 6c 74 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20  ult *configdat* 
1810: 22 65 6e 76 2d 6f 76 65 72 72 69 64 65 22 20 27  "env-override" '
1820: 28 29 29 29 0a 09 09 09 09 09 09 20 20 20 28 6c  ())).......   (l
1830: 69 73 74 20 27 72 75 6e 6e 61 6d 65 20 20 20 28  ist 'runname   (
1840: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72  args:get-arg ":r
1850: 75 6e 6e 61 6d 65 22 29 29 0a 09 09 09 09 09 09  unname")).......
1860: 20 20 20 28 6c 69 73 74 20 27 6d 74 2d 62 69 6e     (list 'mt-bin
1870: 64 69 72 2d 70 61 74 68 20 6d 74 2d 62 69 6e 64  dir-path mt-bind
1880: 69 72 2d 70 61 74 68 29 29 29 29 29 29 29 20 3b  ir-path))))))) ;
1890: 3b 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73  ; (string-inters
18a0: 70 65 72 73 65 20 6b 65 79 76 61 6c 6c 73 74 20  perse keyvallst 
18b0: 22 20 22 29 29 29 29 0a 20 20 20 20 3b 3b 20 63  " ")))).    ;; c
18c0: 6c 65 61 6e 20 6f 75 74 20 73 74 65 70 20 72 65  lean out step re
18d0: 63 6f 72 64 73 20 66 72 6f 6d 20 70 72 65 76 69  cords from previ
18e0: 6f 75 73 20 72 75 6e 20 69 66 20 74 68 65 79 20  ous run if they 
18f0: 65 78 69 73 74 0a 20 20 20 20 28 64 62 3a 64 65  exist.    (db:de
1900: 6c 65 74 65 2d 74 65 73 74 2d 73 74 65 70 2d 72  lete-test-step-r
1910: 65 63 6f 72 64 73 20 64 62 20 72 75 6e 2d 69 64  ecords db run-id
1920: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 64   test-name itemd
1930: 61 74 29 0a 20 20 20 20 28 63 68 61 6e 67 65 2d  at).    (change-
1940: 64 69 72 65 63 74 6f 72 79 20 77 6f 72 6b 2d 61  directory work-a
1950: 72 65 61 29 20 3b 3b 20 73 6f 20 74 68 61 74 20  rea) ;; so that 
1960: 6c 6f 67 20 66 69 6c 65 73 20 66 72 6f 6d 20 74  log files from t
1970: 68 65 20 6c 61 75 6e 63 68 20 70 72 6f 63 65 73  he launch proces
1980: 73 20 64 6f 6e 27 74 20 63 6c 75 74 74 65 72 20  s don't clutter 
1990: 74 68 65 20 74 65 73 74 20 64 69 72 0a 20 20 20  the test dir.   
19a0: 20 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 61 6e   (cond.     ((an
19b0: 64 20 6c 61 75 6e 63 68 65 72 20 68 6f 73 74 73  d launcher hosts
19c0: 29 20 3b 3b 20 6d 75 73 74 20 62 65 20 75 73 69  ) ;; must be usi
19d0: 6e 67 20 73 73 68 20 68 6f 73 74 6e 61 6d 65 0a  ng ssh hostname.
19e0: 20 20 20 20 20 20 28 73 65 74 21 20 66 75 6c 6c        (set! full
19f0: 63 6d 64 20 28 61 70 70 65 6e 64 20 6c 61 75 6e  cmd (append laun
1a00: 63 68 65 72 20 28 63 61 72 20 68 6f 73 74 73 29  cher (car hosts)
1a10: 28 6c 69 73 74 20 72 65 6d 6f 74 65 2d 6d 65 67  (list remote-meg
1a20: 61 74 65 73 74 20 22 2d 65 78 65 63 75 74 65 22  atest "-execute"
1a30: 20 63 6d 64 70 61 72 6d 73 29 29 29 29 0a 20 20   cmdparms)))).  
1a40: 20 20 20 28 6c 61 75 6e 63 68 65 72 0a 20 20 20     (launcher.   
1a50: 20 20 20 28 73 65 74 21 20 66 75 6c 6c 63 6d 64     (set! fullcmd
1a60: 20 28 61 70 70 65 6e 64 20 6c 61 75 6e 63 68 65   (append launche
1a70: 72 20 28 6c 69 73 74 20 72 65 6d 6f 74 65 2d 6d  r (list remote-m
1a80: 65 67 61 74 65 73 74 20 22 2d 65 78 65 63 75 74  egatest "-execut
1a90: 65 22 20 63 6d 64 70 61 72 6d 73 29 29 29 29 0a  e" cmdparms)))).
1aa0: 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20       (else.     
1ab0: 20 28 73 65 74 21 20 66 75 6c 6c 63 6d 64 20 28   (set! fullcmd (
1ac0: 6c 69 73 74 20 72 65 6d 6f 74 65 2d 6d 65 67 61  list remote-mega
1ad0: 74 65 73 74 20 22 2d 65 78 65 63 75 74 65 22 20  test "-execute" 
1ae0: 63 6d 64 70 61 72 6d 73 29 29 29 29 0a 20 20 20  cmdparms)))).   
1af0: 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61   (if (args:get-a
1b00: 72 67 20 22 2d 78 74 65 72 6d 22 29 28 73 65 74  rg "-xterm")(set
1b10: 21 20 66 75 6c 6c 63 6d 64 20 28 61 70 70 65 6e  ! fullcmd (appen
1b20: 64 20 66 75 6c 6c 63 6d 64 20 28 6c 69 73 74 20  d fullcmd (list 
1b30: 22 2d 78 74 65 72 6d 22 29 29 29 29 0a 20 20 20  "-xterm")))).   
1b40: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
1b50: 22 4c 61 75 6e 63 68 69 6e 67 20 6d 65 67 61 74  "Launching megat
1b60: 65 73 74 20 66 6f 72 20 74 65 73 74 20 22 20 74  est for test " t
1b70: 65 73 74 2d 6e 61 6d 65 20 22 20 69 6e 20 22 20  est-name " in " 
1b80: 77 6f 72 6b 2d 61 72 65 61 22 20 2e 2e 2e 22 29  work-area" ...")
1b90: 0a 20 20 20 20 28 74 65 73 74 2d 73 65 74 2d 73  .    (test-set-s
1ba0: 74 61 74 75 73 21 20 64 62 20 72 75 6e 2d 69 64  tatus! db run-id
1bb0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 4c 41 55 4e   test-name "LAUN
1bc0: 43 48 45 44 22 20 22 6e 2f 61 22 20 69 74 65 6d  CHED" "n/a" item
1bd0: 64 61 74 20 23 66 20 23 66 29 20 3b 3b 20 28 69  dat #f #f) ;; (i
1be0: 66 20 6c 61 75 6e 63 68 2d 72 65 73 75 6c 74 73  f launch-results
1bf0: 20 6c 61 75 6e 63 68 2d 72 65 73 75 6c 74 73 20   launch-results 
1c00: 22 46 41 49 4c 45 44 22 29 29 0a 20 20 20 20 3b  "FAILED")).    ;
1c10: 3b 20 73 65 74 20 0a 20 20 20 20 3b 3b 20 73 65  ; set .    ;; se
1c20: 74 20 70 72 65 2d 6c 61 75 6e 63 68 2d 65 6e 76  t pre-launch-env
1c30: 2d 76 61 72 73 20 62 65 66 6f 72 65 20 6c 61 75  -vars before lau
1c40: 6e 63 68 69 6e 67 2c 20 6b 65 65 70 20 74 68 65  nching, keep the
1c50: 20 76 61 72 73 20 69 6e 20 70 72 65 76 76 61 6c   vars in prevval
1c60: 73 20 61 6e 64 20 70 75 74 20 74 68 65 20 65 6e  s and put the en
1c70: 76 69 6f 6e 6d 65 6e 74 20 62 61 63 6b 20 77 68  vionment back wh
1c80: 65 6e 20 64 6f 6e 65 0a 20 20 20 20 28 64 65 62  en done.    (deb
1c90: 75 67 3a 70 72 69 6e 74 20 34 20 22 66 75 6c 6c  ug:print 4 "full
1ca0: 63 6d 64 3a 20 22 20 66 75 6c 6c 63 6d 64 29 0a  cmd: " fullcmd).
1cb0: 20 20 20 20 28 6c 65 74 2a 20 28 28 63 6f 6d 6d      (let* ((comm
1cc0: 6f 6e 70 72 65 76 76 61 6c 73 20 28 61 6c 69 73  onprevvals (alis
1cd0: 74 2d 3e 65 6e 76 2d 76 61 72 73 0a 09 09 09 20  t->env-vars.... 
1ce0: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72     (hash-table-r
1cf0: 65 66 2f 64 65 66 61 75 6c 74 20 2a 63 6f 6e 66  ef/default *conf
1d00: 69 67 64 61 74 2a 20 22 65 6e 76 2d 6f 76 65 72  igdat* "env-over
1d10: 72 69 64 65 22 20 27 28 29 29 29 29 0a 09 20 20  ride" '())))..  
1d20: 20 28 74 65 73 74 70 72 65 76 76 61 6c 73 20 20   (testprevvals  
1d30: 20 28 61 6c 69 73 74 2d 3e 65 6e 76 2d 76 61 72   (alist->env-var
1d40: 73 0a 09 09 09 20 20 20 20 28 68 61 73 68 2d 74  s....    (hash-t
1d50: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
1d60: 20 74 65 73 74 2d 63 6f 6e 66 20 22 70 72 65 2d   test-conf "pre-
1d70: 6c 61 75 6e 63 68 2d 65 6e 76 2d 6f 76 65 72 72  launch-env-overr
1d80: 69 64 65 73 22 20 27 28 29 29 29 29 0a 09 20 20  ides" '())))..  
1d90: 20 28 6d 69 73 63 70 72 65 76 76 61 6c 73 20 20   (miscprevvals  
1da0: 20 28 61 6c 69 73 74 2d 3e 65 6e 76 2d 76 61 72   (alist->env-var
1db0: 73 20 3b 3b 20 63 6f 6e 73 6f 6c 69 64 61 74 65  s ;; consolidate
1dc0: 20 74 68 69 73 20 63 6f 64 65 20 77 69 74 68 20   this code with 
1dd0: 74 68 65 20 63 6f 64 65 20 69 6e 20 6d 65 67 61  the code in mega
1de0: 74 65 73 74 2e 73 63 6d 20 66 6f 72 20 22 2d 65  test.scm for "-e
1df0: 78 65 63 75 74 65 22 0a 09 09 09 20 20 20 20 28  xecute"....    (
1e00: 61 70 70 65 6e 64 20 28 6c 69 73 74 20 28 6c 69  append (list (li
1e10: 73 74 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45  st "MT_TEST_NAME
1e20: 22 20 74 65 73 74 2d 6e 61 6d 65 29 0a 09 09 09  " test-name)....
1e30: 09 09 20 20 28 6c 69 73 74 20 22 4d 54 5f 49 54  ..  (list "MT_IT
1e40: 45 4d 5f 49 4e 46 4f 22 20 28 63 6f 6e 63 20 69  EM_INFO" (conc i
1e50: 74 65 6d 64 61 74 29 29 20 0a 09 09 09 09 09 20  temdat)) ...... 
1e60: 20 28 6c 69 73 74 20 22 4d 54 5f 52 55 4e 4e 41   (list "MT_RUNNA
1e70: 4d 45 22 20 20 20 28 61 72 67 73 3a 67 65 74 2d  ME"   (args:get-
1e80: 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29  arg ":runname"))
1e90: 29 0a 09 09 09 09 20 20 20 20 69 74 65 6d 64 61  ).....    itemda
1ea0: 74 29 29 29 0a 09 20 20 20 28 6c 61 75 6e 63 68  t)))..   (launch
1eb0: 2d 72 65 73 75 6c 74 73 20 28 61 70 70 6c 79 20  -results (apply 
1ec0: 63 6d 64 2d 72 75 6e 2d 70 72 6f 63 2d 65 61 63  cmd-run-proc-eac
1ed0: 68 2d 6c 69 6e 65 0a 09 09 09 09 20 20 28 69 66  h-line.....  (if
1ee0: 20 75 73 65 73 68 65 6c 6c 0a 09 09 09 09 20 20   useshell.....  
1ef0: 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65      (string-inte
1f00: 72 73 70 65 72 73 65 20 66 75 6c 6c 63 6d 64 20  rsperse fullcmd 
1f10: 22 20 22 29 0a 09 09 09 09 20 20 20 20 20 20 28  " ").....      (
1f20: 63 61 72 20 66 75 6c 6c 63 6d 64 29 29 0a 09 09  car fullcmd))...
1f30: 09 09 20 20 70 72 69 6e 74 0a 09 09 09 09 20 20  ..  print.....  
1f40: 28 69 66 20 75 73 65 73 68 65 6c 6c 0a 09 09 09  (if useshell....
1f50: 09 20 20 20 20 20 20 27 28 29 0a 09 09 09 09 20  .      '()..... 
1f60: 20 20 20 20 20 28 63 64 72 20 66 75 6c 6c 63 6d       (cdr fullcm
1f70: 64 29 29 29 29 29 20 3b 3b 20 20 6c 61 75 6e 63  d))))) ;;  launc
1f80: 68 65 72 20 66 75 6c 6c 63 6d 64 29 29 29 3b 3b  her fullcmd)));;
1f90: 20 28 61 70 70 6c 79 20 63 6d 64 2d 72 75 6e 2d   (apply cmd-run-
1fa0: 70 72 6f 63 2d 65 61 63 68 2d 6c 69 6e 65 20 6c  proc-each-line l
1fb0: 61 75 6e 63 68 65 72 20 70 72 69 6e 74 20 66 75  auncher print fu
1fc0: 6c 6c 63 6d 64 29 29 29 20 3b 3b 20 28 63 6d 64  llcmd))) ;; (cmd
1fd0: 2d 72 75 6e 2d 3e 6c 69 73 74 20 66 75 6c 6c 63  -run->list fullc
1fe0: 6d 64 29 29 0a 20 20 20 20 20 20 28 64 65 62 75  md)).      (debu
1ff0: 67 3a 70 72 69 6e 74 20 32 20 22 4c 61 75 6e 63  g:print 2 "Launc
2000: 68 69 6e 67 20 63 6f 6d 70 6c 65 74 65 64 2c 20  hing completed, 
2010: 75 70 64 61 74 69 6e 67 20 64 62 22 29 0a 20 20  updating db").  
2020: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
2030: 20 34 20 22 4c 61 75 6e 63 68 20 72 65 73 75 6c   4 "Launch resul
2040: 74 73 3a 20 22 20 6c 61 75 6e 63 68 2d 72 65 73  ts: " launch-res
2050: 75 6c 74 73 29 0a 20 20 20 20 20 20 28 69 66 20  ults).      (if 
2060: 28 6e 6f 74 20 6c 61 75 6e 63 68 2d 72 65 73 75  (not launch-resu
2070: 6c 74 73 29 0a 09 20 20 28 62 65 67 69 6e 0a 09  lts)..  (begin..
2080: 20 20 20 20 28 70 72 69 6e 74 20 22 45 52 52 4f      (print "ERRO
2090: 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 72 75 6e  R: Failed to run
20a0: 20 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72   " (string-inter
20b0: 73 70 65 72 73 65 20 66 75 6c 6c 63 6d 64 20 22  sperse fullcmd "
20c0: 20 22 29 20 22 2c 20 65 78 69 74 69 6e 67 20 6e   ") ", exiting n
20d0: 6f 77 22 29 0a 09 20 20 20 20 28 73 71 6c 69 74  ow")..    (sqlit
20e0: 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29  e3:finalize! db)
20f0: 0a 09 20 20 20 20 3b 3b 20 67 6f 6f 64 20 6f 6c  ..    ;; good ol
2100: 65 20 22 65 78 69 74 22 20 73 65 65 6d 73 20 6e  e "exit" seems n
2110: 6f 74 20 74 6f 20 77 6f 72 6b 0a 09 20 20 20 20  ot to work..    
2120: 3b 3b 20 28 5f 65 78 69 74 20 39 29 0a 09 20 20  ;; (_exit 9)..  
2130: 20 20 3b 3b 20 62 75 74 20 74 68 69 73 20 68 61    ;; but this ha
2140: 63 6b 20 77 69 6c 6c 20 77 6f 72 6b 21 20 54 68  ck will work! Th
2150: 61 6e 6b 73 20 67 6f 20 74 6f 20 41 6c 61 6e 20  anks go to Alan 
2160: 50 6f 73 74 20 6f 66 20 74 68 65 20 43 68 69 63  Post of the Chic
2170: 6b 65 6e 20 65 6d 61 69 6c 20 6c 69 73 74 0a 09  ken email list..
2180: 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 49 73 20 74      ;; NB// Is t
2190: 68 69 73 20 73 74 69 6c 6c 20 6e 65 65 64 65 64  his still needed
21a0: 3f 20 53 68 6f 75 6c 64 20 62 65 20 73 61 66 65  ? Should be safe
21b0: 20 74 6f 20 67 6f 20 62 61 63 6b 20 74 6f 20 22   to go back to "
21c0: 65 78 69 74 22 20 6e 6f 77 3f 0a 09 20 20 20 20  exit" now?..    
21d0: 28 70 72 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20  (process-signal 
21e0: 28 63 75 72 72 65 6e 74 2d 70 72 6f 63 65 73 73  (current-process
21f0: 2d 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c  -id) signal/kill
2200: 29 0a 09 20 20 20 20 29 29 0a 20 20 20 20 20 20  )..    )).      
2210: 28 61 6c 69 73 74 2d 3e 65 6e 76 2d 76 61 72 73  (alist->env-vars
2220: 20 6d 69 73 63 70 72 65 76 76 61 6c 73 29 0a 20   miscprevvals). 
2230: 20 20 20 20 20 28 61 6c 69 73 74 2d 3e 65 6e 76       (alist->env
2240: 2d 76 61 72 73 20 74 65 73 74 70 72 65 76 76 61  -vars testprevva
2250: 6c 73 29 0a 20 20 20 20 20 20 28 61 6c 69 73 74  ls).      (alist
2260: 2d 3e 65 6e 76 2d 76 61 72 73 20 63 6f 6d 6d 6f  ->env-vars commo
2270: 6e 70 72 65 76 76 61 6c 73 29 0a 20 20 20 20 20  nprevvals).     
2280: 20 6c 61 75 6e 63 68 2d 72 65 73 75 6c 74 73 29   launch-results)
2290: 29 29 0a 0a                                      ))..