Megatest

Hex Artifact Content
Login

Artifact 5f0f872d62ff3937072432ebc705f5e61a61a6a2:


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 74 65 73 74 2d  aunch-test test-
4e50: 69 64 20 72 75 6e 2d 69 64 20 72 75 6e 2d 69 6e  id run-id run-in
4e60: 66 6f 20 6b 65 79 2d 76 61 6c 73 20 72 75 6e 6e  fo key-vals runn
4e70: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65  ame test-conf ke
4e80: 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d  yvallst test-nam
4e90: 65 20 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d  e test-path item
4ea0: 64 61 74 20 66 6c 61 67 73 29 29 0a 09 09 20 20  dat flags))...  
4eb0: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28   (begin...     (
4ec0: 70 72 69 6e 74 20 22 45 52 52 4f 52 3a 20 46 61  print "ERROR: Fa
4ed0: 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74  iled to launch t
4ee0: 68 65 20 74 65 73 74 2e 20 45 78 69 74 69 6e 67  he test. Exiting
4ef0: 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73   as soon as poss
4f00: 69 62 6c 65 22 29 0a 09 09 20 20 20 20 20 28 73  ible")...     (s
4f10: 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73  et! *globalexits
4f20: 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09  tatus* 1) ;; ...
4f30: 20 20 20 20 20 28 70 72 6f 63 65 73 73 2d 73 69       (process-si
4f40: 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d 70 72  gnal (current-pr
4f50: 6f 63 65 73 73 2d 69 64 29 20 73 69 67 6e 61 6c  ocess-id) signal
4f60: 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09 28 28 4b  /kill))))))..((K
4f70: 49 4c 4c 45 44 29 20 0a 09 20 28 64 65 62 75 67  ILLED) .. (debug
4f80: 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20  :print 1 "NOTE: 
4f90: 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20  " new-test-name 
4fa0: 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e  " is already run
4fb0: 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 78 70 6c  ning or was expl
4fc0: 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73  ictly killed, us
4fd0: 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e  e -force to laun
4fe0: 63 68 20 69 74 2e 22 29 29 0a 09 28 28 4c 41 55  ch it."))..((LAU
4ff0: 4e 43 48 45 44 20 52 45 4d 4f 54 45 48 4f 53 54  NCHED REMOTEHOST
5000: 53 54 41 52 54 20 52 55 4e 4e 49 4e 47 29 20 20  START RUNNING)  
5010: 0a 09 20 28 69 66 20 28 3e 20 28 2d 20 28 63 75  .. (if (> (- (cu
5020: 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b  rrent-seconds)(+
5030: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 65 76   (db:test-get-ev
5040: 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 61 74  ent_time testdat
5050: 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 62  ).....       (db
5060: 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75  :test-get-run_du
5070: 72 61 74 69 6f 6e 20 74 65 73 74 64 61 74 29 29  ration testdat))
5080: 29 0a 09 09 36 30 30 29 20 3b 3b 20 69 2e 65 2e  )...600) ;; i.e.
5090: 20 6e 6f 20 75 70 64 61 74 65 20 66 6f 72 20 6d   no update for m
50a0: 6f 72 65 20 74 68 61 6e 20 36 30 30 20 73 65 63  ore than 600 sec
50b0: 6f 6e 64 73 0a 09 20 20 20 20 20 28 62 65 67 69  onds..     (begi
50c0: 6e 0a 09 20 20 20 20 20 20 20 28 64 65 62 75 67  n..       (debug
50d0: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e  :print 0 "WARNIN
50e0: 47 3a 20 54 65 73 74 20 22 20 74 65 73 74 2d 6e  G: Test " test-n
50f0: 61 6d 65 20 22 20 61 70 70 65 61 72 73 20 74 6f  ame " appears to
5100: 20 62 65 20 64 65 61 64 2e 20 46 6f 72 63 69 6e   be dead. Forcin
5110: 67 20 69 74 20 74 6f 20 73 74 61 74 65 20 49 4e  g it to state IN
5120: 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 73 74 61  COMPLETE and sta
5130: 74 75 73 20 53 54 55 43 4b 2f 44 45 41 44 22 29  tus STUCK/DEAD")
5140: 0a 09 20 20 20 20 20 20 20 28 74 65 73 74 73 3a  ..       (tests:
5150: 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 21  test-set-status!
5160: 20 74 65 73 74 2d 69 64 20 22 49 4e 43 4f 4d 50   test-id "INCOMP
5170: 4c 45 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41  LETE" "STUCK/DEA
5180: 44 22 20 22 54 65 73 74 20 69 73 20 73 74 75 63  D" "Test is stuc
5190: 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 0a  k or dead" #f)).
51a0: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  .     (debug:pri
51b0: 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 65  nt 2 "NOTE: " te
51c0: 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72  st-name " is alr
51d0: 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 29  eady running")))
51e0: 0a 09 28 65 6c 73 65 20 20 20 20 20 20 20 28 64  ..(else       (d
51f0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
5200: 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c  ROR: Failed to l
5210: 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65 77  aunch test " new
5220: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e  -test-name ". Un
5230: 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74 65  recognised state
5240: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
5250: 74 65 20 74 65 73 74 64 61 74 29 29 29 29 29 29  te testdat))))))
5260: 29 0a 0a 3b 3b 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 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45  ===========.;; E
52b0: 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46 0a  ND OF NEW STUFF.
52c0: 3b 3b 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: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e  ========..(defin
5310: 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20  e (get-dir-up-n 
5320: 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20  dir . params) . 
5330: 20 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 20   (let ((dparts  
5340: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69  (string-split di
5350: 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20  r "/"))..(count 
5360: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72    (if (null? par
5370: 61 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 61  ams) 1 (car para
5380: 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63  ms)))).    (conc
5390: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74   "/" (string-int
53a0: 65 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 20  ersperse ..     
53b0: 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28    (take dparts (
53c0: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73  - (length dparts
53d0: 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20  ) count))..     
53e0: 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d    "/")))).;; Rem
53f0: 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c  ove runs.;; fiel
5400: 64 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 69  ds are passing i
5410: 6e 20 74 68 72 6f 75 67 68 20 0a 3b 3b 20 61 63  n through .;; ac
5420: 74 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27 72 65 6d  tion:.;;    'rem
5430: 6f 76 65 2d 72 75 6e 73 0a 3b 3b 20 20 20 20 27  ove-runs.;;    '
5440: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73  set-state-status
5450: 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73 68 6f 75  .;;.;; NB// shou
5460: 6c 64 20 70 61 73 73 20 69 6e 20 6b 65 79 73 3f  ld pass in keys?
5470: 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  .;;.(define (run
5480: 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 61 63 74  s:operate-on act
5490: 69 6f 6e 20 72 75 6e 6e 61 6d 65 70 61 74 74 20  ion runnamepatt 
54a0: 74 65 73 74 70 61 74 74 20 23 21 6b 65 79 20 28  testpatt #!key (
54b0: 73 74 61 74 65 20 23 66 29 28 73 74 61 74 75 73  state #f)(status
54c0: 20 23 66 29 28 6e 65 77 2d 73 74 61 74 65 2d 73   #f)(new-state-s
54d0: 74 61 74 75 73 20 23 66 29 29 0a 20 20 28 63 6f  tatus #f)).  (co
54e0: 6d 6d 6f 6e 3a 63 6c 65 61 72 2d 63 61 63 68 65  mmon:clear-cache
54f0: 73 29 20 3b 3b 20 63 6c 65 61 72 20 61 6c 6c 20  s) ;; clear all 
5500: 63 61 63 68 65 73 0a 20 20 28 6c 65 74 2a 20 28  caches.  (let* (
5510: 28 64 62 20 20 20 20 20 20 20 20 20 20 20 23 66  (db           #f
5520: 29 0a 09 20 28 6b 65 79 73 20 20 20 20 20 20 20  ).. (keys       
5530: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
5540: 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62  e db:get-keys db
5550: 29 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 20  )).. (rundat    
5560: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
5570: 73 65 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73  se runs:get-runs
5580: 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73  -by-patt db keys
5590: 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09   runnamepatt))..
55a0: 20 28 68 65 61 64 65 72 20 20 20 20 20 20 20 28   (header       (
55b0: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61  vector-ref runda
55c0: 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20  t 0)).. (runs   
55d0: 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65        (vector-re
55e0: 66 20 72 75 6e 64 61 74 20 31 29 29 0a 09 20 28  f rundat 1)).. (
55f0: 73 74 61 74 65 73 20 20 20 20 20 20 20 28 69 66  states       (if
5600: 20 73 74 61 74 65 20 20 28 73 74 72 69 6e 67 2d   state  (string-
5610: 73 70 6c 69 74 20 73 74 61 74 65 20 20 22 2c 22  split state  ","
5620: 29 20 27 28 29 29 29 0a 09 20 28 73 74 61 74 75  ) '())).. (statu
5630: 73 65 73 20 20 20 20 20 28 69 66 20 73 74 61 74  ses     (if stat
5640: 75 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74  us (string-split
5650: 20 73 74 61 74 75 73 20 22 2c 22 29 20 27 28 29   status ",") '()
5660: 29 29 0a 09 20 28 73 74 61 74 65 2d 73 74 61 74  )).. (state-stat
5670: 75 73 20 28 69 66 20 28 73 74 72 69 6e 67 3f 20  us (if (string? 
5680: 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73  new-state-status
5690: 29 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20  ) (string-split 
56a0: 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73  new-state-status
56b0: 20 22 2c 22 29 20 27 28 23 66 20 23 66 29 29 29   ",") '(#f #f)))
56c0: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ).    (debug:pri
56d0: 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73 3a  nt-info 4 "runs:
56e0: 6f 70 65 72 61 74 65 2d 6f 6e 20 3d 3e 20 48 65  operate-on => He
56f0: 61 64 65 72 3a 20 22 20 68 65 61 64 65 72 20 22  ader: " header "
5700: 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f   action: " actio
5710: 6e 20 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74  n " new-state-st
5720: 61 74 75 73 3a 20 22 20 6e 65 77 2d 73 74 61 74  atus: " new-stat
5730: 65 2d 73 74 61 74 75 73 29 0a 20 20 20 20 28 69  e-status).    (i
5740: 66 20 28 3e 20 32 20 28 6c 65 6e 67 74 68 20 73  f (> 2 (length s
5750: 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a 09 28  tate-status))..(
5760: 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a  begin..  (debug:
5770: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
5780: 74 68 65 20 70 61 72 61 6d 65 74 65 72 20 74 6f  the parameter to
5790: 20 2d 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74   -set-state-stat
57a0: 75 73 20 69 73 20 61 20 63 6f 6d 6d 61 20 64 65  us is a comma de
57b0: 6c 69 6d 69 74 65 64 20 73 74 72 69 6e 67 2e 20  limited string. 
57c0: 45 2e 67 2e 20 43 4f 4d 50 4c 45 54 45 44 2c 46  E.g. COMPLETED,F
57d0: 41 49 4c 22 29 0a 09 20 20 28 65 78 69 74 29 29  AIL")..  (exit))
57e0: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a  ).    (for-each.
57f0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 75       (lambda (ru
5800: 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28  n).       (let (
5810: 28 72 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d  (runkey (string-
5820: 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70  intersperse (map
5830: 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 09   (lambda (k)....
5840: 09 09 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 65  ...(db:get-value
5850: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
5860: 65 61 64 65 72 20 28 76 65 63 74 6f 72 2d 72 65  eader (vector-re
5870: 66 20 6b 20 30 29 29 29 20 6b 65 79 73 29 20 22  f k 0))) keys) "
5880: 2f 22 29 29 0a 09 20 20 20 20 20 28 64 69 72 73  /"))..     (dirs
5890: 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b 65  -to-remove (make
58a0: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 09  -hash-table)))..
58b0: 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 20   (let* ((run-id 
58c0: 20 20 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65     (db:get-value
58d0: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
58e0: 65 61 64 65 72 20 22 69 64 22 29 29 0a 09 09 28  eader "id"))...(
58f0: 72 75 6e 2d 73 74 61 74 65 20 28 64 62 3a 67 65  run-state (db:ge
5900: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65  t-value-by-heade
5910: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 73 74  r run header "st
5920: 61 74 65 22 29 29 0a 09 09 28 74 65 73 74 73 20  ate"))...(tests 
5930: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65 71      (if (not (eq
5940: 75 61 6c 3f 20 72 75 6e 2d 73 74 61 74 65 20 22  ual? run-state "
5950: 6c 6f 63 6b 65 64 22 29 29 0a 09 09 09 20 20 20  locked"))....   
5960: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
5970: 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73  ose db:get-tests
5980: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d  -for-run db run-
5990: 69 64 0a 09 09 09 09 09 09 20 20 20 20 20 20 74  id.......      t
59a0: 65 73 74 70 61 74 74 20 73 74 61 74 65 73 20 73  estpatt states s
59b0: 74 61 74 75 73 65 73 0a 09 09 09 09 09 09 20 20  tatuses.......  
59c0: 20 20 20 20 6e 6f 74 2d 69 6e 3a 20 20 23 66 0a      not-in:  #f.
59d0: 09 09 09 09 09 09 20 20 20 20 20 20 73 6f 72 74  ......      sort
59e0: 2d 62 79 3a 20 28 63 61 73 65 20 61 63 74 69 6f  -by: (case actio
59f0: 6e 0a 09 09 09 09 09 09 09 09 20 28 28 72 65 6d  n......... ((rem
5a00: 6f 76 65 2d 72 75 6e 73 29 20 27 72 75 6e 64 69  ove-runs) 'rundi
5a10: 72 29 0a 09 09 09 09 09 09 09 09 20 28 65 6c 73  r)......... (els
5a20: 65 20 20 20 20 20 20 20 20 20 20 27 65 76 65 6e  e          'even
5a30: 74 5f 74 69 6d 65 29 29 29 0a 09 09 09 20 20 20  t_time)))....   
5a40: 20 20 20 20 27 28 29 29 29 0a 09 09 28 6c 61 73      '()))...(las
5a50: 74 74 70 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f  ttpath "/does/no
5a60: 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70 65 22 29  t/exist/I/hope")
5a70: 29 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72 69  )..   (debug:pri
5a80: 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73 3a  nt-info 4 "runs:
5a90: 6f 70 65 72 61 74 65 2d 6f 6e 20 72 75 6e 3d 22  operate-on run="
5aa0: 20 72 75 6e 20 22 2c 20 68 65 61 64 65 72 3d 22   run ", header="
5ab0: 20 68 65 61 64 65 72 29 0a 09 20 20 20 28 69 66   header)..   (if
5ac0: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73   (not (null? tes
5ad0: 74 73 29 29 0a 09 20 20 20 20 20 20 20 28 62 65  ts))..       (be
5ae0: 67 69 6e 0a 09 09 20 28 63 61 73 65 20 61 63 74  gin... (case act
5af0: 69 6f 6e 0a 09 09 20 20 20 28 28 72 65 6d 6f 76  ion...   ((remov
5b00: 65 2d 72 75 6e 73 29 0a 09 09 20 20 20 20 28 64  e-runs)...    (d
5b10: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65  ebug:print 1 "Re
5b20: 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 66 6f 72  moving tests for
5b30: 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22   run: " runkey "
5b40: 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65   " (db:get-value
5b50: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
5b60: 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29  eader "runname")
5b70: 29 29 0a 09 09 20 20 20 28 28 73 65 74 2d 73 74  ))...   ((set-st
5b80: 61 74 65 2d 73 74 61 74 75 73 29 0a 09 09 20 20  ate-status)...  
5b90: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31    (debug:print 1
5ba0: 20 22 4d 6f 64 69 66 79 69 6e 67 20 73 74 61 74   "Modifying stat
5bb0: 65 20 61 6e 64 20 73 74 61 75 73 20 66 6f 72 20  e and staus for 
5bc0: 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22  tests for run: "
5bd0: 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a   runkey " " (db:
5be0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
5bf0: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
5c00: 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20  runname")))...  
5c10: 20 28 28 70 72 69 6e 74 2d 72 75 6e 29 0a 09 09   ((print-run)...
5c20: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
5c30: 20 31 20 22 50 72 69 6e 74 69 6e 67 20 69 6e 66   1 "Printing inf
5c40: 6f 20 66 6f 72 20 72 75 6e 20 22 20 72 75 6e 6b  o for run " runk
5c50: 65 79 20 22 2c 20 72 75 6e 3d 22 20 72 75 6e 20  ey ", run=" run 
5c60: 22 2c 20 74 65 73 74 73 3d 22 20 74 65 73 74 73  ", tests=" tests
5c70: 20 22 2c 20 68 65 61 64 65 72 3d 22 20 68 65 61   ", header=" hea
5c80: 64 65 72 29 0a 09 09 20 20 20 20 61 63 74 69 6f  der)...    actio
5c90: 6e 29 0a 09 09 20 20 20 28 65 6c 73 65 0a 09 09  n)...   (else...
5ca0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
5cb0: 2d 69 6e 66 6f 20 30 20 22 61 63 74 69 6f 6e 20  -info 0 "action 
5cc0: 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65 64 20 22  not recognised "
5cd0: 20 61 63 74 69 6f 6e 29 29 29 0a 09 09 20 28 66   action)))... (f
5ce0: 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d  or-each...  (lam
5cf0: 62 64 61 20 28 74 65 73 74 29 0a 09 09 20 20 20  bda (test)...   
5d00: 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61   (let* ((item-pa
5d10: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  th (db:test-get-
5d20: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29  item-path test))
5d30: 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d  ....   (test-nam
5d40: 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74  e (db:test-get-t
5d50: 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09  estname test))..
5d60: 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20  ..   (run-dir   
5d70: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e  (db:test-get-run
5d80: 64 69 72 20 74 65 73 74 29 29 20 20 20 20 3b 3b  dir test))    ;;
5d90: 20 72 75 6e 20 64 69 72 20 69 73 20 66 72 6f 6d   run dir is from
5da0: 20 74 68 65 20 6c 69 6e 6b 20 74 72 65 65 0a 09   the link tree..
5db0: 09 09 20 20 20 28 72 65 61 6c 2d 64 69 72 20 20  ..   (real-dir  
5dc0: 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73  (if (file-exists
5dd0: 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 09  ? run-dir)......
5de0: 20 20 28 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e    (resolve-pathn
5df0: 61 6d 65 20 72 75 6e 2d 64 69 72 29 0a 09 09 09  ame run-dir)....
5e00: 09 09 20 20 23 66 29 29 0a 09 09 09 20 20 20 28  ..  #f))....   (
5e10: 74 65 73 74 2d 69 64 20 20 20 28 64 62 3a 74 65  test-id   (db:te
5e20: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29  st-get-id test))
5e30: 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 20 20 28  )...      ;;   (
5e40: 74 64 62 20 20 20 20 20 20 20 28 64 62 3a 6f 70  tdb       (db:op
5e50: 65 6e 2d 74 65 73 74 2d 64 62 20 72 75 6e 2d 64  en-test-db run-d
5e60: 69 72 29 29 29 0a 09 09 20 20 20 20 20 20 28 64  ir)))...      (d
5e70: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
5e80: 34 20 22 74 65 73 74 3d 22 20 74 65 73 74 29 20  4 "test=" test) 
5e90: 3b 3b 20 20 20 22 20 28 64 62 3a 74 65 73 74 2d  ;;   " (db:test-
5ea0: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73  get-testname tes
5eb0: 74 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a 74  t) " id: " (db:t
5ec0: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29  est-get-id test)
5ed0: 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22   " " item-path "
5ee0: 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f   action: " actio
5ef0: 6e 29 0a 09 09 20 20 20 20 20 20 28 63 61 73 65  n)...      (case
5f00: 20 61 63 74 69 6f 6e 0a 09 09 09 28 28 72 65 6d   action....((rem
5f10: 6f 76 65 2d 72 75 6e 73 29 20 3b 3b 20 74 68 65  ove-runs) ;; the
5f20: 20 74 64 62 20 69 73 20 66 6f 72 20 66 75 74 75   tdb is for futu
5f30: 72 65 20 70 6f 73 73 69 62 6c 65 2e 20 0a 09 09  re possible. ...
5f40: 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73  . (open-run-clos
5f50: 65 20 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74  e db:delete-test
5f60: 2d 72 65 63 6f 72 64 73 20 64 62 20 23 66 20 28  -records db #f (
5f70: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
5f80: 65 73 74 29 29 0a 09 09 09 20 28 64 65 62 75 67  est)).... (debug
5f90: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41  :print-info 1 "A
5fa0: 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 72 65 6d  ttempting to rem
5fb0: 6f 76 65 20 22 20 28 69 66 20 72 65 61 6c 2d 64  ove " (if real-d
5fc0: 69 72 20 28 63 6f 6e 63 20 22 20 64 69 72 20 22  ir (conc " dir "
5fd0: 20 72 65 61 6c 2d 64 69 72 20 22 20 61 6e 64 20   real-dir " and 
5fe0: 22 29 20 22 22 29 20 22 20 6c 69 6e 6b 20 22 20  ") "") " link " 
5ff0: 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 28 69 66  run-dir).... (if
6000: 20 28 61 6e 64 20 72 65 61 6c 2d 64 69 72 20 0a   (and real-dir .
6010: 09 09 09 09 20 20 28 3e 20 28 73 74 72 69 6e 67  ....  (> (string
6020: 2d 6c 65 6e 67 74 68 20 72 65 61 6c 2d 64 69 72  -length real-dir
6030: 29 20 35 29 0a 09 09 09 09 20 20 28 66 69 6c 65  ) 5).....  (file
6040: 2d 65 78 69 73 74 73 3f 20 72 65 61 6c 2d 64 69  -exists? real-di
6050: 72 29 29 20 3b 3b 20 62 61 64 20 68 65 75 72 69  r)) ;; bad heuri
6060: 73 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64 20  stic but should 
6070: 70 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f  prevent /tmp /ho
6080: 6d 65 20 65 74 63 2e 0a 09 09 09 20 20 20 20 20  me etc.....     
6090: 28 62 65 67 69 6e 20 3b 3b 20 6c 65 74 2a 20 28  (begin ;; let* (
60a0: 28 72 65 61 6c 70 61 74 68 20 28 72 65 73 6f 6c  (realpath (resol
60b0: 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d  ve-pathname run-
60c0: 64 69 72 29 29 29 0a 09 09 09 20 20 20 20 20 20  dir)))....      
60d0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
60e0: 66 6f 20 31 20 22 52 65 63 75 72 73 69 76 65 6c  fo 1 "Recursivel
60f0: 79 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 65 61  y removing " rea
6100: 6c 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20 20  l-dir)....      
6110: 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74   (if (file-exist
6120: 73 3f 20 72 65 61 6c 2d 64 69 72 29 0a 09 09 09  s? real-dir)....
6130: 09 20 20 20 28 69 66 20 28 3e 20 28 73 79 73 74  .   (if (> (syst
6140: 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d 72 66  em (conc "rm -rf
6150: 20 22 20 72 65 61 6c 2d 64 69 72 29 29 20 30 29   " real-dir)) 0)
6160: 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 65 62  .....       (deb
6170: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
6180: 52 3a 20 54 68 65 72 65 20 77 61 73 20 61 20 70  R: There was a p
6190: 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 69 6e 67 20  roblem removing 
61a0: 22 20 72 65 61 6c 2d 64 69 72 20 22 20 77 69 74  " real-dir " wit
61b0: 68 20 72 6d 20 2d 66 22 29 29 0a 09 09 09 09 20  h rm -f"))..... 
61c0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
61d0: 20 22 57 41 52 4e 49 4e 47 3a 20 74 65 73 74 20   "WARNING: test 
61e0: 64 69 72 20 22 20 72 65 61 6c 2d 64 69 72 20 22  dir " real-dir "
61f0: 20 61 70 70 65 61 72 73 20 74 6f 20 6e 6f 74 20   appears to not 
6200: 65 78 69 73 74 20 6f 72 20 69 73 20 6e 6f 74 20  exist or is not 
6210: 72 65 61 64 61 62 6c 65 22 29 29 29 0a 09 09 09  readable")))....
6220: 20 20 20 20 20 28 69 66 20 72 65 61 6c 2d 64 69       (if real-di
6230: 72 20 0a 09 09 09 09 20 28 64 65 62 75 67 3a 70  r ..... (debug:p
6240: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a  rint 0 "WARNING:
6250: 20 64 69 72 65 63 74 6f 72 79 20 22 20 72 65 61   directory " rea
6260: 6c 2d 64 69 72 20 22 20 64 6f 65 73 20 6e 6f 74  l-dir " does not
6270: 20 65 78 69 73 74 22 29 0a 09 09 09 09 20 28 64   exist")..... (d
6280: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41  ebug:print 0 "WA
6290: 52 4e 49 4e 47 3a 20 6e 6f 20 72 65 61 6c 20 64  RNING: no real d
62a0: 69 72 65 63 74 6f 72 79 20 63 6f 72 72 6f 73 70  irectory corrosp
62b0: 6f 6e 64 69 6e 67 20 74 6f 20 6c 69 6e 6b 20 22  onding to link "
62c0: 20 72 75 6e 2d 64 69 72 20 22 2c 20 6e 6f 74 68   run-dir ", noth
62d0: 69 6e 67 20 64 6f 6e 65 22 29 29 29 0a 09 09 09  ing done")))....
62e0: 20 28 69 66 20 28 73 79 6d 62 6f 6c 69 63 2d 6c   (if (symbolic-l
62f0: 69 6e 6b 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09  ink? run-dir)...
6300: 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09  .     (begin....
6310: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72         (debug:pr
6320: 69 6e 74 2d 69 6e 66 6f 20 31 20 22 52 65 6d 6f  int-info 1 "Remo
6330: 76 69 6e 67 20 73 79 6d 6c 69 6e 6b 20 22 20 72  ving symlink " r
6340: 75 6e 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20  un-dir)....     
6350: 20 20 28 68 61 6e 64 6c 65 2d 65 78 63 65 70 74    (handle-except
6360: 69 6f 6e 73 0a 09 09 09 09 65 78 6e 0a 09 09 09  ions.....exn....
6370: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20  .(debug:print 0 
6380: 22 45 52 52 4f 52 3a 20 20 46 61 69 6c 65 64 20  "ERROR:  Failed 
6390: 74 6f 20 72 65 6d 6f 76 65 20 73 79 6d 6c 69 6e  to remove symlin
63a0: 6b 20 22 20 72 75 6e 2d 64 69 72 20 28 28 63 6f  k " run-dir ((co
63b0: 6e 64 69 74 69 6f 6e 2d 70 72 6f 70 65 72 74 79  ndition-property
63c0: 2d 61 63 63 65 73 73 6f 72 20 27 65 78 6e 20 27  -accessor 'exn '
63d0: 6d 65 73 73 61 67 65 29 20 65 78 6e 29 20 22 2c  message) exn) ",
63e0: 20 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 63   attempting to c
63f0: 6f 6e 74 69 6e 75 65 22 29 0a 09 09 09 09 28 64  ontinue").....(d
6400: 65 6c 65 74 65 2d 66 69 6c 65 20 72 75 6e 2d 64  elete-file run-d
6410: 69 72 29 29 29 0a 09 09 09 20 20 20 20 20 28 69  ir)))....     (i
6420: 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20 72 75  f (directory? ru
6430: 6e 2d 64 69 72 29 0a 09 09 09 09 20 28 69 66 20  n-dir)..... (if 
6440: 28 3e 20 28 64 69 72 65 63 74 6f 72 79 2d 66 6f  (> (directory-fo
6450: 6c 64 20 28 6c 61 6d 62 64 61 20 28 66 20 78 29  ld (lambda (f x)
6460: 28 2b 20 31 20 78 29 29 20 30 20 72 75 6e 2d 64  (+ 1 x)) 0 run-d
6470: 69 72 29 20 30 29 0a 09 09 09 09 20 20 20 20 20  ir) 0).....     
6480: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
6490: 57 41 52 4e 49 4e 47 3a 20 72 65 66 75 73 69 6e  WARNING: refusin
64a0: 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72 75  g to remove " ru
64b0: 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20 69 73  n-dir " as it is
64c0: 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09 09 09   not empty")....
64d0: 09 20 20 20 20 20 20 28 68 61 6e 64 6c 65 2d 65  .      (handle-e
64e0: 78 63 65 70 74 69 6f 6e 73 0a 09 09 09 09 20 20  xceptions.....  
64f0: 20 20 20 20 20 65 78 6e 0a 09 09 09 09 20 20 20       exn.....   
6500: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
6510: 20 30 20 22 45 52 52 4f 52 3a 20 20 46 61 69 6c   0 "ERROR:  Fail
6520: 65 64 20 74 6f 20 72 65 6d 6f 76 65 20 64 69 72  ed to remove dir
6530: 65 63 74 6f 72 79 20 22 20 72 75 6e 2d 64 69 72  ectory " run-dir
6540: 20 28 28 63 6f 6e 64 69 74 69 6f 6e 2d 70 72 6f   ((condition-pro
6550: 70 65 72 74 79 2d 61 63 63 65 73 73 6f 72 20 27  perty-accessor '
6560: 65 78 6e 20 27 6d 65 73 73 61 67 65 29 20 65 78  exn 'message) ex
6570: 6e 29 20 22 2c 20 61 74 74 65 6d 70 74 69 6e 67  n) ", attempting
6580: 20 74 6f 20 63 6f 6e 74 69 6e 75 65 22 29 0a 09   to continue")..
6590: 09 09 09 20 20 20 20 20 20 20 28 64 65 6c 65 74  ...       (delet
65a0: 65 2d 64 69 72 65 63 74 6f 72 79 20 72 75 6e 2d  e-directory run-
65b0: 64 69 72 29 29 29 0a 09 09 09 09 20 28 69 66 20  dir)))..... (if 
65c0: 72 75 6e 2d 64 69 72 0a 09 09 09 09 20 20 20 20  run-dir.....    
65d0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
65e0: 22 57 41 52 4e 49 4e 47 3a 20 6e 6f 74 20 72 65  "WARNING: not re
65f0: 6d 6f 76 69 6e 67 20 22 20 72 75 6e 2d 64 69 72  moving " run-dir
6600: 20 22 20 61 73 20 69 74 20 65 69 74 68 65 72 20   " as it either 
6610: 64 6f 65 73 6e 27 74 20 65 78 69 73 74 20 6f 72  doesn't exist or
6620: 20 69 73 20 6e 6f 74 20 61 20 73 79 6d 6c 69 6e   is not a symlin
6630: 6b 22 29 0a 09 09 09 09 20 20 20 20 20 28 64 65  k").....     (de
6640: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 4e 4f 54  bug:print 0 "NOT
6650: 45 3a 20 74 68 65 20 72 75 6e 20 64 69 72 20 66  E: the run dir f
6660: 6f 72 20 74 68 69 73 20 74 65 73 74 20 69 73 20  or this test is 
6670: 75 6e 64 65 66 69 6e 65 64 2e 20 54 65 73 74 20  undefined. Test 
6680: 6d 61 79 20 68 61 76 65 20 61 6c 72 65 61 64 79  may have already
6690: 20 62 65 65 6e 20 64 65 6c 65 74 65 64 2e 22 29   been deleted.")
66a0: 29 0a 09 09 09 09 20 29 29 29 0a 09 09 09 28 28  )..... )))....((
66b0: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73  set-state-status
66c0: 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ).... (debug:pri
66d0: 6e 74 2d 69 6e 66 6f 20 32 20 22 6e 65 77 20 73  nt-info 2 "new s
66e0: 74 61 74 65 20 22 20 28 63 61 72 20 73 74 61 74  tate " (car stat
66f0: 65 2d 73 74 61 74 75 73 29 20 22 2c 20 6e 65 77  e-status) ", new
6700: 20 73 74 61 74 75 73 20 22 20 28 63 61 64 72 20   status " (cadr 
6710: 73 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a 09  state-status))..
6720: 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  .. (open-run-clo
6730: 73 65 20 64 62 3a 74 65 73 74 2d 73 65 74 2d 73  se db:test-set-s
6740: 74 61 74 65 2d 73 74 61 74 75 73 2d 62 79 2d 69  tate-status-by-i
6750: 64 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65  d db (db:test-ge
6760: 74 2d 69 64 20 74 65 73 74 29 20 28 63 61 72 20  t-id test) (car 
6770: 73 74 61 74 65 2d 73 74 61 74 75 73 29 28 63 61  state-status)(ca
6780: 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29  dr state-status)
6790: 20 23 66 29 29 29 29 29 0a 09 09 20 20 28 73 6f   #f)))))...  (so
67a0: 72 74 20 74 65 73 74 73 20 28 6c 61 6d 62 64 61  rt tests (lambda
67b0: 20 28 61 20 62 29 28 6c 65 74 20 28 28 64 69 72   (a b)(let ((dir
67c0: 61 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72  a (db:test-get-r
67d0: 75 6e 64 69 72 20 61 29 29 0a 09 09 09 09 09 09  undir a)).......
67e0: 20 28 64 69 72 62 20 28 64 62 3a 74 65 73 74 2d   (dirb (db:test-
67f0: 67 65 74 2d 72 75 6e 64 69 72 20 62 29 29 29 0a  get-rundir b))).
6800: 09 09 09 09 09 20 20 20 20 20 28 69 66 20 28 61  .....     (if (a
6810: 6e 64 20 28 73 74 72 69 6e 67 3f 20 64 69 72 61  nd (string? dira
6820: 29 28 73 74 72 69 6e 67 3f 20 64 69 72 62 29 29  )(string? dirb))
6830: 0a 09 09 09 09 09 09 20 28 3e 20 28 73 74 72 69  ....... (> (stri
6840: 6e 67 2d 6c 65 6e 67 74 68 20 64 69 72 61 29 28  ng-length dira)(
6850: 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 64 69  string-length di
6860: 72 62 29 29 0a 09 09 09 09 09 09 20 23 66 29 29  rb))....... #f))
6870: 29 29 29 29 29 0a 09 20 20 20 3b 3b 20 72 65 6d  )))))..   ;; rem
6880: 6f 76 65 20 74 68 65 20 72 75 6e 20 69 66 20 7a  ove the run if z
6890: 65 72 6f 20 74 65 73 74 73 20 72 65 6d 61 69 6e  ero tests remain
68a0: 0a 09 20 20 20 28 69 66 20 28 65 71 3f 20 61 63  ..   (if (eq? ac
68b0: 74 69 6f 6e 20 27 72 65 6d 6f 76 65 2d 72 75 6e  tion 'remove-run
68c0: 73 29 0a 09 20 20 20 20 20 20 20 28 6c 65 74 20  s)..       (let 
68d0: 28 28 72 65 6d 74 65 73 74 73 20 28 6f 70 65 6e  ((remtests (open
68e0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65  -run-close db:ge
68f0: 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20  t-tests-for-run 
6900: 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65  db (db:get-value
6910: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
6920: 65 61 64 65 72 20 22 69 64 22 29 20 23 66 20 27  eader "id") #f '
6930: 28 22 44 45 4c 45 54 45 44 22 29 20 27 28 22 6e  ("DELETED") '("n
6940: 2f 61 22 29 20 6e 6f 74 2d 69 6e 3a 20 23 74 29  /a") not-in: #t)
6950: 29 29 0a 09 09 20 28 69 66 20 28 6e 75 6c 6c 3f  ))... (if (null?
6960: 20 72 65 6d 74 65 73 74 73 29 20 3b 3b 20 6e 6f   remtests) ;; no
6970: 20 6d 6f 72 65 20 74 65 73 74 73 20 72 65 6d 61   more tests rema
6980: 69 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 6c 65  ining...     (le
6990: 74 2a 20 28 28 64 70 61 72 74 73 20 20 28 73 74  t* ((dparts  (st
69a0: 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73 74 74  ring-split lastt
69b0: 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09 20 20  path "/"))....  
69c0: 20 20 28 72 75 6e 70 61 74 68 20 28 63 6f 6e 63    (runpath (conc
69d0: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74   "/" (string-int
69e0: 65 72 73 70 65 72 73 65 20 0a 09 09 09 09 09 09  ersperse .......
69f0: 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20  (take dparts (- 
6a00: 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 20  (length dparts) 
6a10: 31 29 29 0a 09 09 09 09 09 09 22 2f 22 29 29 29  1))......."/")))
6a20: 29 0a 09 09 20 20 20 20 20 20 20 28 64 65 62 75  )...       (debu
6a30: 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76  g:print 1 "Remov
6a40: 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65  ing run: " runke
6a50: 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61  y " " (db:get-va
6a60: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
6a70: 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d  n header "runnam
6a80: 65 22 29 20 22 20 61 6e 64 20 72 65 6c 61 74 65  e") " and relate
6a90: 64 20 72 65 63 6f 72 64 22 29 0a 09 09 20 20 20  d record")...   
6aa0: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
6ab0: 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 72 75  ose db:delete-ru
6ac0: 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20  n db run-id)... 
6ad0: 20 20 20 20 20 20 3b 3b 20 54 68 69 73 20 69 73        ;; This is
6ae0: 20 61 20 70 72 65 74 74 79 20 67 6f 6f 64 20 70   a pretty good p
6af0: 6c 61 63 65 20 74 6f 20 70 75 72 67 65 20 6f 6c  lace to purge ol
6b00: 64 20 44 45 4c 45 54 45 44 20 74 65 73 74 73 0a  d DELETED tests.
6b10: 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  ..       (open-r
6b20: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65  un-close db:dele
6b30: 74 65 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e  te-tests-for-run
6b40: 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20   db run-id)...  
6b50: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
6b60: 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 6f  lose db:delete-o
6b70: 6c 64 2d 64 65 6c 65 74 65 64 2d 74 65 73 74 2d  ld-deleted-test-
6b80: 72 65 63 6f 72 64 73 20 64 62 29 0a 09 09 20 20  records db)...  
6b90: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
6ba0: 6c 6f 73 65 20 64 62 3a 73 65 74 2d 76 61 72 20  lose db:set-var 
6bb0: 64 62 20 22 44 45 4c 45 54 45 44 5f 54 45 53 54  db "DELETED_TEST
6bc0: 53 22 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f  S" (current-seco
6bd0: 6e 64 73 29 29 0a 09 09 20 20 20 20 20 20 20 3b  nds))...       ;
6be0: 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 75 72 65  ; need to figure
6bf0: 20 6f 75 74 20 74 68 65 20 70 61 74 68 20 74 6f   out the path to
6c00: 20 74 68 65 20 72 75 6e 20 64 69 72 20 61 6e 64   the run dir and
6c10: 20 72 65 6d 6f 76 65 20 69 74 20 69 66 20 65 6d   remove it if em
6c20: 70 74 79 0a 09 09 20 20 20 20 20 20 20 3b 3b 20  pty...       ;; 
6c30: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 28 67     (if (null? (g
6c40: 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70 61 74  lob (conc runpat
6c50: 68 20 22 2f 2a 22 29 29 29 0a 09 09 20 20 20 20  h "/*")))...    
6c60: 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 62 65     ;;        (be
6c70: 67 69 6e 0a 09 09 20 20 20 20 20 20 20 3b 3b 20  gin...       ;; 
6c80: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31  . (debug:print 1
6c90: 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64   "Removing run d
6ca0: 69 72 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09  ir " runpath)...
6cb0: 20 20 20 20 20 20 20 3b 3b 20 09 20 28 73 79 73         ;; . (sys
6cc0: 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64 69 72  tem (conc "rmdir
6cd0: 20 2d 70 20 22 20 72 75 6e 70 61 74 68 29 29 29   -p " runpath)))
6ce0: 29 0a 09 09 20 20 20 20 20 20 20 29 29 29 29 29  )...       )))))
6cf0: 0a 09 20 29 29 0a 20 20 20 20 20 72 75 6e 73 29  .. )).     runs)
6d00: 29 0a 20 20 23 74 29 0a 0a 3b 3b 3d 3d 3d 3d 3d  ).  #t)..;;=====
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 3d 3d 3d 3d 3d 3d 3d  ================
6d50: 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f  =.;; Routines fo
6d60: 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 72  r manipulating r
6d70: 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  uns.;;==========
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 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b  ============..;;
6dc0: 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c   Since many call
6dd0: 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71 75 69  s to a run requi
6de0: 72 65 20 70 72 65 74 74 79 20 6d 75 63 68 20 74  re pretty much t
6df0: 68 65 20 73 61 6d 65 20 73 65 74 75 70 20 0a 3b  he same setup .;
6e00: 3b 20 74 68 69 73 20 77 72 61 70 70 65 72 20 69  ; this wrapper i
6e10: 73 20 75 73 65 64 20 74 6f 20 72 65 64 75 63 65  s used to reduce
6e20: 20 74 68 65 20 72 65 70 6c 69 63 61 74 69 6f 6e   the replication
6e30: 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 6e 65   of code.(define
6e40: 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61   (general-run-ca
6e50: 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 61 63  ll switchname ac
6e60: 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a  tion-desc proc).
6e70: 20 20 28 6c 65 74 20 28 28 72 75 6e 6e 61 6d 65    (let ((runname
6e80: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
6e90: 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28 74 61  :runname"))..(ta
6ea0: 72 67 65 74 20 20 28 69 66 20 28 61 72 67 73 3a  rget  (if (args:
6eb0: 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74  get-arg "-target
6ec0: 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a  ")...     (args:
6ed0: 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74  get-arg "-target
6ee0: 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a  ")...     (args:
6ef0: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
6f00: 67 22 29 29 29 0a 09 28 74 68 31 20 20 20 20 20  g")))..(th1     
6f10: 23 66 29 29 0a 20 20 20 20 28 63 6f 6e 64 0a 20  #f)).    (cond. 
6f20: 20 20 20 20 28 28 6e 6f 74 20 74 61 72 67 65 74      ((not target
6f30: 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  ).      (debug:p
6f40: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d  rint 0 "ERROR: M
6f50: 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20  issing required 
6f60: 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20  parameter for " 
6f70: 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f  switchname ", yo
6f80: 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74  u must specify t
6f90: 68 65 20 74 61 72 67 65 74 20 77 69 74 68 20 2d  he target with -
6fa0: 74 61 72 67 65 74 22 29 0a 20 20 20 20 20 20 28  target").      (
6fb0: 65 78 69 74 20 33 29 29 0a 20 20 20 20 20 28 28  exit 3)).     ((
6fc0: 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20  not runname).   
6fd0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
6fe0: 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e  0 "ERROR: Missin
6ff0: 67 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d  g required param
7000: 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 63  eter for " switc
7010: 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73  hname ", you mus
7020: 74 20 73 70 65 63 69 66 79 20 74 68 65 20 72 75  t specify the ru
7030: 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 75 6e  n name with :run
7040: 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a 20  name runname"). 
7050: 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a 20       (exit 3)). 
7060: 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20      (else.      
7070: 28 6c 65 74 20 28 28 64 62 20 20 20 23 66 29 0a  (let ((db   #f).
7080: 09 20 20 20 20 28 6b 65 79 73 20 23 66 29 29 0a  .    (keys #f)).
7090: 09 28 69 66 20 28 6e 6f 74 20 28 73 65 74 75 70  .(if (not (setup
70a0: 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 20  -for-run))..    
70b0: 28 62 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28  (begin ..      (
70c0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 46  debug:print 0 "F
70d0: 61 69 6c 65 64 20 74 6f 20 73 65 74 75 70 2c 20  ailed to setup, 
70e0: 65 78 69 74 69 6e 67 22 29 0a 09 20 20 20 20 20  exiting")..     
70f0: 20 28 65 78 69 74 20 31 29 29 29 0a 09 28 69 66   (exit 1)))..(if
7100: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
7110: 2d 73 65 72 76 65 72 22 29 0a 09 20 20 20 20 28  -server")..    (
7120: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73  open-run-close s
7130: 65 72 76 65 72 3a 73 74 61 72 74 20 64 62 20 28  erver:start db (
7140: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73  args:get-arg "-s
7150: 65 72 76 65 72 22 29 29 29 0a 20 09 20 20 20 20  erver"))). .    
7160: 3b 3b 20 28 69 66 20 28 6e 6f 74 20 28 6f 72 20  ;; (if (not (or 
7170: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
7180: 72 75 6e 61 6c 6c 22 29 20 20 20 20 20 3b 3b 20  runall")     ;; 
7190: 72 75 6e 61 6c 6c 20 61 6e 64 20 72 75 6e 74 65  runall and runte
71a0: 73 74 73 20 61 72 65 20 61 6c 6c 6f 77 65 64 20  sts are allowed 
71b0: 74 6f 20 62 65 20 73 65 72 76 65 72 73 0a 20 09  to be servers. .
71c0: 20 20 20 20 3b 3b 20 20 20 20 20 09 20 28 61 72      ;;     . (ar
71d0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e  gs:get-arg "-run
71e0: 74 65 73 74 73 22 29 29 29 0a 09 20 20 20 20 3b  tests")))..    ;
71f0: 3b 20 20 20 20 20 28 63 6c 69 65 6e 74 3a 73 65  ;     (client:se
7200: 74 75 70 29 20 3b 3b 20 54 68 69 73 20 69 73 20  tup) ;; This is 
7210: 61 20 64 75 70 6c 69 63 61 74 65 20 73 74 61 72  a duplicate star
7220: 74 75 70 21 21 21 3f 3f 3f 20 42 55 47 3f 0a 09  tup!!!??? BUG?..
7230: 20 20 20 20 3b 3b 20 20 20 20 20 29 29 0a 09 28      ;;     ))..(
7240: 73 65 74 21 20 6b 65 79 73 20 28 6f 70 65 6e 2d  set! keys (open-
7250: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
7260: 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b 20 68  -keys db))..;; h
7270: 61 76 65 20 65 6e 6f 75 67 68 20 74 6f 20 70 72  ave enough to pr
7280: 6f 63 65 73 73 20 2d 74 61 72 67 65 74 20 6f 72  ocess -target or
7290: 20 2d 72 65 71 74 61 72 67 20 68 65 72 65 0a 09   -reqtarg here..
72a0: 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72  (if (args:get-ar
72b0: 67 20 22 2d 72 65 71 74 61 72 67 22 29 0a 09 20  g "-reqtarg").. 
72c0: 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f     (let* ((runco
72d0: 6e 66 69 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f  nfigf (conc  *to
72e0: 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66  ppath* "/runconf
72f0: 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b  igs.config")) ;;
7300: 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41 54 45   DO NOT EVALUATE
7310: 20 41 4c 4c 20 0a 09 09 20 20 20 28 72 75 6e 63   ALL ...   (runc
7320: 6f 6e 66 69 67 20 20 28 72 65 61 64 2d 63 6f 6e  onfig  (read-con
7330: 66 69 67 20 72 75 6e 63 6f 6e 66 69 67 66 20 23  fig runconfigf #
7340: 66 20 23 74 20 65 6e 76 69 72 6f 6e 2d 70 61 74  f #t environ-pat
7350: 74 3a 20 23 66 29 29 29 20 0a 09 20 20 20 20 20  t: #f))) ..     
7360: 20 28 69 66 20 28 68 61 73 68 2d 74 61 62 6c 65   (if (hash-table
7370: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 72 75 6e  -ref/default run
7380: 63 6f 6e 66 69 67 20 28 61 72 67 73 3a 67 65 74  config (args:get
7390: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29  -arg "-reqtarg")
73a0: 20 23 66 29 0a 09 09 20 20 28 6b 65 79 73 3a 74   #f)...  (keys:t
73b0: 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b  arget-set-args k
73c0: 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72  eys (args:get-ar
73d0: 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 61 72  g "-reqtarg") ar
73e0: 67 73 3a 61 72 67 2d 68 61 73 68 29 0a 09 09 20  gs:arg-hash)... 
73f0: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64   (begin...    (d
7400: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
7410: 52 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a 67 65  ROR: [" (args:ge
7420: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22  t-arg "-reqtarg"
7430: 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69  ) "] not found i
7440: 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a  n " runconfigf).
7450: 09 09 20 20 20 20 28 69 66 20 64 62 20 28 73 71  ..    (if db (sq
7460: 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20  lite3:finalize! 
7470: 64 62 29 29 0a 09 09 20 20 20 20 28 65 78 69 74  db))...    (exit
7480: 20 31 29 29 29 29 0a 09 20 20 20 20 28 69 66 20   1))))..    (if 
7490: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
74a0: 74 61 72 67 65 74 22 29 0a 09 09 28 6b 65 79 73  target")...(keys
74b0: 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73  :target-set-args
74c0: 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d   keys (args:get-
74d0: 61 72 67 20 22 2d 74 61 72 67 65 74 22 20 61 72  arg "-target" ar
74e0: 67 73 3a 61 72 67 2d 68 61 73 68 29 20 61 72 67  gs:arg-hash) arg
74f0: 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a 09 28  s:arg-hash)))..(
7500: 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f  if (not (car *co
7510: 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20  nfiginfo*))..   
7520: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 28   (begin..      (
7530: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
7540: 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 20  RROR: Attempted 
7550: 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 63  to " action-desc
7560: 20 22 20 62 75 74 20 72 75 6e 20 61 72 65 61 20   " but run area 
7570: 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 20  config file not 
7580: 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 20 28  found")..      (
7590: 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 3b 3b  exit 1))..    ;;
75a0: 20 45 78 74 72 61 63 74 20 6f 75 74 20 73 74 75   Extract out stu
75b0: 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73  ff needed in mos
75c0: 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a  t or many calls.
75d0: 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74 68 65  .    ;; here the
75e0: 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20  n call proc..   
75f0: 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65   (let* ((keyname
7600: 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 74  s   (map key:get
7610: 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29  -fieldname keys)
7620: 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c 6c 73  )...   (keyvalls
7630: 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73  t  (keys->vallis
7640: 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09 20 20  t keys #t)))..  
7650: 20 20 20 20 28 70 72 6f 63 20 74 61 72 67 65 74      (proc target
7660: 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20 6b 65   runname keys ke
7670: 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74  ynames keyvallst
7680: 29 29 29 0a 09 28 69 66 20 74 68 31 20 28 74 68  )))..(if th1 (th
7690: 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31 29 29  read-join! th1))
76a0: 0a 09 28 69 66 20 64 62 20 28 73 71 6c 69 74 65  ..(if db (sqlite
76b0: 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 29  3:finalize! db))
76c0: 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f 6d 65  ..(set! *didsome
76d0: 74 68 69 6e 67 2a 20 23 74 29 29 29 29 29 29 0a  thing* #t)))))).
76e0: 0a 3b 3b 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 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c 6f 63  =========.;; Loc
7730: 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73 0a 3b 3b  k/unlock 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 3d 3d  ================
7780: 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20  ======..(define 
7790: 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d 6c 6f 63  (runs:handle-loc
77a0: 6b 69 6e 67 20 74 61 72 67 65 74 20 6b 65 79 73  king target keys
77b0: 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b 20 75 6e   runname lock un
77c0: 6c 6f 63 6b 20 75 73 65 72 29 0a 20 20 28 6c 65  lock user).  (le
77d0: 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 23 66  t* ((db       #f
77e0: 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 28 6f  ).. (rundat   (o
77f0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75  pen-run-close ru
7800: 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70  ns:get-runs-by-p
7810: 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e  att db keys runn
7820: 61 6d 65 29 29 0a 09 20 28 68 65 61 64 65 72 20  ame)).. (header 
7830: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75    (vector-ref ru
7840: 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73  ndat 0)).. (runs
7850: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66       (vector-ref
7860: 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20 20 20   rundat 1))).   
7870: 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62   (for-each (lamb
7880: 64 61 20 28 72 75 6e 29 0a 09 09 28 6c 65 74 20  da (run)...(let 
7890: 28 28 72 75 6e 2d 69 64 20 28 64 62 3a 67 65 74  ((run-id (db:get
78a0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
78b0: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22   run header "id"
78c0: 29 29 29 0a 09 09 20 20 28 69 66 20 28 6f 72 20  )))...  (if (or 
78d0: 6c 6f 63 6b 0a 09 09 09 20 20 28 61 6e 64 20 75  lock....  (and u
78e0: 6e 6c 6f 63 6b 0a 09 09 09 20 20 20 20 20 20 20  nlock....       
78f0: 28 62 65 67 69 6e 0a 09 09 09 09 20 28 70 72 69  (begin..... (pri
7900: 6e 74 20 22 44 6f 20 79 6f 75 20 72 65 61 6c 6c  nt "Do you reall
7910: 79 20 77 69 73 68 20 74 6f 20 75 6e 6c 6f 63 6b  y wish to unlock
7920: 20 72 75 6e 20 22 20 72 75 6e 2d 69 64 20 22 3f   run " run-id "?
7930: 5c 6e 20 20 20 79 2f 6e 3a 20 22 29 0a 09 09 09  \n   y/n: ")....
7940: 09 20 28 65 71 75 61 6c 3f 20 22 79 22 20 28 72  . (equal? "y" (r
7950: 65 61 64 2d 6c 69 6e 65 29 29 29 29 29 0a 09 09  ead-line)))))...
7960: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
7970: 63 6c 6f 73 65 20 64 62 3a 6c 6f 63 6b 2f 75 6e  close db:lock/un
7980: 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 72 75 6e 2d  lock-run db run-
7990: 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75  id lock unlock u
79a0: 73 65 72 29 0a 09 09 20 20 20 20 20 20 28 64 65  ser)...      (de
79b0: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30  bug:print-info 0
79c0: 20 22 53 6b 69 70 70 69 6e 67 20 6c 6f 63 6b 2f   "Skipping lock/
79d0: 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 75 6e 2d  unlock on " run-
79e0: 69 64 29 29 29 29 0a 09 20 20 20 20 20 20 72 75  id))))..      ru
79f0: 6e 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d  ns))).;;========
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 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b  ==============.;
7a40: 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b  ; Rollup 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 3d 3d  ================
7a90: 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74  ======..;; Updat
7aa0: 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20  e the test_meta 
7ab0: 74 61 62 6c 65 20 66 6f 72 20 74 68 69 73 20 74  table for this t
7ac0: 65 73 74 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  est.(define (run
7ad0: 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65  s:update-test_me
7ae0: 74 61 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73  ta test-name tes
7af0: 74 2d 63 6f 6e 66 29 0a 20 20 28 6c 65 74 20 28  t-conf).  (let (
7b00: 28 63 75 72 72 72 65 63 6f 72 64 20 28 63 64 62  (currrecord (cdb
7b10: 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 74  :remote-run db:t
7b20: 65 73 74 6d 65 74 61 2d 67 65 74 2d 72 65 63 6f  estmeta-get-reco
7b30: 72 64 20 23 66 20 74 65 73 74 2d 6e 61 6d 65 29  rd #f test-name)
7b40: 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20  )).    (if (not 
7b50: 63 75 72 72 72 65 63 6f 72 64 29 0a 09 28 62 65  currrecord)..(be
7b60: 67 69 6e 0a 09 20 20 28 73 65 74 21 20 63 75 72  gin..  (set! cur
7b70: 72 72 65 63 6f 72 64 20 28 6d 61 6b 65 2d 76 65  rrecord (make-ve
7b80: 63 74 6f 72 20 31 30 20 23 66 29 29 0a 09 20 20  ctor 10 #f))..  
7b90: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20  (cdb:remote-run 
7ba0: 64 62 3a 74 65 73 74 6d 65 74 61 2d 61 64 64 2d  db:testmeta-add-
7bb0: 72 65 63 6f 72 64 20 23 66 20 74 65 73 74 2d 6e  record #f test-n
7bc0: 61 6d 65 29 29 29 0a 20 20 20 20 28 66 6f 72 2d  ame))).    (for-
7bd0: 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62  each .     (lamb
7be0: 64 61 20 28 6b 65 79 29 0a 20 20 20 20 20 20 20  da (key).       
7bf0: 28 6c 65 74 2a 20 28 28 69 64 78 20 28 63 61 64  (let* ((idx (cad
7c00: 72 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28  r key))..      (
7c10: 66 6c 64 20 28 63 61 72 20 20 6b 65 79 29 29 0a  fld (car  key)).
7c20: 09 20 20 20 20 20 20 28 76 61 6c 20 28 63 6f 6e  .      (val (con
7c30: 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d  fig-lookup test-
7c40: 63 6f 6e 66 20 22 74 65 73 74 5f 6d 65 74 61 22  conf "test_meta"
7c50: 20 66 6c 64 29 29 29 0a 09 20 3b 3b 20 28 64 65   fld))).. ;; (de
7c60: 62 75 67 3a 70 72 69 6e 74 20 35 20 22 69 64 78  bug:print 5 "idx
7c70: 3a 20 22 20 69 64 78 20 22 20 66 6c 64 3a 20 22  : " idx " fld: "
7c80: 20 66 6c 64 20 22 20 76 61 6c 3a 20 22 20 76 61   fld " val: " va
7c90: 6c 29 0a 09 20 28 69 66 20 28 61 6e 64 20 76 61  l).. (if (and va
7ca0: 6c 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28  l (not (equal? (
7cb0: 76 65 63 74 6f 72 2d 72 65 66 20 63 75 72 72 72  vector-ref currr
7cc0: 65 63 6f 72 64 20 69 64 78 29 20 76 61 6c 29 29  ecord idx) val))
7cd0: 29 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09  )..     (begin..
7ce0: 20 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 55         (print "U
7cf0: 70 64 61 74 69 6e 67 20 22 20 74 65 73 74 2d 6e  pdating " test-n
7d00: 61 6d 65 20 22 20 22 20 66 6c 64 20 22 20 74 6f  ame " " fld " to
7d10: 20 22 20 76 61 6c 29 0a 09 20 20 20 20 20 20 20   " val)..       
7d20: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20  (cdb:remote-run 
7d30: 64 62 3a 74 65 73 74 6d 65 74 61 2d 75 70 64 61  db:testmeta-upda
7d40: 74 65 2d 66 69 65 6c 64 20 23 66 20 74 65 73 74  te-field #f test
7d50: 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c 29 29 29  -name fld val)))
7d60: 29 29 0a 20 20 20 20 20 27 28 28 22 61 75 74 68  )).     '(("auth
7d70: 6f 72 22 20 32 29 28 22 6f 77 6e 65 72 22 20 33  or" 2)("owner" 3
7d80: 29 28 22 64 65 73 63 72 69 70 74 69 6f 6e 22 20  )("description" 
7d90: 34 29 28 22 72 65 76 69 65 77 65 64 22 20 35 29  4)("reviewed" 5)
7da0: 28 22 74 61 67 73 22 20 39 29 29 29 29 29 0a 0a  ("tags" 9)))))..
7db0: 3b 3b 20 55 70 64 61 74 65 20 74 65 73 74 5f 6d  ;; Update test_m
7dc0: 65 74 61 20 66 6f 72 20 61 6c 6c 20 74 65 73 74  eta for all test
7dd0: 73 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a  s.(define (runs:
7de0: 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f  update-all-test_
7df0: 6d 65 74 61 20 64 62 29 0a 20 20 28 6c 65 74 20  meta db).  (let 
7e00: 28 28 74 65 73 74 2d 6e 61 6d 65 73 20 28 67 65  ((test-names (ge
7e10: 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74  t-all-legal-test
7e20: 73 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61  s))).    (for-ea
7e30: 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61  ch .     (lambda
7e40: 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20   (test-name).   
7e50: 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74      (let* ((test
7e60: 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a  -path    (conc *
7e70: 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73  toppath* "/tests
7e80: 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09  /" test-name))..
7e90: 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66        (test-conf
7ea0: 69 67 66 20 28 63 6f 6e 63 20 74 65 73 74 2d 70  igf (conc test-p
7eb0: 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 67  ath "/testconfig
7ec0: 22 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74  "))..      (test
7ed0: 65 78 69 73 74 73 20 20 20 28 61 6e 64 20 28 66  exists   (and (f
7ee0: 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74  ile-exists? test
7ef0: 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72  -configf)(file-r
7f00: 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74  ead-access? test
7f10: 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 20 20  -configf)))..   
7f20: 20 20 20 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69     ;; read confi
7f30: 67 73 20 77 69 74 68 20 74 72 69 63 6b 73 20 74  gs with tricks t
7f40: 75 72 6e 65 64 20 6f 66 66 20 28 69 2e 65 2e 20  urned off (i.e. 
7f50: 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20 20 20 20  no system)..    
7f60: 20 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20    (test-conf    
7f70: 28 69 66 20 74 65 73 74 65 78 69 73 74 73 20 28  (if testexists (
7f80: 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 74  read-config test
7f90: 2d 63 6f 6e 66 69 67 66 20 23 66 20 23 66 29 28  -configf #f #f)(
7fa0: 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29  make-hash-table)
7fb0: 29 29 29 0a 09 20 3b 3b 20 75 73 65 20 74 68 65  ))).. ;; use the
7fc0: 20 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20   open-run-close 
7fd0: 69 6e 73 74 65 61 64 20 6f 66 20 70 61 73 73 69  instead of passi
7fe0: 6e 67 20 69 6e 20 64 62 0a 09 20 28 72 75 6e 73  ng in db.. (runs
7ff0: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74  :update-test_met
8000: 61 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74  a test-name test
8010: 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 20 74 65  -conf))).     te
8020: 73 74 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20  st-names)))..;; 
8030: 54 68 69 73 20 63 6f 75 6c 64 20 70 72 6f 62 61  This could proba
8040: 62 6c 79 20 62 65 20 72 65 66 61 63 74 6f 72 65  bly be refactore
8050: 64 20 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c  d into one compl
8060: 65 78 20 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65  ex query ....(de
8070: 66 69 6e 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75  fine (runs:rollu
8080: 70 2d 72 75 6e 20 6b 65 79 73 20 6b 65 79 76 61  p-run keys keyva
8090: 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75 73 65  llst runname use
80a0: 72 29 20 3b 3b 20 77 61 73 20 74 61 72 67 65 74  r) ;; was target
80b0: 2c 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74 0a  , now keyvallst.
80c0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34    (debug:print 4
80d0: 20 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75   "runs:rollup-ru
80e0: 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20  n, keys: " keys 
80f0: 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b  " keyvallst: " k
8100: 65 79 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e 6e  eyvallst " :runn
8110: 61 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20 22 20  ame " runname " 
8120: 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20 20  user: " user).  
8130: 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 20  (let* ((db      
8140: 20 20 20 20 20 20 20 20 23 66 29 20 3b 3b 20 28          #f) ;; (
8150: 6b 65 79 76 61 6c 6c 6c 73 74 20 20 20 20 20 20  keyvalllst      
8160: 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65  (keys:target->ke
8170: 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74  yval keys target
8180: 29 29 0a 09 20 28 6e 65 77 2d 72 75 6e 2d 69 64  )).. (new-run-id
8190: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74        (cdb:remot
81a0: 65 2d 72 75 6e 20 64 62 3a 72 65 67 69 73 74 65  e-run db:registe
81b0: 72 2d 72 75 6e 20 23 66 20 6b 65 79 73 20 6b 65  r-run #f keys ke
81c0: 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20  yvallst runname 
81d0: 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72  "new" "n/a" user
81e0: 29 29 0a 09 20 28 70 72 65 76 2d 74 65 73 74 73  )).. (prev-tests
81f0: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
8200: 63 6c 6f 73 65 20 74 65 73 74 3a 67 65 74 2d 6d  close test:get-m
8210: 61 74 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 73  atching-previous
8220: 2d 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64  -test-run-record
8230: 73 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20  s db new-run-id 
8240: 22 25 22 20 22 25 22 29 29 0a 09 20 28 63 75 72  "%" "%")).. (cur
8250: 72 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f 70  r-tests      (op
8260: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
8270: 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75  get-tests-for-ru
8280: 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20  n db new-run-id 
8290: 22 25 2f 25 22 20 27 28 29 20 27 28 29 29 29 0a  "%/%" '() '())).
82a0: 09 20 28 63 75 72 72 2d 74 65 73 74 73 2d 68 61  . (curr-tests-ha
82b0: 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61  sh (make-hash-ta
82c0: 62 6c 65 29 29 29 0a 20 20 20 20 28 6f 70 65 6e  ble))).    (open
82d0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 75 70  -run-close db:up
82e0: 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e 74 5f 74  date-run-event_t
82f0: 69 6d 65 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69  ime db new-run-i
8300: 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64 65 78 20  d).    ;; index 
8310: 74 68 65 20 61 6c 72 65 61 64 79 20 73 61 76 65  the already save
8320: 64 20 74 65 73 74 73 20 62 79 20 74 65 73 74 6e  d tests by testn
8330: 61 6d 65 20 61 6e 64 20 69 74 65 6d 64 61 74 20  ame and itemdat 
8340: 69 6e 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61  in curr-tests-ha
8350: 73 68 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  sh.    (for-each
8360: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74  .     (lambda (t
8370: 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28  estdat).       (
8380: 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20  let* ((testname 
8390: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
83a0: 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29  stname testdat))
83b0: 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61  ..      (item-pa
83c0: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  th (db:test-get-
83d0: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61  item-path testda
83e0: 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c  t))..      (full
83f0: 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74  -name (conc test
8400: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
8410: 74 68 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61  th))).. (hash-ta
8420: 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65  ble-set! curr-te
8430: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61  sts-hash full-na
8440: 6d 65 20 74 65 73 74 64 61 74 29 29 29 0a 20 20  me testdat))).  
8450: 20 20 20 63 75 72 72 2d 74 65 73 74 73 29 0a 20     curr-tests). 
8460: 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d     ;; NOPE: Non-
8470: 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f 61 63 68  optimal approach
8480: 2e 20 54 72 79 20 74 68 69 73 20 69 6e 73 74 65  . Try this inste
8490: 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20 31 2e 20  ad..    ;;   1. 
84a0: 74 65 73 74 73 20 61 72 65 20 72 65 63 65 69 76  tests are receiv
84b0: 65 64 20 69 6e 20 61 20 6c 69 73 74 2c 20 6d 6f  ed in a list, mo
84c0: 73 74 20 72 65 63 65 6e 74 20 66 69 72 73 74 0a  st recent first.
84d0: 20 20 20 20 3b 3b 20 20 20 32 2e 20 72 65 70 6c      ;;   2. repl
84e0: 61 63 65 20 74 68 65 20 72 6f 6c 6c 75 70 20 74  ace the rollup t
84f0: 65 73 74 20 77 69 74 68 20 74 68 65 20 6e 65 77  est with the new
8500: 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20 20 28 66   *always*.    (f
8510: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c  or-each .     (l
8520: 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a  ambda (testdat).
8530: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74         (let* ((t
8540: 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73  estname  (db:tes
8550: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  t-get-testname t
8560: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20  estdat))..      
8570: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74  (item-path (db:t
8580: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74  est-get-item-pat
8590: 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  h testdat))..   
85a0: 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63     (full-name (c
85b0: 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22  onc testname "/"
85c0: 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20   item-path))..  
85d0: 20 20 20 20 28 70 72 65 76 2d 74 65 73 74 2d 64      (prev-test-d
85e0: 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72  at (hash-table-r
85f0: 65 66 2f 64 65 66 61 75 6c 74 20 63 75 72 72 2d  ef/default curr-
8600: 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d  tests-hash full-
8610: 6e 61 6d 65 20 23 66 29 29 0a 09 20 20 20 20 20  name #f))..     
8620: 20 28 74 65 73 74 2d 73 74 65 70 73 20 20 20 20   (test-steps    
8630: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
8640: 65 20 64 62 3a 67 65 74 2d 73 74 65 70 73 2d 66  e db:get-steps-f
8650: 6f 72 2d 74 65 73 74 20 64 62 20 28 64 62 3a 74  or-test db (db:t
8660: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
8670: 61 74 29 29 29 0a 09 20 20 20 20 20 20 28 6e 65  at)))..      (ne
8680: 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66  w-test-record #f
8690: 29 29 0a 09 20 3b 3b 20 72 65 70 6c 61 63 65 20  )).. ;; replace 
86a0: 74 68 65 73 65 20 77 69 74 68 20 69 6e 73 65 72  these with inser
86b0: 74 20 2e 2e 2e 20 73 65 6c 65 63 74 0a 09 20 28  t ... select.. (
86c0: 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78  apply sqlite3:ex
86d0: 65 63 75 74 65 20 0a 09 09 64 62 20 0a 09 09 28  ecute ...db ...(
86e0: 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20  conc "INSERT OR 
86f0: 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73  REPLACE INTO tes
8700: 74 73 20 28 72 75 6e 5f 69 64 2c 74 65 73 74 6e  ts (run_id,testn
8710: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73  ame,state,status
8720: 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 68 6f 73 74  ,event_time,host
8730: 2c 63 70 75 6c 6f 61 64 2c 64 69 73 6b 66 72 65  ,cpuload,diskfre
8740: 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 69 72 2c 69  e,uname,rundir,i
8750: 74 65 6d 5f 70 61 74 68 2c 72 75 6e 5f 64 75 72  tem_path,run_dur
8760: 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66  ation,final_logf
8770: 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20  ,comment) "...  
8780: 20 20 20 20 22 56 41 4c 55 45 53 20 28 3f 2c 3f      "VALUES (?,?
8790: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
87a0: 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e  ,?,?,?,?);")...n
87b0: 65 77 2d 72 75 6e 2d 69 64 20 28 63 64 64 72 20  ew-run-id (cddr 
87c0: 28 76 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74 65  (vector->list te
87d0: 73 74 64 61 74 29 29 29 0a 09 20 28 73 65 74 21  stdat))).. (set!
87e0: 20 6e 65 77 2d 74 65 73 74 64 61 74 20 28 63 61   new-testdat (ca
87f0: 72 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73  r (open-run-clos
8800: 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66  e db:get-tests-f
8810: 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75  or-run db new-ru
8820: 6e 2d 69 64 20 28 63 6f 6e 63 20 74 65 73 74 6e  n-id (conc testn
8830: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
8840: 68 29 20 27 28 29 20 27 28 29 29 29 29 0a 09 20  h) '() '()))).. 
8850: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
8860: 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68   curr-tests-hash
8870: 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65 77 2d 74   full-name new-t
8880: 65 73 74 64 61 74 29 20 3b 3b 20 74 68 69 73 20  estdat) ;; this 
8890: 63 6f 75 6c 64 20 62 65 20 63 6f 6e 66 75 73 69  could be confusi
88a0: 6e 67 2c 20 77 68 69 63 68 20 72 65 63 6f 72 64  ng, which record
88b0: 20 73 68 6f 75 6c 64 20 67 6f 20 69 6e 74 6f 20   should go into 
88c0: 74 68 65 20 6c 6f 6f 6b 75 70 20 74 61 62 6c 65  the lookup table
88d0: 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69  ?.. ;; Now dupli
88e0: 63 61 74 65 20 74 68 65 20 74 65 73 74 20 73 74  cate the test st
88f0: 65 70 73 0a 09 20 28 64 65 62 75 67 3a 70 72 69  eps.. (debug:pri
8900: 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 65  nt 4 "Copying re
8910: 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 73 74  cords in test_st
8920: 65 70 73 20 66 72 6f 6d 20 74 65 73 74 5f 69 64  eps from test_id
8930: 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  =" (db:test-get-
8940: 69 64 20 74 65 73 74 64 61 74 29 20 22 20 74 6f  id testdat) " to
8950: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d   " (db:test-get-
8960: 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29  id new-testdat))
8970: 0a 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  .. (open-run-clo
8980: 73 65 20 0a 09 20 20 28 6c 61 6d 62 64 61 20 28  se ..  (lambda (
8990: 29 0a 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a  )..    (sqlite3:
89a0: 65 78 65 63 75 74 65 20 0a 09 20 20 20 20 20 64  execute ..     d
89b0: 62 20 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 22  b ..     (conc "
89c0: 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43  INSERT OR REPLAC
89d0: 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 74 65 70  E INTO test_step
89e0: 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65 70 6e  s (test_id,stepn
89f0: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73  ame,state,status
8a00: 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d  ,event_time,comm
8a10: 65 6e 74 29 20 22 0a 09 09 20 20 20 22 53 45 4c  ent) "...   "SEL
8a20: 45 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67  ECT " (db:test-g
8a30: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61  et-id new-testda
8a40: 74 29 20 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74  t) ",stepname,st
8a50: 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74  ate,status,event
8a60: 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52  _time,comment FR
8a70: 4f 4d 20 74 65 73 74 5f 73 74 65 70 73 20 57 48  OM test_steps WH
8a80: 45 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29  ERE test_id=?;")
8a90: 0a 09 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d  ..     (db:test-
8aa0: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29  get-id testdat))
8ab0: 0a 09 20 20 20 20 3b 3b 20 4e 6f 77 20 64 75 70  ..    ;; Now dup
8ac0: 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 74 20  licate the test 
8ad0: 64 61 74 61 0a 09 20 20 20 20 28 64 65 62 75 67  data..    (debug
8ae0: 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e  :print 4 "Copyin
8af0: 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73  g records in tes
8b00: 74 5f 64 61 74 61 20 66 72 6f 6d 20 74 65 73 74  t_data from test
8b10: 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67  _id=" (db:test-g
8b20: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 22  et-id testdat) "
8b30: 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67   to " (db:test-g
8b40: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61  et-id new-testda
8b50: 74 29 29 0a 09 20 20 20 20 28 73 71 6c 69 74 65  t))..    (sqlite
8b60: 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 20 20  3:execute ..    
8b70: 20 64 62 20 0a 09 20 20 20 20 20 28 63 6f 6e 63   db ..     (conc
8b80: 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c   "INSERT OR REPL
8b90: 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 64 61  ACE INTO test_da
8ba0: 74 61 20 28 74 65 73 74 5f 69 64 2c 63 61 74 65  ta (test_id,cate
8bb0: 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61  gory,variable,va
8bc0: 6c 75 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c  lue,expected,tol
8bd0: 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 29 20  ,units,comment) 
8be0: 22 0a 09 09 20 20 20 22 53 45 4c 45 43 54 20 22  "...   "SELECT "
8bf0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
8c00: 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c   new-testdat) ",
8c10: 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c  category,variabl
8c20: 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64  e,value,expected
8c30: 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65  ,tol,units,comme
8c40: 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 64 61 74  nt FROM test_dat
8c50: 61 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d  a WHERE test_id=
8c60: 3f 3b 22 29 0a 09 20 20 20 20 20 28 64 62 3a 74  ?;")..     (db:t
8c70: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
8c80: 61 74 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20  at)))).. )).    
8c90: 20 70 72 65 76 2d 74 65 73 74 73 29 29 29 0a 09   prev-tests)))..
8ca0: 20 0a 20 20 20 20 20 0a                           .     .