Megatest

Hex Artifact Content
Login

Artifact 5cd6719766f46492ffb0cbe204a764a81f8364fc:


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 32 2c 20 4d 61 74 74 68 65 77  06-2012, 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 20 20 73   PURPOSE...;;  s
0150: 74 72 66 74 69 6d 65 28 27 25 6d 2f 25 64 2f 25  trftime('%m/%d/%
0160: 59 20 25 48 3a 25 4d 3a 25 53 27 2c 27 6e 6f 77  Y %H:%M:%S','now
0170: 27 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 29 0a 0a  ','localtime')..
0180: 28 75 73 65 20 73 71 6c 69 74 65 33 20 73 72 66  (use sqlite3 srf
0190: 69 2d 31 20 70 6f 73 69 78 20 72 65 67 65 78 20  i-1 posix regex 
01a0: 72 65 67 65 78 2d 63 61 73 65 20 73 72 66 69 2d  regex-case srfi-
01b0: 36 39 20 64 6f 74 2d 6c 6f 63 6b 69 6e 67 20 28  69 dot-locking (
01c0: 73 72 66 69 20 31 38 29 20 70 6f 73 69 78 2d 65  srfi 18) posix-e
01d0: 78 74 72 61 73 20 64 69 72 65 63 74 6f 72 79 2d  xtras directory-
01e0: 75 74 69 6c 73 29 0a 28 69 6d 70 6f 72 74 20 28  utils).(import (
01f0: 70 72 65 66 69 78 20 73 71 6c 69 74 65 33 20 73  prefix sqlite3 s
0200: 71 6c 69 74 65 33 3a 29 29 0a 0a 28 64 65 63 6c  qlite3:))..(decl
0210: 61 72 65 20 28 75 6e 69 74 20 72 75 6e 73 29 29  are (unit runs))
0220: 0a 28 64 65 63 6c 61 72 65 20 28 75 73 65 73 20  .(declare (uses 
0230: 64 62 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75  db)).(declare (u
0240: 73 65 73 20 63 6f 6d 6d 6f 6e 29 29 0a 28 64 65  ses common)).(de
0250: 63 6c 61 72 65 20 28 75 73 65 73 20 69 74 65 6d  clare (uses item
0260: 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75 73  s)).(declare (us
0270: 65 73 20 72 75 6e 63 6f 6e 66 69 67 29 29 0a 28  es runconfig)).(
0280: 64 65 63 6c 61 72 65 20 28 75 73 65 73 20 74 65  declare (uses te
0290: 73 74 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28  sts)).(declare (
02a0: 75 73 65 73 20 73 65 72 76 65 72 29 29 0a 0a 28  uses server))..(
02b0: 69 6e 63 6c 75 64 65 20 22 63 6f 6d 6d 6f 6e 5f  include "common_
02c0: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 69  records.scm").(i
02d0: 6e 63 6c 75 64 65 20 22 6b 65 79 5f 72 65 63 6f  nclude "key_reco
02e0: 72 64 73 2e 73 63 6d 22 29 0a 28 69 6e 63 6c 75  rds.scm").(inclu
02f0: 64 65 20 22 64 62 5f 72 65 63 6f 72 64 73 2e 73  de "db_records.s
0300: 63 6d 22 29 0a 28 69 6e 63 6c 75 64 65 20 22 72  cm").(include "r
0310: 75 6e 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29  un_records.scm")
0320: 0a 28 69 6e 63 6c 75 64 65 20 22 74 65 73 74 5f  .(include "test_
0330: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 0a 3b  records.scm")..;
0340: 3b 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d  ; runs:get-runs-
0350: 62 79 2d 70 61 74 74 0a 3b 3b 20 67 65 74 20 72  by-patt.;; get r
0360: 75 6e 73 20 62 79 20 6c 69 73 74 20 6f 66 20 63  uns by list of c
0370: 72 69 74 65 72 69 61 0a 3b 3b 20 72 65 67 69 73  riteria.;; regis
0380: 74 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77  ter a test run w
0390: 69 74 68 20 74 68 65 20 64 62 0a 3b 3b 0a 3b 3b  ith the db.;;.;;
03a0: 20 55 73 65 3a 20 28 64 62 2d 67 65 74 2d 76 61   Use: (db-get-va
03b0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28 64  lue-by-header (d
03c0: 62 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e  b:get-header run
03d0: 69 6e 66 6f 29 28 64 62 3a 67 65 74 2d 72 6f 77  info)(db:get-row
03e0: 20 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b 20 20 74   runinfo)).;;  t
03f0: 6f 20 65 78 74 72 61 63 74 20 69 6e 66 6f 20 66  o extract info f
0400: 72 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 72  rom the structur
0410: 65 20 72 65 74 75 72 6e 65 64 0a 3b 3b 0a 28 64  e returned.;;.(d
0420: 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d  efine (runs:get-
0430: 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20  runs-by-patt db 
0440: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74  keys runnamepatt
0450: 29 20 3b 3b 20 74 65 73 74 2d 6e 61 6d 65 29 0a  ) ;; test-name).
0460: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 76 61 6c    (let* ((keyval
0470: 6c 73 74 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69  lst (keys->valli
0480: 73 74 20 6b 65 79 73 29 29 0a 09 20 28 74 6d 70  st keys)).. (tmp
0490: 20 20 20 20 20 20 28 72 75 6e 73 3a 67 65 74 2d        (runs:get-
04a0: 73 74 64 2d 72 75 6e 2d 66 69 65 6c 64 73 20 6b  std-run-fields k
04b0: 65 79 73 20 27 28 22 69 64 22 20 22 72 75 6e 6e  eys '("id" "runn
04c0: 61 6d 65 22 20 22 73 74 61 74 65 22 20 22 73 74  ame" "state" "st
04d0: 61 74 75 73 22 20 22 6f 77 6e 65 72 22 20 22 65  atus" "owner" "e
04e0: 76 65 6e 74 5f 74 69 6d 65 22 29 29 29 0a 09 20  vent_time"))).. 
04f0: 28 6b 65 79 73 74 72 20 20 20 28 63 61 72 20 74  (keystr   (car t
0500: 6d 70 29 29 0a 09 20 28 68 65 61 64 65 72 20 20  mp)).. (header  
0510: 20 28 63 61 64 72 20 74 6d 70 29 29 0a 09 20 28   (cadr tmp)).. (
0520: 72 65 73 20 20 20 20 20 27 28 29 29 0a 09 20 28  res     '()).. (
0530: 6b 65 79 2d 70 61 74 74 20 22 22 29 0a 09 20 28  key-patt "").. (
0540: 72 75 6e 77 69 6c 64 74 79 70 65 20 28 69 66 20  runwildtype (if 
0550: 28 73 75 62 73 74 72 69 6e 67 2d 69 6e 64 65 78  (substring-index
0560: 20 22 25 22 20 72 75 6e 6e 61 6d 65 70 61 74 74   "%" runnamepatt
0570: 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f 62 22 29  ) "like" "glob")
0580: 29 0a 09 20 28 71 72 79 2d 73 74 72 20 20 23 66  ).. (qry-str  #f
0590: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  )).    (for-each
05a0: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 76 61 6c   (lambda (keyval
05b0: 29 0a 09 09 28 6c 65 74 2a 20 28 28 6b 65 79 20  )...(let* ((key 
05c0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b     (vector-ref k
05d0: 65 79 76 61 6c 20 30 29 29 0a 09 09 20 20 20 20  eyval 0))...    
05e0: 20 20 20 28 66 75 6c 6b 65 79 20 28 63 6f 6e 63     (fulkey (conc
05f0: 20 22 3a 22 20 6b 65 79 29 29 0a 09 09 20 20 20   ":" key))...   
0600: 20 20 20 20 28 70 61 74 74 20 20 20 28 61 72 67      (patt   (arg
0610: 73 3a 67 65 74 2d 61 72 67 20 66 75 6c 6b 65 79  s:get-arg fulkey
0620: 29 29 0a 09 09 20 20 20 20 20 20 20 28 77 69 6c  ))...       (wil
0630: 64 74 79 70 65 20 28 69 66 20 28 73 75 62 73 74  dtype (if (subst
0640: 72 69 6e 67 2d 69 6e 64 65 78 20 22 25 22 20 70  ring-index "%" p
0650: 61 74 74 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f  att) "like" "glo
0660: 62 22 29 29 29 0a 09 09 20 20 28 69 66 20 70 61  b")))...  (if pa
0670: 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 74 21  tt...      (set!
0680: 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e 63 20   key-patt (conc 
0690: 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 20 22  key-patt " AND "
06a0: 20 6b 65 79 20 22 20 22 20 77 69 6c 64 74 79 70   key " " wildtyp
06b0: 65 20 22 20 27 22 20 70 61 74 74 20 22 27 22 29  e " '" patt "'")
06c0: 29 0a 09 09 20 20 20 20 20 20 28 62 65 67 69 6e  )...      (begin
06d0: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ....(debug:print
06e0: 20 30 20 22 45 52 52 4f 52 3a 20 73 65 61 72 63   0 "ERROR: searc
06f0: 68 69 6e 67 20 66 6f 72 20 72 75 6e 73 20 77 69  hing for runs wi
0700: 74 68 20 6e 6f 20 70 61 74 74 65 72 6e 20 73 65  th no pattern se
0710: 74 20 66 6f 72 20 22 20 66 75 6c 6b 65 79 29 0a  t for " fulkey).
0720: 09 09 09 28 65 78 69 74 20 36 29 29 29 29 29 0a  ...(exit 6))))).
0730: 09 20 20 20 20 20 20 6b 65 79 73 29 0a 20 20 20  .      keys).   
0740: 20 28 73 65 74 21 20 71 72 79 2d 73 74 72 20 28   (set! qry-str (
0750: 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 20 6b  conc "SELECT " k
0760: 65 79 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e  eystr " FROM run
0770: 73 20 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 20  s WHERE runname 
0780: 22 20 72 75 6e 77 69 6c 64 74 79 70 65 20 22 20  " runwildtype " 
0790: 3f 20 22 20 6b 65 79 2d 70 61 74 74 20 22 3b 22  ? " key-patt ";"
07a0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  )).    (debug:pr
07b0: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73  int-info 4 "runs
07c0: 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74  :get-runs-by-pat
07d0: 74 20 71 72 79 3d 22 20 71 72 79 2d 73 74 72 20  t qry=" qry-str 
07e0: 22 20 22 20 72 75 6e 6e 61 6d 65 70 61 74 74 29  " " runnamepatt)
07f0: 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f  .    (sqlite3:fo
0800: 72 2d 65 61 63 68 2d 72 6f 77 20 0a 20 20 20 20  r-each-row .    
0810: 20 28 6c 61 6d 62 64 61 20 28 61 20 2e 20 72 29   (lambda (a . r)
0820: 0a 20 20 20 20 20 20 20 28 73 65 74 21 20 72 65  .       (set! re
0830: 73 20 28 63 6f 6e 73 20 28 6c 69 73 74 2d 3e 76  s (cons (list->v
0840: 65 63 74 6f 72 20 28 63 6f 6e 73 20 61 20 72 29  ector (cons a r)
0850: 29 20 72 65 73 29 29 29 0a 20 20 20 20 20 64 62  ) res))).     db
0860: 20 0a 20 20 20 20 20 71 72 79 2d 73 74 72 0a 20   .     qry-str. 
0870: 20 20 20 20 72 75 6e 6e 61 6d 65 70 61 74 74 29      runnamepatt)
0880: 0a 20 20 20 20 28 76 65 63 74 6f 72 20 68 65 61  .    (vector hea
0890: 64 65 72 20 72 65 73 29 29 29 0a 0a 28 64 65 66  der res)))..(def
08a0: 69 6e 65 20 28 72 75 6e 73 3a 74 65 73 74 2d 67  ine (runs:test-g
08b0: 65 74 2d 66 75 6c 6c 2d 70 61 74 68 20 74 65 73  et-full-path tes
08c0: 74 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73  t).  (let* ((tes
08d0: 74 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67  tname (db:test-g
08e0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65  et-testname   te
08f0: 73 74 29 29 0a 09 20 28 69 74 65 6d 70 61 74 68  st)).. (itempath
0900: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74   (db:test-get-it
0910: 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 29 0a  em-path test))).
0920: 20 20 20 20 28 63 6f 6e 63 20 74 65 73 74 6e 61      (conc testna
0930: 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69  me (if (equal? i
0940: 74 65 6d 70 61 74 68 20 22 22 29 20 22 22 20 28  tempath "") "" (
0950: 63 6f 6e 63 20 22 28 22 20 69 74 65 6d 70 61 74  conc "(" itempat
0960: 68 20 22 29 22 29 29 29 29 29 0a 0a 28 64 65 66  h ")")))))..(def
0970: 69 6e 65 20 28 64 62 3a 67 65 74 2d 72 75 6e 2d  ine (db:get-run-
0980: 6b 65 79 2d 76 61 6c 20 64 62 20 72 75 6e 2d 69  key-val db run-i
0990: 64 20 6b 65 79 29 0a 20 20 28 6c 65 74 20 28 28  d key).  (let ((
09a0: 72 65 73 20 23 66 29 29 0a 20 20 20 20 28 73 71  res #f)).    (sq
09b0: 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72  lite3:for-each-r
09c0: 6f 77 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20  ow.     (lambda 
09d0: 28 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73 65  (val).       (se
09e0: 74 21 20 72 65 73 20 76 61 6c 29 29 0a 20 20 20  t! res val)).   
09f0: 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f 6e 63    db .     (conc
0a00: 20 22 53 45 4c 45 43 54 20 22 20 28 6b 65 79 3a   "SELECT " (key:
0a10: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65  get-fieldname ke
0a20: 79 29 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57  y) " FROM runs W
0a30: 48 45 52 45 20 69 64 3d 3f 3b 22 29 0a 20 20 20  HERE id=?;").   
0a40: 20 20 72 75 6e 2d 69 64 29 0a 20 20 20 20 72 65    run-id).    re
0a50: 73 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 64 62  s))..(define (db
0a60: 3a 67 65 74 2d 72 75 6e 2d 6e 61 6d 65 2d 66 72  :get-run-name-fr
0a70: 6f 6d 2d 69 64 20 64 62 20 72 75 6e 2d 69 64 29  om-id db run-id)
0a80: 0a 20 20 28 6c 65 74 20 28 28 72 65 73 20 23 66  .  (let ((res #f
0a90: 29 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a  )).    (sqlite3:
0aa0: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 20 20 20  for-each-row.   
0ab0: 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 6e 61    (lambda (runna
0ac0: 6d 65 29 0a 20 20 20 20 20 20 20 28 73 65 74 21  me).       (set!
0ad0: 20 72 65 73 20 72 75 6e 6e 61 6d 65 29 29 0a 20   res runname)). 
0ae0: 20 20 20 20 64 62 0a 20 20 20 20 20 22 53 45 4c      db.     "SEL
0af0: 45 43 54 20 72 75 6e 6e 61 6d 65 20 46 52 4f 4d  ECT runname FROM
0b00: 20 72 75 6e 73 20 57 48 45 52 45 20 69 64 3d 3f   runs WHERE id=?
0b10: 3b 22 0a 20 20 20 20 20 72 75 6e 2d 69 64 29 0a  ;".     run-id).
0b20: 20 20 20 20 72 65 73 29 29 0a 0a 28 64 65 66 69      res))..(defi
0b30: 6e 65 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74  ne (set-megatest
0b40: 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64  -env-vars run-id
0b50: 29 0a 20 20 28 6c 65 74 20 28 28 6b 65 79 73 20  ).  (let ((keys 
0b60: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20  (cdb:remote-run 
0b70: 64 62 3a 67 65 74 2d 6b 65 79 73 20 23 66 29 29  db:get-keys #f))
0b80: 0a 09 28 76 61 6c 73 20 28 68 61 73 68 2d 74 61  ..(vals (hash-ta
0b90: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
0ba0: 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e  *env-vars-by-run
0bb0: 2d 69 64 2a 20 72 75 6e 2d 69 64 20 23 66 29 29  -id* run-id #f))
0bc0: 29 0a 20 20 20 20 3b 3b 20 67 65 74 20 74 68 65  ).    ;; get the
0bd0: 20 69 6e 66 6f 20 66 72 6f 6d 20 74 68 65 20 64   info from the d
0be0: 62 20 61 6e 64 20 70 75 74 20 69 74 20 69 6e 20  b and put it in 
0bf0: 74 68 65 20 63 61 63 68 65 0a 20 20 20 20 28 69  the cache.    (i
0c00: 66 20 28 6e 6f 74 20 76 61 6c 73 29 0a 09 28 6c  f (not vals)..(l
0c10: 65 74 20 28 28 68 74 20 28 6d 61 6b 65 2d 68 61  et ((ht (make-ha
0c20: 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 20 28  sh-table)))..  (
0c30: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20  hash-table-set! 
0c40: 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e  *env-vars-by-run
0c50: 2d 69 64 2a 20 72 75 6e 2d 69 64 20 68 74 29 0a  -id* run-id ht).
0c60: 09 20 20 28 73 65 74 21 20 76 61 6c 73 20 68 74  .  (set! vals ht
0c70: 29 0a 09 20 20 28 66 6f 72 2d 65 61 63 68 0a 09  )..  (for-each..
0c80: 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29     (lambda (key)
0c90: 0a 09 20 20 20 20 20 28 68 61 73 68 2d 74 61 62  ..     (hash-tab
0ca0: 6c 65 2d 73 65 74 21 20 76 61 6c 73 20 6b 65 79  le-set! vals key
0cb0: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e   (cdb:remote-run
0cc0: 20 64 62 3a 67 65 74 2d 72 75 6e 2d 6b 65 79 2d   db:get-run-key-
0cd0: 76 61 6c 20 23 66 20 72 75 6e 2d 69 64 20 6b 65  val #f run-id ke
0ce0: 79 29 29 29 0a 09 20 20 20 6b 65 79 73 29 29 29  y)))..   keys)))
0cf0: 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20 74 68 65  .    ;; from the
0d00: 20 63 61 63 68 65 64 20 64 61 74 61 20 73 65 74   cached data set
0d10: 20 74 68 65 20 76 61 72 73 0a 20 20 20 20 28 68   the vars.    (h
0d20: 61 73 68 2d 74 61 62 6c 65 2d 66 6f 72 2d 65 61  ash-table-for-ea
0d30: 63 68 0a 20 20 20 20 20 76 61 6c 73 0a 20 20 20  ch.     vals.   
0d40: 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 20 76    (lambda (key v
0d50: 61 6c 29 0a 20 20 20 20 20 20 20 28 64 65 62 75  al).       (debu
0d60: 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e  g:print 2 "seten
0d70: 76 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65  v " (key:get-fie
0d80: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 22 20  ldname key) " " 
0d90: 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73 65 74  val).       (set
0da0: 65 6e 76 20 28 6b 65 79 3a 67 65 74 2d 66 69 65  env (key:get-fie
0db0: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 76 61 6c 29  ldname key) val)
0dc0: 29 29 0a 20 20 20 20 28 61 6c 69 73 74 2d 3e 65  )).    (alist->e
0dd0: 6e 76 2d 76 61 72 73 20 28 68 61 73 68 2d 74 61  nv-vars (hash-ta
0de0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
0df0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 65 6e 76  *configdat* "env
0e00: 2d 6f 76 65 72 72 69 64 65 22 20 27 28 29 29 29  -override" '()))
0e10: 0a 20 20 20 20 3b 3b 20 4c 65 74 73 20 75 73 65  .    ;; Lets use
0e20: 20 74 68 69 73 20 61 73 20 61 6e 20 6f 70 70 6f   this as an oppo
0e30: 72 74 75 6e 69 74 79 20 74 6f 20 70 75 74 20 4d  rtunity to put M
0e40: 54 5f 52 55 4e 4e 41 4d 45 20 69 6e 20 74 68 65  T_RUNNAME in the
0e50: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20   environment.   
0e60: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e   (setenv "MT_RUN
0e70: 4e 41 4d 45 22 20 28 63 64 62 3a 72 65 6d 6f 74  NAME" (cdb:remot
0e80: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 72 75 6e  e-run db:get-run
0e90: 2d 6e 61 6d 65 2d 66 72 6f 6d 2d 69 64 20 23 66  -name-from-id #f
0ea0: 20 72 75 6e 2d 69 64 29 29 0a 20 20 20 20 28 73   run-id)).    (s
0eb0: 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 5f 41 52  etenv "MT_RUN_AR
0ec0: 45 41 5f 48 4f 4d 45 22 20 2a 74 6f 70 70 61 74  EA_HOME" *toppat
0ed0: 68 2a 29 0a 20 20 20 20 29 29 0a 0a 28 64 65 66  h*).    ))..(def
0ee0: 69 6e 65 20 28 73 65 74 2d 69 74 65 6d 2d 65 6e  ine (set-item-en
0ef0: 76 2d 76 61 72 73 20 69 74 65 6d 64 61 74 29 0a  v-vars itemdat).
0f00: 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d    (for-each (lam
0f10: 62 64 61 20 28 69 74 65 6d 29 0a 09 20 20 20 20  bda (item)..    
0f20: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32    (debug:print 2
0f30: 20 22 73 65 74 65 6e 76 20 22 20 28 63 61 72 20   "setenv " (car 
0f40: 69 74 65 6d 29 20 22 20 22 20 28 63 61 64 72 20  item) " " (cadr 
0f50: 69 74 65 6d 29 29 0a 09 20 20 20 20 20 20 28 73  item))..      (s
0f60: 65 74 65 6e 76 20 28 63 61 72 20 69 74 65 6d 29  etenv (car item)
0f70: 20 28 63 61 64 72 20 69 74 65 6d 29 29 29 0a 09   (cadr item)))..
0f80: 20 20 20 20 69 74 65 6d 64 61 74 29 29 0a 0a 28      itemdat))..(
0f90: 64 65 66 69 6e 65 20 2a 6c 61 73 74 2d 6e 75 6d  define *last-num
0fa0: 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20  -running-tests* 
0fb0: 30 29 0a 0a 3b 3b 20 45 76 65 72 79 20 74 69 6d  0)..;; Every tim
0fc0: 65 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74  e can-run-more-t
0fd0: 65 73 74 73 20 69 73 20 63 61 6c 6c 65 64 20 69  ests is called i
0fe0: 6e 63 72 65 6d 65 6e 74 20 74 68 65 20 64 65 6c  ncrement the del
0ff0: 61 79 0a 3b 3b 20 69 66 20 74 68 65 20 63 6f 75  ay.;; if the cou
1000: 0a 28 64 65 66 69 6e 65 20 2a 72 75 6e 73 3a 63  .(define *runs:c
1010: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74  an-run-more-test
1020: 73 2d 63 6f 75 6e 74 2a 20 30 29 0a 28 64 65 66  s-count* 0).(def
1030: 69 6e 65 20 28 72 75 6e 73 3a 73 68 72 69 6e 6b  ine (runs:shrink
1040: 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65  -can-run-more-te
1050: 73 74 73 2d 63 6f 75 6e 74 29 0a 20 20 28 73 65  sts-count).  (se
1060: 74 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e  t! *runs:can-run
1070: 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 6e  -more-tests-coun
1080: 74 2a 20 30 29 29 20 3b 3b 20 28 2f 20 2a 72 75  t* 0)) ;; (/ *ru
1090: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  ns:can-run-more-
10a0: 74 65 73 74 73 2d 63 6f 75 6e 74 2a 20 32 29 29  tests-count* 2))
10b0: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  )..(define (runs
10c0: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65  :can-run-more-te
10d0: 73 74 73 20 74 65 73 74 2d 72 65 63 6f 72 64 20  sts test-record 
10e0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a  max-concurrent-j
10f0: 6f 62 73 29 0a 20 20 28 74 68 72 65 61 64 2d 73  obs).  (thread-s
1100: 6c 65 65 70 21 20 28 63 6f 6e 64 0a 09 09 20 20  leep! (cond...  
1110: 28 28 3e 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75  ((> *runs:can-ru
1120: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75  n-more-tests-cou
1130: 6e 74 2a 20 32 30 29 20 32 29 3b 3b 20 6f 62 76  nt* 20) 2);; obv
1140: 69 6f 75 73 6c 79 20 68 61 76 65 6e 27 74 20 68  iously haven't h
1150: 61 64 20 61 6e 79 20 77 6f 72 6b 20 74 6f 20 64  ad any work to d
1160: 6f 20 66 6f 72 20 61 20 77 68 69 6c 65 0a 09 09  o for a while...
1170: 20 20 28 65 6c 73 65 20 30 29 29 29 0a 20 20 28    (else 0))).  (
1180: 6c 65 74 2a 20 28 28 74 63 6f 6e 66 69 67 20 20  let* ((tconfig  
1190: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28                 (
11a0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
11b0: 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74  get-testconfig t
11c0: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28  est-record)).. (
11d0: 6a 6f 62 67 72 6f 75 70 20 20 20 20 20 20 20 20  jobgroup        
11e0: 20 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d          (config-
11f0: 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20 22  lookup tconfig "
1200: 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 6a  requirements" "j
1210: 6f 62 67 72 6f 75 70 22 29 29 0a 09 20 28 6e 75  obgroup")).. (nu
1220: 6d 2d 72 75 6e 6e 69 6e 67 20 20 20 20 20 20 20  m-running       
1230: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74        (cdb:remot
1240: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 63 6f 75  e-run db:get-cou
1250: 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67  nt-tests-running
1260: 20 23 66 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e   #f)).. (num-run
1270: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70  ning-in-jobgroup
1280: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e   (cdb:remote-run
1290: 20 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65   db:get-count-te
12a0: 73 74 73 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a  sts-running-in-j
12b0: 6f 62 67 72 6f 75 70 20 23 66 20 6a 6f 62 67 72  obgroup #f jobgr
12c0: 6f 75 70 29 29 0a 09 20 28 6a 6f 62 2d 67 72 6f  oup)).. (job-gro
12d0: 75 70 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20  up-limit        
12e0: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20   (config-lookup 
12f0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 6a 6f 62  *configdat* "job
1300: 67 72 6f 75 70 73 22 20 6a 6f 62 67 72 6f 75 70  groups" jobgroup
1310: 29 29 29 0a 20 20 20 20 28 69 66 20 28 3e 20 28  ))).    (if (> (
1320: 2b 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 6e 75  + num-running nu
1330: 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62  m-running-in-job
1340: 67 72 6f 75 70 29 20 30 29 0a 09 28 73 65 74 21  group) 0)..(set!
1350: 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d   *runs:can-run-m
1360: 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 6e 74 2a  ore-tests-count*
1370: 20 28 2b 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75   (+ *runs:can-ru
1380: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75  n-more-tests-cou
1390: 6e 74 2a 20 31 29 29 29 0a 20 20 20 20 28 69 66  nt* 1))).    (if
13a0: 20 28 6e 6f 74 20 28 65 71 3f 20 2a 6c 61 73 74   (not (eq? *last
13b0: 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 73  -num-running-tes
13c0: 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29  ts* num-running)
13d0: 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65  )..(begin..  (de
13e0: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 6d 61 78  bug:print 2 "max
13f0: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73  -concurrent-jobs
1400: 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65  : " max-concurre
1410: 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72  nt-jobs ", num-r
1420: 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75  unning: " num-ru
1430: 6e 6e 69 6e 67 29 0a 09 20 20 28 73 65 74 21 20  nning)..  (set! 
1440: 2a 6c 61 73 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e  *last-num-runnin
1450: 67 2d 74 65 73 74 73 2a 20 6e 75 6d 2d 72 75 6e  g-tests* num-run
1460: 6e 69 6e 67 29 29 29 0a 20 20 20 20 28 69 66 20  ning))).    (if 
1470: 28 6e 6f 74 20 28 65 71 3f 20 30 20 2a 67 6c 6f  (not (eq? 0 *glo
1480: 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 29 29  balexitstatus*))
1490: 0a 09 28 6c 69 73 74 20 23 66 20 6e 75 6d 2d 72  ..(list #f num-r
14a0: 75 6e 6e 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69  unning num-runni
14b0: 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d  ng-in-jobgroup m
14c0: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f  ax-concurrent-jo
14d0: 62 73 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d  bs job-group-lim
14e0: 69 74 29 0a 09 28 6c 65 74 20 28 28 63 61 6e 2d  it)..(let ((can-
14f0: 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 20 28 63 6f  not-run-more (co
1500: 6e 64 0a 09 09 09 09 20 3b 3b 20 69 66 20 6d 61  nd..... ;; if ma
1510: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
1520: 73 20 69 73 20 73 65 74 20 61 6e 64 20 74 68 65  s is set and the
1530: 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 20   number running 
1540: 69 73 20 67 72 65 61 74 65 72 20 0a 09 09 09 09  is greater .....
1550: 20 3b 3b 20 74 68 61 6e 20 69 74 20 74 68 61 6e   ;; than it than
1560: 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65   cannot run more
1570: 20 6a 6f 62 73 0a 09 09 09 09 20 28 28 61 6e 64   jobs..... ((and
1580: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d   max-concurrent-
1590: 6a 6f 62 73 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e  jobs (>= num-run
15a0: 6e 69 6e 67 20 6d 61 78 2d 63 6f 6e 63 75 72 72  ning max-concurr
15b0: 65 6e 74 2d 6a 6f 62 73 29 29 0a 09 09 09 09 20  ent-jobs))..... 
15c0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
15d0: 22 57 41 52 4e 49 4e 47 3a 20 4d 61 78 20 72 75  "WARNING: Max ru
15e0: 6e 6e 69 6e 67 20 6a 6f 62 73 20 65 78 63 65 65  nning jobs excee
15f0: 64 65 64 2c 20 63 75 72 72 65 6e 74 20 6e 75 6d  ded, current num
1600: 62 65 72 20 72 75 6e 6e 69 6e 67 3a 20 22 20 6e  ber running: " n
1610: 75 6d 2d 72 75 6e 6e 69 6e 67 20 0a 09 09 09 09  um-running .....
1620: 09 20 20 20 20 20 20 20 22 2c 20 6d 61 78 5f 63  .       ", max_c
1630: 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 3a 20  oncurrent_jobs: 
1640: 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74  " max-concurrent
1650: 2d 6a 6f 62 73 29 0a 09 09 09 09 20 20 23 74 29  -jobs).....  #t)
1660: 0a 09 09 09 09 20 3b 3b 20 69 66 20 6a 6f 62 2d  ..... ;; if job-
1670: 67 72 6f 75 70 2d 6c 69 6d 69 74 20 69 73 20 73  group-limit is s
1680: 65 74 20 61 6e 64 20 6e 75 6d 62 65 72 20 6f 66  et and number of
1690: 20 6a 6f 62 73 20 69 6e 20 74 68 65 20 67 72 6f   jobs in the gro
16a0: 75 70 20 69 73 20 67 72 65 61 74 65 72 0a 09 09  up is greater...
16b0: 09 09 20 3b 3b 20 74 68 61 6e 20 74 68 65 20 6c  .. ;; than the l
16c0: 69 6d 69 74 20 74 68 65 6e 20 63 61 6e 6e 6f 74  imit then cannot
16d0: 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 20 6f   run more jobs o
16e0: 66 20 74 68 69 73 20 6b 69 6e 64 0a 09 09 09 09  f this kind.....
16f0: 20 28 28 61 6e 64 20 6a 6f 62 2d 67 72 6f 75 70   ((and job-group
1700: 2d 6c 69 6d 69 74 0a 09 09 09 09 20 20 20 20 20  -limit.....     
1710: 20 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e    (>= num-runnin
1720: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f  g-in-jobgroup jo
1730: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 0a  b-group-limit)).
1740: 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69  ....  (debug:pri
1750: 6e 74 20 31 20 22 57 41 52 4e 49 4e 47 3a 20 6e  nt 1 "WARNING: n
1760: 75 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 22 20  umber of jobs " 
1770: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a  num-running-in-j
1780: 6f 62 67 72 6f 75 70 20 0a 09 09 09 09 09 20 20  obgroup ......  
1790: 20 20 20 20 20 22 20 69 6e 20 22 20 6a 6f 62 67       " in " jobg
17a0: 72 6f 75 70 20 22 20 65 78 63 65 65 64 65 64 2c  roup " exceeded,
17b0: 20 77 69 6c 6c 20 6e 6f 74 20 72 75 6e 20 22 20   will not run " 
17c0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
17d0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65  -get-testname te
17e0: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 09 09  st-record)).....
17f0: 20 20 23 74 29 0a 09 09 09 09 20 28 65 6c 73 65    #t)..... (else
1800: 20 23 66 29 29 29 29 0a 09 20 20 28 6c 69 73 74   #f))))..  (list
1810: 20 28 6e 6f 74 20 63 61 6e 2d 6e 6f 74 2d 72 75   (not can-not-ru
1820: 6e 2d 6d 6f 72 65 29 20 6e 75 6d 2d 72 75 6e 6e  n-more) num-runn
1830: 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d  ing num-running-
1840: 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d 61 78 2d  in-jobgroup max-
1850: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20  concurrent-jobs 
1860: 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29  job-group-limit)
1870: 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d  ))))..;;========
1880: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1890: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
18a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
18b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b  ==============.;
18c0: 3b 20 4e 65 77 20 6d 65 74 68 6f 64 6f 6c 6f 67  ; New methodolog
18d0: 79 2e 20 54 68 65 73 65 20 72 6f 75 74 69 6e 65  y. These routine
18e0: 73 20 77 69 6c 6c 20 72 65 70 6c 61 63 65 20 74  s will replace t
18f0: 68 65 20 61 62 6f 76 65 20 69 6e 20 74 69 6d 65  he above in time
1900: 2e 20 46 6f 72 0a 3b 3b 20 6e 6f 77 20 74 68 65  . For.;; now the
1910: 20 63 6f 64 65 20 69 73 20 64 75 70 6c 69 63 61   code is duplica
1920: 74 65 64 2e 20 54 68 69 73 20 73 74 75 66 66 20  ted. This stuff 
1930: 69 73 20 69 6e 69 74 69 61 6c 6c 79 20 75 73 65  is initially use
1940: 64 20 69 6e 20 74 68 65 20 6d 6f 6e 69 74 6f 72  d in the monitor
1950: 0a 3b 3b 20 62 61 73 65 64 20 63 6f 64 65 2e 0a  .;; based code..
1960: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
1970: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1980: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1990: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
19a0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 0a 3b 3b 20 54 68  ========...;; Th
19b0: 69 73 20 69 73 20 61 20 64 75 70 6c 69 63 61 74  is is a duplicat
19c0: 65 20 6f 66 20 72 75 6e 2d 74 65 73 74 73 20 28  e of run-tests (
19d0: 77 68 69 63 68 20 68 61 73 20 62 65 65 6e 20 64  which has been d
19e0: 65 70 72 65 63 61 74 65 64 29 2e 20 55 73 65 20  eprecated). Use 
19f0: 74 68 69 73 20 6f 6e 65 20 69 6e 73 74 65 61 64  this one instead
1a00: 20 6f 66 20 72 75 6e 20 74 65 73 74 73 2e 0a 3b   of run tests..;
1a10: 3b 20 6b 65 79 76 61 6c 73 2e 0a 3b 3b 0a 3b 3b  ; keyvals..;;.;;
1a20: 20 20 74 65 73 74 2d 6e 61 6d 65 73 3a 20 43 6f    test-names: Co
1a30: 6d 6d 61 20 73 65 70 61 72 61 74 65 64 20 70 61  mma separated pa
1a40: 74 74 65 72 6e 73 20 73 61 6d 65 20 61 73 20 74  tterns same as t
1a50: 65 73 74 2d 70 61 74 74 73 20 62 75 74 20 75 73  est-patts but us
1a60: 65 64 20 69 6e 20 73 65 6c 65 63 74 69 6f 6e 20  ed in selection 
1a70: 0a 3b 3b 20 20 20 20 20 20 20 20 20 20 20 20 20  .;;             
1a80: 20 6f 66 20 74 65 73 74 73 20 74 6f 20 72 75 6e   of tests to run
1a90: 2e 20 54 68 65 20 69 74 65 6d 20 70 6f 72 74 69  . The item porti
1aa0: 6f 6e 73 20 61 72 65 20 6e 6f 74 20 72 65 73 70  ons are not resp
1ab0: 65 63 74 65 64 2e 0a 3b 3b 20 20 20 20 20 20 20  ected..;;       
1ac0: 20 20 20 20 20 20 20 46 49 58 4d 45 3a 20 65 72         FIXME: er
1ad0: 72 6f 72 20 6f 75 74 20 69 66 20 2f 70 61 74 74  ror out if /patt
1ae0: 20 73 70 65 63 69 66 69 65 64 0a 3b 3b 20 20 20   specified.;;   
1af0: 20 20 20 20 20 20 20 20 20 0a 28 64 65 66 69 6e           .(defin
1b00: 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74  e (runs:run-test
1b10: 73 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65  s target runname
1b20: 20 74 65 73 74 2d 6e 61 6d 65 73 20 74 65 73 74   test-names test
1b30: 2d 70 61 74 74 73 20 75 73 65 72 20 66 6c 61 67  -patts user flag
1b40: 73 29 0a 20 20 28 63 6f 6d 6d 6f 6e 3a 63 6c 65  s).  (common:cle
1b50: 61 72 2d 63 61 63 68 65 73 29 20 3b 3b 20 63 6c  ar-caches) ;; cl
1b60: 65 61 72 20 61 6c 6c 20 63 61 63 68 65 73 0a 20  ear all caches. 
1b70: 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20   (let* ((db     
1b80: 20 20 20 20 20 23 66 29 0a 09 20 28 6b 65 79 73       #f).. (keys
1b90: 20 20 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d          (cdb:rem
1ba0: 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 6b  ote-run db:get-k
1bb0: 65 79 73 20 23 66 29 29 0a 09 20 28 6b 65 79 76  eys #f)).. (keyv
1bc0: 61 6c 6c 73 74 20 20 20 28 6b 65 79 73 3a 74 61  allst   (keys:ta
1bd0: 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79  rget->keyval key
1be0: 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 72 75  s target)).. (ru
1bf0: 6e 2d 69 64 20 20 20 20 20 20 28 63 64 62 3a 72  n-id      (cdb:r
1c00: 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 72 65 67  emote-run db:reg
1c10: 69 73 74 65 72 2d 72 75 6e 20 23 66 20 6b 65 79  ister-run #f key
1c20: 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e  s keyvallst runn
1c30: 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 20  ame "new" "n/a" 
1c40: 75 73 65 72 29 29 20 20 3b 3b 20 20 74 65 73 74  user))  ;;  test
1c50: 2d 6e 61 6d 65 29 29 29 0a 09 20 28 6b 65 79 76  -name))).. (keyv
1c60: 61 6c 73 20 20 20 20 20 28 69 66 20 72 75 6e 2d  als     (if run-
1c70: 69 64 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72  id (cdb:remote-r
1c80: 75 6e 20 64 62 3a 67 65 74 2d 6b 65 79 2d 76 61  un db:get-key-va
1c90: 6c 73 20 23 66 20 72 75 6e 2d 69 64 29 20 23 66  ls #f run-id) #f
1ca0: 29 29 0a 09 20 28 64 65 66 65 72 72 65 64 20 20  )).. (deferred  
1cb0: 20 20 27 28 29 29 20 3b 3b 20 64 65 6c 61 79 20    '()) ;; delay 
1cc0: 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20 73 69  running these si
1cd0: 6e 63 65 20 74 68 65 79 20 68 61 76 65 20 61 20  nce they have a 
1ce0: 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20  waiton clause.. 
1cf0: 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69 73 20  ;; keepgoing is 
1d00: 74 68 65 20 64 65 66 61 63 74 6f 20 6d 6f 64 61  the defacto moda
1d10: 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 61  lity now, will a
1d20: 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61 20 62  dd hit-n-run a b
1d30: 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20 28 6b  it later.. ;; (k
1d40: 65 65 70 67 6f 69 6e 67 20 20 20 28 68 61 73 68  eepgoing   (hash
1d50: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
1d60: 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67  lt flags "-keepg
1d70: 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 72 75  oing" #f)).. (ru
1d80: 6e 63 6f 6e 66 69 67 66 20 20 20 28 63 6f 6e 63  nconfigf   (conc
1d90: 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75    *toppath* "/ru
1da0: 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22  nconfigs.config"
1db0: 29 29 0a 09 20 28 72 65 71 75 69 72 65 64 2d 74  )).. (required-t
1dc0: 65 73 74 73 20 27 28 29 29 0a 09 20 28 74 65 73  ests '()).. (tes
1dd0: 74 2d 72 65 63 6f 72 64 73 20 28 6d 61 6b 65 2d  t-records (make-
1de0: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 0a 20  hash-table))).. 
1df0: 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74     (set-megatest
1e00: 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64  -env-vars run-id
1e10: 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62  ) ;; these may b
1e20: 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20  e needed by the 
1e30: 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73  launching proces
1e40: 73 0a 0a 20 20 20 20 28 69 66 20 28 66 69 6c 65  s..    (if (file
1e50: 2d 65 78 69 73 74 73 3f 20 72 75 6e 63 6f 6e 66  -exists? runconf
1e60: 69 67 66 29 0a 09 28 73 65 74 75 70 2d 65 6e 76  igf)..(setup-env
1e70: 2d 64 65 66 61 75 6c 74 73 20 72 75 6e 63 6f 6e  -defaults runcon
1e80: 66 69 67 66 20 72 75 6e 2d 69 64 20 2a 61 6c 72  figf run-id *alr
1e90: 65 61 64 79 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e  eady-seen-runcon
1ea0: 66 69 67 2d 69 6e 66 6f 2a 20 6b 65 79 73 20 6b  fig-info* keys k
1eb0: 65 79 76 61 6c 73 20 22 70 72 65 2d 6c 61 75 6e  eyvals "pre-laun
1ec0: 63 68 2d 65 6e 76 2d 76 61 72 73 22 29 0a 09 28  ch-env-vars")..(
1ed0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57  debug:print 0 "W
1ee0: 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e  ARNING: You do n
1ef0: 6f 74 20 68 61 76 65 20 61 20 72 75 6e 20 63 6f  ot have a run co
1f00: 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 72 75 6e  nfig file: " run
1f10: 63 6f 6e 66 69 67 66 29 29 0a 20 20 20 20 0a 20  configf)).    . 
1f20: 20 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c     ;; look up al
1f30: 6c 20 74 65 73 74 73 20 6d 61 74 63 68 69 6e 67  l tests matching
1f40: 20 74 68 65 20 63 6f 6d 6d 61 20 73 65 70 61 72   the comma separ
1f50: 61 74 65 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f  ated list of glo
1f60: 62 73 20 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73  bs in.    ;; tes
1f70: 74 2d 70 61 74 74 73 20 28 75 73 69 6e 67 20 25  t-patts (using %
1f80: 20 61 73 20 77 69 6c 64 63 61 72 64 29 0a 0a 20   as wildcard).. 
1f90: 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61     (set! test-na
1fa0: 6d 65 73 20 28 74 65 73 74 73 3a 67 65 74 2d 76  mes (tests:get-v
1fb0: 61 6c 69 64 2d 74 65 73 74 73 20 2a 74 6f 70 70  alid-tests *topp
1fc0: 61 74 68 2a 20 74 65 73 74 2d 6e 61 6d 65 73 29  ath* test-names)
1fd0: 29 0a 20 20 20 20 28 73 65 74 21 20 74 65 73 74  ).    (set! test
1fe0: 2d 6e 61 6d 65 73 20 28 64 65 6c 65 74 65 2d 64  -names (delete-d
1ff0: 75 70 6c 69 63 61 74 65 73 20 74 65 73 74 2d 6e  uplicates test-n
2000: 61 6d 65 73 29 29 0a 0a 20 20 20 20 28 64 65 62  ames))..    (deb
2010: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30 20  ug:print-info 0 
2020: 22 74 65 73 74 20 6e 61 6d 65 73 20 22 20 74 65  "test names " te
2030: 73 74 2d 6e 61 6d 65 73 29 0a 0a 20 20 20 20 3b  st-names)..    ;
2040: 3b 20 6f 6e 20 74 68 65 20 66 69 72 73 74 20 70  ; on the first p
2050: 61 73 73 20 6f 72 20 63 61 6c 6c 20 74 6f 20 72  ass or call to r
2060: 75 6e 2d 74 65 73 74 73 20 73 65 74 20 46 41 49  un-tests set FAI
2070: 4c 53 20 74 6f 20 4e 4f 54 5f 53 54 41 52 54 45  LS to NOT_STARTE
2080: 44 20 69 66 0a 20 20 20 20 3b 3b 20 2d 6b 65 65  D if.    ;; -kee
2090: 70 67 6f 69 6e 67 20 69 73 20 73 70 65 63 69 66  pgoing is specif
20a0: 69 65 64 0a 20 20 20 20 28 69 66 20 28 65 71 3f  ied.    (if (eq?
20b0: 20 2a 70 61 73 73 6e 75 6d 2a 20 30 29 0a 09 28   *passnum* 0)..(
20c0: 62 65 67 69 6e 0a 09 20 20 3b 3b 20 68 61 76 65  begin..  ;; have
20d0: 20 74 6f 20 64 65 6c 65 74 65 20 74 65 73 74 20   to delete test 
20e0: 72 65 63 6f 72 64 73 20 77 68 65 72 65 20 4e 4f  records where NO
20f0: 54 5f 53 54 41 52 54 45 44 20 73 69 6e 63 65 20  T_STARTED since 
2100: 74 68 65 79 20 63 61 6e 20 63 61 75 73 65 20 2d  they can cause -
2110: 6b 65 65 70 67 6f 69 6e 67 20 74 6f 20 0a 09 20  keepgoing to .. 
2120: 20 3b 3b 20 67 65 74 20 73 74 75 63 6b 20 64 75   ;; get stuck du
2130: 65 20 74 6f 20 62 65 63 6f 6d 69 6e 67 20 69 6e  e to becoming in
2140: 61 63 63 65 73 73 69 62 6c 65 20 66 72 6f 6d 20  accessible from 
2150: 61 20 66 61 69 6c 65 64 20 74 65 73 74 2e 20 49  a failed test. I
2160: 2e 65 2e 20 69 66 20 74 65 73 74 20 42 20 64 65  .e. if test B de
2170: 70 65 6e 64 73 20 0a 09 20 20 3b 3b 20 6f 6e 20  pends ..  ;; on 
2180: 74 65 73 74 20 41 20 62 75 74 20 74 65 73 74 20  test A but test 
2190: 42 20 72 65 61 63 68 65 64 20 74 68 65 20 70 6f  B reached the po
21a0: 69 6e 74 20 6f 6e 20 62 65 69 6e 67 20 72 65 67  int on being reg
21b0: 69 73 74 65 72 65 64 20 61 73 20 4e 4f 54 5f 53  istered as NOT_S
21c0: 54 41 52 54 45 44 20 61 6e 64 20 74 65 73 74 0a  TARTED and test.
21d0: 09 20 20 3b 3b 20 41 20 66 61 69 6c 65 64 20 66  .  ;; A failed f
21e0: 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e 20 74  or some reason t
21f0: 68 65 6e 20 6f 6e 20 72 65 2d 72 75 6e 20 75 73  hen on re-run us
2200: 69 6e 67 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74  ing -keepgoing t
2210: 68 65 20 72 75 6e 20 63 61 6e 20 6e 65 76 65 72  he run can never
2220: 20 63 6f 6d 70 6c 65 74 65 2e 0a 09 20 20 28 63   complete...  (c
2230: 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73 2d  db:delete-tests-
2240: 69 6e 2d 73 74 61 74 65 20 2a 72 75 6e 72 65 6d  in-state *runrem
2250: 6f 74 65 2a 20 72 75 6e 2d 69 64 20 22 4e 4f 54  ote* run-id "NOT
2260: 5f 53 54 41 52 54 45 44 22 29 0a 09 20 20 28 63  _STARTED")..  (c
2270: 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62  db:remote-run db
2280: 3a 73 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65  :set-tests-state
2290: 2d 73 74 61 74 75 73 20 23 66 20 72 75 6e 2d 69  -status #f run-i
22a0: 64 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20  d test-names #f 
22b0: 22 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52  "FAIL" "NOT_STAR
22c0: 54 45 44 22 20 22 46 41 49 4c 22 29 29 29 0a 0a  TED" "FAIL")))..
22d0: 20 20 20 20 3b 3b 20 66 72 6f 6d 20 68 65 72 65      ;; from here
22e0: 20 6f 6e 20 6f 75 74 20 74 68 65 20 64 62 20 77   on out the db w
22f0: 69 6c 6c 20 62 65 20 6f 70 65 6e 65 64 20 61 6e  ill be opened an
2300: 64 20 63 6c 6f 73 65 64 20 6f 6e 20 65 76 65 72  d closed on ever
2310: 79 20 63 61 6c 6c 20 72 75 6e 73 3a 72 75 6e 2d  y call runs:run-
2320: 74 65 73 74 73 2d 71 75 65 75 65 0a 20 20 20 20  tests-queue.    
2330: 3b 3b 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61  ;; (sqlite3:fina
2340: 6c 69 7a 65 21 20 64 62 29 20 0a 20 20 20 20 3b  lize! db) .    ;
2350: 3b 20 6e 6f 77 20 61 64 64 20 6e 6f 6e 2d 64 69  ; now add non-di
2360: 72 65 63 74 6c 79 20 72 65 66 65 72 65 6e 63 65  rectly reference
2370: 64 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 28  d dependencies (
2380: 69 2e 65 2e 20 77 61 69 74 6f 6e 29 0a 20 20 20  i.e. waiton).   
2390: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f   (if (not (null?
23a0: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 28   test-names))..(
23b0: 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 28  let loop ((hed (
23c0: 63 61 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  car test-names))
23d0: 0a 09 09 20 20 20 28 74 61 6c 20 28 63 64 72 20  ...   (tal (cdr 
23e0: 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 20 20 20  test-names)))   
23f0: 20 20 20 20 20 20 3b 3b 20 27 72 65 74 75 72 6e        ;; 'return
2400: 2d 70 72 6f 63 73 20 74 65 6c 6c 73 20 74 68 65  -procs tells the
2410: 20 63 6f 6e 66 69 67 20 72 65 61 64 65 72 20 74   config reader t
2420: 6f 20 70 72 65 70 20 72 75 6e 6e 69 6e 67 20 73  o prep running s
2430: 79 73 74 65 6d 20 62 75 74 20 72 65 74 75 72 6e  ystem but return
2440: 20 61 20 70 72 6f 63 0a 09 20 20 28 64 65 62 75   a proc..  (debu
2450: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
2460: 68 65 64 3d 22 20 68 65 64 20 22 20 61 74 20 74  hed=" hed " at t
2470: 6f 70 20 6f 66 20 6c 6f 6f 70 22 29 0a 09 20 20  op of loop")..  
2480: 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20  (let* ((config  
2490: 28 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63  (tests:get-testc
24a0: 6f 6e 66 69 67 20 68 65 64 20 27 72 65 74 75 72  onfig hed 'retur
24b0: 6e 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61  n-procs))... (wa
24c0: 69 74 6f 6e 73 20 28 6c 65 74 20 28 28 69 6e 73  itons (let ((ins
24d0: 74 72 20 28 69 66 20 63 6f 6e 66 69 67 20 0a 09  tr (if config ..
24e0: 09 09 09 09 20 20 20 28 63 6f 6e 66 69 67 2d 6c  ....   (config-l
24f0: 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 65  ookup config "re
2500: 71 75 69 72 65 6d 65 6e 74 73 22 20 22 77 61 69  quirements" "wai
2510: 74 6f 6e 22 29 0a 09 09 09 09 09 20 20 20 28 62  ton")......   (b
2520: 65 67 69 6e 20 3b 3b 20 4e 6f 20 63 6f 6e 66 69  egin ;; No confi
2530: 67 20 6d 65 61 6e 73 20 74 68 69 73 20 69 73 20  g means this is 
2540: 61 20 6e 6f 6e 2d 65 78 69 73 74 61 6e 74 20 74  a non-existant t
2550: 65 73 74 0a 09 09 09 09 09 20 20 20 20 20 28 64  est......     (d
2560: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
2570: 52 4f 52 3a 20 6e 6f 6e 2d 65 78 69 73 74 65 6e  ROR: non-existen
2580: 74 20 72 65 71 75 69 72 65 64 20 74 65 73 74 20  t required test 
2590: 5c 22 22 20 68 65 64 20 22 5c 22 22 29 0a 09 09  \"" hed "\"")...
25a0: 09 09 09 20 20 20 20 20 28 69 66 20 64 62 20 28  ...     (if db (
25b0: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65  sqlite3:finalize
25c0: 21 20 64 62 29 29 0a 09 09 09 09 09 20 20 20 20  ! db))......    
25d0: 20 28 65 78 69 74 20 31 29 29 29 29 29 0a 09 09   (exit 1)))))...
25e0: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
25f0: 74 2d 69 6e 66 6f 20 38 20 22 77 61 69 74 6f 6e  t-info 8 "waiton
2600: 73 20 73 74 72 69 6e 67 20 69 73 20 22 20 69 6e  s string is " in
2610: 73 74 72 29 0a 09 09 09 20 20 20 20 28 73 74 72  str)....    (str
2620: 69 6e 67 2d 73 70 6c 69 74 20 28 63 6f 6e 64 0a  ing-split (cond.
2630: 09 09 09 09 09 20 20 20 28 28 70 72 6f 63 65 64  .....   ((proced
2640: 75 72 65 3f 20 69 6e 73 74 72 29 0a 09 09 09 09  ure? instr).....
2650: 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 73 20  .    (let ((res 
2660: 28 69 6e 73 74 72 29 29 29 0a 09 09 09 09 09 20  (instr)))...... 
2670: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
2680: 74 2d 69 6e 66 6f 20 38 20 22 77 61 69 74 6f 6e  t-info 8 "waiton
2690: 20 70 72 6f 63 65 64 75 72 65 20 72 65 73 75 6c   procedure resul
26a0: 74 73 20 69 6e 20 73 74 72 69 6e 67 20 22 20 72  ts in string " r
26b0: 65 73 20 22 20 66 6f 72 20 74 65 73 74 20 22 20  es " for test " 
26c0: 68 65 64 29 0a 09 09 09 09 09 20 20 20 20 20 20  hed)......      
26d0: 72 65 73 29 29 0a 09 09 09 09 09 20 20 20 28 28  res))......   ((
26e0: 73 74 72 69 6e 67 3f 20 69 6e 73 74 72 29 20 20  string? instr)  
26f0: 20 20 20 69 6e 73 74 72 29 0a 09 09 09 09 09 20     instr)...... 
2700: 20 20 28 65 6c 73 65 20 0a 09 09 09 09 09 20 20    (else ......  
2710: 20 20 3b 3b 20 4e 4f 54 45 3a 20 54 68 69 73 20    ;; NOTE: This 
2720: 69 73 20 61 63 74 75 61 6c 6c 79 20 74 68 65 20  is actually the 
2730: 63 61 73 65 20 6f 66 20 2a 6e 6f 2a 20 77 61 69  case of *no* wai
2740: 74 6f 6e 73 21 20 3b 3b 20 28 64 65 62 75 67 3a  tons! ;; (debug:
2750: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
2760: 73 6f 6d 65 74 68 69 6e 67 20 77 65 6e 74 20 77  something went w
2770: 72 6f 6e 67 20 69 6e 20 70 72 6f 63 65 73 73 69  rong in processi
2780: 6e 67 20 77 61 69 74 6f 6e 73 20 66 6f 72 20 74  ng waitons for t
2790: 65 73 74 20 22 20 68 65 64 29 0a 09 09 09 09 09  est " hed)......
27a0: 20 20 20 20 22 22 29 29 29 29 29 29 0a 09 20 20      ""))))))..  
27b0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
27c0: 6e 66 6f 20 38 20 22 77 61 69 74 6f 6e 73 3a 20  nfo 8 "waitons: 
27d0: 22 20 77 61 69 74 6f 6e 73 29 0a 09 20 20 20 20  " waitons)..    
27e0: 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65 64  ;; check for hed
27f0: 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74   in waitons => t
2800: 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69 72  his would be cir
2810: 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69 74  cular, remove it
2820: 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09 20   and issue an.. 
2830: 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20     ;; error..   
2840: 20 28 69 66 20 28 6d 65 6d 62 65 72 20 68 65 64   (if (member hed
2850: 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62 65 67   waitons)...(beg
2860: 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72  in...  (debug:pr
2870: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74 65  int 0 "ERROR: te
2880: 73 74 20 22 20 68 65 64 20 22 20 68 61 73 20 6c  st " hed " has l
2890: 69 73 74 65 64 20 69 74 73 65 6c 66 20 61 73 20  isted itself as 
28a0: 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61 73 65  a waiton, please
28b0: 20 63 6f 72 72 65 63 74 20 74 68 69 73 21 22 29   correct this!")
28c0: 0a 09 09 20 20 28 73 65 74 21 20 77 61 69 74 6f  ...  (set! waito
28d0: 6e 73 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62  ns (filter (lamb
28e0: 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71 75 61  da (x)(not (equa
28f0: 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61 69 74  l? x hed))) wait
2900: 6f 6e 73 29 29 29 29 0a 09 20 20 20 20 0a 09 20  ons))))..    .. 
2910: 20 20 20 3b 3b 20 28 69 74 65 6d 73 20 20 20 28     ;; (items   (
2920: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d  items:get-items-
2930: 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66  from-config conf
2940: 69 67 29 29 29 0a 09 20 20 20 20 28 69 66 20 28  ig)))..    (if (
2950: 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  not (hash-table-
2960: 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74  ref/default test
2970: 2d 72 65 63 6f 72 64 73 20 68 65 64 20 23 66 29  -records hed #f)
2980: 29 0a 09 09 28 68 61 73 68 2d 74 61 62 6c 65 2d  )...(hash-table-
2990: 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f 72 64  set! test-record
29a0: 73 0a 09 09 09 09 20 68 65 64 20 28 76 65 63 74  s..... hed (vect
29b0: 6f 72 20 68 65 64 20 20 20 20 20 3b 3b 20 30 0a  or hed     ;; 0.
29c0: 09 09 09 09 09 20 20 20 20 20 63 6f 6e 66 69 67  .....     config
29d0: 20 20 3b 3b 20 31 0a 09 09 09 09 09 20 20 20 20    ;; 1......    
29e0: 20 77 61 69 74 6f 6e 73 20 3b 3b 20 32 0a 09 09   waitons ;; 2...
29f0: 09 09 09 20 20 20 20 20 28 63 6f 6e 66 69 67 2d  ...     (config-
2a00: 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72  lookup config "r
2a10: 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 70 72  equirements" "pr
2a20: 69 6f 72 69 74 79 22 29 20 20 20 20 20 3b 3b 20  iority")     ;; 
2a30: 70 72 69 6f 72 69 74 79 20 33 0a 09 09 09 09 09  priority 3......
2a40: 20 20 20 20 20 28 6c 65 74 20 28 28 69 74 65 6d       (let ((item
2a50: 73 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62  s      (hash-tab
2a60: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63  le-ref/default c
2a70: 6f 6e 66 69 67 20 22 69 74 65 6d 73 22 20 23 66  onfig "items" #f
2a80: 29 29 20 3b 3b 20 69 74 65 6d 73 20 34 0a 09 09  )) ;; items 4...
2a90: 09 09 09 09 20 20 20 28 69 74 65 6d 73 74 61 62  ....   (itemstab
2aa0: 6c 65 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72  le (hash-table-r
2ab0: 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 69  ef/default confi
2ac0: 67 20 22 69 74 65 6d 73 74 61 62 6c 65 22 20 23  g "itemstable" #
2ad0: 66 29 29 29 20 0a 09 09 09 09 09 20 20 20 20 20  f))) ......     
2ae0: 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20 69    ;; if either i
2af0: 74 65 6d 73 20 6f 72 20 69 74 65 6d 73 20 74 61  tems or items ta
2b00: 62 6c 65 20 69 73 20 61 20 70 72 6f 63 20 72 65  ble is a proc re
2b10: 74 75 72 6e 20 69 74 20 73 6f 20 74 65 73 74 20  turn it so test 
2b20: 72 75 6e 6e 69 6e 67 0a 09 09 09 09 09 20 20 20  running......   
2b30: 20 20 20 20 3b 3b 20 70 72 6f 63 65 73 73 20 63      ;; process c
2b40: 61 6e 20 6b 6e 6f 77 20 74 6f 20 63 61 6c 6c 20  an know to call 
2b50: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d  items:get-items-
2b60: 66 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09 09 09 09  from-config.....
2b70: 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20 65 69  .       ;; if ei
2b80: 74 68 65 72 20 69 73 20 61 20 6c 69 73 74 20 61  ther is a list a
2b90: 6e 64 20 6e 6f 6e 65 20 69 73 20 61 20 70 72 6f  nd none is a pro
2ba0: 63 20 67 6f 20 61 68 65 61 64 20 61 6e 64 20 63  c go ahead and c
2bb0: 61 6c 6c 20 67 65 74 2d 69 74 65 6d 73 0a 09 09  all get-items...
2bc0: 09 09 09 20 20 20 20 20 20 20 3b 3b 20 6f 74 68  ...       ;; oth
2bd0: 65 72 77 69 73 65 20 72 65 74 75 72 6e 20 23 66  erwise return #f
2be0: 20 2d 20 74 68 69 73 20 69 73 20 6e 6f 74 20 61   - this is not a
2bf0: 6e 20 69 74 65 72 61 74 65 64 20 74 65 73 74 0a  n iterated test.
2c00: 09 09 09 09 09 20 20 20 20 20 20 20 28 63 6f 6e  .....       (con
2c10: 64 0a 09 09 09 09 09 09 28 28 70 72 6f 63 65 64  d.......((proced
2c20: 75 72 65 3f 20 69 74 65 6d 73 29 20 20 20 20 20  ure? items)     
2c30: 20 0a 09 09 09 09 09 09 20 28 64 65 62 75 67 3a   ....... (debug:
2c40: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74  print-info 4 "it
2c50: 65 6d 73 20 69 73 20 61 20 70 72 6f 63 65 64 75  ems is a procedu
2c60: 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61  re, will calc la
2c70: 74 65 72 22 29 0a 09 09 09 09 09 09 20 69 74 65  ter")....... ite
2c80: 6d 73 29 20 20 20 20 20 20 20 20 20 20 20 20 3b  ms)            ;
2c90: 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09  ; calc later....
2ca0: 09 09 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20  ...((procedure? 
2cb0: 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 09 09 09  itemstable).....
2cc0: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  .. (debug:print-
2cd0: 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 74 61 62  info 4 "itemstab
2ce0: 6c 65 20 69 73 20 61 20 70 72 6f 63 65 64 75 72  le is a procedur
2cf0: 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74  e, will calc lat
2d00: 65 72 22 29 0a 09 09 09 09 09 09 20 69 74 65 6d  er")....... item
2d10: 73 74 61 62 6c 65 29 20 20 20 20 20 20 20 3b 3b  stable)       ;;
2d20: 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 09   calc later.....
2d30: 09 09 28 28 66 69 6c 74 65 72 20 28 6c 61 6d 62  ..((filter (lamb
2d40: 64 61 20 28 78 29 0a 09 09 09 09 09 09 09 20 20  da (x)........  
2d50: 20 28 6c 65 74 20 28 28 76 61 6c 20 28 63 61 72   (let ((val (car
2d60: 20 78 29 29 29 0a 09 09 09 09 09 09 09 20 20 20   x)))........   
2d70: 20 20 28 69 66 20 28 70 72 6f 63 65 64 75 72 65    (if (procedure
2d80: 3f 20 76 61 6c 29 20 76 61 6c 20 23 66 29 29 29  ? val) val #f)))
2d90: 0a 09 09 09 09 09 09 09 20 28 61 70 70 65 6e 64  ........ (append
2da0: 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d   (if (list? item
2db0: 73 29 20 69 74 65 6d 73 20 27 28 29 29 0a 09 09  s) items '())...
2dc0: 09 09 09 09 09 09 20 28 69 66 20 28 6c 69 73 74  ...... (if (list
2dd0: 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 20 69 74  ? itemstable) it
2de0: 65 6d 73 74 61 62 6c 65 20 27 28 29 29 29 29 0a  emstable '()))).
2df0: 09 09 09 09 09 09 20 27 68 61 76 65 2d 70 72 6f  ...... 'have-pro
2e00: 63 65 64 75 72 65 29 0a 09 09 09 09 09 09 28 28  cedure).......((
2e10: 6f 72 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29  or (list? items)
2e20: 28 6c 69 73 74 3f 20 69 74 65 6d 73 74 61 62 6c  (list? itemstabl
2e30: 65 29 29 20 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a  e)) ;; calc now.
2e40: 09 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72  ...... (debug:pr
2e50: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d  int-info 4 "item
2e60: 73 20 61 6e 64 20 69 74 65 6d 73 74 61 62 6c 65  s and itemstable
2e70: 20 61 72 65 20 6c 69 73 74 73 2c 20 63 61 6c 63   are lists, calc
2e80: 20 6e 6f 77 5c 6e 22 0a 09 09 09 09 09 09 09 20   now\n"........ 
2e90: 20 20 20 20 20 22 20 20 20 20 69 74 65 6d 73 3a       "    items:
2ea0: 20 22 20 69 74 65 6d 73 20 22 20 69 74 65 6d 73   " items " items
2eb0: 74 61 62 6c 65 3a 20 22 20 69 74 65 6d 73 74 61  table: " itemsta
2ec0: 62 6c 65 29 0a 09 09 09 09 09 09 20 28 69 74 65  ble)....... (ite
2ed0: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f  ms:get-items-fro
2ee0: 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29  m-config config)
2ef0: 29 0a 09 09 09 09 09 09 28 65 6c 73 65 20 23 66  ).......(else #f
2f00: 29 29 29 20 20 20 20 20 20 20 20 20 20 20 20 20  )))             
2f10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b                ;;
2f20: 20 6e 6f 74 20 69 74 65 72 61 74 65 64 0a 09 09   not iterated...
2f30: 09 09 09 20 20 20 20 20 23 66 20 20 20 20 20 20  ...     #f      
2f40: 3b 3b 20 69 74 65 6d 73 64 61 74 20 35 0a 09 09  ;; itemsdat 5...
2f50: 09 09 09 20 20 20 20 20 23 66 20 20 20 20 20 20  ...     #f      
2f60: 3b 3b 20 73 70 61 72 65 20 2d 20 75 73 65 64 20  ;; spare - used 
2f70: 66 6f 72 20 69 74 65 6d 2d 70 61 74 68 0a 09 09  for item-path...
2f80: 09 09 09 20 20 20 20 20 29 29 29 0a 09 20 20 20  ...     )))..   
2f90: 20 28 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 20   (for-each ..   
2fa0: 20 20 28 6c 61 6d 62 64 61 20 28 77 61 69 74 6f    (lambda (waito
2fb0: 6e 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 28  n)..       (if (
2fc0: 61 6e 64 20 77 61 69 74 6f 6e 20 28 6e 6f 74 20  and waiton (not 
2fd0: 28 6d 65 6d 62 65 72 20 77 61 69 74 6f 6e 20 74  (member waiton t
2fe0: 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09 09 20  est-names)))... 
2ff0: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20    (begin...     
3000: 28 73 65 74 21 20 72 65 71 75 69 72 65 64 2d 74  (set! required-t
3010: 65 73 74 73 20 28 63 6f 6e 73 20 77 61 69 74 6f  ests (cons waito
3020: 6e 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73  n required-tests
3030: 29 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 20  ))...     (set! 
3040: 74 65 73 74 2d 6e 61 6d 65 73 20 28 63 6f 6e 73  test-names (cons
3050: 20 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d   waiton test-nam
3060: 65 73 29 29 29 29 29 20 3b 3b 20 77 61 73 20 61  es))))) ;; was a
3070: 6e 20 61 70 70 65 6e 64 2c 20 6e 6f 77 20 61 20  n append, now a 
3080: 63 6f 6e 73 0a 09 20 20 20 20 20 77 61 69 74 6f  cons..     waito
3090: 6e 73 29 0a 09 20 20 20 20 28 6c 65 74 20 28 28  ns)..    (let ((
30a0: 72 65 6d 74 65 73 74 73 20 28 64 65 6c 65 74 65  remtests (delete
30b0: 2d 64 75 70 6c 69 63 61 74 65 73 20 28 61 70 70  -duplicates (app
30c0: 65 6e 64 20 77 61 69 74 6f 6e 73 20 74 61 6c 29  end waitons tal)
30d0: 29 29 29 0a 09 20 20 20 20 20 20 28 69 66 20 28  )))..      (if (
30e0: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65  not (null? remte
30f0: 73 74 73 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20  sts))...  (loop 
3100: 28 63 61 72 20 72 65 6d 74 65 73 74 73 29 28 63  (car remtests)(c
3110: 64 72 20 72 65 6d 74 65 73 74 73 29 29 29 29 29  dr remtests)))))
3120: 29 29 0a 0a 20 20 20 20 28 69 66 20 28 6e 6f 74  ))..    (if (not
3130: 20 28 6e 75 6c 6c 3f 20 72 65 71 75 69 72 65 64   (null? required
3140: 2d 74 65 73 74 73 29 29 0a 09 28 64 65 62 75 67  -tests))..(debug
3150: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41  :print-info 1 "A
3160: 64 64 69 6e 67 20 22 20 72 65 71 75 69 72 65 64  dding " required
3170: 2d 74 65 73 74 73 20 22 20 74 6f 20 74 68 65 20  -tests " to the 
3180: 72 75 6e 20 71 75 65 75 65 22 29 29 0a 20 20 20  run queue")).   
3190: 20 3b 3b 20 4e 4f 54 45 3a 20 74 68 65 73 65 20   ;; NOTE: these 
31a0: 61 72 65 20 61 6c 6c 20 70 61 72 65 6e 74 20 74  are all parent t
31b0: 65 73 74 73 2c 20 69 74 65 6d 73 20 61 72 65 20  ests, items are 
31c0: 6e 6f 74 20 65 78 70 61 6e 64 65 64 20 79 65 74  not expanded yet
31d0: 2e 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
31e0: 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 2d  nt-info 4 "test-
31f0: 72 65 63 6f 72 64 73 3d 22 20 28 68 61 73 68 2d  records=" (hash-
3200: 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73  table->alist tes
3210: 74 2d 72 65 63 6f 72 64 73 29 29 0a 20 20 20 20  t-records)).    
3220: 28 6c 65 74 20 28 28 72 65 67 6c 65 6e 20 28 61  (let ((reglen (a
3230: 6e 79 2d 3e 6e 75 6d 62 65 72 20 20 28 63 6f 6e  ny->number  (con
3240: 66 69 67 66 3a 6c 6f 6f 6b 75 70 20 2a 63 6f 6e  figf:lookup *con
3250: 66 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 20  figdat* "setup" 
3260: 22 72 75 6e 71 75 65 75 65 22 29 29 29 29 0a 20  "runqueue")))). 
3270: 20 20 20 20 20 28 69 66 20 72 65 67 6c 65 6e 0a       (if reglen.
3280: 09 20 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73  .  (runs:run-tes
3290: 74 73 2d 71 75 65 75 65 2d 6e 65 77 20 72 75 6e  ts-queue-new run
32a0: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74  -id runname test
32b0: 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c  -records keyvall
32c0: 73 74 20 66 6c 61 67 73 20 74 65 73 74 2d 70 61  st flags test-pa
32d0: 74 74 73 20 72 65 67 6c 65 6e 29 0a 09 20 20 28  tts reglen)..  (
32e0: 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71  runs:run-tests-q
32f0: 75 65 75 65 2d 63 6c 61 73 73 69 63 20 72 75 6e  ueue-classic run
3300: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74  -id runname test
3310: 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c  -records keyvall
3320: 73 74 20 66 6c 61 67 73 20 74 65 73 74 2d 70 61  st flags test-pa
3330: 74 74 73 29 29 29 0a 20 20 20 20 28 64 65 62 75  tts))).    (debu
3340: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
3350: 41 6c 6c 20 64 6f 6e 65 20 62 79 20 68 65 72 65  All done by here
3360: 22 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72  ")))..(define (r
3370: 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70  uns:calc-fails p
3380: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a  rereqs-not-met).
3390: 20 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64    (filter (lambd
33a0: 61 20 28 74 65 73 74 29 0a 09 20 20 20 20 28 61  a (test)..    (a
33b0: 6e 64 20 28 76 65 63 74 6f 72 3f 20 74 65 73 74  nd (vector? test
33c0: 29 20 3b 3b 20 6e 6f 74 20 28 73 74 72 69 6e 67  ) ;; not (string
33d0: 3f 20 74 65 73 74 29 29 0a 09 09 20 28 65 71 75  ? test))... (equ
33e0: 61 6c 3f 20 28 64 62 3a 74 65 73 74 2d 67 65 74  al? (db:test-get
33f0: 2d 73 74 61 74 65 20 74 65 73 74 29 20 22 43 4f  -state test) "CO
3400: 4d 50 4c 45 54 45 44 22 29 0a 09 09 20 28 6e 6f  MPLETED")... (no
3410: 74 20 28 6d 65 6d 62 65 72 20 28 64 62 3a 74 65  t (member (db:te
3420: 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 65  st-get-status te
3430: 73 74 29 0a 09 09 09 20 20 20 20 20 20 27 28 22  st)....      '("
3440: 50 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 48  PASS" "WARN" "CH
3450: 45 43 4b 22 20 22 57 41 49 56 45 44 22 20 22 53  ECK" "WAIVED" "S
3460: 4b 49 50 22 29 29 29 29 29 0a 09 20 20 70 72 65  KIP")))))..  pre
3470: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 0a  reqs-not-met))..
3480: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61  (define (runs:ca
3490: 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64  lc-not-completed
34a0: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
34b0: 29 0a 20 20 28 66 69 6c 74 65 72 0a 20 20 20 28  ).  (filter.   (
34c0: 6c 61 6d 62 64 61 20 28 74 29 0a 20 20 20 20 20  lambda (t).     
34d0: 28 6f 72 20 28 6e 6f 74 20 28 76 65 63 74 6f 72  (or (not (vector
34e0: 3f 20 74 29 29 0a 09 20 28 6e 6f 74 20 28 65 71  ? t)).. (not (eq
34f0: 75 61 6c 3f 20 22 43 4f 4d 50 4c 45 54 45 44 22  ual? "COMPLETED"
3500: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74   (db:test-get-st
3510: 61 74 65 20 74 29 29 29 29 29 0a 20 20 20 70 72  ate t))))).   pr
3520: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a  ereqs-not-met)).
3530: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 70  .(define (runs:p
3540: 72 65 74 74 79 2d 73 74 72 69 6e 67 20 6c 73 74  retty-string lst
3550: 29 0a 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61  ).  (map (lambda
3560: 20 28 74 29 0a 09 20 28 69 66 20 28 6e 6f 74 20   (t).. (if (not 
3570: 28 76 65 63 74 6f 72 3f 20 74 29 29 0a 09 20 20  (vector? t))..  
3580: 20 20 20 28 63 6f 6e 63 20 74 29 0a 09 20 20 20     (conc t)..   
3590: 20 20 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74    (conc (db:test
35a0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 29  -get-testname t)
35b0: 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 65   ":" (db:test-ge
35c0: 74 2d 73 74 61 74 65 20 74 29 20 22 2f 22 20 28  t-state t) "/" (
35d0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74  db:test-get-stat
35e0: 75 73 20 74 29 29 29 29 0a 20 20 20 20 20 20 20  us t)))).       
35f0: 6c 73 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28  lst))..(define (
3600: 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74  runs:make-full-t
3610: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 6e 61 6d  est-name testnam
3620: 65 20 69 74 65 6d 70 61 74 68 29 0a 20 20 28 69  e itempath).  (i
3630: 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 70 61  f (equal? itempa
3640: 74 68 20 22 22 29 20 74 65 73 74 6e 61 6d 65 20  th "") testname 
3650: 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22  (conc testname "
3660: 2f 22 20 69 74 65 6d 70 61 74 68 29 29 29 0a 0a  /" itempath)))..
3670: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 71 75  (define (runs:qu
3680: 65 75 65 2d 6e 65 78 74 2d 68 65 64 20 74 61 6c  eue-next-hed tal
3690: 20 72 65 67 20 6e 20 72 65 67 66 75 6c 29 0a 20   reg n regful). 
36a0: 20 28 69 66 20 72 65 67 66 75 6c 0a 20 20 20 20   (if regful.    
36b0: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 67    (if (null? reg
36c0: 29 20 3b 3b 20 64 6f 65 73 6e 27 74 20 6d 61 6b  ) ;; doesn't mak
36d0: 65 20 73 65 6e 73 65 2c 20 74 68 69 73 20 69 73  e sense, this is
36e0: 20 70 72 6f 62 61 62 6c 79 20 4e 4f 54 20 74 68   probably NOT th
36f0: 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 74 68 65  e problem of the
3700: 20 63 61 72 0a 09 20 20 28 63 61 72 20 74 61 6c   car..  (car tal
3710: 29 0a 09 20 20 28 63 61 72 20 72 65 67 29 29 0a  )..  (car reg)).
3720: 20 20 20 20 20 20 28 63 61 72 20 74 61 6c 29 29        (car tal))
3730: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  )..(define (runs
3740: 3a 71 75 65 75 65 2d 6e 65 78 74 2d 74 61 6c 20  :queue-next-tal 
3750: 74 61 6c 20 72 65 67 20 6e 20 72 65 67 66 75 6c  tal reg n regful
3760: 29 0a 20 20 28 69 66 20 72 65 67 66 75 6c 0a 20  ).  (if regful. 
3770: 20 20 20 20 20 74 61 6c 0a 20 20 20 20 20 20 28       tal.      (
3780: 6c 65 74 20 28 28 6e 65 77 74 61 6c 20 28 63 64  let ((newtal (cd
3790: 72 20 74 61 6c 29 29 29 0a 09 28 69 66 20 28 6e  r tal)))..(if (n
37a0: 75 6c 6c 3f 20 6e 65 77 74 61 6c 29 0a 09 20 20  ull? newtal)..  
37b0: 20 20 72 65 67 0a 09 20 20 20 20 6e 65 77 74 61    reg..    newta
37c0: 6c 0a 09 20 20 20 20 29 29 29 29 0a 0a 28 64 65  l..    ))))..(de
37d0: 66 69 6e 65 20 28 72 75 6e 73 3a 71 75 65 75 65  fine (runs:queue
37e0: 2d 6e 65 78 74 2d 72 65 67 20 74 61 6c 20 72 65  -next-reg tal re
37f0: 67 20 6e 20 72 65 67 66 75 6c 29 0a 20 20 28 69  g n regful).  (i
3800: 66 20 72 65 67 66 75 6c 0a 20 20 20 20 20 20 28  f regful.      (
3810: 63 64 72 20 72 65 67 29 0a 20 20 20 20 20 20 28  cdr reg).      (
3820: 69 66 20 28 65 71 3f 20 28 6c 65 6e 67 74 68 20  if (eq? (length 
3830: 74 61 6c 29 20 31 29 0a 09 20 20 27 28 29 0a 09  tal) 1)..  '()..
3840: 20 20 72 65 67 29 29 29 0a 0a 28 69 6e 63 6c 75    reg)))..(inclu
3850: 64 65 20 22 72 75 6e 2d 74 65 73 74 73 2d 71 75  de "run-tests-qu
3860: 65 75 65 2d 63 6c 61 73 73 69 63 2e 73 63 6d 22  eue-classic.scm"
3870: 29 0a 28 69 6e 63 6c 75 64 65 20 22 72 75 6e 2d  ).(include "run-
3880: 74 65 73 74 73 2d 71 75 65 75 65 2d 6e 65 77 2e  tests-queue-new.
3890: 73 63 6d 22 29 0a 0a 3b 3b 20 70 61 72 65 6e 74  scm")..;; parent
38a0: 2d 74 65 73 74 20 69 73 20 74 68 65 72 65 20 61  -test is there a
38b0: 73 20 61 20 70 6c 61 63 65 68 6f 6c 64 65 72 20  s a placeholder 
38c0: 66 6f 72 20 77 68 65 6e 20 70 61 72 65 6e 74 2d  for when parent-
38d0: 74 65 73 74 73 20 63 61 6e 20 62 65 20 72 75 6e  tests can be run
38e0: 20 61 73 20 61 20 73 65 74 75 70 20 73 74 65 70   as a setup step
38f0: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 3a 74 65  .(define (run:te
3900: 73 74 20 72 75 6e 2d 69 64 20 72 75 6e 2d 69 6e  st run-id run-in
3910: 66 6f 20 6b 65 79 2d 76 61 6c 73 20 72 75 6e 6e  fo key-vals runn
3920: 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65  ame keyvallst te
3930: 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20  st-record flags 
3940: 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 20 20 3b  parent-test).  ;
3950: 3b 20 41 6c 6c 20 74 68 65 73 65 20 76 61 72 73  ; All these vars
3960: 20 6d 69 67 68 74 20 62 65 20 72 65 66 65 72 65   might be refere
3970: 6e 63 65 64 20 62 79 20 74 68 65 20 74 65 73 74  nced by the test
3980: 63 6f 6e 66 69 67 20 66 69 6c 65 20 72 65 61 64  config file read
3990: 65 72 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73  er.  (let* ((tes
39a0: 74 2d 6e 61 6d 65 20 20 20 20 28 74 65 73 74 73  t-name    (tests
39b0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74  :testqueue-get-t
39c0: 65 73 74 6e 61 6d 65 20 20 20 74 65 73 74 2d 72  estname   test-r
39d0: 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d  ecord)).. (test-
39e0: 77 61 69 74 6f 6e 73 20 28 74 65 73 74 73 3a 74  waitons (tests:t
39f0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69  estqueue-get-wai
3a00: 74 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63  tons    test-rec
3a10: 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 63 6f  ord)).. (test-co
3a20: 6e 66 20 20 20 20 28 74 65 73 74 73 3a 74 65 73  nf    (tests:tes
3a30: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63  tqueue-get-testc
3a40: 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72  onfig test-recor
3a50: 64 29 29 0a 09 20 28 69 74 65 6d 64 61 74 20 20  d)).. (itemdat  
3a60: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
3a70: 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74  ueue-get-itemdat
3a80: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29      test-record)
3a90: 29 0a 09 20 28 74 65 73 74 2d 70 61 74 68 20 20  ).. (test-path  
3aa0: 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68    (conc *toppath
3ab0: 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74  * "/tests/" test
3ac0: 2d 6e 61 6d 65 29 29 20 3b 3b 20 63 6f 75 6c 64  -name)) ;; could
3ad0: 20 75 73 65 20 74 65 73 74 73 3a 67 65 74 2d 74   use tests:get-t
3ae0: 65 73 74 63 6f 6e 66 69 67 20 68 65 72 65 20 2e  estconfig here .
3af0: 2e 2e 0a 09 20 28 66 6f 72 63 65 20 20 20 20 20  .... (force     
3b00: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72     (hash-table-r
3b10: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73  ef/default flags
3b20: 20 22 2d 66 6f 72 63 65 22 20 23 66 29 29 0a 09   "-force" #f))..
3b30: 20 28 72 65 72 75 6e 20 20 20 20 20 20 20 20 28   (rerun        (
3b40: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
3b50: 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 72  efault flags "-r
3b60: 65 72 75 6e 22 20 23 66 29 29 0a 09 20 28 6b 65  erun" #f)).. (ke
3b70: 65 70 67 6f 69 6e 67 20 20 20 20 28 68 61 73 68  epgoing    (hash
3b80: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
3b90: 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67  lt flags "-keepg
3ba0: 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 69 74  oing" #f)).. (it
3bb0: 65 6d 2d 70 61 74 68 20 20 20 20 20 22 22 29 0a  em-path     "").
3bc0: 09 20 28 64 62 20 20 20 20 20 20 20 20 20 20 20  . (db           
3bd0: 23 66 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a  #f)).    (debug:
3be0: 70 72 69 6e 74 20 34 0a 09 09 20 22 74 65 73 74  print 4... "test
3bf0: 2d 63 6f 6e 66 69 67 3a 20 22 20 28 68 61 73 68  -config: " (hash
3c00: 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65  -table->alist te
3c10: 73 74 2d 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20  st-conf)... "\n 
3c20: 20 20 69 74 65 6d 64 61 74 3a 20 22 20 69 74 65    itemdat: " ite
3c30: 6d 64 61 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b  mdat... ).    ;;
3c40: 20 73 65 74 74 69 6e 67 20 69 74 65 6d 64 61 74   setting itemdat
3c50: 20 74 6f 20 61 20 6c 69 73 74 20 69 66 20 69 74   to a list if it
3c60: 20 69 73 20 23 66 0a 20 20 20 20 28 69 66 20 28   is #f.    (if (
3c70: 6e 6f 74 20 69 74 65 6d 64 61 74 29 28 73 65 74  not itemdat)(set
3c80: 21 20 69 74 65 6d 64 61 74 20 27 28 29 29 29 0a  ! itemdat '())).
3c90: 20 20 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70      (set! item-p
3ca0: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e  ath (item-list->
3cb0: 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 20  path itemdat)). 
3cc0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
3cd0: 32 20 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f  2 "Attempting to
3ce0: 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 74   launch test " t
3cf0: 65 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71  est-name (if (eq
3d00: 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22  ual? item-path "
3d10: 2f 22 29 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  /") "/" item-pat
3d20: 68 29 29 0a 20 20 20 20 28 73 65 74 65 6e 76 20  h)).    (setenv 
3d30: 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74  "MT_TEST_NAME" t
3d40: 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 20 20  est-name) ;; .  
3d50: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55    (setenv "MT_RU
3d60: 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65  NNAME"   runname
3d70: 29 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 61 74  ).    (set-megat
3d80: 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e  est-env-vars run
3d90: 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61  -id) ;; these ma
3da0: 79 20 62 65 20 6e 65 65 64 65 64 20 62 79 20 74  y be needed by t
3db0: 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f  he launching pro
3dc0: 63 65 73 73 0a 20 20 20 20 28 63 68 61 6e 67 65  cess.    (change
3dd0: 2d 64 69 72 65 63 74 6f 72 79 20 2a 74 6f 70 70  -directory *topp
3de0: 61 74 68 2a 29 0a 0a 20 20 20 20 3b 3b 20 48 65  ath*)..    ;; He
3df0: 72 65 20 69 73 20 77 68 65 72 65 20 74 68 65 20  re is where the 
3e00: 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20  test_meta table 
3e10: 69 73 20 62 65 73 74 20 75 70 64 61 74 65 64 0a  is best updated.
3e20: 20 20 20 20 3b 3b 20 59 65 73 2c 20 61 6e 6f 74      ;; Yes, anot
3e30: 68 65 72 20 75 73 65 20 6f 66 20 61 20 67 6c 6f  her use of a glo
3e40: 62 61 6c 20 66 6f 72 20 63 61 63 68 69 6e 67 2e  bal for caching.
3e50: 20 4e 65 65 64 20 61 20 62 65 74 74 65 72 20 77   Need a better w
3e60: 61 79 3f 0a 20 20 20 20 28 69 66 20 28 6e 6f 74  ay?.    (if (not
3e70: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
3e80: 2f 64 65 66 61 75 6c 74 20 2a 74 65 73 74 2d 6d  /default *test-m
3e90: 65 74 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73  eta-updated* tes
3ea0: 74 2d 6e 61 6d 65 20 23 66 29 29 0a 20 20 20 20  t-name #f)).    
3eb0: 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 28      (begin..   (
3ec0: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20  hash-table-set! 
3ed0: 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74  *test-meta-updat
3ee0: 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 74  ed* test-name #t
3ef0: 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 72 75  ).           (ru
3f00: 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d  ns:update-test_m
3f10: 65 74 61 20 74 65 73 74 2d 6e 61 6d 65 20 74 65  eta test-name te
3f20: 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 0a  st-conf))).    .
3f30: 20 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28      ;; (lambda (
3f40: 69 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72  itemdat) ;;; ((r
3f50: 69 70 65 6e 65 73 73 20 22 6f 76 65 72 72 69 70  ipeness "overrip
3f60: 65 22 29 20 28 74 65 6d 70 65 72 61 74 75 72 65  e") (temperature
3f70: 20 22 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e   "cool") (season
3f80: 20 22 73 75 6d 6d 65 72 22 29 29 0a 20 20 20 20   "summer")).    
3f90: 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74  (let* ((new-test
3fa0: 2d 70 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e  -path (string-in
3fb0: 74 65 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20  tersperse (cons 
3fc0: 74 65 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63  test-path (map c
3fd0: 61 64 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f  adr itemdat)) "/
3fe0: 22 29 29 0a 09 20 20 20 28 6e 65 77 2d 74 65 73  "))..   (new-tes
3ff0: 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61  t-name (if (equa
4000: 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29  l? item-path "")
4010: 20 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63   test-name (conc
4020: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69   test-name "/" i
4030: 74 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a  tem-path))) ;; j
4040: 75 73 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62  ust need it to b
4050: 65 20 75 6e 69 71 75 65 0a 09 20 20 20 28 74 65  e unique..   (te
4060: 73 74 2d 69 64 20 20 20 20 20 20 20 28 63 64 62  st-id       (cdb
4070: 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 67  :remote-run db:g
4080: 65 74 2d 74 65 73 74 2d 69 64 20 23 66 20 20 72  et-test-id #f  r
4090: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20  un-id test-name 
40a0: 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20  item-path))..   
40b0: 28 74 65 73 74 64 61 74 20 20 20 20 20 20 20 28  (testdat       (
40c0: 63 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66  cdb:get-test-inf
40d0: 6f 2d 62 79 2d 69 64 20 2a 72 75 6e 72 65 6d 6f  o-by-id *runremo
40e0: 74 65 2a 20 74 65 73 74 2d 69 64 29 29 29 0a 20  te* test-id))). 
40f0: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65       (if (not te
4100: 73 74 64 61 74 29 0a 09 20 20 28 62 65 67 69 6e  stdat)..  (begin
4110: 0a 09 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 20  ..    ;; ensure 
4120: 74 68 61 74 20 74 68 65 20 70 61 74 68 20 65 78  that the path ex
4130: 69 73 74 73 20 62 65 66 6f 72 65 20 72 65 67 69  ists before regi
4140: 73 74 65 72 69 6e 67 20 74 68 65 20 74 65 73 74  stering the test
4150: 0a 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43  ..    ;; NOPE: C
4160: 61 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f  annot! Don't kno
4170: 77 20 79 65 74 20 77 68 69 63 68 20 64 69 73 6b  w yet which disk
4180: 20 61 72 65 61 20 77 69 6c 6c 20 62 65 20 61 73   area will be as
4190: 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20  signed......    
41a0: 3b 3b 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63  ;; (system (conc
41b0: 20 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77   "mkdir -p " new
41c0: 2d 74 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20  -test-path))..  
41d0: 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 28 6f 70    ;;..    ;; (op
41e0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73  en-run-close tes
41f0: 74 73 3a 72 65 67 69 73 74 65 72 2d 74 65 73 74  ts:register-test
4200: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d   db run-id test-
4210: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a  name item-path).
4220: 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20  .    ;;..    ;; 
4230: 4e 42 2f 2f 20 66 6f 72 20 74 68 65 20 61 62 6f  NB// for the abo
4240: 76 65 20 6c 69 6e 65 2e 20 49 20 77 61 6e 74 20  ve line. I want 
4250: 74 68 65 20 74 65 73 74 20 74 6f 20 62 65 20 72  the test to be r
4260: 65 67 69 73 74 65 72 65 64 20 6c 6f 6e 67 20 62  egistered long b
4270: 65 66 6f 72 65 20 74 68 69 73 20 72 6f 75 74 69  efore this routi
4280: 6e 65 20 67 65 74 73 20 63 61 6c 6c 65 64 21 0a  ne gets called!.
4290: 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 28 73 65  .    ;;..    (se
42a0: 74 21 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e  t! test-id (open
42b0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65  -run-close db:ge
42c0: 74 2d 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e  t-test-id db run
42d0: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  -id test-name it
42e0: 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 20 28  em-path))..    (
42f0: 69 66 20 28 6e 6f 74 20 74 65 73 74 2d 69 64 29  if (not test-id)
4300: 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64  ...(begin...  (d
4310: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 57 41  ebug:print 2 "WA
4320: 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70 72 65  RN: Test not pre
4330: 2d 63 72 65 61 74 65 64 3f 20 74 65 73 74 2d 6e  -created? test-n
4340: 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65 20  ame=" test-name 
4350: 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d 22 20 69  ", item-path=" i
4360: 74 65 6d 2d 70 61 74 68 20 22 2c 20 72 75 6e 2d  tem-path ", run-
4370: 69 64 3d 22 20 72 75 6e 2d 69 64 29 0a 09 09 20  id=" run-id)... 
4380: 20 28 63 64 62 3a 74 65 73 74 73 2d 72 65 67 69   (cdb:tests-regi
4390: 73 74 65 72 2d 74 65 73 74 20 2a 72 75 6e 72 65  ster-test *runre
43a0: 6d 6f 74 65 2a 20 72 75 6e 2d 69 64 20 74 65 73  mote* run-id tes
43b0: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68  t-name item-path
43c0: 29 0a 09 09 20 20 28 73 65 74 21 20 74 65 73 74  )...  (set! test
43d0: 2d 69 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c  -id (open-run-cl
43e0: 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d  ose db:get-test-
43f0: 69 64 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73  id db run-id tes
4400: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68  t-name item-path
4410: 29 29 29 29 0a 09 20 20 20 20 28 64 65 62 75 67  ))))..    (debug
4420: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 74  :print-info 4 "t
4430: 65 73 74 2d 69 64 3d 22 20 74 65 73 74 2d 69 64  est-id=" test-id
4440: 20 22 2c 20 72 75 6e 2d 69 64 3d 22 20 72 75 6e   ", run-id=" run
4450: 2d 69 64 20 22 2c 20 74 65 73 74 2d 6e 61 6d 65  -id ", test-name
4460: 3d 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2c 20  =" test-name ", 
4470: 69 74 65 6d 2d 70 61 74 68 3d 5c 22 22 20 69 74  item-path=\"" it
4480: 65 6d 2d 70 61 74 68 20 22 5c 22 22 29 0a 09 20  em-path "\"").. 
4490: 20 20 20 28 73 65 74 21 20 74 65 73 74 64 61 74     (set! testdat
44a0: 20 28 63 64 62 3a 67 65 74 2d 74 65 73 74 2d 69   (cdb:get-test-i
44b0: 6e 66 6f 2d 62 79 2d 69 64 20 2a 72 75 6e 72 65  nfo-by-id *runre
44c0: 6d 6f 74 65 2a 20 74 65 73 74 2d 69 64 29 29 29  mote* test-id)))
44d0: 29 0a 20 20 20 20 20 20 28 73 65 74 21 20 74 65  ).      (set! te
44e0: 73 74 2d 69 64 20 28 64 62 3a 74 65 73 74 2d 67  st-id (db:test-g
44f0: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 0a  et-id testdat)).
4500: 20 20 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69        (change-di
4510: 72 65 63 74 6f 72 79 20 74 65 73 74 2d 70 61 74  rectory test-pat
4520: 68 29 0a 20 20 20 20 20 20 28 63 61 73 65 20 28  h).      (case (
4530: 69 66 20 66 6f 72 63 65 20 3b 3b 20 28 61 72 67  if force ;; (arg
4540: 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 63  s:get-arg "-forc
4550: 65 22 29 0a 09 09 27 4e 4f 54 5f 53 54 41 52 54  e")...'NOT_START
4560: 45 44 0a 09 09 28 69 66 20 74 65 73 74 64 61 74  ED...(if testdat
4570: 0a 09 09 20 20 20 20 28 73 74 72 69 6e 67 2d 3e  ...    (string->
4580: 73 79 6d 62 6f 6c 20 28 74 65 73 74 3a 67 65 74  symbol (test:get
4590: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29  -state testdat))
45a0: 0a 09 09 20 20 20 20 27 66 61 69 6c 65 64 2d 74  ...    'failed-t
45b0: 6f 2d 69 6e 73 65 72 74 29 29 0a 09 28 28 66 61  o-insert))..((fa
45c0: 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a  iled-to-insert).
45d0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30  . (debug:print 0
45e0: 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20   "ERROR: Failed 
45f0: 74 6f 20 69 6e 73 65 72 74 20 74 68 65 20 72 65  to insert the re
4600: 63 6f 72 64 20 69 6e 74 6f 20 74 68 65 20 64 62  cord into the db
4610: 22 29 29 0a 09 28 28 4e 4f 54 5f 53 54 41 52 54  "))..((NOT_START
4620: 45 44 20 43 4f 4d 50 4c 45 54 45 44 20 44 45 4c  ED COMPLETED DEL
4630: 45 54 45 44 29 0a 09 20 28 6c 65 74 20 28 28 72  ETED).. (let ((r
4640: 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20  unflag #f))..   
4650: 28 63 6f 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66  (cond..    ;; -f
4660: 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74  orce, run no mat
4670: 74 65 72 20 77 68 61 74 0a 09 20 20 20 20 28 66  ter what..    (f
4680: 6f 72 63 65 20 28 73 65 74 21 20 72 75 6e 66 6c  orce (set! runfl
4690: 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20  ag #t))..    ;; 
46a0: 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20 72 75 6e  NOT_STARTED, run
46b0: 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a   no matter what.
46c0: 09 20 20 20 20 28 28 6d 65 6d 62 65 72 20 28 74  .    ((member (t
46d0: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65  est:get-state te
46e0: 73 74 64 61 74 29 20 27 28 22 44 45 4c 45 54 45  stdat) '("DELETE
46f0: 44 22 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22  D" "NOT_STARTED"
4700: 29 29 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20  ))(set! runflag 
4710: 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f 74  #t))..    ;; not
4720: 20 2d 72 65 72 75 6e 20 61 6e 64 20 50 41 53 53   -rerun and PASS
4730: 2c 20 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c  , WARN or CHECK,
4740: 20 64 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20 20   do no run..    
4750: 28 28 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72  ((and (or (not r
4760: 65 72 75 6e 29 0a 09 09 20 20 20 20 20 20 6b 65  erun)...      ke
4770: 65 70 67 6f 69 6e 67 29 0a 09 09 20 20 3b 3b 20  epgoing)...  ;; 
4780: 52 65 71 75 69 72 65 20 74 6f 20 66 6f 72 63 65  Require to force
4790: 20 72 65 2d 72 75 6e 20 66 6f 72 20 43 4f 4d 50   re-run for COMP
47a0: 4c 45 54 45 44 20 6f 72 20 2a 61 6e 79 74 68 69  LETED or *anythi
47b0: 6e 67 2a 20 2b 20 50 41 53 53 2c 57 41 52 4e 20  ng* + PASS,WARN 
47c0: 6f 72 20 43 48 45 43 4b 0a 09 09 20 20 28 6f 72  or CHECK...  (or
47d0: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67   (member (test:g
47e0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
47f0: 74 29 20 27 28 22 50 41 53 53 22 20 22 57 41 52  t) '("PASS" "WAR
4800: 4e 22 20 22 43 48 45 43 4b 22 20 22 53 4b 49 50  N" "CHECK" "SKIP
4810: 22 29 29 0a 09 09 20 20 20 20 20 20 28 6d 65 6d  "))...      (mem
4820: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74  ber (test:get-st
4830: 61 74 65 20 20 74 65 73 74 64 61 74 29 20 27 28  ate  testdat) '(
4840: 22 43 4f 4d 50 4c 45 54 45 44 22 29 29 29 29 20  "COMPLETED")))) 
4850: 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  ..     (debug:pr
4860: 69 6e 74 2d 69 6e 66 6f 20 32 20 22 72 75 6e 6e  int-info 2 "runn
4870: 69 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 2d  ing test " test-
4880: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
4890: 74 68 20 22 20 73 75 70 70 72 65 73 73 65 64 20  th " suppressed 
48a0: 61 73 20 69 74 20 69 73 20 22 20 28 74 65 73 74  as it is " (test
48b0: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
48c0: 61 74 29 20 22 20 61 6e 64 20 22 20 28 74 65 73  at) " and " (tes
48d0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
48e0: 74 64 61 74 29 29 0a 09 20 20 20 20 20 28 73 65  tdat))..     (se
48f0: 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a  t! runflag #f)).
4900: 09 20 20 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61  .    ;; -rerun a
4910: 6e 64 20 73 74 61 74 75 73 20 69 73 20 6f 6e 65  nd status is one
4920: 20 6f 66 20 74 68 65 20 73 70 65 63 69 66 65 64   of the specifed
4930: 2c 20 72 75 6e 20 69 74 0a 09 20 20 20 20 28 28  , run it..    ((
4940: 61 6e 64 20 72 65 72 75 6e 0a 09 09 20 20 28 6c  and rerun...  (l
4950: 65 74 2a 20 28 28 72 65 72 75 6e 6c 73 74 20 20  et* ((rerunlst  
4960: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 72   (string-split r
4970: 65 72 75 6e 20 22 2c 22 29 29 0a 09 09 09 20 28  erun ",")).... (
4980: 6d 75 73 74 2d 72 65 72 75 6e 20 28 6d 65 6d 62  must-rerun (memb
4990: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  er (test:get-sta
49a0: 74 75 73 20 74 65 73 74 64 61 74 29 20 72 65 72  tus testdat) rer
49b0: 75 6e 6c 73 74 29 29 29 0a 09 09 20 20 20 20 28  unlst)))...    (
49c0: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
49d0: 20 33 20 22 2d 72 65 72 75 6e 20 6c 69 73 74 3a   3 "-rerun list:
49e0: 20 22 20 72 65 72 75 6e 20 22 2c 20 74 65 73 74   " rerun ", test
49f0: 2d 73 74 61 74 75 73 3a 20 22 20 28 74 65 73 74  -status: " (test
4a00: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74  :get-status test
4a10: 64 61 74 29 22 2c 20 6d 75 73 74 2d 72 65 72 75  dat)", must-reru
4a20: 6e 3a 20 22 20 6d 75 73 74 2d 72 65 72 75 6e 29  n: " must-rerun)
4a30: 0a 09 09 20 20 20 20 6d 75 73 74 2d 72 65 72 75  ...    must-reru
4a40: 6e 29 29 0a 09 20 20 20 20 20 28 64 65 62 75 67  n))..     (debug
4a50: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22 52  :print-info 2 "R
4a60: 65 72 75 6e 20 66 6f 72 63 65 64 20 66 6f 72 20  erun forced for 
4a70: 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65  test " test-name
4a80: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 0a   "/" item-path).
4a90: 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66  .     (set! runf
4aa0: 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b  lag #t))..    ;;
4ab0: 20 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20   -keepgoing, do 
4ac0: 6e 6f 74 20 72 65 72 75 6e 20 46 41 49 4c 0a 09  not rerun FAIL..
4ad0: 20 20 20 20 28 28 61 6e 64 20 6b 65 65 70 67 6f      ((and keepgo
4ae0: 69 6e 67 0a 09 09 20 20 28 6d 65 6d 62 65 72 20  ing...  (member 
4af0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
4b00: 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49   testdat) '("FAI
4b10: 4c 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 74  L")))..     (set
4b20: 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09  ! runflag #f))..
4b30: 20 20 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 72      ((and (not r
4b40: 65 72 75 6e 29 0a 09 09 20 20 28 6d 65 6d 62 65  erun)...  (membe
4b50: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  r (test:get-stat
4b60: 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 46  us testdat) '("F
4b70: 41 49 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09 20  AIL" "n/a"))).. 
4b80: 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61      (set! runfla
4b90: 67 20 23 74 29 29 0a 09 20 20 20 20 28 65 6c 73  g #t))..    (els
4ba0: 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20  e (set! runflag 
4bb0: 23 66 29 29 29 0a 09 20 20 20 28 64 65 62 75 67  #f)))..   (debug
4bc0: 3a 70 72 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e  :print 6 "RUNNIN
4bd0: 47 20 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20  G => runflag: " 
4be0: 72 75 6e 66 6c 61 67 20 22 20 53 54 41 54 45 3a  runflag " STATE:
4bf0: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
4c00: 74 65 20 74 65 73 74 64 61 74 29 20 22 20 53 54  te testdat) " ST
4c10: 41 54 55 53 3a 20 22 20 28 74 65 73 74 3a 67 65  ATUS: " (test:ge
4c20: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74  t-status testdat
4c30: 29 29 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20  ))..   (if (not 
4c40: 72 75 6e 66 6c 61 67 29 0a 09 20 20 20 20 20 20  runflag)..      
4c50: 20 28 69 66 20 28 6e 6f 74 20 70 61 72 65 6e 74   (if (not parent
4c60: 2d 74 65 73 74 29 0a 09 09 20 20 20 28 64 65 62  -test)...   (deb
4c70: 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45  ug:print 1 "NOTE
4c80: 3a 20 4e 6f 74 20 73 74 61 72 74 69 6e 67 20 74  : Not starting t
4c90: 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e  est " new-test-n
4ca0: 61 6d 65 20 22 20 61 73 20 69 74 20 69 73 20 73  ame " as it is s
4cb0: 74 61 74 65 20 5c 22 22 20 28 74 65 73 74 3a 67  tate \"" (test:g
4cc0: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74  et-state testdat
4cd0: 29 20 0a 09 09 09 09 22 5c 22 20 61 6e 64 20 73  ) ....."\" and s
4ce0: 74 61 74 75 73 20 5c 22 22 20 28 74 65 73 74 3a  tatus \"" (test:
4cf0: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
4d00: 61 74 29 20 22 5c 22 2c 20 75 73 65 20 2d 72 65  at) "\", use -re
4d10: 72 75 6e 20 5c 22 22 20 28 74 65 73 74 3a 67 65  run \"" (test:ge
4d20: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74  t-status testdat
4d30: 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ).              
4d40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
4d50: 20 20 22 5c 22 20 6f 72 20 2d 66 6f 72 63 65 20    "\" or -force 
4d60: 74 6f 20 6f 76 65 72 72 69 64 65 22 29 29 0a 09  to override"))..
4d70: 20 20 20 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20         ;; NOTE: 
4d80: 4e 6f 20 6c 6f 6e 67 65 72 20 62 65 20 63 68 65  No longer be che
4d90: 63 6b 69 6e 67 20 70 72 65 72 65 71 75 69 73 69  cking prerequisi
4da0: 74 65 73 20 68 65 72 65 21 20 57 69 6c 6c 20 6e  tes here! Will n
4db0: 65 76 65 72 20 67 65 74 20 68 65 72 65 20 75 6e  ever get here un
4dc0: 6c 65 73 73 20 70 72 65 72 65 71 73 20 61 72 65  less prereqs are
4dd0: 0a 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 20  ..       ;;     
4de0: 20 20 61 6c 72 65 61 64 79 20 6d 65 74 2e 0a 09    already met...
4df0: 20 20 20 20 20 20 20 3b 3b 20 54 68 69 73 20 77         ;; This w
4e00: 6f 75 6c 64 20 62 65 20 61 20 67 72 65 61 74 20  ould be a great 
4e10: 70 6c 61 63 65 20 74 6f 20 64 6f 20 74 68 65 20  place to do the 
4e20: 70 72 6f 63 65 73 73 2d 66 6f 72 6b 0a 09 20 20  process-fork..  
4e30: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6c       (if (not (l
4e40: 61 75 6e 63 68 2d 74 65 73 74 20 72 75 6e 2d 69  aunch-test run-i
4e50: 64 20 72 75 6e 2d 69 6e 66 6f 20 6b 65 79 2d 76  d run-info key-v
4e60: 61 6c 73 20 72 75 6e 6e 61 6d 65 20 74 65 73 74  als runname test
4e70: 2d 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20  -conf keyvallst 
4e80: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70  test-name test-p
4e90: 61 74 68 20 69 74 65 6d 64 61 74 20 66 6c 61 67  ath itemdat flag
4ea0: 73 29 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a  s))...   (begin.
4eb0: 09 09 20 20 20 20 20 28 70 72 69 6e 74 20 22 45  ..     (print "E
4ec0: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20  RROR: Failed to 
4ed0: 6c 61 75 6e 63 68 20 74 68 65 20 74 65 73 74 2e  launch the test.
4ee0: 20 45 78 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e   Exiting as soon
4ef0: 20 61 73 20 70 6f 73 73 69 62 6c 65 22 29 0a 09   as possible")..
4f00: 09 20 20 20 20 20 28 73 65 74 21 20 2a 67 6c 6f  .     (set! *glo
4f10: 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31  balexitstatus* 1
4f20: 29 20 3b 3b 20 0a 09 09 20 20 20 20 20 28 70 72  ) ;; ...     (pr
4f30: 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75  ocess-signal (cu
4f40: 72 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64  rrent-process-id
4f50: 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29  ) signal/kill)))
4f60: 29 29 29 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a  )))..((KILLED) .
4f70: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31  . (debug:print 1
4f80: 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65   "NOTE: " new-te
4f90: 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72  st-name " is alr
4fa0: 65 61 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20  eady running or 
4fb0: 77 61 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69  was explictly ki
4fc0: 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65  lled, use -force
4fd0: 20 74 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29   to launch it.")
4fe0: 29 0a 09 28 28 4c 41 55 4e 43 48 45 44 20 52 45  )..((LAUNCHED RE
4ff0: 4d 4f 54 45 48 4f 53 54 53 54 41 52 54 20 52 55  MOTEHOSTSTART RU
5000: 4e 4e 49 4e 47 29 20 20 0a 09 20 28 69 66 20 28  NNING)  .. (if (
5010: 3e 20 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 65  > (- (current-se
5020: 63 6f 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 73  conds)(+ (db:tes
5030: 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65  t-get-event_time
5040: 20 74 65 73 74 64 61 74 29 0a 09 09 09 09 20 20   testdat).....  
5050: 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65       (db:test-ge
5060: 74 2d 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74  t-run_duration t
5070: 65 73 74 64 61 74 29 29 29 0a 09 09 36 30 30 29  estdat)))...600)
5080: 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61   ;; i.e. no upda
5090: 74 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e  te for more than
50a0: 20 36 30 30 20 73 65 63 6f 6e 64 73 0a 09 20 20   600 seconds..  
50b0: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20     (begin..     
50c0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
50d0: 20 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20   "WARNING: Test 
50e0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70  " test-name " ap
50f0: 70 65 61 72 73 20 74 6f 20 62 65 20 64 65 61 64  pears to be dead
5100: 2e 20 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20  . Forcing it to 
5110: 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45  state INCOMPLETE
5120: 20 61 6e 64 20 73 74 61 74 75 73 20 53 54 55 43   and status STUC
5130: 4b 2f 44 45 41 44 22 29 0a 09 20 20 20 20 20 20  K/DEAD")..      
5140: 20 28 74 65 73 74 73 3a 74 65 73 74 2d 73 65 74   (tests:test-set
5150: 2d 73 74 61 74 75 73 21 20 74 65 73 74 2d 69 64  -status! test-id
5160: 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22 53   "INCOMPLETE" "S
5170: 54 55 43 4b 2f 44 45 41 44 22 20 22 54 65 73 74  TUCK/DEAD" "Test
5180: 20 69 73 20 73 74 75 63 6b 20 6f 72 20 64 65 61   is stuck or dea
5190: 64 22 20 23 66 29 29 0a 09 20 20 20 20 20 28 64  d" #f))..     (d
51a0: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f  ebug:print 2 "NO
51b0: 54 45 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  TE: " test-name 
51c0: 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e  " is already run
51d0: 6e 69 6e 67 22 29 29 29 0a 09 28 65 6c 73 65 20  ning")))..(else 
51e0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
51f0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69  nt 0 "ERROR: Fai
5200: 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 65  led to launch te
5210: 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61  st " new-test-na
5220: 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73  me ". Unrecognis
5230: 65 64 20 73 74 61 74 65 20 22 20 28 74 65 73 74  ed state " (test
5240: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
5250: 61 74 29 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d  at)))))))..;;===
5260: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5270: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5280: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5290: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
52a0: 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e 45  ===.;; END OF NE
52b0: 57 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d  W STUFF.;;======
52c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
52d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
52e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
52f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5300: 0a 0a 28 64 65 66 69 6e 65 20 28 67 65 74 2d 64  ..(define (get-d
5310: 69 72 2d 75 70 2d 6e 20 64 69 72 20 2e 20 70 61  ir-up-n dir . pa
5320: 72 61 6d 73 29 20 0a 20 20 28 6c 65 74 20 28 28  rams) .  (let ((
5330: 64 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d  dparts  (string-
5340: 73 70 6c 69 74 20 64 69 72 20 22 2f 22 29 29 0a  split dir "/")).
5350: 09 28 63 6f 75 6e 74 20 20 20 28 69 66 20 28 6e  .(count   (if (n
5360: 75 6c 6c 3f 20 70 61 72 61 6d 73 29 20 31 20 28  ull? params) 1 (
5370: 63 61 72 20 70 61 72 61 6d 73 29 29 29 29 0a 20  car params)))). 
5380: 20 20 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74     (conc "/" (st
5390: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
53a0: 20 0a 09 20 20 20 20 20 20 20 28 74 61 6b 65 20   ..       (take 
53b0: 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74  dparts (- (lengt
53c0: 68 20 64 70 61 72 74 73 29 20 63 6f 75 6e 74 29  h dparts) count)
53d0: 29 0a 09 20 20 20 20 20 20 20 22 2f 22 29 29 29  )..       "/")))
53e0: 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73  ).;; Remove runs
53f0: 0a 3b 3b 20 66 69 65 6c 64 73 20 61 72 65 20 70  .;; fields are p
5400: 61 73 73 69 6e 67 20 69 6e 20 74 68 72 6f 75 67  assing in throug
5410: 68 20 0a 3b 3b 20 61 63 74 69 6f 6e 3a 0a 3b 3b  h .;; action:.;;
5420: 20 20 20 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73      'remove-runs
5430: 0a 3b 3b 20 20 20 20 27 73 65 74 2d 73 74 61 74  .;;    'set-stat
5440: 65 2d 73 74 61 74 75 73 0a 3b 3b 0a 3b 3b 20 4e  e-status.;;.;; N
5450: 42 2f 2f 20 73 68 6f 75 6c 64 20 70 61 73 73 20  B// should pass 
5460: 69 6e 20 6b 65 79 73 3f 0a 3b 3b 0a 28 64 65 66  in keys?.;;.(def
5470: 69 6e 65 20 28 72 75 6e 73 3a 6f 70 65 72 61 74  ine (runs:operat
5480: 65 2d 6f 6e 20 61 63 74 69 6f 6e 20 72 75 6e 6e  e-on action runn
5490: 61 6d 65 70 61 74 74 20 74 65 73 74 70 61 74 74  amepatt testpatt
54a0: 20 23 21 6b 65 79 20 28 73 74 61 74 65 20 23 66   #!key (state #f
54b0: 29 28 73 74 61 74 75 73 20 23 66 29 28 6e 65 77  )(status #f)(new
54c0: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 23 66  -state-status #f
54d0: 29 29 0a 20 20 28 63 6f 6d 6d 6f 6e 3a 63 6c 65  )).  (common:cle
54e0: 61 72 2d 63 61 63 68 65 73 29 20 3b 3b 20 63 6c  ar-caches) ;; cl
54f0: 65 61 72 20 61 6c 6c 20 63 61 63 68 65 73 0a 20  ear all caches. 
5500: 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20   (let* ((db     
5510: 20 20 20 20 20 20 23 66 29 0a 09 20 28 6b 65 79        #f).. (key
5520: 73 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d  s         (open-
5530: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
5540: 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 28 72 75  -keys db)).. (ru
5550: 6e 64 61 74 20 20 20 20 20 20 20 28 6f 70 65 6e  ndat       (open
5560: 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a  -run-close runs:
5570: 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74  get-runs-by-patt
5580: 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65   db keys runname
5590: 70 61 74 74 29 29 0a 09 20 28 68 65 61 64 65 72  patt)).. (header
55a0: 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72         (vector-r
55b0: 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20  ef rundat 0)).. 
55c0: 28 72 75 6e 73 20 20 20 20 20 20 20 20 20 28 76  (runs         (v
55d0: 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74  ector-ref rundat
55e0: 20 31 29 29 0a 09 20 28 73 74 61 74 65 73 20 20   1)).. (states  
55f0: 20 20 20 20 20 28 69 66 20 73 74 61 74 65 20 20       (if state  
5600: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74  (string-split st
5610: 61 74 65 20 20 22 2c 22 29 20 27 28 29 29 29 0a  ate  ",") '())).
5620: 09 20 28 73 74 61 74 75 73 65 73 20 20 20 20 20  . (statuses     
5630: 28 69 66 20 73 74 61 74 75 73 20 28 73 74 72 69  (if status (stri
5640: 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 75 73 20  ng-split status 
5650: 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 74  ",") '())).. (st
5660: 61 74 65 2d 73 74 61 74 75 73 20 28 69 66 20 28  ate-status (if (
5670: 73 74 72 69 6e 67 3f 20 6e 65 77 2d 73 74 61 74  string? new-stat
5680: 65 2d 73 74 61 74 75 73 29 20 28 73 74 72 69 6e  e-status) (strin
5690: 67 2d 73 70 6c 69 74 20 6e 65 77 2d 73 74 61 74  g-split new-stat
56a0: 65 2d 73 74 61 74 75 73 20 22 2c 22 29 20 27 28  e-status ",") '(
56b0: 23 66 20 23 66 29 29 29 29 0a 20 20 20 20 28 64  #f #f)))).    (d
56c0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
56d0: 34 20 22 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d  4 "runs:operate-
56e0: 6f 6e 20 3d 3e 20 48 65 61 64 65 72 3a 20 22 20  on => Header: " 
56f0: 68 65 61 64 65 72 20 22 20 61 63 74 69 6f 6e 3a  header " action:
5700: 20 22 20 61 63 74 69 6f 6e 20 22 20 6e 65 77 2d   " action " new-
5710: 73 74 61 74 65 2d 73 74 61 74 75 73 3a 20 22 20  state-status: " 
5720: 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73  new-state-status
5730: 29 0a 20 20 20 20 28 69 66 20 28 3e 20 32 20 28  ).    (if (> 2 (
5740: 6c 65 6e 67 74 68 20 73 74 61 74 65 2d 73 74 61  length state-sta
5750: 74 75 73 29 29 0a 09 28 62 65 67 69 6e 0a 09 20  tus))..(begin.. 
5760: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
5770: 22 45 52 52 4f 52 3a 20 74 68 65 20 70 61 72 61  "ERROR: the para
5780: 6d 65 74 65 72 20 74 6f 20 2d 73 65 74 2d 73 74  meter to -set-st
5790: 61 74 65 2d 73 74 61 74 75 73 20 69 73 20 61 20  ate-status is a 
57a0: 63 6f 6d 6d 61 20 64 65 6c 69 6d 69 74 65 64 20  comma delimited 
57b0: 73 74 72 69 6e 67 2e 20 45 2e 67 2e 20 43 4f 4d  string. E.g. COM
57c0: 50 4c 45 54 45 44 2c 46 41 49 4c 22 29 0a 09 20  PLETED,FAIL").. 
57d0: 20 28 65 78 69 74 29 29 29 0a 20 20 20 20 28 66   (exit))).    (f
57e0: 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61  or-each.     (la
57f0: 6d 62 64 61 20 28 72 75 6e 29 0a 20 20 20 20 20  mbda (run).     
5800: 20 20 28 6c 65 74 20 28 28 72 75 6e 6b 65 79 20    (let ((runkey 
5810: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65  (string-interspe
5820: 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61  rse (map (lambda
5830: 20 28 6b 29 0a 09 09 09 09 09 09 28 64 62 3a 67   (k).......(db:g
5840: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
5850: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 28 76  er run header (v
5860: 65 63 74 6f 72 2d 72 65 66 20 6b 20 30 29 29 29  ector-ref k 0)))
5870: 20 6b 65 79 73 29 20 22 2f 22 29 29 0a 09 20 20   keys) "/"))..  
5880: 20 20 20 28 64 69 72 73 2d 74 6f 2d 72 65 6d 6f     (dirs-to-remo
5890: 76 65 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61  ve (make-hash-ta
58a0: 62 6c 65 29 29 29 0a 09 20 28 6c 65 74 2a 20 28  ble))).. (let* (
58b0: 28 72 75 6e 2d 69 64 20 20 20 20 28 64 62 3a 67  (run-id    (db:g
58c0: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
58d0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69  er run header "i
58e0: 64 22 29 29 0a 09 09 28 72 75 6e 2d 73 74 61 74  d"))...(run-stat
58f0: 65 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  e (db:get-value-
5900: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
5910: 61 64 65 72 20 22 73 74 61 74 65 22 29 29 0a 09  ader "state"))..
5920: 09 28 74 65 73 74 73 20 20 20 20 20 28 69 66 20  .(tests     (if 
5930: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 72 75 6e  (not (equal? run
5940: 2d 73 74 61 74 65 20 22 6c 6f 63 6b 65 64 22 29  -state "locked")
5950: 29 0a 09 09 09 20 20 20 20 20 20 20 28 6f 70 65  )....       (ope
5960: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67  n-run-close db:g
5970: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e  et-tests-for-run
5980: 20 64 62 20 72 75 6e 2d 69 64 0a 09 09 09 09 09   db run-id......
5990: 09 20 20 20 20 20 20 74 65 73 74 70 61 74 74 20  .      testpatt 
59a0: 73 74 61 74 65 73 20 73 74 61 74 75 73 65 73 0a  states statuses.
59b0: 09 09 09 09 09 09 20 20 20 20 20 20 6e 6f 74 2d  ......      not-
59c0: 69 6e 3a 20 20 23 66 0a 09 09 09 09 09 09 20 20  in:  #f.......  
59d0: 20 20 20 20 73 6f 72 74 2d 62 79 3a 20 28 63 61      sort-by: (ca
59e0: 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 09 09 09  se action.......
59f0: 09 09 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73  .. ((remove-runs
5a00: 29 20 27 72 75 6e 64 69 72 29 0a 09 09 09 09 09  ) 'rundir)......
5a10: 09 09 09 20 28 65 6c 73 65 20 20 20 20 20 20 20  ... (else       
5a20: 20 20 20 27 65 76 65 6e 74 5f 74 69 6d 65 29 29     'event_time))
5a30: 29 0a 09 09 09 20 20 20 20 20 20 20 27 28 29 29  )....       '())
5a40: 29 0a 09 09 28 6c 61 73 74 74 70 61 74 68 20 22  )...(lasttpath "
5a50: 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f  /does/not/exist/
5a60: 49 2f 68 6f 70 65 22 29 29 0a 09 20 20 20 28 64  I/hope"))..   (d
5a70: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
5a80: 34 20 22 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d  4 "runs:operate-
5a90: 6f 6e 20 72 75 6e 3d 22 20 72 75 6e 20 22 2c 20  on run=" run ", 
5aa0: 68 65 61 64 65 72 3d 22 20 68 65 61 64 65 72 29  header=" header)
5ab0: 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e  ..   (if (not (n
5ac0: 75 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 20  ull? tests))..  
5ad0: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 28       (begin... (
5ae0: 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 20 20  case action...  
5af0: 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a   ((remove-runs).
5b00: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
5b10: 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 74  nt 1 "Removing t
5b20: 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20  ests for run: " 
5b30: 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67  runkey " " (db:g
5b40: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
5b50: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72  er run header "r
5b60: 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20  unname")))...   
5b70: 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74  ((set-state-stat
5b80: 75 73 29 0a 09 09 20 20 20 20 28 64 65 62 75 67  us)...    (debug
5b90: 3a 70 72 69 6e 74 20 31 20 22 4d 6f 64 69 66 79  :print 1 "Modify
5ba0: 69 6e 67 20 73 74 61 74 65 20 61 6e 64 20 73 74  ing state and st
5bb0: 61 75 73 20 66 6f 72 20 74 65 73 74 73 20 66 6f  aus for tests fo
5bc0: 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20  r run: " runkey 
5bd0: 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75  " " (db:get-valu
5be0: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20  e-by-header run 
5bf0: 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22  header "runname"
5c00: 29 29 29 0a 09 09 20 20 20 28 28 70 72 69 6e 74  )))...   ((print
5c10: 2d 72 75 6e 29 0a 09 09 20 20 20 20 28 64 65 62  -run)...    (deb
5c20: 75 67 3a 70 72 69 6e 74 20 31 20 22 50 72 69 6e  ug:print 1 "Prin
5c30: 74 69 6e 67 20 69 6e 66 6f 20 66 6f 72 20 72 75  ting info for ru
5c40: 6e 20 22 20 72 75 6e 6b 65 79 20 22 2c 20 72 75  n " runkey ", ru
5c50: 6e 3d 22 20 72 75 6e 20 22 2c 20 74 65 73 74 73  n=" run ", tests
5c60: 3d 22 20 74 65 73 74 73 20 22 2c 20 68 65 61 64  =" tests ", head
5c70: 65 72 3d 22 20 68 65 61 64 65 72 29 0a 09 09 20  er=" header)... 
5c80: 20 20 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 20     action)...   
5c90: 28 65 6c 73 65 0a 09 09 20 20 20 20 28 64 65 62  (else...    (deb
5ca0: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30 20  ug:print-info 0 
5cb0: 22 61 63 74 69 6f 6e 20 6e 6f 74 20 72 65 63 6f  "action not reco
5cc0: 67 6e 69 73 65 64 20 22 20 61 63 74 69 6f 6e 29  gnised " action)
5cd0: 29 29 0a 09 09 20 28 66 6f 72 2d 65 61 63 68 0a  ))... (for-each.
5ce0: 09 09 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73  ..  (lambda (tes
5cf0: 74 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28  t)...    (let* (
5d00: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74  (item-path (db:t
5d10: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74  est-get-item-pat
5d20: 68 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28  h test))....   (
5d30: 74 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a 74 65  test-name (db:te
5d40: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  st-get-testname 
5d50: 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 72 75  test))....   (ru
5d60: 6e 2d 64 69 72 20 20 20 28 64 62 3a 74 65 73 74  n-dir   (db:test
5d70: 2d 67 65 74 2d 72 75 6e 64 69 72 20 74 65 73 74  -get-rundir test
5d80: 29 29 20 20 20 20 3b 3b 20 72 75 6e 20 64 69 72  ))    ;; run dir
5d90: 20 69 73 20 66 72 6f 6d 20 74 68 65 20 6c 69 6e   is from the lin
5da0: 6b 20 74 72 65 65 0a 09 09 09 20 20 20 28 72 65  k tree....   (re
5db0: 61 6c 2d 64 69 72 20 20 28 69 66 20 28 66 69 6c  al-dir  (if (fil
5dc0: 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d 64 69  e-exists? run-di
5dd0: 72 29 0a 09 09 09 09 09 20 20 28 72 65 73 6f 6c  r)......  (resol
5de0: 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d  ve-pathname run-
5df0: 64 69 72 29 0a 09 09 09 09 09 20 20 23 66 29 29  dir)......  #f))
5e00: 0a 09 09 09 20 20 20 28 74 65 73 74 2d 69 64 20  ....   (test-id 
5e10: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69    (db:test-get-i
5e20: 64 20 74 65 73 74 29 29 29 0a 09 09 20 20 20 20  d test)))...    
5e30: 20 20 3b 3b 20 20 20 28 74 64 62 20 20 20 20 20    ;;   (tdb     
5e40: 20 20 28 64 62 3a 6f 70 65 6e 2d 74 65 73 74 2d    (db:open-test-
5e50: 64 62 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09  db run-dir)))...
5e60: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
5e70: 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 3d  nt-info 4 "test=
5e80: 22 20 74 65 73 74 29 20 3b 3b 20 20 20 22 20 28  " test) ;;   " (
5e90: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74  db:test-get-test
5ea0: 6e 61 6d 65 20 74 65 73 74 29 20 22 20 69 64 3a  name test) " id:
5eb0: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d   " (db:test-get-
5ec0: 69 64 20 74 65 73 74 29 20 22 20 22 20 69 74 65  id test) " " ite
5ed0: 6d 2d 70 61 74 68 20 22 20 61 63 74 69 6f 6e 3a  m-path " action:
5ee0: 20 22 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 20   " action)...   
5ef0: 20 20 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a     (case action.
5f00: 09 09 09 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73  ...((remove-runs
5f10: 29 20 3b 3b 20 74 68 65 20 74 64 62 20 69 73 20  ) ;; the tdb is 
5f20: 66 6f 72 20 66 75 74 75 72 65 20 70 6f 73 73 69  for future possi
5f30: 62 6c 65 2e 20 0a 09 09 09 20 28 6f 70 65 6e 2d  ble. .... (open-
5f40: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c  run-close db:del
5f50: 65 74 65 2d 74 65 73 74 2d 72 65 63 6f 72 64 73  ete-test-records
5f60: 20 64 62 20 23 66 20 28 64 62 3a 74 65 73 74 2d   db #f (db:test-
5f70: 67 65 74 2d 69 64 20 74 65 73 74 29 29 0a 09 09  get-id test))...
5f80: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69  . (debug:print-i
5f90: 6e 66 6f 20 31 20 22 41 74 74 65 6d 70 74 69 6e  nfo 1 "Attemptin
5fa0: 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 28 69  g to remove " (i
5fb0: 66 20 72 65 61 6c 2d 64 69 72 20 28 63 6f 6e 63  f real-dir (conc
5fc0: 20 22 20 64 69 72 20 22 20 72 65 61 6c 2d 64 69   " dir " real-di
5fd0: 72 20 22 20 61 6e 64 20 22 29 20 22 22 29 20 22  r " and ") "") "
5fe0: 20 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 29   link " run-dir)
5ff0: 0a 09 09 09 20 28 69 66 20 28 61 6e 64 20 72 65  .... (if (and re
6000: 61 6c 2d 64 69 72 20 0a 09 09 09 09 20 20 28 3e  al-dir .....  (>
6010: 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20   (string-length 
6020: 72 65 61 6c 2d 64 69 72 29 20 35 29 0a 09 09 09  real-dir) 5)....
6030: 09 20 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f  .  (file-exists?
6040: 20 72 65 61 6c 2d 64 69 72 29 29 20 3b 3b 20 62   real-dir)) ;; b
6050: 61 64 20 68 65 75 72 69 73 74 69 63 20 62 75 74  ad heuristic but
6060: 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 20   should prevent 
6070: 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a  /tmp /home etc..
6080: 09 09 09 20 20 20 20 20 28 62 65 67 69 6e 20 3b  ...     (begin ;
6090: 3b 20 6c 65 74 2a 20 28 28 72 65 61 6c 70 61 74  ; let* ((realpat
60a0: 68 20 28 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e  h (resolve-pathn
60b0: 61 6d 65 20 72 75 6e 2d 64 69 72 29 29 29 0a 09  ame run-dir)))..
60c0: 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a  ..       (debug:
60d0: 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 52 65  print-info 1 "Re
60e0: 63 75 72 73 69 76 65 6c 79 20 72 65 6d 6f 76 69  cursively removi
60f0: 6e 67 20 22 20 72 65 61 6c 2d 64 69 72 29 0a 09  ng " real-dir)..
6100: 09 09 20 20 20 20 20 20 20 28 69 66 20 28 66 69  ..       (if (fi
6110: 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c 2d  le-exists? real-
6120: 64 69 72 29 0a 09 09 09 09 20 20 20 28 69 66 20  dir).....   (if 
6130: 28 3e 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63  (> (system (conc
6140: 20 22 72 6d 20 2d 72 66 20 22 20 72 65 61 6c 2d   "rm -rf " real-
6150: 64 69 72 29 29 20 30 29 0a 09 09 09 09 20 20 20  dir)) 0).....   
6160: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
6170: 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 72 65   0 "ERROR: There
6180: 20 77 61 73 20 61 20 70 72 6f 62 6c 65 6d 20 72   was a problem r
6190: 65 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c 2d 64  emoving " real-d
61a0: 69 72 20 22 20 77 69 74 68 20 72 6d 20 2d 66 22  ir " with rm -f"
61b0: 29 29 0a 09 09 09 09 20 20 20 28 64 65 62 75 67  )).....   (debug
61c0: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e  :print 0 "WARNIN
61d0: 47 3a 20 74 65 73 74 20 64 69 72 20 22 20 72 65  G: test dir " re
61e0: 61 6c 2d 64 69 72 20 22 20 61 70 70 65 61 72 73  al-dir " appears
61f0: 20 74 6f 20 6e 6f 74 20 65 78 69 73 74 20 6f 72   to not exist or
6200: 20 69 73 20 6e 6f 74 20 72 65 61 64 61 62 6c 65   is not readable
6210: 22 29 29 29 0a 09 09 09 20 20 20 20 20 28 69 66  ")))....     (if
6220: 20 72 65 61 6c 2d 64 69 72 20 0a 09 09 09 09 20   real-dir ..... 
6230: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
6240: 57 41 52 4e 49 4e 47 3a 20 64 69 72 65 63 74 6f  WARNING: directo
6250: 72 79 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20  ry " real-dir " 
6260: 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 22 29  does not exist")
6270: 0a 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ..... (debug:pri
6280: 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 6e  nt 0 "WARNING: n
6290: 6f 20 72 65 61 6c 20 64 69 72 65 63 74 6f 72 79  o real directory
62a0: 20 63 6f 72 72 6f 73 70 6f 6e 64 69 6e 67 20 74   corrosponding t
62b0: 6f 20 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72  o link " run-dir
62c0: 20 22 2c 20 6e 6f 74 68 69 6e 67 20 64 6f 6e 65   ", nothing done
62d0: 22 29 29 29 0a 09 09 09 20 28 69 66 20 28 73 79  "))).... (if (sy
62e0: 6d 62 6f 6c 69 63 2d 6c 69 6e 6b 3f 20 72 75 6e  mbolic-link? run
62f0: 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20 28 62  -dir)....     (b
6300: 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20 20 28  egin....       (
6310: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
6320: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 73 79 6d   1 "Removing sym
6330: 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 29 0a  link " run-dir).
6340: 09 09 09 20 20 20 20 20 20 20 28 68 61 6e 64 6c  ...       (handl
6350: 65 2d 65 78 63 65 70 74 69 6f 6e 73 0a 09 09 09  e-exceptions....
6360: 09 65 78 6e 0a 09 09 09 09 28 64 65 62 75 67 3a  .exn.....(debug:
6370: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
6380: 20 46 61 69 6c 65 64 20 74 6f 20 72 65 6d 6f 76   Failed to remov
6390: 65 20 73 79 6d 6c 69 6e 6b 20 22 20 72 75 6e 2d  e symlink " run-
63a0: 64 69 72 20 28 28 63 6f 6e 64 69 74 69 6f 6e 2d  dir ((condition-
63b0: 70 72 6f 70 65 72 74 79 2d 61 63 63 65 73 73 6f  property-accesso
63c0: 72 20 27 65 78 6e 20 27 6d 65 73 73 61 67 65 29  r 'exn 'message)
63d0: 20 65 78 6e 29 20 22 2c 20 61 74 74 65 6d 70 74   exn) ", attempt
63e0: 69 6e 67 20 74 6f 20 63 6f 6e 74 69 6e 75 65 22  ing to continue"
63f0: 29 0a 09 09 09 09 28 64 65 6c 65 74 65 2d 66 69  ).....(delete-fi
6400: 6c 65 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09  le run-dir)))...
6410: 09 20 20 20 20 20 28 69 66 20 28 64 69 72 65 63  .     (if (direc
6420: 74 6f 72 79 3f 20 72 75 6e 2d 64 69 72 29 0a 09  tory? run-dir)..
6430: 09 09 09 20 28 69 66 20 28 3e 20 28 64 69 72 65  ... (if (> (dire
6440: 63 74 6f 72 79 2d 66 6f 6c 64 20 28 6c 61 6d 62  ctory-fold (lamb
6450: 64 61 20 28 66 20 78 29 28 2b 20 31 20 78 29 29  da (f x)(+ 1 x))
6460: 20 30 20 72 75 6e 2d 64 69 72 29 20 30 29 0a 09   0 run-dir) 0)..
6470: 09 09 09 20 20 20 20 20 28 64 65 62 75 67 3a 70  ...     (debug:p
6480: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a  rint 0 "WARNING:
6490: 20 72 65 66 75 73 69 6e 67 20 74 6f 20 72 65 6d   refusing to rem
64a0: 6f 76 65 20 22 20 72 75 6e 2d 64 69 72 20 22 20  ove " run-dir " 
64b0: 61 73 20 69 74 20 69 73 20 6e 6f 74 20 65 6d 70  as it is not emp
64c0: 74 79 22 29 0a 09 09 09 09 20 20 20 20 20 20 28  ty").....      (
64d0: 68 61 6e 64 6c 65 2d 65 78 63 65 70 74 69 6f 6e  handle-exception
64e0: 73 0a 09 09 09 09 20 20 20 20 20 20 20 65 78 6e  s.....       exn
64f0: 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 65 62  .....       (deb
6500: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
6510: 52 3a 20 20 46 61 69 6c 65 64 20 74 6f 20 72 65  R:  Failed to re
6520: 6d 6f 76 65 20 64 69 72 65 63 74 6f 72 79 20 22  move directory "
6530: 20 72 75 6e 2d 64 69 72 20 28 28 63 6f 6e 64 69   run-dir ((condi
6540: 74 69 6f 6e 2d 70 72 6f 70 65 72 74 79 2d 61 63  tion-property-ac
6550: 63 65 73 73 6f 72 20 27 65 78 6e 20 27 6d 65 73  cessor 'exn 'mes
6560: 73 61 67 65 29 20 65 78 6e 29 20 22 2c 20 61 74  sage) exn) ", at
6570: 74 65 6d 70 74 69 6e 67 20 74 6f 20 63 6f 6e 74  tempting to cont
6580: 69 6e 75 65 22 29 0a 09 09 09 09 20 20 20 20 20  inue").....     
6590: 20 20 28 64 65 6c 65 74 65 2d 64 69 72 65 63 74    (delete-direct
65a0: 6f 72 79 20 72 75 6e 2d 64 69 72 29 29 29 0a 09  ory run-dir)))..
65b0: 09 09 09 20 28 69 66 20 72 75 6e 2d 64 69 72 0a  ... (if run-dir.
65c0: 09 09 09 09 20 20 20 20 20 28 64 65 62 75 67 3a  ....     (debug:
65d0: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47  print 0 "WARNING
65e0: 3a 20 6e 6f 74 20 72 65 6d 6f 76 69 6e 67 20 22  : not removing "
65f0: 20 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74   run-dir " as it
6600: 20 65 69 74 68 65 72 20 64 6f 65 73 6e 27 74 20   either doesn't 
6610: 65 78 69 73 74 20 6f 72 20 69 73 20 6e 6f 74 20  exist or is not 
6620: 61 20 73 79 6d 6c 69 6e 6b 22 29 0a 09 09 09 09  a symlink").....
6630: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
6640: 74 20 30 20 22 4e 4f 54 45 3a 20 74 68 65 20 72  t 0 "NOTE: the r
6650: 75 6e 20 64 69 72 20 66 6f 72 20 74 68 69 73 20  un dir for this 
6660: 74 65 73 74 20 69 73 20 75 6e 64 65 66 69 6e 65  test is undefine
6670: 64 2e 20 54 65 73 74 20 6d 61 79 20 68 61 76 65  d. Test may have
6680: 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 64 65   already been de
6690: 6c 65 74 65 64 2e 22 29 29 0a 09 09 09 09 20 29  leted."))..... )
66a0: 29 29 0a 09 09 09 28 28 73 65 74 2d 73 74 61 74  ))....((set-stat
66b0: 65 2d 73 74 61 74 75 73 29 0a 09 09 09 20 28 64  e-status).... (d
66c0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
66d0: 32 20 22 6e 65 77 20 73 74 61 74 65 20 22 20 28  2 "new state " (
66e0: 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 75 73  car state-status
66f0: 29 20 22 2c 20 6e 65 77 20 73 74 61 74 75 73 20  ) ", new status 
6700: 22 20 28 63 61 64 72 20 73 74 61 74 65 2d 73 74  " (cadr state-st
6710: 61 74 75 73 29 29 0a 09 09 09 20 28 6f 70 65 6e  atus)).... (open
6720: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65  -run-close db:te
6730: 73 74 2d 73 65 74 2d 73 74 61 74 65 2d 73 74 61  st-set-state-sta
6740: 74 75 73 2d 62 79 2d 69 64 20 64 62 20 28 64 62  tus-by-id db (db
6750: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
6760: 74 29 20 28 63 61 72 20 73 74 61 74 65 2d 73 74  t) (car state-st
6770: 61 74 75 73 29 28 63 61 64 72 20 73 74 61 74 65  atus)(cadr state
6780: 2d 73 74 61 74 75 73 29 20 23 66 29 29 29 29 29  -status) #f)))))
6790: 0a 09 09 20 20 28 73 6f 72 74 20 74 65 73 74 73  ...  (sort tests
67a0: 20 28 6c 61 6d 62 64 61 20 28 61 20 62 29 28 6c   (lambda (a b)(l
67b0: 65 74 20 28 28 64 69 72 61 20 28 64 62 3a 74 65  et ((dira (db:te
67c0: 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 61 29  st-get-rundir a)
67d0: 29 0a 09 09 09 09 09 09 20 28 64 69 72 62 20 28  )....... (dirb (
67e0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64  db:test-get-rund
67f0: 69 72 20 62 29 29 29 0a 09 09 09 09 09 20 20 20  ir b)))......   
6800: 20 20 28 69 66 20 28 61 6e 64 20 28 73 74 72 69    (if (and (stri
6810: 6e 67 3f 20 64 69 72 61 29 28 73 74 72 69 6e 67  ng? dira)(string
6820: 3f 20 64 69 72 62 29 29 0a 09 09 09 09 09 09 20  ? dirb))....... 
6830: 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74  (> (string-lengt
6840: 68 20 64 69 72 61 29 28 73 74 72 69 6e 67 2d 6c  h dira)(string-l
6850: 65 6e 67 74 68 20 64 69 72 62 29 29 0a 09 09 09  ength dirb))....
6860: 09 09 09 20 23 66 29 29 29 29 29 29 29 0a 09 20  ... #f))))))).. 
6870: 20 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65 20    ;; remove the 
6880: 72 75 6e 20 69 66 20 7a 65 72 6f 20 74 65 73 74  run if zero test
6890: 73 20 72 65 6d 61 69 6e 0a 09 20 20 20 28 69 66  s remain..   (if
68a0: 20 28 65 71 3f 20 61 63 74 69 6f 6e 20 27 72 65   (eq? action 're
68b0: 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 20 20 20 20  move-runs)..    
68c0: 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73     (let ((remtes
68d0: 74 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  ts (open-run-clo
68e0: 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d  se db:get-tests-
68f0: 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67  for-run db (db:g
6900: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
6910: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69  er run header "i
6920: 64 22 29 20 23 66 20 27 28 22 44 45 4c 45 54 45  d") #f '("DELETE
6930: 44 22 29 20 27 28 22 6e 2f 61 22 29 20 6e 6f 74  D") '("n/a") not
6940: 2d 69 6e 3a 20 23 74 29 29 29 0a 09 09 20 28 69  -in: #t)))... (i
6950: 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74  f (null? remtest
6960: 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65  s) ;; no more te
6970: 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09  sts remaining...
6980: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 64 70 61       (let* ((dpa
6990: 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c  rts  (string-spl
69a0: 69 74 20 6c 61 73 74 74 70 61 74 68 20 22 2f 22  it lasttpath "/"
69b0: 29 29 0a 09 09 09 20 20 20 20 28 72 75 6e 70 61  ))....    (runpa
69c0: 74 68 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74  th (conc "/" (st
69d0: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
69e0: 20 0a 09 09 09 09 09 09 28 74 61 6b 65 20 64 70   .......(take dp
69f0: 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20  arts (- (length 
6a00: 64 70 61 72 74 73 29 20 31 29 29 0a 09 09 09 09  dparts) 1)).....
6a10: 09 09 22 2f 22 29 29 29 29 0a 09 09 20 20 20 20  .."/"))))...    
6a20: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
6a30: 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a  1 "Removing run:
6a40: 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64   " runkey " " (d
6a50: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
6a60: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
6a70: 20 22 72 75 6e 6e 61 6d 65 22 29 20 22 20 61 6e   "runname") " an
6a80: 64 20 72 65 6c 61 74 65 64 20 72 65 63 6f 72 64  d related record
6a90: 22 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65  ")...       (ope
6aa0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64  n-run-close db:d
6ab0: 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 6e  elete-run db run
6ac0: 2d 69 64 29 0a 09 09 20 20 20 20 20 20 20 3b 3b  -id)...       ;;
6ad0: 20 54 68 69 73 20 69 73 20 61 20 70 72 65 74 74   This is a prett
6ae0: 79 20 67 6f 6f 64 20 70 6c 61 63 65 20 74 6f 20  y good place to 
6af0: 70 75 72 67 65 20 6f 6c 64 20 44 45 4c 45 54 45  purge old DELETE
6b00: 44 20 74 65 73 74 73 0a 09 09 20 20 20 20 20 20  D tests...      
6b10: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
6b20: 20 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73   db:delete-tests
6b30: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d  -for-run db run-
6b40: 69 64 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70  id)...       (op
6b50: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
6b60: 64 65 6c 65 74 65 2d 6f 6c 64 2d 64 65 6c 65 74  delete-old-delet
6b70: 65 64 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20  ed-test-records 
6b80: 64 62 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70  db)...       (op
6b90: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
6ba0: 73 65 74 2d 76 61 72 20 64 62 20 22 44 45 4c 45  set-var db "DELE
6bb0: 54 45 44 5f 54 45 53 54 53 22 20 28 63 75 72 72  TED_TESTS" (curr
6bc0: 65 6e 74 2d 73 65 63 6f 6e 64 73 29 29 0a 09 09  ent-seconds))...
6bd0: 20 20 20 20 20 20 20 3b 3b 20 6e 65 65 64 20 74         ;; need t
6be0: 6f 20 66 69 67 75 72 65 20 6f 75 74 20 74 68 65  o figure out the
6bf0: 20 70 61 74 68 20 74 6f 20 74 68 65 20 72 75 6e   path to the run
6c00: 20 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 20   dir and remove 
6c10: 69 74 20 69 66 20 65 6d 70 74 79 0a 09 09 20 20  it if empty...  
6c20: 20 20 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28       ;;    (if (
6c30: 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e  null? (glob (con
6c40: 63 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29  c runpath "/*"))
6c50: 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20  )...       ;;   
6c60: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20       (begin...  
6c70: 20 20 20 20 20 3b 3b 20 09 20 28 64 65 62 75 67       ;; . (debug
6c80: 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69  :print 1 "Removi
6c90: 6e 67 20 72 75 6e 20 64 69 72 20 22 20 72 75 6e  ng run dir " run
6ca0: 70 61 74 68 29 0a 09 09 20 20 20 20 20 20 20 3b  path)...       ;
6cb0: 3b 20 09 20 28 73 79 73 74 65 6d 20 28 63 6f 6e  ; . (system (con
6cc0: 63 20 22 72 6d 64 69 72 20 2d 70 20 22 20 72 75  c "rmdir -p " ru
6cd0: 6e 70 61 74 68 29 29 29 29 0a 09 09 20 20 20 20  npath))))...    
6ce0: 20 20 20 29 29 29 29 29 0a 09 20 29 29 0a 20 20     ))))).. )).  
6cf0: 20 20 20 72 75 6e 73 29 29 0a 20 20 23 74 29 0a     runs)).  #t).
6d00: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
6d10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6d20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6d30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6d40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75  =========.;; Rou
6d50: 74 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 75  tines for manipu
6d60: 6c 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d  lating runs.;;==
6d70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6d80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6d90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6da0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6db0: 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d  ====..;; Since m
6dc0: 61 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 72  any calls to a r
6dd0: 75 6e 20 72 65 71 75 69 72 65 20 70 72 65 74 74  un require prett
6de0: 79 20 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20  y much the same 
6df0: 73 65 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 77  setup .;; this w
6e00: 72 61 70 70 65 72 20 69 73 20 75 73 65 64 20 74  rapper is used t
6e10: 6f 20 72 65 64 75 63 65 20 74 68 65 20 72 65 70  o reduce the rep
6e20: 6c 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65  lication of code
6e30: 0a 28 64 65 66 69 6e 65 20 28 67 65 6e 65 72 61  .(define (genera
6e40: 6c 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63  l-run-call switc
6e50: 68 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73  hname action-des
6e60: 63 20 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 28  c proc).  (let (
6e70: 28 72 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67  (runname (args:g
6e80: 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65  et-arg ":runname
6e90: 22 29 29 0a 09 28 74 61 72 67 65 74 20 20 28 69  "))..(target  (i
6ea0: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  f (args:get-arg 
6eb0: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20  "-target")...   
6ec0: 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20    (args:get-arg 
6ed0: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20  "-target")...   
6ee0: 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20    (args:get-arg 
6ef0: 22 2d 72 65 71 74 61 72 67 22 29 29 29 0a 09 28  "-reqtarg")))..(
6f00: 74 68 31 20 20 20 20 20 23 66 29 29 0a 20 20 20  th1     #f)).   
6f10: 20 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 6e 6f   (cond.     ((no
6f20: 74 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 20  t target).      
6f30: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
6f40: 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72  ERROR: Missing r
6f50: 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65  equired paramete
6f60: 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61  r for " switchna
6f70: 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73  me ", you must s
6f80: 70 65 63 69 66 79 20 74 68 65 20 74 61 72 67 65  pecify the targe
6f90: 74 20 77 69 74 68 20 2d 74 61 72 67 65 74 22 29  t with -target")
6fa0: 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29  .      (exit 3))
6fb0: 0a 20 20 20 20 20 28 28 6e 6f 74 20 72 75 6e 6e  .     ((not runn
6fc0: 61 6d 65 29 0a 20 20 20 20 20 20 28 64 65 62 75  ame).      (debu
6fd0: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
6fe0: 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72  : Missing requir
6ff0: 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72  ed parameter for
7000: 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c   " switchname ",
7010: 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66   you must specif
7020: 79 20 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 77  y the run name w
7030: 69 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e  ith :runname run
7040: 6e 61 6d 65 22 29 0a 20 20 20 20 20 20 28 65 78  name").      (ex
7050: 69 74 20 33 29 29 0a 20 20 20 20 20 28 65 6c 73  it 3)).     (els
7060: 65 0a 20 20 20 20 20 20 28 6c 65 74 20 28 28 64  e.      (let ((d
7070: 62 20 20 20 23 66 29 0a 09 20 20 20 20 28 6b 65  b   #f)..    (ke
7080: 79 73 20 23 66 29 29 0a 09 28 69 66 20 28 6e 6f  ys #f))..(if (no
7090: 74 20 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e  t (setup-for-run
70a0: 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a  ))..    (begin .
70b0: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
70c0: 69 6e 74 20 30 20 22 46 61 69 6c 65 64 20 74 6f  int 0 "Failed to
70d0: 20 73 65 74 75 70 2c 20 65 78 69 74 69 6e 67 22   setup, exiting"
70e0: 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31  )..      (exit 1
70f0: 29 29 29 0a 09 28 69 66 20 28 61 72 67 73 3a 67  )))..(if (args:g
7100: 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22  et-arg "-server"
7110: 29 0a 09 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e  )..    (open-run
7120: 2d 63 6c 6f 73 65 20 73 65 72 76 65 72 3a 73 74  -close server:st
7130: 61 72 74 20 64 62 20 28 61 72 67 73 3a 67 65 74  art db (args:get
7140: 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 29  -arg "-server"))
7150: 29 0a 20 09 20 20 20 20 3b 3b 20 28 69 66 20 28  ). .    ;; (if (
7160: 6e 6f 74 20 28 6f 72 20 28 61 72 67 73 3a 67 65  not (or (args:ge
7170: 74 2d 61 72 67 20 22 2d 72 75 6e 61 6c 6c 22 29  t-arg "-runall")
7180: 20 20 20 20 20 3b 3b 20 72 75 6e 61 6c 6c 20 61       ;; runall a
7190: 6e 64 20 72 75 6e 74 65 73 74 73 20 61 72 65 20  nd runtests are 
71a0: 61 6c 6c 6f 77 65 64 20 74 6f 20 62 65 20 73 65  allowed to be se
71b0: 72 76 65 72 73 0a 20 09 20 20 20 20 3b 3b 20 20  rvers. .    ;;  
71c0: 20 20 20 09 20 28 61 72 67 73 3a 67 65 74 2d 61     . (args:get-a
71d0: 72 67 20 22 2d 72 75 6e 74 65 73 74 73 22 29 29  rg "-runtests"))
71e0: 29 0a 09 20 20 20 20 3b 3b 20 20 20 20 20 28 63  )..    ;;     (c
71f0: 6c 69 65 6e 74 3a 73 65 74 75 70 29 20 3b 3b 20  lient:setup) ;; 
7200: 54 68 69 73 20 69 73 20 61 20 64 75 70 6c 69 63  This is a duplic
7210: 61 74 65 20 73 74 61 72 74 75 70 21 21 21 3f 3f  ate startup!!!??
7220: 3f 20 42 55 47 3f 0a 09 20 20 20 20 3b 3b 20 20  ? BUG?..    ;;  
7230: 20 20 20 29 29 0a 09 28 73 65 74 21 20 6b 65 79     ))..(set! key
7240: 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73  s (open-run-clos
7250: 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62  e db:get-keys db
7260: 29 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f 75  ))..;; have enou
7270: 67 68 20 74 6f 20 70 72 6f 63 65 73 73 20 2d 74  gh to process -t
7280: 61 72 67 65 74 20 6f 72 20 2d 72 65 71 74 61 72  arget or -reqtar
7290: 67 20 68 65 72 65 0a 09 28 69 66 20 28 61 72 67  g here..(if (arg
72a0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74  s:get-arg "-reqt
72b0: 61 72 67 22 29 0a 09 20 20 20 20 28 6c 65 74 2a  arg")..    (let*
72c0: 20 28 28 72 75 6e 63 6f 6e 66 69 67 66 20 28 63   ((runconfigf (c
72d0: 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22  onc  *toppath* "
72e0: 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66  /runconfigs.conf
72f0: 69 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 20  ig")) ;; DO NOT 
7300: 45 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09 09  EVALUATE ALL ...
7310: 20 20 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 28     (runconfig  (
7320: 72 65 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63  read-config runc
7330: 6f 6e 66 69 67 66 20 23 66 20 23 74 20 65 6e 76  onfigf #f #t env
7340: 69 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29 29  iron-patt: #f)))
7350: 20 0a 09 20 20 20 20 20 20 28 69 66 20 28 68 61   ..      (if (ha
7360: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
7370: 61 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20 28  ault runconfig (
7380: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72  args:get-arg "-r
7390: 65 71 74 61 72 67 22 29 20 23 66 29 0a 09 09 20  eqtarg") #f)... 
73a0: 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65   (keys:target-se
73b0: 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 67  t-args keys (arg
73c0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74  s:get-arg "-reqt
73d0: 61 72 67 22 29 20 61 72 67 73 3a 61 72 67 2d 68  arg") args:arg-h
73e0: 61 73 68 29 0a 09 09 20 20 28 62 65 67 69 6e 0a  ash)...  (begin.
73f0: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
7400: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 5b 22 20  nt 0 "ERROR: [" 
7410: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
7420: 72 65 71 74 61 72 67 22 29 20 22 5d 20 6e 6f 74  reqtarg") "] not
7430: 20 66 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e 63   found in " runc
7440: 6f 6e 66 69 67 66 29 0a 09 09 20 20 20 20 28 69  onfigf)...    (i
7450: 66 20 64 62 20 28 73 71 6c 69 74 65 33 3a 66 69  f db (sqlite3:fi
7460: 6e 61 6c 69 7a 65 21 20 64 62 29 29 0a 09 09 20  nalize! db))... 
7470: 20 20 20 28 65 78 69 74 20 31 29 29 29 29 0a 09     (exit 1))))..
7480: 20 20 20 20 28 69 66 20 28 61 72 67 73 3a 67 65      (if (args:ge
7490: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29  t-arg "-target")
74a0: 0a 09 09 28 6b 65 79 73 3a 74 61 72 67 65 74 2d  ...(keys:target-
74b0: 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61  set-args keys (a
74c0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61  rgs:get-arg "-ta
74d0: 72 67 65 74 22 20 61 72 67 73 3a 61 72 67 2d 68  rget" args:arg-h
74e0: 61 73 68 29 20 61 72 67 73 3a 61 72 67 2d 68 61  ash) args:arg-ha
74f0: 73 68 29 29 29 0a 09 28 69 66 20 28 6e 6f 74 20  sh)))..(if (not 
7500: 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f  (car *configinfo
7510: 2a 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e 0a  *))..    (begin.
7520: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
7530: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 41 74  int 0 "ERROR: At
7540: 74 65 6d 70 74 65 64 20 74 6f 20 22 20 61 63 74  tempted to " act
7550: 69 6f 6e 2d 64 65 73 63 20 22 20 62 75 74 20 72  ion-desc " but r
7560: 75 6e 20 61 72 65 61 20 63 6f 6e 66 69 67 20 66  un area config f
7570: 69 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 22 29 0a  ile not found").
7580: 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29  .      (exit 1))
7590: 0a 09 20 20 20 20 3b 3b 20 45 78 74 72 61 63 74  ..    ;; Extract
75a0: 20 6f 75 74 20 73 74 75 66 66 20 6e 65 65 64 65   out stuff neede
75b0: 64 20 69 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 6e  d in most or man
75c0: 79 20 63 61 6c 6c 73 0a 09 20 20 20 20 3b 3b 20  y calls..    ;; 
75d0: 68 65 72 65 20 74 68 65 6e 20 63 61 6c 6c 20 70  here then call p
75e0: 72 6f 63 0a 09 20 20 20 20 28 6c 65 74 2a 20 28  roc..    (let* (
75f0: 28 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d 61 70  (keynames   (map
7600: 20 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61   key:get-fieldna
7610: 6d 65 20 6b 65 79 73 29 29 0a 09 09 20 20 20 28  me keys))...   (
7620: 6b 65 79 76 61 6c 6c 73 74 20 20 28 6b 65 79 73  keyvallst  (keys
7630: 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 20 23  ->vallist keys #
7640: 74 29 29 29 0a 09 20 20 20 20 20 20 28 70 72 6f  t)))..      (pro
7650: 63 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65  c target runname
7660: 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73 20 6b   keys keynames k
7670: 65 79 76 61 6c 6c 73 74 29 29 29 0a 09 28 69 66  eyvallst)))..(if
7680: 20 74 68 31 20 28 74 68 72 65 61 64 2d 6a 6f 69   th1 (thread-joi
7690: 6e 21 20 74 68 31 29 29 0a 09 28 69 66 20 64 62  n! th1))..(if db
76a0: 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69   (sqlite3:finali
76b0: 7a 65 21 20 64 62 29 29 0a 09 28 73 65 74 21 20  ze! db))..(set! 
76c0: 2a 64 69 64 73 6f 6d 65 74 68 69 6e 67 2a 20 23  *didsomething* #
76d0: 74 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d  t))))))..;;=====
76e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
76f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7700: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7710: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7720: 3d 0a 3b 3b 20 4c 6f 63 6b 2f 75 6e 6c 6f 63 6b  =.;; Lock/unlock
7730: 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d   runs.;;========
7740: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7750: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7760: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7770: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a  ==============..
7780: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 68 61  (define (runs:ha
7790: 6e 64 6c 65 2d 6c 6f 63 6b 69 6e 67 20 74 61 72  ndle-locking tar
77a0: 67 65 74 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65  get keys runname
77b0: 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65   lock unlock use
77c0: 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 20  r).  (let* ((db 
77d0: 20 20 20 20 20 20 23 66 29 0a 09 20 28 72 75 6e        #f).. (run
77e0: 64 61 74 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d  dat   (open-run-
77f0: 63 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d 72  close runs:get-r
7800: 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b  uns-by-patt db k
7810: 65 79 73 20 72 75 6e 6e 61 6d 65 29 29 0a 09 20  eys runname)).. 
7820: 28 68 65 61 64 65 72 20 20 20 28 76 65 63 74 6f  (header   (vecto
7830: 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 29  r-ref rundat 0))
7840: 0a 09 20 28 72 75 6e 73 20 20 20 20 20 28 76 65  .. (runs     (ve
7850: 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20  ctor-ref rundat 
7860: 31 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61  1))).    (for-ea
7870: 63 68 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29  ch (lambda (run)
7880: 0a 09 09 28 6c 65 74 20 28 28 72 75 6e 2d 69 64  ...(let ((run-id
7890: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62   (db:get-value-b
78a0: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61  y-header run hea
78b0: 64 65 72 20 22 69 64 22 29 29 29 0a 09 09 20 20  der "id")))...  
78c0: 28 69 66 20 28 6f 72 20 6c 6f 63 6b 0a 09 09 09  (if (or lock....
78d0: 20 20 28 61 6e 64 20 75 6e 6c 6f 63 6b 0a 09 09    (and unlock...
78e0: 09 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09  .       (begin..
78f0: 09 09 09 20 28 70 72 69 6e 74 20 22 44 6f 20 79  ... (print "Do y
7900: 6f 75 20 72 65 61 6c 6c 79 20 77 69 73 68 20 74  ou really wish t
7910: 6f 20 75 6e 6c 6f 63 6b 20 72 75 6e 20 22 20 72  o unlock run " r
7920: 75 6e 2d 69 64 20 22 3f 5c 6e 20 20 20 79 2f 6e  un-id "?\n   y/n
7930: 3a 20 22 29 0a 09 09 09 09 20 28 65 71 75 61 6c  : ")..... (equal
7940: 3f 20 22 79 22 20 28 72 65 61 64 2d 6c 69 6e 65  ? "y" (read-line
7950: 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 28 6f  )))))...      (o
7960: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
7970: 3a 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 75 6e  :lock/unlock-run
7980: 20 64 62 20 72 75 6e 2d 69 64 20 6c 6f 63 6b 20   db run-id lock 
7990: 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 09 09 20  unlock user)... 
79a0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
79b0: 74 2d 69 6e 66 6f 20 30 20 22 53 6b 69 70 70 69  t-info 0 "Skippi
79c0: 6e 67 20 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 6f  ng lock/unlock o
79d0: 6e 20 22 20 72 75 6e 2d 69 64 29 29 29 29 0a 09  n " run-id))))..
79e0: 20 20 20 20 20 20 72 75 6e 73 29 29 29 0a 3b 3b        runs))).;;
79f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7a00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7a10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7a20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7a30: 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70  ======.;; Rollup
7a40: 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d   runs.;;========
7a50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7a60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7a70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7a80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a  ==============..
7a90: 3b 3b 20 55 70 64 61 74 65 20 74 68 65 20 74 65  ;; Update the te
7aa0: 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 66 6f  st_meta table fo
7ab0: 72 20 74 68 69 73 20 74 65 73 74 0a 28 64 65 66  r this test.(def
7ac0: 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65  ine (runs:update
7ad0: 2d 74 65 73 74 5f 6d 65 74 61 20 74 65 73 74 2d  -test_meta test-
7ae0: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a  name test-conf).
7af0: 20 20 28 6c 65 74 20 28 28 63 75 72 72 72 65 63    (let ((currrec
7b00: 6f 72 64 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d  ord (cdb:remote-
7b10: 72 75 6e 20 64 62 3a 74 65 73 74 6d 65 74 61 2d  run db:testmeta-
7b20: 67 65 74 2d 72 65 63 6f 72 64 20 23 66 20 74 65  get-record #f te
7b30: 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28  st-name))).    (
7b40: 69 66 20 28 6e 6f 74 20 63 75 72 72 72 65 63 6f  if (not currreco
7b50: 72 64 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28  rd)..(begin..  (
7b60: 73 65 74 21 20 63 75 72 72 72 65 63 6f 72 64 20  set! currrecord 
7b70: 28 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 20  (make-vector 10 
7b80: 23 66 29 29 0a 09 20 20 28 63 64 62 3a 72 65 6d  #f))..  (cdb:rem
7b90: 6f 74 65 2d 72 75 6e 20 64 62 3a 74 65 73 74 6d  ote-run db:testm
7ba0: 65 74 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 23  eta-add-record #
7bb0: 66 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20  f test-name))). 
7bc0: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20     (for-each .  
7bd0: 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29     (lambda (key)
7be0: 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28  .       (let* ((
7bf0: 69 64 78 20 28 63 61 64 72 20 6b 65 79 29 29 0a  idx (cadr key)).
7c00: 09 20 20 20 20 20 20 28 66 6c 64 20 28 63 61 72  .      (fld (car
7c10: 20 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28    key))..      (
7c20: 76 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b  val (config-look
7c30: 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 65  up test-conf "te
7c40: 73 74 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 0a  st_meta" fld))).
7c50: 09 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e  . ;; (debug:prin
7c60: 74 20 35 20 22 69 64 78 3a 20 22 20 69 64 78 20  t 5 "idx: " idx 
7c70: 22 20 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 76  " fld: " fld " v
7c80: 61 6c 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 66  al: " val).. (if
7c90: 20 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28   (and val (not (
7ca0: 65 71 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72  equal? (vector-r
7cb0: 65 66 20 63 75 72 72 72 65 63 6f 72 64 20 69 64  ef currrecord id
7cc0: 78 29 20 76 61 6c 29 29 29 0a 09 20 20 20 20 20  x) val)))..     
7cd0: 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28  (begin..       (
7ce0: 70 72 69 6e 74 20 22 55 70 64 61 74 69 6e 67 20  print "Updating 
7cf0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 20  " test-name " " 
7d00: 66 6c 64 20 22 20 74 6f 20 22 20 76 61 6c 29 0a  fld " to " val).
7d10: 09 20 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d  .       (cdb:rem
7d20: 6f 74 65 2d 72 75 6e 20 64 62 3a 74 65 73 74 6d  ote-run db:testm
7d30: 65 74 61 2d 75 70 64 61 74 65 2d 66 69 65 6c 64  eta-update-field
7d40: 20 23 66 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c   #f test-name fl
7d50: 64 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20 20  d val))))).     
7d60: 27 28 28 22 61 75 74 68 6f 72 22 20 32 29 28 22  '(("author" 2)("
7d70: 6f 77 6e 65 72 22 20 33 29 28 22 64 65 73 63 72  owner" 3)("descr
7d80: 69 70 74 69 6f 6e 22 20 34 29 28 22 72 65 76 69  iption" 4)("revi
7d90: 65 77 65 64 22 20 35 29 28 22 74 61 67 73 22 20  ewed" 5)("tags" 
7da0: 39 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74  9)))))..;; Updat
7db0: 65 20 74 65 73 74 5f 6d 65 74 61 20 66 6f 72 20  e test_meta for 
7dc0: 61 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 69 6e  all tests.(defin
7dd0: 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 61  e (runs:update-a
7de0: 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 29  ll-test_meta db)
7df0: 0a 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e  .  (let ((test-n
7e00: 61 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65  ames (get-all-le
7e10: 67 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 20 20  gal-tests))).   
7e20: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20   (for-each .    
7e30: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 6e   (lambda (test-n
7e40: 61 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74  ame).       (let
7e50: 2a 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 20  * ((test-path   
7e60: 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a   (conc *toppath*
7e70: 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d   "/tests/" test-
7e80: 6e 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28 74  name))..      (t
7e90: 65 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e  est-configf (con
7ea0: 63 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65  c test-path "/te
7eb0: 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 20  stconfig"))..   
7ec0: 20 20 20 28 74 65 73 74 65 78 69 73 74 73 20 20     (testexists  
7ed0: 20 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73   (and (file-exis
7ee0: 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66  ts? test-configf
7ef0: 29 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65  )(file-read-acce
7f00: 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66  ss? test-configf
7f10: 29 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 65  )))..      ;; re
7f20: 61 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68 20  ad configs with 
7f30: 74 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f 66  tricks turned of
7f40: 66 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65  f (i.e. no syste
7f50: 6d 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d  m)..      (test-
7f60: 63 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 74  conf    (if test
7f70: 65 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e  exists (read-con
7f80: 66 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66  fig test-configf
7f90: 20 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 73   #f #f)(make-has
7fa0: 68 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 3b 3b  h-table)))).. ;;
7fb0: 20 75 73 65 20 74 68 65 20 6f 70 65 6e 2d 72 75   use the open-ru
7fc0: 6e 2d 63 6c 6f 73 65 20 69 6e 73 74 65 61 64 20  n-close instead 
7fd0: 6f 66 20 70 61 73 73 69 6e 67 20 69 6e 20 64 62  of passing in db
7fe0: 0a 09 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d  .. (runs:update-
7ff0: 74 65 73 74 5f 6d 65 74 61 20 74 65 73 74 2d 6e  test_meta test-n
8000: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29  ame test-conf)))
8010: 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73  .     test-names
8020: 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75  )))..;; This cou
8030: 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 65 20 72  ld probably be r
8040: 65 66 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f  efactored into o
8050: 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 79  ne complex query
8060: 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 75   ....(define (ru
8070: 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 6b 65  ns:rollup-run ke
8080: 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e  ys keyvallst run
8090: 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61  name user) ;; wa
80a0: 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65  s target, now ke
80b0: 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67  yvallst.  (debug
80c0: 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72  :print 4 "runs:r
80d0: 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a  ollup-run, keys:
80e0: 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c   " keys " keyval
80f0: 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74  lst: " keyvallst
8100: 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75   " :runname " ru
8110: 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20  nname " user: " 
8120: 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28  user).  (let* ((
8130: 64 62 20 20 20 20 20 20 20 20 20 20 20 20 20 20  db              
8140: 23 66 29 20 3b 3b 20 28 6b 65 79 76 61 6c 6c 6c  #f) ;; (keyvalll
8150: 73 74 20 20 20 20 20 20 28 6b 65 79 73 3a 74 61  st      (keys:ta
8160: 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79  rget->keyval key
8170: 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 6e 65  s target)).. (ne
8180: 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 20 28 63  w-run-id      (c
8190: 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62  db:remote-run db
81a0: 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 23 66  :register-run #f
81b0: 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20   keys keyvallst 
81c0: 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e  runname "new" "n
81d0: 2f 61 22 20 75 73 65 72 29 29 0a 09 20 28 70 72  /a" user)).. (pr
81e0: 65 76 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f  ev-tests      (o
81f0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65  pen-run-close te
8200: 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d  st:get-matching-
8210: 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75  previous-test-ru
8220: 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77  n-records db new
8230: 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29  -run-id "%" "%")
8240: 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 20  ).. (curr-tests 
8250: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
8260: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74  lose db:get-test
8270: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77  s-for-run db new
8280: 2d 72 75 6e 2d 69 64 20 22 25 2f 25 22 20 27 28  -run-id "%/%" '(
8290: 29 20 27 28 29 29 29 0a 09 20 28 63 75 72 72 2d  ) '())).. (curr-
82a0: 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61 6b 65  tests-hash (make
82b0: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 20  -hash-table))). 
82c0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
82d0: 73 65 20 64 62 3a 75 70 64 61 74 65 2d 72 75 6e  se db:update-run
82e0: 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20 6e  -event_time db n
82f0: 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20 3b  ew-run-id).    ;
8300: 3b 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72 65  ; index the alre
8310: 61 64 79 20 73 61 76 65 64 20 74 65 73 74 73 20  ady saved tests 
8320: 62 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64 20  by testname and 
8330: 69 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72 2d  itemdat in curr-
8340: 74 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20 28  tests-hash.    (
8350: 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c  for-each.     (l
8360: 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a  ambda (testdat).
8370: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74         (let* ((t
8380: 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73  estname  (db:tes
8390: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  t-get-testname t
83a0: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20  estdat))..      
83b0: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74  (item-path (db:t
83c0: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74  est-get-item-pat
83d0: 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  h testdat))..   
83e0: 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63     (full-name (c
83f0: 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22  onc testname "/"
8400: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20   item-path))).. 
8410: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
8420: 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68   curr-tests-hash
8430: 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 64   full-name testd
8440: 61 74 29 29 29 0a 20 20 20 20 20 63 75 72 72 2d  at))).     curr-
8450: 74 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e 4f  tests).    ;; NO
8460: 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20  PE: Non-optimal 
8470: 61 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74 68  approach. Try th
8480: 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20 20  is instead..    
8490: 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61 72  ;;   1. tests ar
84a0: 65 20 72 65 63 65 69 76 65 64 20 69 6e 20 61 20  e received in a 
84b0: 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65 6e  list, most recen
84c0: 74 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20 20  t first.    ;;  
84d0: 20 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65 20   2. replace the 
84e0: 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74 68  rollup test with
84f0: 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79 73   the new *always
8500: 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20  *.    (for-each 
8510: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74  .     (lambda (t
8520: 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28  estdat).       (
8530: 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20  let* ((testname 
8540: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
8550: 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29  stname testdat))
8560: 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61  ..      (item-pa
8570: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  th (db:test-get-
8580: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61  item-path testda
8590: 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c  t))..      (full
85a0: 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74  -name (conc test
85b0: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
85c0: 74 68 29 29 0a 09 20 20 20 20 20 20 28 70 72 65  th))..      (pre
85d0: 76 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73 68  v-test-dat (hash
85e0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
85f0: 6c 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61  lt curr-tests-ha
8600: 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 29  sh full-name #f)
8610: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 73  )..      (test-s
8620: 74 65 70 73 20 20 20 20 20 20 28 6f 70 65 6e 2d  teps      (open-
8630: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
8640: 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 74 20  -steps-for-test 
8650: 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  db (db:test-get-
8660: 69 64 20 74 65 73 74 64 61 74 29 29 29 0a 09 20  id testdat))).. 
8670: 20 20 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 72       (new-test-r
8680: 65 63 6f 72 64 20 23 66 29 29 0a 09 20 3b 3b 20  ecord #f)).. ;; 
8690: 72 65 70 6c 61 63 65 20 74 68 65 73 65 20 77 69  replace these wi
86a0: 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65  th insert ... se
86b0: 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 20 73 71  lect.. (apply sq
86c0: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09  lite3:execute ..
86d0: 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e  .db ...(conc "IN
86e0: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20  SERT OR REPLACE 
86f0: 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75 6e 5f  INTO tests (run_
8700: 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74  id,testname,stat
8710: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74  e,status,event_t
8720: 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64  ime,host,cpuload
8730: 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c  ,diskfree,uname,
8740: 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 74 68  rundir,item_path
8750: 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69  ,run_duration,fi
8760: 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74  nal_logf,comment
8770: 29 20 22 0a 09 09 20 20 20 20 20 20 22 56 41 4c  ) "...      "VAL
8780: 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  UES (?,?,?,?,?,?
8790: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
87a0: 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69  );")...new-run-i
87b0: 64 20 28 63 64 64 72 20 28 76 65 63 74 6f 72 2d  d (cddr (vector-
87c0: 3e 6c 69 73 74 20 74 65 73 74 64 61 74 29 29 29  >list testdat)))
87d0: 0a 09 20 28 73 65 74 21 20 6e 65 77 2d 74 65 73  .. (set! new-tes
87e0: 74 64 61 74 20 28 63 61 72 20 28 6f 70 65 6e 2d  tdat (car (open-
87f0: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
8800: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64  -tests-for-run d
8810: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 6f  b new-run-id (co
8820: 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20  nc testname "/" 
8830: 69 74 65 6d 2d 70 61 74 68 29 20 27 28 29 20 27  item-path) '() '
8840: 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61  ()))).. (hash-ta
8850: 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65  ble-set! curr-te
8860: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61  sts-hash full-na
8870: 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20  me new-testdat) 
8880: 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65  ;; this could be
8890: 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 63   confusing, whic
88a0: 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 20  h record should 
88b0: 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b  go into the look
88c0: 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e  up table?.. ;; N
88d0: 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65  ow duplicate the
88e0: 20 74 65 73 74 20 73 74 65 70 73 0a 09 20 28 64   test steps.. (d
88f0: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f  ebug:print 4 "Co
8900: 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e  pying records in
8910: 20 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f 6d   test_steps from
8920: 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74   test_id=" (db:t
8930: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
8940: 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74  at) " to " (db:t
8950: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74  est-get-id new-t
8960: 65 73 74 64 61 74 29 29 0a 09 20 28 6f 70 65 6e  estdat)).. (open
8970: 2d 72 75 6e 2d 63 6c 6f 73 65 20 0a 09 20 20 28  -run-close ..  (
8980: 6c 61 6d 62 64 61 20 28 29 0a 09 20 20 20 20 28  lambda ()..    (
8990: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20  sqlite3:execute 
89a0: 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20 20 20  ..     db ..    
89b0: 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f   (conc "INSERT O
89c0: 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74  R REPLACE INTO t
89d0: 65 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 5f  est_steps (test_
89e0: 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74  id,stepname,stat
89f0: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74  e,status,event_t
8a00: 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09  ime,comment) "..
8a10: 09 20 20 20 22 53 45 4c 45 43 54 20 22 20 28 64  .   "SELECT " (d
8a20: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
8a30: 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 65  w-testdat) ",ste
8a40: 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74  pname,state,stat
8a50: 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f  us,event_time,co
8a60: 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f  mment FROM test_
8a70: 73 74 65 70 73 20 57 48 45 52 45 20 74 65 73 74  steps WHERE test
8a80: 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28  _id=?;")..     (
8a90: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
8aa0: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 3b 3b  estdat))..    ;;
8ab0: 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74   Now duplicate t
8ac0: 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 20  he test data..  
8ad0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34    (debug:print 4
8ae0: 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64   "Copying record
8af0: 73 20 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66  s in test_data f
8b00: 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64  rom test_id=" (d
8b10: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
8b20: 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64  stdat) " to " (d
8b30: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
8b40: 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  w-testdat))..   
8b50: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74   (sqlite3:execut
8b60: 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20  e ..     db ..  
8b70: 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54     (conc "INSERT
8b80: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f   OR REPLACE INTO
8b90: 20 74 65 73 74 5f 64 61 74 61 20 28 74 65 73 74   test_data (test
8ba0: 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72  _id,category,var
8bb0: 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65  iable,value,expe
8bc0: 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63  cted,tol,units,c
8bd0: 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22  omment) "...   "
8be0: 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73  SELECT " (db:tes
8bf0: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73  t-get-id new-tes
8c00: 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79  tdat) ",category
8c10: 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c  ,variable,value,
8c20: 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69  expected,tol,uni
8c30: 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20  ts,comment FROM 
8c40: 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 20  test_data WHERE 
8c50: 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20  test_id=?;")..  
8c60: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d     (db:test-get-
8c70: 69 64 20 74 65 73 74 64 61 74 29 29 29 29 0a 09  id testdat))))..
8c80: 20 29 29 0a 20 20 20 20 20 70 72 65 76 2d 74 65   )).     prev-te
8c90: 73 74 73 29 29 29 0a 09 20 0a 20 20 20 20 20 0a  sts))).. .     .