Megatest

Hex Artifact Content
Login

Artifact 6f1beb94af8fa665cb44033e117fd3aaa999a602:


0000: 0a 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 32 30  .;; Copyright 20
0010: 30 36 2d 32 30 31 31 2c 20 4d 61 74 74 68 65 77  06-2011, Matthew
0020: 20 57 65 6c 6c 61 6e 64 2e 0a 3b 3b 20 0a 3b 3b   Welland..;; .;;
0030: 20 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69    This program i
0040: 73 20 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65  s made available
0050: 20 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47   under the GNU G
0060: 50 4c 20 76 65 72 73 69 6f 6e 20 32 2e 30 20 6f  PL version 2.0 o
0070: 72 0a 3b 3b 20 20 67 72 65 61 74 65 72 2e 20 53  r.;;  greater. S
0080: 65 65 20 74 68 65 20 61 63 63 6f 6d 70 61 6e 79  ee the accompany
0090: 69 6e 67 20 66 69 6c 65 20 43 4f 50 59 49 4e 47  ing file COPYING
00a0: 20 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 3b 3b   for details..;;
00b0: 20 0a 3b 3b 20 20 54 68 69 73 20 70 72 6f 67 72   .;;  This progr
00c0: 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 65  am is distribute
00d0: 64 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41  d WITHOUT ANY WA
00e0: 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20  RRANTY; without 
00f0: 65 76 65 6e 20 74 68 65 0a 3b 3b 20 20 69 6d 70  even the.;;  imp
0100: 6c 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66  lied warranty of
0110: 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59   MERCHANTABILITY
0120: 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20   or FITNESS FOR 
0130: 41 20 50 41 52 54 49 43 55 4c 41 52 0a 3b 3b 20  A PARTICULAR.;; 
0140: 20 50 55 52 50 4f 53 45 2e 0a 0a 3b 3b 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: 20 2e 20 70 61 72 61 6d 73 29 20 3b 3b 20 74 65   . params) ;; te
0460: 73 74 2d 6e 61 6d 65 29 0a 20 20 28 6c 65 74 2a  st-name).  (let*
0470: 20 28 28 6b 65 79 76 61 6c 6c 73 74 20 28 6b 65   ((keyvallst (ke
0480: 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73  ys->vallist keys
0490: 29 29 0a 09 20 28 74 6d 70 20 20 20 20 20 20 28  )).. (tmp      (
04a0: 72 75 6e 73 3a 67 65 74 2d 73 74 64 2d 72 75 6e  runs:get-std-run
04b0: 2d 66 69 65 6c 64 73 20 6b 65 79 73 20 27 28 22  -fields keys '("
04c0: 69 64 22 20 22 72 75 6e 6e 61 6d 65 22 20 22 73  id" "runname" "s
04d0: 74 61 74 65 22 20 22 73 74 61 74 75 73 22 20 22  tate" "status" "
04e0: 6f 77 6e 65 72 22 20 22 65 76 65 6e 74 5f 74 69  owner" "event_ti
04f0: 6d 65 22 29 29 29 0a 09 20 28 6b 65 79 73 74 72  me"))).. (keystr
0500: 20 20 20 28 63 61 72 20 74 6d 70 29 29 0a 09 20     (car tmp)).. 
0510: 28 68 65 61 64 65 72 20 20 20 28 63 61 64 72 20  (header   (cadr 
0520: 74 6d 70 29 29 0a 09 20 28 72 65 73 20 20 20 20  tmp)).. (res    
0530: 20 27 28 29 29 0a 09 20 28 6b 65 79 2d 70 61 74   '()).. (key-pat
0540: 74 20 22 22 29 29 0a 20 20 20 20 28 66 6f 72 2d  t "")).    (for-
0550: 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 6b 65  each (lambda (ke
0560: 79 76 61 6c 29 0a 09 09 28 6c 65 74 2a 20 28 28  yval)...(let* ((
0570: 6b 65 79 20 20 20 20 28 76 65 63 74 6f 72 2d 72  key    (vector-r
0580: 65 66 20 6b 65 79 76 61 6c 20 30 29 29 0a 09 09  ef keyval 0))...
0590: 20 20 20 20 20 20 20 28 66 75 6c 6b 65 79 20 28         (fulkey (
05a0: 63 6f 6e 63 20 22 3a 22 20 6b 65 79 29 29 0a 09  conc ":" key))..
05b0: 09 20 20 20 20 20 20 20 28 70 61 74 74 20 20 20  .       (patt   
05c0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 66 75  (args:get-arg fu
05d0: 6c 6b 65 79 29 29 29 0a 09 09 20 20 28 69 66 20  lkey)))...  (if 
05e0: 70 61 74 74 0a 09 09 20 20 20 20 20 20 28 73 65  patt...      (se
05f0: 74 21 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e  t! key-patt (con
0600: 63 20 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44  c key-patt " AND
0610: 20 22 20 6b 65 79 20 22 20 6c 69 6b 65 20 27 22   " key " like '"
0620: 20 70 61 74 74 20 22 27 22 29 29 0a 09 09 20 20   patt "'"))...  
0630: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 28 64      (begin....(d
0640: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
0650: 52 4f 52 3a 20 73 65 61 72 63 68 69 6e 67 20 66  ROR: searching f
0660: 6f 72 20 72 75 6e 73 20 77 69 74 68 20 6e 6f 20  or runs with no 
0670: 70 61 74 74 65 72 6e 20 73 65 74 20 66 6f 72 20  pattern set for 
0680: 22 20 66 75 6c 6b 65 79 29 0a 09 09 09 28 65 78  " fulkey)....(ex
0690: 69 74 20 36 29 29 29 29 29 0a 09 20 20 20 20 20  it 6)))))..     
06a0: 20 6b 65 79 73 29 0a 20 20 20 20 28 73 71 6c 69   keys).    (sqli
06b0: 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77  te3:for-each-row
06c0: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28   .     (lambda (
06d0: 61 20 2e 20 72 29 0a 20 20 20 20 20 20 20 28 73  a . r).       (s
06e0: 65 74 21 20 72 65 73 20 28 63 6f 6e 73 20 28 6c  et! res (cons (l
06f0: 69 73 74 2d 3e 76 65 63 74 6f 72 20 28 63 6f 6e  ist->vector (con
0700: 73 20 61 20 72 29 29 20 72 65 73 29 29 29 0a 20  s a r)) res))). 
0710: 20 20 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f      db .     (co
0720: 6e 63 20 22 53 45 4c 45 43 54 20 22 20 6b 65 79  nc "SELECT " key
0730: 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e 73 20  str " FROM runs 
0740: 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 20 6c 69  WHERE runname li
0750: 6b 65 20 3f 20 22 20 6b 65 79 2d 70 61 74 74 20  ke ? " key-patt 
0760: 22 3b 22 29 0a 20 20 20 20 20 72 75 6e 6e 61 6d  ";").     runnam
0770: 65 70 61 74 74 29 0a 20 20 20 20 28 76 65 63 74  epatt).    (vect
0780: 6f 72 20 68 65 61 64 65 72 20 72 65 73 29 29 29  or header res)))
0790: 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a  ..(define (runs:
07a0: 74 65 73 74 2d 67 65 74 2d 66 75 6c 6c 2d 70 61  test-get-full-pa
07b0: 74 68 20 74 65 73 74 29 0a 20 20 28 6c 65 74 2a  th test).  (let*
07c0: 20 28 28 74 65 73 74 6e 61 6d 65 20 28 64 62 3a   ((testname (db:
07d0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d  test-get-testnam
07e0: 65 20 20 20 74 65 73 74 29 29 0a 09 20 28 69 74  e   test)).. (it
07f0: 65 6d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d  empath (db:test-
0800: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65  get-item-path te
0810: 73 74 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20  st))).    (conc 
0820: 74 65 73 74 6e 61 6d 65 20 28 69 66 20 28 65 71  testname (if (eq
0830: 75 61 6c 3f 20 69 74 65 6d 70 61 74 68 20 22 22  ual? itempath ""
0840: 29 20 22 22 20 28 63 6f 6e 63 20 22 28 22 20 69  ) "" (conc "(" i
0850: 74 65 6d 70 61 74 68 20 22 29 22 29 29 29 29 29  tempath ")")))))
0860: 0a 0a 0a 28 64 65 66 69 6e 65 20 28 73 65 74 2d  ...(define (set-
0870: 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72  megatest-env-var
0880: 73 20 64 62 20 72 75 6e 2d 69 64 29 0a 20 20 28  s db run-id).  (
0890: 6c 65 74 20 28 28 6b 65 79 73 20 28 72 64 62 3a  let ((keys (rdb:
08a0: 67 65 74 2d 6b 65 79 73 20 64 62 29 29 29 0a 20  get-keys db))). 
08b0: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61     (for-each (la
08c0: 6d 62 64 61 20 28 6b 65 79 29 0a 09 09 28 73 71  mbda (key)...(sq
08d0: 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72  lite3:for-each-r
08e0: 6f 77 0a 09 09 20 28 6c 61 6d 62 64 61 20 28 76  ow... (lambda (v
08f0: 61 6c 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a  al)...   (debug:
0900: 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e 76 20  print 2 "setenv 
0910: 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64  " (key:get-field
0920: 6e 61 6d 65 20 6b 65 79 29 20 22 20 22 20 76 61  name key) " " va
0930: 6c 29 0a 09 09 20 20 20 28 73 65 74 65 6e 76 20  l)...   (setenv 
0940: 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61  (key:get-fieldna
0950: 6d 65 20 6b 65 79 29 20 76 61 6c 29 29 0a 09 09  me key) val))...
0960: 20 64 62 20 0a 09 09 20 28 63 6f 6e 63 20 22 53   db ... (conc "S
0970: 45 4c 45 43 54 20 22 20 28 6b 65 79 3a 67 65 74  ELECT " (key:get
0980: 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20  -fieldname key) 
0990: 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52  " FROM runs WHER
09a0: 45 20 69 64 3d 3f 3b 22 29 0a 09 09 20 72 75 6e  E id=?;")... run
09b0: 2d 69 64 29 29 0a 09 20 20 20 20 20 20 6b 65 79  -id))..      key
09c0: 73 29 0a 20 20 20 20 28 61 6c 69 73 74 2d 3e 65  s).    (alist->e
09d0: 6e 76 2d 76 61 72 73 20 28 68 61 73 68 2d 74 61  nv-vars (hash-ta
09e0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
09f0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 65 6e 76  *configdat* "env
0a00: 2d 6f 76 65 72 72 69 64 65 22 20 27 28 29 29 29  -override" '()))
0a10: 0a 20 20 20 20 3b 3b 20 4c 65 74 73 20 75 73 65  .    ;; Lets use
0a20: 20 74 68 69 73 20 61 73 20 61 6e 20 6f 70 70 6f   this as an oppo
0a30: 72 74 75 6e 69 74 79 20 74 6f 20 70 75 74 20 4d  rtunity to put M
0a40: 54 5f 52 55 4e 4e 41 4d 45 20 69 6e 20 74 68 65  T_RUNNAME in the
0a50: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20   environment.   
0a60: 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61   (sqlite3:for-ea
0a70: 63 68 2d 72 6f 77 0a 20 20 20 20 20 28 6c 61 6d  ch-row.     (lam
0a80: 62 64 61 20 28 72 75 6e 6e 61 6d 65 29 0a 20 20  bda (runname).  
0a90: 20 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54       (setenv "MT
0aa0: 5f 52 55 4e 4e 41 4d 45 22 20 72 75 6e 6e 61 6d  _RUNNAME" runnam
0ab0: 65 29 29 0a 20 20 20 20 20 64 62 0a 20 20 20 20  e)).     db.    
0ac0: 20 22 53 45 4c 45 43 54 20 72 75 6e 6e 61 6d 65   "SELECT runname
0ad0: 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45   FROM runs WHERE
0ae0: 20 69 64 3d 3f 3b 22 0a 20 20 20 20 20 72 75 6e   id=?;".     run
0af0: 2d 69 64 29 0a 20 20 20 20 29 29 0a 0a 28 64 65  -id).    ))..(de
0b00: 66 69 6e 65 20 28 73 65 74 2d 69 74 65 6d 2d 65  fine (set-item-e
0b10: 6e 76 2d 76 61 72 73 20 69 74 65 6d 64 61 74 29  nv-vars itemdat)
0b20: 0a 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61  .  (for-each (la
0b30: 6d 62 64 61 20 28 69 74 65 6d 29 0a 09 20 20 20  mbda (item)..   
0b40: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
0b50: 32 20 22 73 65 74 65 6e 76 20 22 20 28 63 61 72  2 "setenv " (car
0b60: 20 69 74 65 6d 29 20 22 20 22 20 28 63 61 64 72   item) " " (cadr
0b70: 20 69 74 65 6d 29 29 0a 09 20 20 20 20 20 20 28   item))..      (
0b80: 73 65 74 65 6e 76 20 28 63 61 72 20 69 74 65 6d  setenv (car item
0b90: 29 20 28 63 61 64 72 20 69 74 65 6d 29 29 29 0a  ) (cadr item))).
0ba0: 09 20 20 20 20 69 74 65 6d 64 61 74 29 29 0a 0a  .    itemdat))..
0bb0: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61  (define (runs:ca
0bc0: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73  n-run-more-tests
0bd0: 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72 64 29   db test-record)
0be0: 0a 20 20 28 6c 65 74 2a 20 28 28 74 63 6f 6e 66  .  (let* ((tconf
0bf0: 69 67 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ig              
0c00: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
0c10: 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66  eue-get-testconf
0c20: 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29  ig test-record))
0c30: 0a 09 20 28 6a 6f 62 67 72 6f 75 70 20 20 20 20  .. (jobgroup    
0c40: 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e              (con
0c50: 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66  fig-lookup tconf
0c60: 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73  ig "requirements
0c70: 22 20 22 6a 6f 62 67 72 6f 75 70 22 29 29 0a 09  " "jobgroup"))..
0c80: 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 20 20   (num-running   
0c90: 20 20 20 20 20 20 20 20 20 20 28 64 62 3a 67 65            (db:ge
0ca0: 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75  t-count-tests-ru
0cb0: 6e 6e 69 6e 67 20 64 62 29 29 0a 09 20 28 6e 75  nning db)).. (nu
0cc0: 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62  m-running-in-job
0cd0: 67 72 6f 75 70 20 28 64 62 3a 67 65 74 2d 63 6f  group (db:get-co
0ce0: 75 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e  unt-tests-runnin
0cf0: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 64 62  g-in-jobgroup db
0d00: 20 6a 6f 62 67 72 6f 75 70 29 29 0a 09 20 28 6d   jobgroup)).. (m
0d10: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f  ax-concurrent-jo
0d20: 62 73 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c  bs     (config-l
0d30: 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74  ookup *configdat
0d40: 2a 20 22 73 65 74 75 70 22 20 20 20 20 20 22 6d  * "setup"     "m
0d50: 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f  ax_concurrent_jo
0d60: 62 73 22 29 29 0a 09 20 28 6a 6f 62 2d 67 72 6f  bs")).. (job-gro
0d70: 75 70 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20  up-limit        
0d80: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20   (config-lookup 
0d90: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 6a 6f 62  *configdat* "job
0da0: 67 72 6f 75 70 73 22 20 6a 6f 62 67 72 6f 75 70  groups" jobgroup
0db0: 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  ))).    (debug:p
0dc0: 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 6f 6e 63  rint 2 "max-conc
0dd0: 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d  urrent-jobs: " m
0de0: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f  ax-concurrent-jo
0df0: 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e  bs ", num-runnin
0e00: 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67  g: " num-running
0e10: 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ).    (if (not (
0e20: 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c 65 78 69  eq? 0 *globalexi
0e30: 74 73 74 61 74 75 73 2a 29 29 0a 09 23 66 0a 09  tstatus*))..#f..
0e40: 28 6c 65 74 20 28 28 63 61 6e 2d 6e 6f 74 2d 72  (let ((can-not-r
0e50: 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e 64 0a 09 09  un-more (cond...
0e60: 09 09 20 3b 3b 20 69 66 20 6d 61 78 2d 63 6f 6e  .. ;; if max-con
0e70: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 69 73 20  current-jobs is 
0e80: 73 65 74 20 61 6e 64 20 74 68 65 20 6e 75 6d 62  set and the numb
0e90: 65 72 20 72 75 6e 6e 69 6e 67 20 69 73 20 67 72  er running is gr
0ea0: 65 61 74 65 72 20 0a 09 09 09 09 20 3b 3b 20 74  eater ..... ;; t
0eb0: 68 61 6e 20 69 74 20 74 68 61 6e 20 63 61 6e 6e  han it than cann
0ec0: 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73  ot run more jobs
0ed0: 0a 09 09 09 09 20 28 28 61 6e 64 20 6d 61 78 2d  ..... ((and max-
0ee0: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 0a  concurrent-jobs.
0ef0: 09 09 09 09 20 20 20 20 20 20 20 28 73 74 72 69  ....       (stri
0f00: 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 63  ng->number max-c
0f10: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a  oncurrent-jobs).
0f20: 09 09 09 09 20 20 20 20 20 20 20 28 3e 3d 20 6e  ....       (>= n
0f30: 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 73 74 72 69  um-running (stri
0f40: 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 63  ng->number max-c
0f50: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 29  oncurrent-jobs))
0f60: 29 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70  ).....  (debug:p
0f70: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a  rint 0 "WARNING:
0f80: 20 4d 61 78 20 72 75 6e 6e 69 6e 67 20 6a 6f 62   Max running job
0f90: 73 20 65 78 63 65 65 64 65 64 2c 20 63 75 72 72  s exceeded, curr
0fa0: 65 6e 74 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69  ent number runni
0fb0: 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e  ng: " num-runnin
0fc0: 67 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 22  g ......       "
0fd0: 2c 20 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74  , max_concurrent
0fe0: 5f 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e  _jobs: " max-con
0ff0: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 09  current-jobs)...
1000: 09 09 20 20 23 74 29 0a 09 09 09 09 20 3b 3b 20  ..  #t)..... ;; 
1010: 69 66 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d  if job-group-lim
1020: 69 74 20 69 73 20 73 65 74 20 61 6e 64 20 6e 75  it is set and nu
1030: 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 69 6e 20  mber of jobs in 
1040: 74 68 65 20 67 72 6f 75 70 20 69 73 20 67 72 65  the group is gre
1050: 61 74 65 72 0a 09 09 09 09 20 3b 3b 20 74 68 61  ater..... ;; tha
1060: 6e 20 74 68 65 20 6c 69 6d 69 74 20 74 68 65 6e  n the limit then
1070: 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65   cannot run more
1080: 20 6a 6f 62 73 20 6f 66 20 74 68 69 73 20 6b 69   jobs of this ki
1090: 6e 64 0a 09 09 09 09 20 28 28 61 6e 64 20 6a 6f  nd..... ((and jo
10a0: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 0a 09 09  b-group-limit...
10b0: 09 09 20 20 20 20 20 20 20 28 3e 3d 20 6e 75 6d  ..       (>= num
10c0: 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67  -running-in-jobg
10d0: 72 6f 75 70 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c  roup job-group-l
10e0: 69 6d 69 74 29 29 0a 09 09 09 09 20 20 28 64 65  imit)).....  (de
10f0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52  bug:print 1 "WAR
1100: 4e 49 4e 47 3a 20 6e 75 6d 62 65 72 20 6f 66 20  NING: number of 
1110: 6a 6f 62 73 20 22 20 6e 75 6d 2d 72 75 6e 6e 69  jobs " num-runni
1120: 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 0a  ng-in-jobgroup .
1130: 09 09 09 09 09 20 20 20 20 20 20 20 22 20 69 6e  .....       " in
1140: 20 22 20 6a 6f 62 67 72 6f 75 70 20 22 20 65 78   " jobgroup " ex
1150: 63 65 65 64 65 64 2c 20 77 69 6c 6c 20 6e 6f 74  ceeded, will not
1160: 20 72 75 6e 20 22 20 28 74 65 73 74 73 3a 74 65   run " (tests:te
1170: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74  stqueue-get-test
1180: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64  name test-record
1190: 29 29 0a 09 09 09 09 20 20 23 74 29 0a 09 09 09  )).....  #t)....
11a0: 09 20 28 65 6c 73 65 20 23 66 29 29 29 29 0a 09  . (else #f))))..
11b0: 20 20 28 6e 6f 74 20 63 61 6e 2d 6e 6f 74 2d 72    (not can-not-r
11c0: 75 6e 2d 6d 6f 72 65 29 29 29 29 29 0a 0a 3b 3b  un-more)))))..;;
11d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
11e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
11f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1200: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1210: 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65 77 20 6d 65  ======.;; New me
1220: 74 68 6f 64 6f 6c 6f 67 79 2e 20 54 68 65 73 65  thodology. These
1230: 20 72 6f 75 74 69 6e 65 73 20 77 69 6c 6c 20 72   routines will r
1240: 65 70 6c 61 63 65 20 74 68 65 20 61 62 6f 76 65  eplace the above
1250: 20 69 6e 20 74 69 6d 65 2e 20 46 6f 72 0a 3b 3b   in time. For.;;
1260: 20 6e 6f 77 20 74 68 65 20 63 6f 64 65 20 69 73   now the code is
1270: 20 64 75 70 6c 69 63 61 74 65 64 2e 20 54 68 69   duplicated. Thi
1280: 73 20 73 74 75 66 66 20 69 73 20 69 6e 69 74 69  s stuff is initi
1290: 61 6c 6c 79 20 75 73 65 64 20 69 6e 20 74 68 65  ally used in the
12a0: 20 6d 6f 6e 69 74 6f 72 0a 3b 3b 20 62 61 73 65   monitor.;; base
12b0: 64 20 63 6f 64 65 2e 0a 3b 3b 3d 3d 3d 3d 3d 3d  d code..;;======
12c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
12d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
12e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
12f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1300: 0a 0a 3b 3b 20 72 65 67 69 73 74 65 72 20 61 20  ..;; register a 
1310: 74 65 73 74 20 72 75 6e 20 77 69 74 68 20 74 68  test run with th
1320: 65 20 64 62 0a 28 64 65 66 69 6e 65 20 28 72 75  e db.(define (ru
1330: 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20  ns:register-run 
1340: 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73  db keys keyvalls
1350: 74 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 65 20  t runname state 
1360: 73 74 61 74 75 73 20 75 73 65 72 29 0a 20 20 28  status user).  (
1370: 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 72  debug:print 3 "r
1380: 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e  uns:register-run
1390: 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22  , keys: " keys "
13a0: 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65   keyvallst: " ke
13b0: 79 76 61 6c 6c 73 74 20 22 20 72 75 6e 6e 61 6d  yvallst " runnam
13c0: 65 3a 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 73  e: " runname " s
13d0: 74 61 74 65 3a 20 22 20 73 74 61 74 65 20 22 20  tate: " state " 
13e0: 73 74 61 74 75 73 3a 20 22 20 73 74 61 74 75 73  status: " status
13f0: 20 22 20 75 73 65 72 3a 20 22 20 75 73 65 72 29   " user: " user)
1400: 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 74  .  (let* ((keyst
1410: 72 20 20 20 20 28 6b 65 79 73 2d 3e 6b 65 79 73  r    (keys->keys
1420: 74 72 20 6b 65 79 73 29 29 0a 09 20 28 63 6f 6d  tr keys)).. (com
1430: 6d 61 20 20 20 20 20 28 69 66 20 28 3e 20 28 6c  ma     (if (> (l
1440: 65 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 22  ength keys) 0) "
1450: 2c 22 20 22 22 29 29 0a 09 20 28 61 6e 64 73 74  ," "")).. (andst
1460: 72 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 6e  r    (if (> (len
1470: 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 20 41  gth keys) 0) " A
1480: 4e 44 20 22 20 22 22 29 29 0a 09 20 28 76 61 6c  ND " "")).. (val
1490: 73 6c 6f 74 73 20 20 28 6b 65 79 73 2d 3e 76 61  slots  (keys->va
14a0: 6c 73 6c 6f 74 73 20 6b 65 79 73 29 29 20 3b 3b  lslots keys)) ;;
14b0: 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 28 6b 65   ?,?,? ..... (ke
14c0: 79 76 61 6c 73 20 20 20 28 6d 61 70 20 63 61 64  yvals   (map cad
14d0: 72 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20  r keyvallst)).. 
14e0: 28 61 6c 6c 76 61 6c 73 20 20 20 28 61 70 70 65  (allvals   (appe
14f0: 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65  nd (list runname
1500: 20 73 74 61 74 65 20 73 74 61 74 75 73 20 75 73   state status us
1510: 65 72 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 20  er) keyvals)).. 
1520: 28 71 72 79 76 61 6c 73 20 20 20 28 61 70 70 65  (qryvals   (appe
1530: 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65  nd (list runname
1540: 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 20 28 6b  ) keyvals)).. (k
1550: 65 79 3d 3f 73 74 72 20 20 28 73 74 72 69 6e 67  ey=?str  (string
1560: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61  -intersperse (ma
1570: 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 28 63 6f  p (lambda (k)(co
1580: 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c  nc (key:get-fiel
1590: 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 29 29 20  dname k) "=?")) 
15a0: 6b 65 79 73 29 20 22 20 41 4e 44 20 22 29 29 29  keys) " AND ")))
15b0: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
15c0: 74 20 33 20 22 6b 65 79 73 3a 20 22 20 6b 65 79  t 3 "keys: " key
15d0: 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20 22 20 61  s " allvals: " a
15e0: 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76 61 6c 73  llvals " keyvals
15f0: 3a 20 22 20 6b 65 79 76 61 6c 73 29 0a 20 20 20  : " keyvals).   
1600: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20   (debug:print 2 
1610: 22 4e 4f 54 45 3a 20 75 73 69 6e 67 20 74 61 72  "NOTE: using tar
1620: 67 65 74 20 22 20 28 73 74 72 69 6e 67 2d 69 6e  get " (string-in
1630: 74 65 72 73 70 65 72 73 65 20 6b 65 79 76 61 6c  tersperse keyval
1640: 73 20 22 2f 22 29 20 22 20 66 6f 72 20 74 68 69  s "/") " for thi
1650: 73 20 72 75 6e 22 29 0a 20 20 20 20 28 69 66 20  s run").    (if 
1660: 28 61 6e 64 20 72 75 6e 6e 61 6d 65 20 28 6e 75  (and runname (nu
1670: 6c 6c 3f 20 28 66 69 6c 74 65 72 20 28 6c 61 6d  ll? (filter (lam
1680: 62 64 61 20 28 78 29 28 6e 6f 74 20 78 29 29 20  bda (x)(not x)) 
1690: 6b 65 79 76 61 6c 73 29 29 29 20 3b 3b 20 74 68  keyvals))) ;; th
16a0: 65 72 65 20 6d 75 73 74 20 62 65 20 61 20 62 65  ere must be a be
16b0: 74 74 65 72 20 77 61 79 20 74 6f 20 22 61 70 70  tter way to "app
16c0: 6c 79 20 61 6e 64 22 0a 09 28 6c 65 74 20 28 28  ly and"..(let ((
16d0: 72 65 73 20 23 66 29 29 0a 09 20 20 28 61 70 70  res #f))..  (app
16e0: 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75  ly sqlite3:execu
16f0: 74 65 20 64 62 20 28 63 6f 6e 63 20 22 49 4e 53  te db (conc "INS
1700: 45 52 54 20 4f 52 20 49 47 4e 4f 52 45 20 49 4e  ERT OR IGNORE IN
1710: 54 4f 20 72 75 6e 73 20 28 72 75 6e 6e 61 6d 65  TO runs (runname
1720: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 6f 77  ,state,status,ow
1730: 6e 65 72 2c 65 76 65 6e 74 5f 74 69 6d 65 22 20  ner,event_time" 
1740: 63 6f 6d 6d 61 20 6b 65 79 73 74 72 20 22 29 20  comma keystr ") 
1750: 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c  VALUES (?,?,?,?,
1760: 73 74 72 66 74 69 6d 65 28 27 25 73 27 2c 27 6e  strftime('%s','n
1770: 6f 77 27 29 22 20 63 6f 6d 6d 61 20 76 61 6c 73  ow')" comma vals
1780: 6c 6f 74 73 20 22 29 3b 22 29 0a 09 09 20 61 6c  lots ");")... al
1790: 6c 76 61 6c 73 29 0a 09 20 20 28 61 70 70 6c 79  lvals)..  (apply
17a0: 20 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63   sqlite3:for-eac
17b0: 68 2d 72 6f 77 20 0a 09 20 20 20 28 6c 61 6d 62  h-row ..   (lamb
17c0: 64 61 20 28 69 64 29 0a 09 20 20 20 20 20 28 73  da (id)..     (s
17d0: 65 74 21 20 72 65 73 20 69 64 29 29 0a 09 20 20  et! res id))..  
17e0: 20 64 62 0a 09 20 20 20 28 6c 65 74 20 28 28 71   db..   (let ((q
17f0: 72 79 20 28 63 6f 6e 63 20 22 53 45 4c 45 43 54  ry (conc "SELECT
1800: 20 69 64 20 46 52 4f 4d 20 72 75 6e 73 20 57 48   id FROM runs WH
1810: 45 52 45 20 28 72 75 6e 6e 61 6d 65 3d 3f 20 22  ERE (runname=? "
1820: 20 61 6e 64 73 74 72 20 6b 65 79 3d 3f 73 74 72   andstr key=?str
1830: 20 22 29 3b 22 29 29 29 0a 09 20 20 20 20 20 3b   ");")))..     ;
1840: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22  (debug:print 4 "
1850: 71 72 79 3a 20 22 20 71 72 79 29 20 0a 09 20 20  qry: " qry) ..  
1860: 20 20 20 71 72 79 29 0a 09 20 20 20 71 72 79 76     qry)..   qryv
1870: 61 6c 73 29 0a 09 20 20 28 73 71 6c 69 74 65 33  als)..  (sqlite3
1880: 3a 65 78 65 63 75 74 65 20 64 62 20 22 55 50 44  :execute db "UPD
1890: 41 54 45 20 72 75 6e 73 20 53 45 54 20 73 74 61  ATE runs SET sta
18a0: 74 65 3d 3f 2c 73 74 61 74 75 73 3d 3f 20 57 48  te=?,status=? WH
18b0: 45 52 45 20 69 64 3d 3f 3b 22 20 73 74 61 74 65  ERE id=?;" state
18c0: 20 73 74 61 74 75 73 20 72 65 73 29 0a 09 20 20   status res)..  
18d0: 72 65 73 29 20 0a 09 28 62 65 67 69 6e 0a 09 20  res) ..(begin.. 
18e0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
18f0: 22 45 52 52 4f 52 3a 20 43 61 6c 6c 65 64 20 77  "ERROR: Called w
1900: 69 74 68 6f 75 74 20 61 6c 6c 20 6e 65 63 65 73  ithout all neces
1910: 73 61 72 79 20 6b 65 79 73 22 29 0a 09 20 20 23  sary keys")..  #
1920: 66 29 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 69  f))))..;; This i
1930: 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 6f 66  s a duplicate of
1940: 20 72 75 6e 2d 74 65 73 74 73 20 28 77 68 69 63   run-tests (whic
1950: 68 20 68 61 73 20 62 65 65 6e 20 64 65 70 72 65  h has been depre
1960: 63 61 74 65 64 29 2e 20 55 73 65 20 74 68 69 73  cated). Use this
1970: 20 6f 6e 65 20 69 6e 73 74 65 61 64 20 6f 66 20   one instead of 
1980: 72 75 6e 20 74 65 73 74 73 2e 0a 3b 3b 20 6b 65  run tests..;; ke
1990: 79 76 61 6c 73 0a 28 64 65 66 69 6e 65 20 28 72  yvals.(define (r
19a0: 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 20 64 62  uns:run-tests db
19b0: 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20   target runname 
19c0: 74 65 73 74 2d 70 61 74 74 73 20 75 73 65 72 20  test-patts user 
19d0: 66 6c 61 67 73 29 0a 20 20 28 6c 65 74 2a 20 28  flags).  (let* (
19e0: 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 72 64  (keys        (rd
19f0: 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a  b:get-keys db)).
1a00: 09 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 28  . (keyvallst   (
1a10: 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79  keys:target->key
1a20: 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29  val keys target)
1a30: 29 0a 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20  ).. (run-id     
1a40: 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d   (runs:register-
1a50: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76  run db keys keyv
1a60: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e  allst runname "n
1a70: 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29  ew" "n/a" user))
1a80: 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29    ;;  test-name)
1a90: 29 29 0a 09 20 28 64 65 66 65 72 72 65 64 20 20  )).. (deferred  
1aa0: 20 20 27 28 29 29 20 3b 3b 20 64 65 6c 61 79 20    '()) ;; delay 
1ab0: 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20 73 69  running these si
1ac0: 6e 63 65 20 74 68 65 79 20 68 61 76 65 20 61 20  nce they have a 
1ad0: 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20  waiton clause.. 
1ae0: 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69 73 20  ;; keepgoing is 
1af0: 74 68 65 20 64 65 66 61 63 74 6f 20 6d 6f 64 61  the defacto moda
1b00: 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 61  lity now, will a
1b10: 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61 20 62  dd hit-n-run a b
1b20: 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20 28 6b  it later.. ;; (k
1b30: 65 65 70 67 6f 69 6e 67 20 20 20 28 68 61 73 68  eepgoing   (hash
1b40: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
1b50: 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67  lt flags "-keepg
1b60: 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 74 65  oing" #f)).. (te
1b70: 73 74 2d 6e 61 6d 65 73 20 20 27 28 29 29 0a 09  st-names  '())..
1b80: 20 28 72 75 6e 63 6f 6e 66 69 67 66 20 20 20 28   (runconfigf   (
1b90: 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20  conc  *toppath* 
1ba0: 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e  "/runconfigs.con
1bb0: 66 69 67 22 29 29 0a 09 20 28 72 65 71 75 69 72  fig")).. (requir
1bc0: 65 64 2d 74 65 73 74 73 20 27 28 29 29 0a 09 20  ed-tests '()).. 
1bd0: 28 74 65 73 74 2d 72 65 63 6f 72 64 73 20 28 6d  (test-records (m
1be0: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29  ake-hash-table))
1bf0: 29 0a 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 61  )..    (set-mega
1c00: 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62  test-env-vars db
1c10: 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73   run-id) ;; thes
1c20: 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20  e may be needed 
1c30: 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67  by the launching
1c40: 20 70 72 6f 63 65 73 73 0a 0a 20 20 20 20 28 69   process..    (i
1c50: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20  f (file-exists? 
1c60: 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 28 73 65  runconfigf)..(se
1c70: 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74 73  tup-env-defaults
1c80: 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 66 20 72   db runconfigf r
1c90: 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d 73  un-id *already-s
1ca0: 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e  een-runconfig-in
1cb0: 66 6f 2a 20 22 70 72 65 2d 6c 61 75 6e 63 68 2d  fo* "pre-launch-
1cc0: 65 6e 76 2d 76 61 72 73 22 29 0a 09 28 64 65 62  env-vars")..(deb
1cd0: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e  ug:print 0 "WARN
1ce0: 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f 74 20  ING: You do not 
1cf0: 68 61 76 65 20 61 20 72 75 6e 20 63 6f 6e 66 69  have a run confi
1d00: 67 20 66 69 6c 65 3a 20 22 20 72 75 6e 63 6f 6e  g file: " runcon
1d10: 66 69 67 66 29 29 0a 20 20 20 20 0a 20 20 20 20  figf)).    .    
1d20: 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c 20 74  ;; look up all t
1d30: 65 73 74 73 20 6d 61 74 63 68 69 6e 67 20 74 68  ests matching th
1d40: 65 20 63 6f 6d 6d 61 20 73 65 70 61 72 61 74 65  e comma separate
1d50: 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f 62 73 20  d list of globs 
1d60: 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73 74 2d 70  in.    ;; test-p
1d70: 61 74 74 73 20 28 75 73 69 6e 67 20 25 20 61 73  atts (using % as
1d80: 20 77 69 6c 64 63 61 72 64 29 0a 20 20 20 20 28   wildcard).    (
1d90: 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28  for-each .     (
1da0: 6c 61 6d 62 64 61 20 28 70 61 74 74 29 0a 20 20  lambda (patt).  
1db0: 20 20 20 20 20 28 6c 65 74 20 28 28 74 65 73 74       (let ((test
1dc0: 73 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 2a 74  s (glob (conc *t
1dd0: 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f  oppath* "/tests/
1de0: 22 20 28 73 74 72 69 6e 67 2d 74 72 61 6e 73 6c  " (string-transl
1df0: 61 74 65 20 70 61 74 74 20 22 25 22 20 22 2a 22  ate patt "%" "*"
1e00: 29 29 29 29 29 0a 09 20 28 73 65 74 21 20 74 65  ))))).. (set! te
1e10: 73 74 73 20 28 66 69 6c 74 65 72 20 28 6c 61 6d  sts (filter (lam
1e20: 62 64 61 20 28 74 65 73 74 29 28 66 69 6c 65 2d  bda (test)(file-
1e30: 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 20 74 65  exists? (conc te
1e40: 73 74 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22  st "/testconfig"
1e50: 29 29 29 20 74 65 73 74 73 29 29 0a 09 20 28 73  ))) tests)).. (s
1e60: 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28  et! test-names (
1e70: 61 70 70 65 6e 64 20 74 65 73 74 2d 6e 61 6d 65  append test-name
1e80: 73 20 0a 09 09 09 09 20 20 28 6d 61 70 20 28 6c  s .....  (map (l
1e90: 61 6d 62 64 61 20 28 74 65 73 74 70 29 0a 09 09  ambda (testp)...
1ea0: 09 09 09 20 28 6c 61 73 74 20 28 73 74 72 69 6e  ... (last (strin
1eb0: 67 2d 73 70 6c 69 74 20 74 65 73 74 70 20 22 2f  g-split testp "/
1ec0: 22 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 20  "))).....       
1ed0: 74 65 73 74 73 29 29 29 29 29 0a 20 20 20 20 20  tests))))).     
1ee0: 28 69 66 20 74 65 73 74 2d 70 61 74 74 73 20 28  (if test-patts (
1ef0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 73  string-split tes
1f00: 74 2d 70 61 74 74 73 20 22 2c 22 29 28 6c 69 73  t-patts ",")(lis
1f10: 74 20 22 25 22 29 29 29 0a 0a 20 20 20 20 20 3b  t "%")))..     ;
1f20: 3b 20 6e 6f 77 20 72 65 6d 6f 76 65 20 64 75 70  ; now remove dup
1f30: 6c 69 63 61 74 65 73 0a 20 20 20 20 28 73 65 74  licates.    (set
1f40: 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 64 65  ! test-names (de
1f50: 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 20  lete-duplicates 
1f60: 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 0a 20 20  test-names))..  
1f70: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
1f80: 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 6e 61 6d   "INFO: test nam
1f90: 65 73 20 22 20 74 65 73 74 2d 6e 61 6d 65 73 29  es " test-names)
1fa0: 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65 20  ..    ;; on the 
1fb0: 66 69 72 73 74 20 70 61 73 73 20 6f 72 20 63 61  first pass or ca
1fc0: 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 73 20  ll to run-tests 
1fd0: 73 65 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f 54  set FAILS to NOT
1fe0: 5f 53 54 41 52 54 45 44 20 69 66 0a 20 20 20 20  _STARTED if.    
1ff0: 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69 73  ;; -keepgoing is
2000: 20 73 70 65 63 69 66 69 65 64 0a 20 20 20 20 28   specified.    (
2010: 69 66 20 28 65 71 3f 20 2a 70 61 73 73 6e 75 6d  if (eq? *passnum
2020: 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a 09 20 20  * 0)..(begin..  
2030: 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 6c 65 74  ;; have to delet
2040: 65 20 74 65 73 74 20 72 65 63 6f 72 64 73 20 77  e test records w
2050: 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 54 45 44  here NOT_STARTED
2060: 20 73 69 6e 63 65 20 74 68 65 79 20 63 61 6e 20   since they can 
2070: 63 61 75 73 65 20 2d 6b 65 65 70 67 6f 69 6e 67  cause -keepgoing
2080: 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74 20 73   to ..  ;; get s
2090: 74 75 63 6b 20 64 75 65 20 74 6f 20 62 65 63 6f  tuck due to beco
20a0: 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 69 62 6c  ming inaccessibl
20b0: 65 20 66 72 6f 6d 20 61 20 66 61 69 6c 65 64 20  e from a failed 
20c0: 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 20 74 65  test. I.e. if te
20d0: 73 74 20 42 20 64 65 70 65 6e 64 73 20 0a 09 20  st B depends .. 
20e0: 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20 62 75   ;; on test A bu
20f0: 74 20 74 65 73 74 20 42 20 72 65 61 63 68 65 64  t test B reached
2100: 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20 62 65   the point on be
2110: 69 6e 67 20 72 65 67 69 73 74 65 72 65 64 20 61  ing registered a
2120: 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 61 6e  s NOT_STARTED an
2130: 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 41 20 66  d test..  ;; A f
2140: 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65 20 72  ailed for some r
2150: 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 72 65  eason then on re
2160: 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65 65 70  -run using -keep
2170: 67 6f 69 6e 67 20 74 68 65 20 72 75 6e 20 63 61  going the run ca
2180: 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65 74 65  n never complete
2190: 2e 0a 09 20 20 28 64 62 3a 64 65 6c 65 74 65 2d  ...  (db:delete-
21a0: 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 20 64  tests-in-state d
21b0: 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 54  b run-id "NOT_ST
21c0: 41 52 54 45 44 22 29 0a 09 20 20 28 72 64 62 3a  ARTED")..  (rdb:
21d0: 73 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65 2d  set-tests-state-
21e0: 73 74 61 74 75 73 20 64 62 20 72 75 6e 2d 69 64  status db run-id
21f0: 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 22   test-names #f "
2200: 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54  FAIL" "NOT_START
2210: 45 44 22 20 22 46 41 49 4c 22 29 29 29 0a 0a 20  ED" "FAIL"))).. 
2220: 20 20 20 3b 3b 20 6e 6f 77 20 61 64 64 20 6e 6f     ;; now add no
2230: 6e 2d 64 69 72 65 63 74 6c 79 20 72 65 66 65 72  n-directly refer
2240: 65 6e 63 65 64 20 64 65 70 65 6e 64 65 6e 63 69  enced dependenci
2250: 65 73 20 28 69 2e 65 2e 20 77 61 69 74 6f 6e 29  es (i.e. waiton)
2260: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e  .    (if (not (n
2270: 75 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 73 29  ull? test-names)
2280: 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68  )..(let loop ((h
2290: 65 64 20 28 63 61 72 20 74 65 73 74 2d 6e 61 6d  ed (car test-nam
22a0: 65 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 28  es))...   (tal (
22b0: 63 64 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  cdr test-names))
22c0: 29 20 20 20 20 20 20 20 20 20 3b 3b 20 27 72 65  )         ;; 're
22d0: 74 75 72 6e 2d 70 72 6f 63 73 20 74 65 6c 6c 73  turn-procs tells
22e0: 20 74 68 65 20 63 6f 6e 66 69 67 20 72 65 61 64   the config read
22f0: 65 72 20 74 6f 20 70 72 65 70 20 72 75 6e 6e 69  er to prep runni
2300: 6e 67 20 73 79 73 74 65 6d 20 62 75 74 20 72 65  ng system but re
2310: 74 75 72 6e 20 61 20 70 72 6f 63 0a 09 20 20 28  turn a proc..  (
2320: 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20 28  let* ((config  (
2330: 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f  tests:get-testco
2340: 6e 66 69 67 20 68 65 64 20 27 72 65 74 75 72 6e  nfig hed 'return
2350: 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61 69  -procs))... (wai
2360: 74 6f 6e 73 20 28 73 74 72 69 6e 67 2d 73 70 6c  tons (string-spl
2370: 69 74 20 28 6c 65 74 20 28 28 77 20 28 63 6f 6e  it (let ((w (con
2380: 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69  fig-lookup confi
2390: 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22  g "requirements"
23a0: 20 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09   "waiton")))....
23b0: 09 09 20 20 28 69 66 20 77 20 77 20 22 22 29 29  ..  (if w w ""))
23c0: 29 29 29 0a 09 20 20 20 20 3b 3b 20 28 69 74 65  )))..    ;; (ite
23d0: 6d 73 20 20 20 28 69 74 65 6d 73 3a 67 65 74 2d  ms   (items:get-
23e0: 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69  items-from-confi
23f0: 67 20 63 6f 6e 66 69 67 29 29 29 0a 09 20 20 20  g config)))..   
2400: 20 28 69 66 20 28 6e 6f 74 20 28 68 61 73 68 2d   (if (not (hash-
2410: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
2420: 74 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 68  t test-records h
2430: 65 64 20 23 66 29 29 0a 09 09 28 68 61 73 68 2d  ed #f))...(hash-
2440: 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d  table-set! test-
2450: 72 65 63 6f 72 64 73 0a 09 09 09 09 20 68 65 64  records..... hed
2460: 20 28 76 65 63 74 6f 72 20 68 65 64 20 20 20 20   (vector hed    
2470: 20 3b 3b 20 30 0a 09 09 09 09 09 20 20 20 20 20   ;; 0......     
2480: 63 6f 6e 66 69 67 20 20 3b 3b 20 31 0a 09 09 09  config  ;; 1....
2490: 09 09 20 20 20 20 20 77 61 69 74 6f 6e 73 20 3b  ..     waitons ;
24a0: 3b 20 32 0a 09 09 09 09 09 20 20 20 20 20 28 63  ; 2......     (c
24b0: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e  onfig-lookup con
24c0: 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74  fig "requirement
24d0: 73 22 20 22 70 72 69 6f 72 69 74 79 22 29 20 20  s" "priority")  
24e0: 20 20 20 3b 3b 20 70 72 69 6f 72 69 74 79 20 33     ;; priority 3
24f0: 0a 09 09 09 09 09 20 20 20 20 20 28 6c 65 74 20  ......     (let 
2500: 28 28 69 74 65 6d 73 20 20 20 20 20 20 28 68 61  ((items      (ha
2510: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
2520: 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 65  ault config "ite
2530: 6d 73 22 20 23 66 29 29 20 3b 3b 20 69 74 65 6d  ms" #f)) ;; item
2540: 73 20 34 0a 09 09 09 09 09 09 20 20 20 28 69 74  s 4.......   (it
2550: 65 6d 73 74 61 62 6c 65 20 28 68 61 73 68 2d 74  emstable (hash-t
2560: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
2570: 20 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 74 61   config "itemsta
2580: 62 6c 65 22 20 23 66 29 29 29 20 0a 09 09 09 09  ble" #f))) .....
2590: 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20 65 69  .       ;; if ei
25a0: 74 68 65 72 20 69 74 65 6d 73 20 6f 72 20 69 74  ther items or it
25b0: 65 6d 73 20 74 61 62 6c 65 20 69 73 20 61 20 70  ems table is a p
25c0: 72 6f 63 20 72 65 74 75 72 6e 20 69 74 20 73 6f  roc return it so
25d0: 20 74 65 73 74 20 72 75 6e 6e 69 6e 67 0a 09 09   test running...
25e0: 09 09 09 20 20 20 20 20 20 20 3b 3b 20 70 72 6f  ...       ;; pro
25f0: 63 65 73 73 20 63 61 6e 20 6b 6e 6f 77 20 74 6f  cess can know to
2600: 20 63 61 6c 6c 20 69 74 65 6d 73 3a 67 65 74 2d   call items:get-
2610: 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69  items-from-confi
2620: 67 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b  g......       ;;
2630: 20 69 66 20 65 69 74 68 65 72 20 69 73 20 61 20   if either is a 
2640: 6c 69 73 74 20 61 6e 64 20 6e 6f 6e 65 20 69 73  list and none is
2650: 20 61 20 70 72 6f 63 20 67 6f 20 61 68 65 61 64   a proc go ahead
2660: 20 61 6e 64 20 63 61 6c 6c 20 67 65 74 2d 69 74   and call get-it
2670: 65 6d 73 0a 09 09 09 09 09 20 20 20 20 20 20 20  ems......       
2680: 3b 3b 20 6f 74 68 65 72 77 69 73 65 20 72 65 74  ;; otherwise ret
2690: 75 72 6e 20 23 66 20 2d 20 74 68 69 73 20 69 73  urn #f - this is
26a0: 20 6e 6f 74 20 61 6e 20 69 74 65 72 61 74 65 64   not an iterated
26b0: 20 74 65 73 74 0a 09 09 09 09 09 20 20 20 20 20   test......     
26c0: 20 20 28 63 6f 6e 64 0a 09 09 09 09 09 09 28 28    (cond.......((
26d0: 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73  procedure? items
26e0: 29 20 20 20 20 20 20 0a 09 09 09 09 09 09 20 28  )      ....... (
26f0: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49  debug:print 4 "I
2700: 4e 46 4f 3a 20 69 74 65 6d 73 20 69 73 20 61 20  NFO: items is a 
2710: 70 72 6f 63 65 64 75 72 65 2c 20 77 69 6c 6c 20  procedure, will 
2720: 63 61 6c 63 20 6c 61 74 65 72 22 29 0a 09 09 09  calc later")....
2730: 09 09 09 20 69 74 65 6d 73 29 20 20 20 20 20 20  ... items)      
2740: 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c 61        ;; calc la
2750: 74 65 72 0a 09 09 09 09 09 09 28 28 70 72 6f 63  ter.......((proc
2760: 65 64 75 72 65 3f 20 69 74 65 6d 73 74 61 62 6c  edure? itemstabl
2770: 65 29 0a 09 09 09 09 09 09 20 28 64 65 62 75 67  e)....... (debug
2780: 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20  :print 4 "INFO: 
2790: 69 74 65 6d 73 74 61 62 6c 65 20 69 73 20 61 20  itemstable is a 
27a0: 70 72 6f 63 65 64 75 72 65 2c 20 77 69 6c 6c 20  procedure, will 
27b0: 63 61 6c 63 20 6c 61 74 65 72 22 29 0a 09 09 09  calc later")....
27c0: 09 09 09 20 69 74 65 6d 73 74 61 62 6c 65 29 20  ... itemstable) 
27d0: 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c 61        ;; calc la
27e0: 74 65 72 0a 09 09 09 09 09 09 28 28 66 69 6c 74  ter.......((filt
27f0: 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 0a 09  er (lambda (x)..
2800: 09 09 09 09 09 09 20 20 20 28 6c 65 74 20 28 28  ......   (let ((
2810: 76 61 6c 20 28 63 61 72 20 78 29 29 29 0a 09 09  val (car x)))...
2820: 09 09 09 09 09 20 20 20 20 20 28 69 66 20 28 70  .....     (if (p
2830: 72 6f 63 65 64 75 72 65 3f 20 76 61 6c 29 20 76  rocedure? val) v
2840: 61 6c 20 23 66 29 29 29 0a 09 09 09 09 09 09 09  al #f)))........
2850: 20 28 61 70 70 65 6e 64 20 28 69 66 20 28 6c 69   (append (if (li
2860: 73 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 73  st? items) items
2870: 20 27 28 29 29 0a 09 09 09 09 09 09 09 09 20 28   '())......... (
2880: 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 74  if (list? itemst
2890: 61 62 6c 65 29 20 69 74 65 6d 73 74 61 62 6c 65  able) itemstable
28a0: 20 27 28 29 29 29 29 0a 09 09 09 09 09 09 20 27   '())))....... '
28b0: 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 0a  have-procedure).
28c0: 09 09 09 09 09 09 28 28 6f 72 20 28 6c 69 73 74  ......((or (list
28d0: 3f 20 69 74 65 6d 73 29 28 6c 69 73 74 3f 20 69  ? items)(list? i
28e0: 74 65 6d 73 74 61 62 6c 65 29 29 20 3b 3b 20 63  temstable)) ;; c
28f0: 61 6c 63 20 6e 6f 77 0a 09 09 09 09 09 09 20 28  alc now....... (
2900: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49  debug:print 4 "I
2910: 4e 46 4f 3a 20 69 74 65 6d 73 20 61 6e 64 20 69  NFO: items and i
2920: 74 65 6d 73 74 61 62 6c 65 20 61 72 65 20 6c 69  temstable are li
2930: 73 74 73 2c 20 63 61 6c 63 20 6e 6f 77 5c 6e 22  sts, calc now\n"
2940: 0a 09 09 09 09 09 09 09 20 20 20 20 20 20 22 20  ........      " 
2950: 20 20 20 69 74 65 6d 73 3a 20 22 20 69 74 65 6d     items: " item
2960: 73 20 22 20 69 74 65 6d 73 74 61 62 6c 65 3a 20  s " itemstable: 
2970: 22 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 09  " itemstable)...
2980: 09 09 09 09 20 28 69 74 65 6d 73 3a 67 65 74 2d  .... (items:get-
2990: 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69  items-from-confi
29a0: 67 20 63 6f 6e 66 69 67 29 29 0a 09 09 09 09 09  g config))......
29b0: 09 28 65 6c 73 65 20 23 66 29 29 29 20 20 20 20  .(else #f)))    
29c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
29d0: 20 20 20 20 20 20 20 3b 3b 20 6e 6f 74 20 69 74         ;; not it
29e0: 65 72 61 74 65 64 0a 09 09 09 09 09 20 20 20 20  erated......    
29f0: 20 23 66 20 20 20 20 20 20 3b 3b 20 69 74 65 6d   #f      ;; item
2a00: 73 64 61 74 20 35 0a 09 09 09 09 09 20 20 20 20  sdat 5......    
2a10: 20 23 66 20 20 20 20 20 20 3b 3b 20 73 70 61 72   #f      ;; spar
2a20: 65 20 2d 20 75 73 65 64 20 66 6f 72 20 69 74 65  e - used for ite
2a30: 6d 2d 70 61 74 68 0a 09 09 09 09 09 20 20 20 20  m-path......    
2a40: 20 29 29 29 0a 09 20 20 20 20 28 66 6f 72 2d 65   )))..    (for-e
2a50: 61 63 68 20 0a 09 20 20 20 20 20 28 6c 61 6d 62  ach ..     (lamb
2a60: 64 61 20 28 77 61 69 74 6f 6e 29 0a 09 20 20 20  da (waiton)..   
2a70: 20 20 20 20 28 69 66 20 28 61 6e 64 20 77 61 69      (if (and wai
2a80: 74 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72  ton (not (member
2a90: 20 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d   waiton test-nam
2aa0: 65 73 29 29 29 0a 09 09 20 20 20 28 62 65 67 69  es)))...   (begi
2ab0: 6e 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 72  n...     (set! r
2ac0: 65 71 75 69 72 65 64 2d 74 65 73 74 73 20 28 63  equired-tests (c
2ad0: 6f 6e 73 20 77 61 69 74 6f 6e 20 72 65 71 75 69  ons waiton requi
2ae0: 72 65 64 2d 74 65 73 74 73 29 29 0a 09 09 20 20  red-tests))...  
2af0: 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61     (set! test-na
2b00: 6d 65 73 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e  mes (cons waiton
2b10: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 29 29   test-names)))))
2b20: 20 3b 3b 20 77 61 73 20 61 6e 20 61 70 70 65 6e   ;; was an appen
2b30: 64 2c 20 6e 6f 77 20 61 20 63 6f 6e 73 0a 09 20  d, now a cons.. 
2b40: 20 20 20 20 77 61 69 74 6f 6e 73 29 0a 09 20 20      waitons)..  
2b50: 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74    (let ((remtest
2b60: 73 20 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63  s (delete-duplic
2b70: 61 74 65 73 20 28 61 70 70 65 6e 64 20 77 61 69  ates (append wai
2b80: 74 6f 6e 73 20 74 61 6c 29 29 29 29 0a 09 20 20  tons tal))))..  
2b90: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75      (if (not (nu
2ba0: 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 29 0a 09  ll? remtests))..
2bb0: 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 72 65  .  (loop (car re
2bc0: 6d 74 65 73 74 73 29 28 63 64 72 20 72 65 6d 74  mtests)(cdr remt
2bd0: 65 73 74 73 29 29 29 29 29 29 29 0a 0a 20 20 20  ests)))))))..   
2be0: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f   (if (not (null?
2bf0: 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 29   required-tests)
2c00: 29 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20  )..(debug:print 
2c10: 31 20 22 49 4e 46 4f 3a 20 41 64 64 69 6e 67 20  1 "INFO: Adding 
2c20: 22 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73  " required-tests
2c30: 20 22 20 74 6f 20 74 68 65 20 72 75 6e 20 71 75   " to the run qu
2c40: 65 75 65 22 29 29 0a 20 20 20 20 3b 3b 20 4e 4f  eue")).    ;; NO
2c50: 54 45 3a 20 74 68 65 73 65 20 61 72 65 20 61 6c  TE: these are al
2c60: 6c 20 70 61 72 65 6e 74 20 74 65 73 74 73 2c 20  l parent tests, 
2c70: 69 74 65 6d 73 20 61 72 65 20 6e 6f 74 20 65 78  items are not ex
2c80: 70 61 6e 64 65 64 20 79 65 74 2e 0a 20 20 20 20  panded yet..    
2c90: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d  (runs:run-tests-
2ca0: 71 75 65 75 65 20 64 62 20 72 75 6e 2d 69 64 20  queue db run-id 
2cb0: 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63  runname test-rec
2cc0: 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66  ords keyvallst f
2cd0: 6c 61 67 73 29 0a 20 20 20 20 28 69 66 20 2a 72  lags).    (if *r
2ce0: 70 63 3a 6c 69 73 74 65 6e 65 72 2a 20 28 73 65  pc:listener* (se
2cf0: 72 76 65 72 3a 6b 65 65 70 2d 72 75 6e 6e 69 6e  rver:keep-runnin
2d00: 67 20 64 62 29 29 0a 20 20 20 20 28 64 65 62 75  g db)).    (debu
2d10: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a  g:print 4 "INFO:
2d20: 20 41 6c 6c 20 64 6f 6e 65 20 62 79 20 68 65 72   All done by her
2d30: 65 22 29 29 29 0a 0a 3b 3b 20 74 65 73 74 2d 72  e")))..;; test-r
2d40: 65 63 6f 72 64 73 20 69 73 20 61 20 68 61 73 68  ecords is a hash
2d50: 20 74 61 62 6c 65 20 74 65 73 74 6e 61 6d 65 3a   table testname:
2d60: 69 74 65 6d 5f 70 61 74 68 20 3d 3e 20 76 65 63  item_path => vec
2d70: 74 6f 72 20 3c 20 74 65 73 74 6e 61 6d 65 20 74  tor < testname t
2d80: 65 73 74 63 6f 6e 66 69 67 20 77 61 69 74 6f 6e  estconfig waiton
2d90: 73 20 70 72 69 6f 72 69 74 79 20 69 74 65 6d 73  s priority items
2da0: 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66  -info ... >.(def
2db0: 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65  ine (runs:run-te
2dc0: 73 74 73 2d 71 75 65 75 65 20 64 62 20 72 75 6e  sts-queue db run
2dd0: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74  -id runname test
2de0: 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c  -records keyvall
2df0: 73 74 20 66 6c 61 67 73 29 0a 20 20 20 20 3b 3b  st flags).    ;;
2e00: 20 41 74 20 74 68 69 73 20 70 6f 69 6e 74 20 74   At this point t
2e10: 68 65 20 6c 69 73 74 20 6f 66 20 70 61 72 65 6e  he list of paren
2e20: 74 20 74 65 73 74 73 20 69 73 20 65 78 70 61 6e  t tests is expan
2e30: 64 65 64 20 0a 20 20 20 20 3b 3b 20 4e 42 2f 2f  ded .    ;; NB//
2e40: 20 53 68 6f 75 6c 64 20 65 78 70 61 6e 64 20 69   Should expand i
2e50: 74 65 6d 73 20 68 65 72 65 20 61 6e 64 20 74 68  tems here and th
2e60: 65 6e 20 69 6e 73 65 72 74 20 69 6e 74 6f 20 74  en insert into t
2e70: 68 65 20 72 75 6e 20 71 75 65 75 65 2e 0a 20 20  he run queue..  
2e80: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22  (debug:print 5 "
2e90: 74 65 73 74 2d 72 65 63 6f 72 64 73 3a 20 22 20  test-records: " 
2ea0: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 22 2c 20  test-records ", 
2eb0: 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79  keyvallst: " key
2ec0: 76 61 6c 6c 73 74 20 22 20 66 6c 61 67 73 3a 20  vallst " flags: 
2ed0: 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61  " (hash-table->a
2ee0: 6c 69 73 74 20 66 6c 61 67 73 29 29 0a 20 20 28  list flags)).  (
2ef0: 6c 65 74 20 28 28 73 6f 72 74 65 64 2d 74 65 73  let ((sorted-tes
2f00: 74 2d 6e 61 6d 65 73 20 28 74 65 73 74 73 3a 73  t-names (tests:s
2f10: 6f 72 74 2d 62 79 2d 70 72 69 6f 72 69 74 79 2d  ort-by-priority-
2f20: 61 6e 64 2d 77 61 69 74 6f 6e 20 74 65 73 74 2d  and-waiton test-
2f30: 72 65 63 6f 72 64 73 29 29 0a 09 28 69 74 65 6d  records))..(item
2f40: 2d 70 61 74 74 73 20 20 20 20 20 20 20 20 28 68  -patts        (h
2f50: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
2f60: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 69 74  fault flags "-it
2f70: 65 6d 70 61 74 74 22 20 23 66 29 29 29 0a 20 20  empatt" #f))).  
2f80: 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c    (if (not (null
2f90: 3f 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61  ? sorted-test-na
2fa0: 6d 65 73 29 29 0a 09 28 6c 65 74 20 6c 6f 6f 70  mes))..(let loop
2fb0: 20 28 28 68 65 64 20 20 20 20 20 20 20 20 20 28   ((hed         (
2fc0: 63 61 72 20 73 6f 72 74 65 64 2d 74 65 73 74 2d  car sorted-test-
2fd0: 6e 61 6d 65 73 29 29 0a 09 09 20 20 20 28 74 61  names))...   (ta
2fe0: 6c 20 20 20 20 20 20 20 20 20 28 63 64 72 20 73  l         (cdr s
2ff0: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73  orted-test-names
3000: 29 29 29 0a 09 20 20 28 6c 65 74 2a 20 28 28 74  )))..  (let* ((t
3010: 65 73 74 2d 72 65 63 6f 72 64 20 28 68 61 73 68  est-record (hash
3020: 2d 74 61 62 6c 65 2d 72 65 66 20 74 65 73 74 2d  -table-ref test-
3030: 72 65 63 6f 72 64 73 20 68 65 64 29 29 0a 09 09  records hed))...
3040: 20 28 74 63 6f 6e 66 69 67 20 20 20 20 20 28 74   (tconfig     (t
3050: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
3060: 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65  et-testconfig te
3070: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28  st-record))... (
3080: 77 61 69 74 6f 6e 73 20 20 20 20 20 28 74 65 73  waitons     (tes
3090: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
30a0: 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74  -waitons    test
30b0: 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 70 72  -record))... (pr
30c0: 69 6f 72 69 74 79 20 20 20 20 28 74 65 73 74 73  iority    (tests
30d0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 70  :testqueue-get-p
30e0: 72 69 6f 72 69 74 79 20 20 20 74 65 73 74 2d 72  riority   test-r
30f0: 65 63 6f 72 64 29 29 0a 09 09 20 28 69 74 65 6d  ecord))... (item
3100: 64 61 74 20 20 20 20 20 28 74 65 73 74 73 3a 74  dat     (tests:t
3110: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65  estqueue-get-ite
3120: 6d 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 63  mdat    test-rec
3130: 6f 72 64 29 29 20 3b 3b 20 69 74 65 6d 64 61 74  ord)) ;; itemdat
3140: 20 63 61 6e 20 62 65 20 61 20 73 74 72 69 6e 67   can be a string
3150: 2c 20 6c 69 73 74 20 6f 72 20 23 66 0a 09 09 20  , list or #f... 
3160: 28 69 74 65 6d 73 20 20 20 20 20 20 20 28 74 65  (items       (te
3170: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
3180: 74 2d 69 74 65 6d 73 20 20 20 20 20 20 74 65 73  t-items      tes
3190: 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 69  t-record))... (i
31a0: 74 65 6d 2d 70 61 74 68 20 20 20 28 69 74 65 6d  tem-path   (item
31b0: 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d  -list->path item
31c0: 64 61 74 29 29 0a 09 09 20 28 6e 65 77 74 61 6c  dat))... (newtal
31d0: 20 20 20 20 20 20 28 61 70 70 65 6e 64 20 74 61        (append ta
31e0: 6c 20 28 6c 69 73 74 20 68 65 64 29 29 29 0a 09  l (list hed)))..
31f0: 09 20 28 63 61 6c 63 2d 66 61 69 6c 73 20 20 28  . (calc-fails  (
3200: 6c 61 6d 62 64 61 20 28 70 72 65 72 65 71 73 2d  lambda (prereqs-
3210: 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 09 28 66 69  not-met).....(fi
3220: 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 74 65  lter (lambda (te
3230: 73 74 29 0a 09 09 09 09 09 20 20 28 64 65 62 75  st)......  (debu
3240: 67 3a 70 72 69 6e 74 20 39 20 22 74 65 73 74 3a  g:print 9 "test:
3250: 20 22 20 74 65 73 74 29 0a 09 09 09 09 09 20 20   " test)......  
3260: 28 61 6e 64 20 28 76 65 63 74 6f 72 3f 20 74 65  (and (vector? te
3270: 73 74 29 20 3b 3b 20 6e 6f 74 20 28 73 74 72 69  st) ;; not (stri
3280: 6e 67 3f 20 74 65 73 74 29 29 0a 09 09 09 09 09  ng? test))......
3290: 20 20 20 20 20 20 20 28 6e 6f 74 20 28 6d 65 6d         (not (mem
32a0: 62 65 72 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ber (db:test-get
32b0: 2d 73 74 61 74 75 73 20 74 65 73 74 29 0a 09 09  -status test)...
32c0: 09 09 09 09 09 20 20 20 20 27 28 22 50 41 53 53  .....    '("PASS
32d0: 22 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22  " "WARN" "CHECK"
32e0: 20 22 57 41 49 56 45 44 22 29 29 29 29 29 0a 09   "WAIVED")))))..
32f0: 09 09 09 09 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ....prereqs-not-
3300: 6d 65 74 29 29 29 29 0a 09 20 20 20 20 28 64 65  met))))..    (de
3310: 62 75 67 3a 70 72 69 6e 74 20 36 0a 09 09 09 20  bug:print 6.... 
3320: 22 69 74 65 6d 64 61 74 3a 20 20 20 20 20 22 20  "itemdat:     " 
3330: 69 74 65 6d 64 61 74 0a 09 09 09 20 22 5c 6e 20  itemdat.... "\n 
3340: 20 69 74 65 6d 73 3a 20 20 20 20 20 22 20 69 74   items:     " it
3350: 65 6d 73 0a 09 09 09 20 22 5c 6e 20 20 69 74 65  ems.... "\n  ite
3360: 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 6d 2d 70  m-path: " item-p
3370: 61 74 68 29 0a 09 20 20 20 20 28 63 6f 6e 64 0a  ath)..    (cond.
3380: 09 20 20 20 20 20 28 28 6e 6f 74 20 69 74 65 6d  .     ((not item
3390: 73 29 20 3b 3b 20 77 68 65 6e 20 66 61 6c 73 65  s) ;; when false
33a0: 20 74 68 65 20 74 65 73 74 20 69 73 20 6f 6b 20   the test is ok 
33b0: 74 6f 20 62 65 20 68 61 6e 64 65 64 20 6f 66 66  to be handed off
33c0: 20 74 6f 20 6c 61 75 6e 63 68 20 28 62 75 74 20   to launch (but 
33d0: 6e 6f 74 20 62 65 66 6f 72 65 29 0a 09 20 20 20  not before)..   
33e0: 20 20 20 28 6c 65 74 2a 20 28 28 68 61 76 65 2d     (let* ((have-
33f0: 72 65 73 6f 75 72 63 65 73 20 20 28 72 75 6e 73  resources  (runs
3400: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65  :can-run-more-te
3410: 73 74 73 20 64 62 20 74 65 73 74 2d 72 65 63 6f  sts db test-reco
3420: 72 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20 61 74 20  rd)) ;; look at 
3430: 74 68 65 20 74 65 73 74 20 6a 6f 62 67 72 6f 75  the test jobgrou
3440: 70 20 61 6e 64 20 74 6f 74 20 6a 6f 62 73 20 72  p and tot jobs r
3450: 75 6e 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 70  unning...     (p
3460: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 28  rereqs-not-met (
3470: 64 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e  db:get-prereqs-n
3480: 6f 74 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 64  ot-met db run-id
3490: 20 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61   waitons item-pa
34a0: 74 68 29 29 0a 09 09 20 20 20 20 20 28 66 61 69  th))...     (fai
34b0: 6c 73 20 20 20 20 20 20 20 20 20 20 20 28 63 61  ls           (ca
34c0: 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71 73  lc-fails prereqs
34d0: 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 28 64  -not-met)))...(d
34e0: 65 62 75 67 3a 70 72 69 6e 74 20 38 20 22 49 4e  ebug:print 8 "IN
34f0: 46 4f 3a 20 68 61 76 65 2d 72 65 73 6f 75 72 63  FO: have-resourc
3500: 65 73 3a 20 22 20 68 61 76 65 2d 72 65 73 6f 75  es: " have-resou
3510: 72 63 65 73 20 22 20 70 72 65 72 65 71 73 2d 6e  rces " prereqs-n
3520: 6f 74 2d 6d 65 74 3a 20 22 20 70 72 65 72 65 71  ot-met: " prereq
3530: 73 2d 6e 6f 74 2d 6d 65 74 20 22 20 66 61 69 6c  s-not-met " fail
3540: 73 3a 20 22 20 66 61 69 6c 73 29 0a 09 09 3b 3b  s: " fails)...;;
3550: 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 61 74 20 74   Don't know at t
3560: 68 69 73 20 74 69 6d 65 20 69 66 20 74 68 65 20  his time if the 
3570: 74 65 73 74 20 68 61 76 65 20 62 65 65 6e 20 6c  test have been l
3580: 61 75 6e 63 68 65 64 20 61 74 20 73 6f 6d 65 20  aunched at some 
3590: 74 69 6d 65 20 69 6e 20 74 68 65 20 70 61 73 74  time in the past
35a0: 0a 09 09 3b 3b 20 69 2e 65 2e 20 69 73 20 74 68  ...;; i.e. is th
35b0: 69 73 20 61 20 72 65 2d 6c 61 75 6e 63 68 3f 0a  is a re-launch?.
35c0: 09 09 28 63 6f 6e 64 0a 09 09 20 28 28 61 6e 64  ..(cond... ((and
35d0: 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 0a   have-resources.
35e0: 09 09 20 20 20 20 20 20 20 28 6e 75 6c 6c 3f 20  ..       (null? 
35f0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
3600: 29 0a 09 09 20 20 3b 3b 20 6e 6f 20 6c 6f 6f 70  )...  ;; no loop
3610: 20 68 65 72 65 2c 20 6a 75 73 74 20 64 72 6f 70   here, just drop
3620: 20 74 68 6f 75 67 68 20 61 6e 64 20 75 73 65 20   though and use 
3630: 74 68 65 20 6c 6f 6f 70 20 61 74 20 74 68 65 20  the loop at the 
3640: 62 6f 74 74 6f 6d 20 0a 09 09 20 20 28 69 66 20  bottom ...  (if 
3650: 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68  (patt-list-match
3660: 20 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d   item-path item-
3670: 70 61 74 74 73 29 0a 09 09 20 20 20 20 20 20 28  patts)...      (
3680: 72 75 6e 3a 74 65 73 74 20 64 62 20 72 75 6e 2d  run:test db run-
3690: 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61  id runname keyva
36a0: 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64  llst test-record
36b0: 20 66 6c 61 67 73 20 23 66 29 0a 09 09 20 20 20   flags #f)...   
36c0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
36d0: 31 20 22 49 4e 46 4f 3a 20 53 6b 69 70 70 69 6e  1 "INFO: Skippin
36e0: 67 20 22 20 28 74 65 73 74 73 3a 74 65 73 74 71  g " (tests:testq
36f0: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d  ueue-get-testnam
3700: 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20 22  e test-record) "
3710: 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 61   " item-path " a
3720: 73 20 69 74 20 64 6f 65 73 6e 27 74 20 6d 61 74  s it doesn't mat
3730: 63 68 20 22 20 69 74 65 6d 2d 70 61 74 74 73 29  ch " item-patts)
3740: 29 0a 09 09 20 20 3b 3b 20 65 6c 73 65 20 74 68  )...  ;; else th
3750: 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b 2c 20  e run is stuck, 
3760: 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20 70  temporarily or p
3770: 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 20 20 3b  ermanently...  ;
3780: 3b 20 62 75 74 20 73 68 6f 75 6c 64 20 63 68 65  ; but should che
3790: 63 6b 20 69 66 20 69 74 20 69 73 20 64 75 65 20  ck if it is due 
37a0: 74 6f 20 6c 61 63 6b 20 6f 66 20 72 65 73 6f 75  to lack of resou
37b0: 72 63 65 73 20 76 73 2e 20 70 72 65 72 65 71 75  rces vs. prerequ
37c0: 69 73 69 74 65 73 0a 09 09 20 20 29 0a 09 09 20  isites...  )... 
37d0: 28 28 6e 6f 74 20 68 61 76 65 2d 72 65 73 6f 75  ((not have-resou
37e0: 72 63 65 73 29 20 3b 3b 20 73 69 6d 70 6c 79 20  rces) ;; simply 
37f0: 74 72 79 20 61 67 61 69 6e 20 61 66 74 65 72 20  try again after 
3800: 77 61 69 74 69 6e 67 20 61 20 73 65 63 6f 6e 64  waiting a second
3810: 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65  ...  (thread-sle
3820: 65 70 21 20 31 2e 30 29 0a 09 09 20 20 28 64 65  ep! 1.0)...  (de
3830: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46  bug:print 1 "INF
3840: 4f 3a 20 6e 6f 20 72 65 73 6f 75 72 63 65 73 20  O: no resources 
3850: 74 6f 20 72 75 6e 20 6e 65 77 20 74 65 73 74 73  to run new tests
3860: 2c 20 77 61 69 74 69 6e 67 20 2e 2e 2e 22 29 0a  , waiting ...").
3870: 09 09 20 20 3b 3b 20 63 6f 75 6c 64 20 68 61 76  ..  ;; could hav
3880: 65 20 64 6f 6e 65 20 68 65 64 20 74 61 6c 20 68  e done hed tal h
3890: 65 72 65 20 62 75 74 20 64 6f 69 6e 67 20 63 61  ere but doing ca
38a0: 72 2f 63 64 72 20 6f 66 20 6e 65 77 74 61 6c 20  r/cdr of newtal 
38b0: 74 6f 20 72 6f 74 61 74 65 20 74 65 73 74 73 0a  to rotate tests.
38c0: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e  ..  (loop (car n
38d0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
38e0: 6c 29 29 29 0a 09 09 20 28 65 6c 73 65 20 3b 3b  l)))... (else ;;
38f0: 20 6d 75 73 74 20 62 65 20 77 65 20 68 61 76 65   must be we have
3900: 20 75 6e 6d 65 74 20 70 72 65 72 65 71 75 69 73   unmet prerequis
3910: 69 74 65 73 0a 09 09 20 20 20 20 28 64 65 62 75  ites...    (debu
3920: 67 3a 70 72 69 6e 74 20 34 20 22 46 41 49 4c 53  g:print 4 "FAILS
3930: 3a 20 22 20 66 61 69 6c 73 29 0a 09 09 20 20 20  : " fails)...   
3940: 20 3b 3b 20 49 66 20 6f 6e 65 20 6f 72 20 6d 6f   ;; If one or mo
3950: 72 65 20 6f 66 20 74 68 65 20 70 72 65 72 65 71  re of the prereq
3960: 73 2d 6e 6f 74 2d 6d 65 74 20 61 72 65 20 46 41  s-not-met are FA
3970: 49 4c 20 74 68 65 6e 20 77 65 20 63 61 6e 20 69  IL then we can i
3980: 73 73 75 65 0a 09 09 20 20 20 20 3b 3b 20 61 20  ssue...    ;; a 
3990: 6d 65 73 73 61 67 65 20 61 6e 64 20 64 72 6f 70  message and drop
39a0: 20 68 65 64 20 66 72 6f 6d 20 74 68 65 20 69 74   hed from the it
39b0: 65 6d 73 20 74 6f 20 62 65 20 70 72 6f 63 65 73  ems to be proces
39c0: 73 65 64 2e 0a 09 09 20 20 20 20 28 69 66 20 28  sed....    (if (
39d0: 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 09 09  null? fails)....
39e0: 28 62 65 67 69 6e 0a 09 09 09 20 20 3b 3b 20 63  (begin....  ;; c
39f0: 6f 75 6c 64 6e 27 74 20 72 75 6e 2c 20 74 61 6b  ouldn't run, tak
3a00: 65 20 61 20 62 72 65 61 74 68 65 72 0a 09 09 09  e a breather....
3a10: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34    (debug:print 4
3a20: 20 22 49 4e 46 4f 3a 20 53 68 6f 75 6c 64 6e 27   "INFO: Shouldn'
3a30: 74 20 72 65 61 6c 6c 79 20 67 65 74 20 68 65 72  t really get her
3a40: 65 2c 20 72 61 63 65 20 63 6f 6e 64 69 74 69 6f  e, race conditio
3a50: 6e 3f 20 55 6e 61 62 6c 65 20 74 6f 20 6c 61 75  n? Unable to lau
3a60: 6e 63 68 20 6d 6f 72 65 20 74 65 73 74 73 20 61  nch more tests a
3a70: 74 20 74 68 69 73 20 6d 6f 6d 65 6e 74 2c 20 6b  t this moment, k
3a80: 69 6c 6c 69 6e 67 20 74 69 6d 65 20 2e 2e 2e 22  illing time ..."
3a90: 29 0a 09 09 09 20 20 28 74 68 72 65 61 64 2d 73  )....  (thread-s
3aa0: 6c 65 65 70 21 20 30 2e 31 29 20 3b 3b 20 6c 6f  leep! 0.1) ;; lo
3ab0: 6e 67 20 73 6c 65 65 70 20 68 65 72 65 20 2d 20  ng sleep here - 
3ac0: 6e 6f 20 72 65 73 6f 75 72 63 65 73 2c 20 6d 61  no resources, ma
3ad0: 79 20 61 73 20 77 65 6c 6c 20 62 65 20 70 61 74  y as well be pat
3ae0: 69 65 6e 74 0a 09 09 09 20 20 3b 3b 20 77 65 20  ient....  ;; we 
3af0: 6d 61 64 65 20 6e 65 77 20 74 61 6c 20 62 79 20  made new tal by 
3b00: 73 74 69 63 6b 69 6e 67 20 68 65 64 20 61 74 20  sticking hed at 
3b10: 74 68 65 20 62 61 63 6b 20 6f 66 20 74 68 65 20  the back of the 
3b20: 6c 69 73 74 0a 09 09 09 20 20 28 6c 6f 6f 70 20  list....  (loop 
3b30: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
3b40: 20 6e 65 77 74 61 6c 29 29 29 0a 09 09 09 3b 3b   newtal)))....;;
3b50: 20 74 68 65 20 77 61 69 74 6f 6e 20 69 73 20 46   the waiton is F
3b60: 41 49 4c 20 73 6f 20 6e 6f 20 70 6f 69 6e 74 20  AIL so no point 
3b70: 69 6e 20 74 72 79 69 6e 67 20 74 6f 20 72 75 6e  in trying to run
3b80: 20 68 65 64 20 65 76 65 72 20 61 67 61 69 6e 0a   hed ever again.
3b90: 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c  ...(if (not (nul
3ba0: 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20  l? tal))....    
3bb0: 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20  (begin....      
3bc0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
3bd0: 57 41 52 4e 3a 20 44 72 6f 70 70 69 6e 67 20 74  WARN: Dropping t
3be0: 65 73 74 20 22 20 28 64 62 3a 74 65 73 74 2d 67  est " (db:test-g
3bf0: 65 74 2d 74 65 73 74 2d 6e 61 6d 65 20 68 65 64  et-test-name hed
3c00: 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67  ) "/" (db:test-g
3c10: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 68 65 64  et-item-path hed
3c20: 29 0a 09 09 09 09 09 20 20 20 22 20 66 72 6f 6d  )......   " from
3c30: 20 74 68 65 20 6c 61 75 6e 63 68 20 6c 69 73 74   the launch list
3c40: 20 61 73 20 69 74 20 68 61 73 20 70 72 65 72 65   as it has prere
3c50: 71 75 69 73 74 65 73 20 74 68 61 74 20 61 72 65  quistes that are
3c60: 20 46 41 49 4c 22 29 0a 09 09 09 20 20 20 20 20   FAIL")....     
3c70: 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29   (loop (car tal)
3c80: 28 63 64 72 20 74 61 6c 29 29 29 29 29 29 29 29  (cdr tal))))))))
3c90: 29 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20 3b  )..     ..     ;
3ca0: 3b 20 63 61 73 65 20 77 68 65 72 65 20 61 6e 20  ; case where an 
3cb0: 69 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 73  items came in as
3cc0: 20 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72 6f   a list been pro
3cd0: 63 65 73 73 65 64 0a 09 20 20 20 20 20 28 28 61  cessed..     ((a
3ce0: 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29  nd (list? items)
3cf0: 20 20 20 20 20 3b 3b 20 74 68 75 73 20 77 65 20       ;; thus we 
3d00: 6b 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 20 61  know our items a
3d10: 72 65 20 61 6c 72 65 61 64 79 20 63 61 6c 63 75  re already calcu
3d20: 6c 61 74 65 64 0a 09 09 20 20 20 28 6e 6f 74 20  lated...   (not 
3d30: 20 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 61    itemdat)) ;; a
3d40: 6e 64 20 6e 6f 74 20 79 65 74 20 65 78 70 61 6e  nd not yet expan
3d50: 64 65 64 20 69 6e 74 6f 20 74 68 65 20 6c 69 73  ded into the lis
3d60: 74 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 62  t of things to b
3d70: 65 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 28 69  e done..      (i
3d80: 66 20 28 61 6e 64 20 28 3e 3d 20 2a 76 65 72 62  f (and (>= *verb
3d90: 6f 73 69 74 79 2a 20 31 29 0a 09 09 20 20 20 20  osity* 1)...    
3da0: 20 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 74     (> (length it
3db0: 65 6d 73 29 20 30 29 0a 09 09 20 20 20 20 20 20  ems) 0)...      
3dc0: 20 28 3e 20 28 6c 65 6e 67 74 68 20 28 63 61 72   (> (length (car
3dd0: 20 69 74 65 6d 73 29 29 20 30 29 29 0a 09 09 20   items)) 0))... 
3de0: 20 28 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20   (pp items))..  
3df0: 20 20 20 20 3b 3b 20 28 69 66 20 28 3e 3d 20 2a      ;; (if (>= *
3e00: 76 65 72 62 6f 73 69 74 79 2a 20 35 29 0a 09 20  verbosity* 5).. 
3e10: 20 20 20 20 20 3b 3b 20 20 20 20 20 28 62 65 67       ;;     (beg
3e20: 69 6e 0a 09 20 20 20 20 20 20 3b 3b 20 20 20 20  in..      ;;    
3e30: 20 20 20 28 70 72 69 6e 74 20 22 69 74 65 6d 73     (print "items
3e40: 3a 20 22 29 20 20 20 20 20 28 70 70 20 28 69 74  : ")     (pp (it
3e50: 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c  em-assoc->item-l
3e60: 69 73 74 20 69 74 65 6d 73 29 29 0a 09 20 20 20  ist items))..   
3e70: 20 20 20 3b 3b 20 20 20 20 20 20 20 28 70 72 69     ;;       (pri
3e80: 6e 74 20 22 69 74 65 6d 73 74 61 62 6c 65 3a 20  nt "itemstable: 
3e90: 22 29 28 70 70 20 28 69 74 65 6d 2d 74 61 62 6c  ")(pp (item-tabl
3ea0: 65 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65  e->item-list ite
3eb0: 6d 73 74 61 62 6c 65 29 29 29 29 0a 09 20 20 20  mstable))))..   
3ec0: 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20     (for-each..  
3ed0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 79       (lambda (my
3ee0: 2d 69 74 65 6d 64 61 74 29 0a 09 09 20 28 6c 65  -itemdat)... (le
3ef0: 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65  t* ((new-test-re
3f00: 63 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72  cord (let ((newr
3f10: 65 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74  ec (make-tests:t
3f20: 65 73 74 71 75 65 75 65 29 29 29 0a 09 09 09 09  estqueue))).....
3f30: 09 20 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 79  .   (vector-copy
3f40: 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20 6e 65  ! test-record ne
3f50: 77 72 65 63 29 0a 09 09 09 09 09 20 20 20 6e 65  wrec)......   ne
3f60: 77 72 65 63 29 29 0a 09 09 09 28 6d 79 2d 69 74  wrec))....(my-it
3f70: 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69  em-path (item-li
3f80: 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d  st->path my-item
3f90: 64 61 74 29 29 29 0a 09 09 20 20 20 28 69 66 20  dat)))...   (if 
3fa0: 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68  (patt-list-match
3fb0: 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 69 74   my-item-path it
3fc0: 65 6d 2d 70 61 74 74 73 29 20 20 20 20 20 20 20  em-patts)       
3fd0: 20 20 20 20 3b 3b 20 79 65 73 2c 20 77 65 20 77      ;; yes, we w
3fe0: 61 6e 74 20 74 6f 20 70 72 6f 63 65 73 73 20 74  ant to process t
3ff0: 68 69 73 20 69 74 65 6d 2c 20 4e 4f 54 45 3a 20  his item, NOTE: 
4000: 53 68 6f 75 6c 64 20 6e 6f 74 20 6e 65 65 64 20  Should not need 
4010: 74 68 69 73 20 63 68 65 63 6b 20 68 65 72 65 21  this check here!
4020: 0a 09 09 20 20 20 20 20 20 20 28 6c 65 74 20 28  ...       (let (
4030: 28 6e 65 77 74 65 73 74 6e 61 6d 65 20 28 63 6f  (newtestname (co
4040: 6e 63 20 68 65 64 20 22 2f 22 20 6d 79 2d 69 74  nc hed "/" my-it
4050: 65 6d 2d 70 61 74 68 29 29 29 20 20 20 20 3b 3b  em-path)))    ;;
4060: 20 74 65 73 74 20 6e 61 6d 65 73 20 61 72 65 20   test names are 
4070: 75 6e 69 71 75 65 20 6f 6e 20 74 65 73 74 6e 61  unique on testna
4080: 6d 65 2f 69 74 65 6d 2d 70 61 74 68 0a 09 09 09  me/item-path....
4090: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
40a0: 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 20 20 20  e-set-items!    
40b0: 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64   new-test-record
40c0: 20 23 66 29 0a 09 09 09 20 28 74 65 73 74 73 3a   #f).... (tests:
40d0: 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74  testqueue-set-it
40e0: 65 6d 64 61 74 21 20 20 20 6e 65 77 2d 74 65 73  emdat!   new-tes
40f0: 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d  t-record my-item
4100: 64 61 74 29 0a 09 09 09 20 28 74 65 73 74 73 3a  dat).... (tests:
4110: 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74  testqueue-set-it
4120: 65 6d 5f 70 61 74 68 21 20 6e 65 77 2d 74 65 73  em_path! new-tes
4130: 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d  t-record my-item
4140: 2d 70 61 74 68 29 0a 09 09 09 20 28 68 61 73 68  -path).... (hash
4150: 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74  -table-set! test
4160: 2d 72 65 63 6f 72 64 73 20 6e 65 77 74 65 73 74  -records newtest
4170: 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 2d 72 65  name new-test-re
4180: 63 6f 72 64 29 0a 09 09 09 20 28 73 65 74 21 20  cord).... (set! 
4190: 74 61 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65 73  tal (cons newtes
41a0: 74 6e 61 6d 65 20 74 61 6c 29 29 29 29 29 29 20  tname tal)))))) 
41b0: 3b 3b 20 73 69 6e 63 65 20 74 68 65 73 65 20 61  ;; since these a
41c0: 72 65 20 69 74 65 6d 69 7a 65 64 20 63 72 65 61  re itemized crea
41d0: 74 65 20 6e 65 77 20 74 65 73 74 20 6e 61 6d 65  te new test name
41e0: 73 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 70  s testname/itemp
41f0: 61 74 68 0a 09 20 20 20 20 20 20 20 69 74 65 6d  ath..       item
4200: 73 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e  s)..      (if (n
4210: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a  ot (null? tal)).
4220: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74  ..  (loop (car t
4230: 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29 0a  al)(cdr tal)))).
4240: 0a 09 20 20 20 20 20 3b 3b 20 69 66 20 69 74 65  ..     ;; if ite
4250: 6d 73 20 69 73 20 61 20 70 72 6f 63 20 74 68 65  ms is a proc the
4260: 6e 20 6e 65 65 64 20 74 6f 20 72 75 6e 20 69 74  n need to run it
4270: 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72  ems:get-items-fr
4280: 6f 6d 2d 63 6f 6e 66 69 67 2c 20 67 65 74 20 74  om-config, get t
4290: 68 65 20 6c 69 73 74 20 61 6e 64 20 6c 6f 6f 70  he list and loop
42a0: 20 0a 09 20 20 20 20 20 3b 3b 20 20 20 20 2d 20   ..     ;;    - 
42b0: 62 75 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74  but only do that
42c0: 20 69 66 20 72 65 73 6f 75 72 63 65 73 20 65 78   if resources ex
42d0: 69 73 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20  ist to kick off 
42e0: 74 68 65 20 6a 6f 62 0a 09 20 20 20 20 20 28 28  the job..     ((
42f0: 6f 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69  or (procedure? i
4300: 74 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20  tems)(eq? items 
4310: 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29  'have-procedure)
4320: 29 0a 09 20 20 20 20 20 20 28 6c 65 74 2a 20 28  )..      (let* (
4330: 28 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 20 20  (can-run-more   
4340: 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d   (runs:can-run-m
4350: 6f 72 65 2d 74 65 73 74 73 20 64 62 20 74 65 73  ore-tests db tes
4360: 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 20 20  t-record))...   
4370: 20 20 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d    (prereqs-not-m
4380: 65 74 20 28 64 62 3a 67 65 74 2d 70 72 65 72 65  et (db:get-prere
4390: 71 73 2d 6e 6f 74 2d 6d 65 74 20 64 62 20 72 75  qs-not-met db ru
43a0: 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74 65  n-id waitons ite
43b0: 6d 2d 70 61 74 68 29 29 0a 09 09 20 20 20 20 20  m-path))...     
43c0: 28 66 61 69 6c 73 20 20 20 20 20 20 20 20 20 20  (fails          
43d0: 20 28 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 65   (calc-fails pre
43e0: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a  reqs-not-met))).
43f0: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 38  ..(debug:print 8
4400: 20 22 49 4e 46 4f 3a 20 63 61 6e 2d 72 75 6e 2d   "INFO: can-run-
4410: 6d 6f 72 65 3a 20 22 20 63 61 6e 2d 72 75 6e 2d  more: " can-run-
4420: 6d 6f 72 65 0a 09 09 09 20 20 20 20 20 22 20 70  more....     " p
4430: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 5c  rereqs-not-met:\
4440: 6e 20 20 22 20 28 69 6e 74 65 72 73 70 65 72 73  n  " (interspers
4450: 65 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  e prereqs-not-me
4460: 74 20 22 5c 6e 22 29 0a 09 09 09 20 20 20 20 20  t "\n")....     
4470: 22 20 66 61 69 6c 73 3a 5c 6e 20 22 20 20 20 20  " fails:\n "    
4480: 20 20 20 20 20 20 20 20 28 69 6e 74 65 72 73 70          (intersp
4490: 65 72 73 65 20 66 61 69 6c 73 20 22 5c 6e 22 29  erse fails "\n")
44a0: 29 0a 09 09 28 63 6f 6e 64 20 0a 09 09 20 28 28  )...(cond ... ((
44b0: 61 6e 64 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  and can-run-more
44c0: 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d   (null? prereqs-
44d0: 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 20 20 28 6c  not-met))...  (l
44e0: 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 28  et ((test-name (
44f0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
4500: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73  get-testname tes
4510: 74 2d 72 65 63 6f 72 64 29 29 29 0a 09 09 20 20  t-record)))...  
4520: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45    (setenv "MT_TE
4530: 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61  ST_NAME" test-na
4540: 6d 65 29 20 3b 3b 20 0a 09 09 20 20 20 20 28 73  me) ;; ...    (s
4550: 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d  etenv "MT_RUNNAM
4560: 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a 09 09  E"   runname)...
4570: 20 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73      (set-megates
4580: 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72 75  t-env-vars db ru
4590: 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d  n-id) ;; these m
45a0: 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 79 20  ay be needed by 
45b0: 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72  the launching pr
45c0: 6f 63 65 73 73 0a 09 09 20 20 20 20 28 6c 65 74  ocess...    (let
45d0: 20 28 28 69 74 65 6d 73 2d 6c 69 73 74 20 28 69   ((items-list (i
45e0: 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66  tems:get-items-f
45f0: 72 6f 6d 2d 63 6f 6e 66 69 67 20 74 63 6f 6e 66  rom-config tconf
4600: 69 67 29 29 29 0a 09 09 20 20 20 20 20 20 28 69  ig)))...      (i
4610: 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 2d 6c  f (list? items-l
4620: 69 73 74 29 0a 09 09 09 20 20 28 62 65 67 69 6e  ist)....  (begin
4630: 0a 09 09 09 20 20 20 20 28 74 65 73 74 73 3a 74  ....    (tests:t
4640: 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65  estqueue-set-ite
4650: 6d 73 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20  ms! test-record 
4660: 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 20  items-list).... 
4670: 20 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c     (loop hed tal
4680: 29 29 0a 09 09 09 20 20 28 62 65 67 69 6e 0a 09  ))....  (begin..
4690: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
46a0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65  nt 0 "ERROR: The
46b0: 20 70 72 6f 63 20 66 72 6f 6d 20 72 65 61 64 69   proc from readi
46c0: 6e 67 20 74 68 65 20 73 65 74 75 70 20 64 69 64  ng the setup did
46d0: 20 6e 6f 74 20 79 69 65 6c 64 20 61 20 6c 69 73   not yield a lis
46e0: 74 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72  t - please repor
46f0: 74 20 74 68 69 73 22 29 0a 09 09 09 20 20 20 20  t this")....    
4700: 28 65 78 69 74 20 31 29 29 29 29 29 29 0a 09 09  (exit 1))))))...
4710: 20 28 28 61 6e 64 20 63 61 6e 2d 72 75 6e 2d 6d   ((and can-run-m
4720: 6f 72 65 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73  ore (null? fails
4730: 29 29 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72  ))...  (debug:pr
4740: 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 43 61 6e  int 4 "INFO: Can
4750: 27 74 20 72 75 6e 20 6d 6f 72 65 20 72 69 67 68  't run more righ
4760: 74 20 6e 6f 77 2c 20 6b 69 6c 6c 69 6e 67 20 61  t now, killing a
4770: 20 6c 69 74 74 6c 65 20 74 69 6d 65 20 2e 2e 2e   little time ...
4780: 22 29 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73  ")...  (thread-s
4790: 6c 65 65 70 21 20 33 2e 30 29 0a 09 09 20 20 28  leep! 3.0)...  (
47a0: 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c  loop (car newtal
47b0: 29 28 63 64 72 20 6e 65 77 74 61 6c 29 29 29 20  )(cdr newtal))) 
47c0: 3b 3b 20 61 6e 20 69 73 73 75 65 20 77 69 74 68  ;; an issue with
47d0: 20 70 72 65 72 65 71 73 20 6e 6f 74 20 79 65 74   prereqs not yet
47e0: 20 6d 65 74 3f 0a 09 09 20 28 65 6c 73 65 0a 09   met?... (else..
47f0: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
4800: 31 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 22 20  1 "INFO: test " 
4810: 20 68 65 64 20 22 20 68 61 73 20 66 61 69 6c 65   hed " has faile
4820: 64 20 70 72 65 72 65 71 75 69 73 69 74 65 28 73  d prerequisite(s
4830: 29 3b 20 22 0a 09 09 09 20 20 20 20 20 20 20 28  ); "....       (
4840: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72  string-intersper
4850: 73 65 20 28 6d 61 70 20 64 62 3a 74 65 73 74 2d  se (map db:test-
4860: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 66 61 69  get-testname fai
4870: 6c 73 29 20 22 2c 20 22 29 0a 09 09 09 20 20 20  ls) ", ")....   
4880: 20 20 20 20 22 2c 20 72 65 6d 6f 76 69 6e 67 20      ", removing 
4890: 69 74 20 66 72 6f 6d 20 74 6f 2d 64 6f 20 6c 69  it from to-do li
48a0: 73 74 22 29 0a 09 09 20 20 28 69 66 20 28 6e 6f  st")...  (if (no
48b0: 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09  t (null? tal))..
48c0: 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61  .      (loop (ca
48d0: 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29  r tal)(cdr tal))
48e0: 29 29 29 29 29 0a 09 20 20 20 20 20 0a 09 20 20  )))))..     ..  
48f0: 20 20 20 3b 3b 20 74 68 69 73 20 63 61 73 65 20     ;; this case 
4900: 73 68 6f 75 6c 64 20 6e 6f 74 20 68 61 70 70 65  should not happe
4910: 6e 2c 20 61 64 64 65 64 20 74 6f 20 68 65 6c 70  n, added to help
4920: 20 63 61 74 63 68 20 61 6e 79 20 62 75 67 73 0a   catch any bugs.
4930: 09 20 20 20 20 20 28 28 61 6e 64 20 28 6c 69 73  .     ((and (lis
4940: 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 64 61  t? items) itemda
4950: 74 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 67  t)..      (debug
4960: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
4970: 20 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65   Should not have
4980: 20 61 20 6c 69 73 74 20 6f 66 20 69 74 65 6d 73   a list of items
4990: 20 69 6e 20 61 20 74 65 73 74 20 61 6e 64 20 74   in a test and t
49a0: 68 65 20 69 74 65 6d 73 70 61 74 68 20 73 65 74  he itemspath set
49b0: 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74   - please report
49c0: 20 74 68 69 73 22 29 0a 09 20 20 20 20 20 20 28   this")..      (
49d0: 65 78 69 74 20 31 29 29 29 29 0a 09 20 20 0a 09  exit 1))))..  ..
49e0: 20 20 3b 3b 20 77 65 20 67 65 74 20 68 65 72 65    ;; we get here
49f0: 20 6f 6e 20 22 64 72 6f 70 20 74 68 72 6f 75 67   on "drop throug
4a00: 68 22 20 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e 65  h" - loop for ne
4a10: 78 74 20 74 65 73 74 20 69 6e 20 71 75 65 75 65  xt test in queue
4a20: 0a 09 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74  ..  (if (null? t
4a30: 61 6c 29 0a 09 20 20 20 20 20 20 28 62 65 67 69  al)..      (begi
4a40: 6e 0a 09 09 3b 3b 20 46 49 58 4d 45 21 21 21 21  n...;; FIXME!!!!
4a50: 20 54 48 49 53 20 53 48 4f 55 4c 44 20 4e 4f 54   THIS SHOULD NOT
4a60: 20 52 45 51 55 49 52 45 20 41 4e 20 45 58 49 54   REQUIRE AN EXIT
4a70: 21 21 21 21 21 21 21 0a 09 09 28 64 65 62 75 67  !!!!!!!...(debug
4a80: 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20  :print 1 "INFO: 
4a90: 41 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e 63 68  All tests launch
4aa0: 65 64 22 29 0a 09 09 28 74 68 72 65 61 64 2d 73  ed")...(thread-s
4ab0: 6c 65 65 70 21 20 30 2e 35 29 0a 09 09 3b 3b 20  leep! 0.5)...;; 
4ac0: 46 49 58 4d 45 21 20 54 68 69 73 20 68 61 72 73  FIXME! This hars
4ad0: 68 20 65 78 69 74 20 73 68 6f 75 6c 64 20 6e 6f  h exit should no
4ae0: 74 20 62 65 20 6e 65 63 65 73 73 61 72 79 2e 2e  t be necessary..
4af0: 2e 2e 0a 09 09 28 69 66 20 28 6e 6f 74 20 2a 72  .....(if (not *r
4b00: 75 6e 72 65 6d 6f 74 65 2a 29 28 65 78 69 74 29  unremote*)(exit)
4b10: 29 20 3b 3b 20 0a 09 09 23 66 29 20 3b 3b 20 72  ) ;; ...#f) ;; r
4b20: 65 74 75 72 6e 20 61 20 23 66 20 61 73 20 61 20  eturn a #f as a 
4b30: 68 69 6e 74 20 74 68 61 74 20 77 65 20 61 72 65  hint that we are
4b40: 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 3b 3b 20   done..      ;; 
4b50: 48 65 72 65 20 77 65 20 6e 65 65 64 20 74 6f 20  Here we need to 
4b60: 63 68 65 63 6b 20 74 68 61 74 20 61 6c 6c 20 74  check that all t
4b70: 68 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69  he tests remaini
4b80: 6e 67 20 74 6f 20 62 65 20 72 75 6e 20 61 72 65  ng to be run are
4b90: 20 65 6c 69 67 69 62 6c 65 20 74 6f 20 72 75 6e   eligible to run
4ba0: 0a 09 20 20 20 20 20 20 3b 3b 20 61 6e 64 20 61  ..      ;; and a
4bb0: 72 65 20 6e 6f 74 20 62 6c 6f 63 6b 65 64 20 62  re not blocked b
4bc0: 79 20 66 61 69 6c 65 64 0a 09 20 20 20 20 20 20  y failed..      
4bd0: 28 6c 65 74 20 28 28 6e 65 77 6c 73 74 20 28 74  (let ((newlst (t
4be0: 65 73 74 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d  ests:filter-non-
4bf0: 72 75 6e 6e 61 62 6c 65 20 64 62 20 72 75 6e 2d  runnable db run-
4c00: 69 64 20 74 61 6c 20 74 65 73 74 2d 72 65 63 6f  id tal test-reco
4c10: 72 64 73 29 29 29 20 3b 3b 20 69 2e 65 2e 20 6e  rds))) ;; i.e. n
4c20: 6f 74 20 46 41 49 4c 2c 20 57 41 49 56 45 44 2c  ot FAIL, WAIVED,
4c30: 20 49 4e 43 4f 4d 50 4c 45 54 45 2c 20 50 41 53   INCOMPLETE, PAS
4c40: 53 2c 20 4b 49 4c 4c 45 44 2c 0a 09 09 28 74 68  S, KILLED,...(th
4c50: 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 31 29  read-sleep! 0.1)
4c60: 0a 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c  ...(if (not (nul
4c70: 6c 3f 20 6e 65 77 6c 73 74 29 29 0a 09 09 20 20  l? newlst))...  
4c80: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77    (loop (car new
4c90: 6c 73 74 29 28 63 64 72 20 6e 65 77 6c 73 74 29  lst)(cdr newlst)
4ca0: 29 29 29 29 29 29 29 29 0a 0a 3b 3b 20 70 61 72  ))))))))..;; par
4cb0: 65 6e 74 2d 74 65 73 74 20 69 73 20 74 68 65 72  ent-test is ther
4cc0: 65 20 61 73 20 61 20 70 6c 61 63 65 68 6f 6c 64  e as a placehold
4cd0: 65 72 20 66 6f 72 20 77 68 65 6e 20 70 61 72 65  er for when pare
4ce0: 6e 74 2d 74 65 73 74 73 20 63 61 6e 20 62 65 20  nt-tests can be 
4cf0: 72 75 6e 20 61 73 20 61 20 73 65 74 75 70 20 73  run as a setup s
4d00: 74 65 70 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  tep.(define (run
4d10: 3a 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20  :test db run-id 
4d20: 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73  runname keyvalls
4d30: 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c  t test-record fl
4d40: 61 67 73 20 70 61 72 65 6e 74 2d 74 65 73 74 29  ags parent-test)
4d50: 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 20  .  ;; All these 
4d60: 76 61 72 73 20 6d 69 67 68 74 20 62 65 20 72 65  vars might be re
4d70: 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 20  ferenced by the 
4d80: 74 65 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 20  testconfig file 
4d90: 72 65 61 64 65 72 0a 20 20 28 6c 65 74 2a 20 28  reader.  (let* (
4da0: 28 74 65 73 74 2d 6e 61 6d 65 20 20 20 20 28 74  (test-name    (t
4db0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
4dc0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65  et-testname   te
4dd0: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74  st-record)).. (t
4de0: 65 73 74 2d 77 61 69 74 6f 6e 73 20 28 74 65 73  est-waitons (tes
4df0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
4e00: 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74  -waitons    test
4e10: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73  -record)).. (tes
4e20: 74 2d 63 6f 6e 66 20 20 20 20 28 74 65 73 74 73  t-conf    (tests
4e30: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74  :testqueue-get-t
4e40: 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72  estconfig test-r
4e50: 65 63 6f 72 64 29 29 0a 09 20 28 69 74 65 6d 64  ecord)).. (itemd
4e60: 61 74 20 20 20 20 20 20 28 74 65 73 74 73 3a 74  at      (tests:t
4e70: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65  estqueue-get-ite
4e80: 6d 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 63  mdat    test-rec
4e90: 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 70 61  ord)).. (test-pa
4ea0: 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70  th    (conc *top
4eb0: 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20  path* "/tests/" 
4ec0: 74 65 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20 63  test-name)) ;; c
4ed0: 6f 75 6c 64 20 75 73 65 20 74 65 73 74 73 3a 67  ould use tests:g
4ee0: 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65  et-testconfig he
4ef0: 72 65 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65 20  re ..... (force 
4f00: 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62         (hash-tab
4f10: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66  le-ref/default f
4f20: 6c 61 67 73 20 22 2d 66 6f 72 63 65 22 20 23 66  lags "-force" #f
4f30: 29 29 0a 09 20 28 72 65 72 75 6e 20 20 20 20 20  )).. (rerun     
4f40: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72     (hash-table-r
4f50: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73  ef/default flags
4f60: 20 22 2d 72 65 72 75 6e 22 20 23 66 29 29 0a 09   "-rerun" #f))..
4f70: 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 28   (keepgoing    (
4f80: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
4f90: 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b  efault flags "-k
4fa0: 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09  eepgoing" #f))..
4fb0: 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 20 20   (item-path     
4fc0: 22 22 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a  "")).    (debug:
4fd0: 70 72 69 6e 74 20 35 0a 09 09 20 22 74 65 73 74  print 5... "test
4fe0: 2d 63 6f 6e 66 69 67 3a 20 22 20 28 68 61 73 68  -config: " (hash
4ff0: 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65  -table->alist te
5000: 73 74 2d 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20  st-conf)... "\n 
5010: 20 20 69 74 65 6d 64 61 74 3a 20 22 20 69 74 65    itemdat: " ite
5020: 6d 64 61 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b  mdat... ).    ;;
5030: 20 73 65 74 74 69 6e 67 20 69 74 65 6d 64 61 74   setting itemdat
5040: 20 74 6f 20 61 20 6c 69 73 74 20 69 66 20 69 74   to a list if it
5050: 20 69 73 20 23 66 0a 20 20 20 20 28 69 66 20 28   is #f.    (if (
5060: 6e 6f 74 20 69 74 65 6d 64 61 74 29 28 73 65 74  not itemdat)(set
5070: 21 20 69 74 65 6d 64 61 74 20 27 28 29 29 29 0a  ! itemdat '())).
5080: 20 20 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70      (set! item-p
5090: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e  ath (item-list->
50a0: 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 20  path itemdat)). 
50b0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
50c0: 32 20 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f  2 "Attempting to
50d0: 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 74   launch test " t
50e0: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65  est-name "/" ite
50f0: 6d 2d 70 61 74 68 29 0a 20 20 20 20 28 73 65 74  m-path).    (set
5100: 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d  env "MT_TEST_NAM
5110: 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b  E" test-name) ;;
5120: 20 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d   .    (setenv "M
5130: 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e  T_RUNNAME"   run
5140: 6e 61 6d 65 29 0a 20 20 20 20 28 73 65 74 2d 6d  name).    (set-m
5150: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73  egatest-env-vars
5160: 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74   db run-id) ;; t
5170: 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64  hese may be need
5180: 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68  ed by the launch
5190: 69 6e 67 20 70 72 6f 63 65 73 73 0a 20 20 20 20  ing process.    
51a0: 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72  (change-director
51b0: 79 20 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20  y *toppath*)..  
51c0: 20 20 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65    ;; Here is whe
51d0: 72 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61  re the test_meta
51e0: 20 74 61 62 6c 65 20 69 73 20 62 65 73 74 20 75   table is best u
51f0: 70 64 61 74 65 64 0a 20 20 20 20 3b 3b 20 59 65  pdated.    ;; Ye
5200: 73 2c 20 61 6e 6f 74 68 65 72 20 75 73 65 20 6f  s, another use o
5210: 66 20 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20 63  f a global for c
5220: 61 63 68 69 6e 67 2e 20 4e 65 65 64 20 61 20 62  aching. Need a b
5230: 65 74 74 65 72 20 77 61 79 3f 0a 20 20 20 20 28  etter way?.    (
5240: 69 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61  if (not (hash-ta
5250: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
5260: 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74  *test-meta-updat
5270: 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 66  ed* test-name #f
5280: 29 29 0a 20 20 20 20 20 20 20 20 28 62 65 67 69  )).        (begi
5290: 6e 0a 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c  n..   (hash-tabl
52a0: 65 2d 73 65 74 21 20 2a 74 65 73 74 2d 6d 65 74  e-set! *test-met
52b0: 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d  a-updated* test-
52c0: 6e 61 6d 65 20 23 74 29 0a 20 20 20 20 20 20 20  name #t).       
52d0: 20 20 20 20 28 72 75 6e 73 3a 75 70 64 61 74 65      (runs:update
52e0: 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65  -test_meta db te
52f0: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e  st-name test-con
5300: 66 29 29 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b  f))).    .    ;;
5310: 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61   (lambda (itemda
5320: 74 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73  t) ;;; ((ripenes
5330: 73 20 22 6f 76 65 72 72 69 70 65 22 29 20 28 74  s "overripe") (t
5340: 65 6d 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c  emperature "cool
5350: 22 29 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d  ") (season "summ
5360: 65 72 22 29 29 0a 20 20 20 20 28 6c 65 74 2a 20  er")).    (let* 
5370: 28 28 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20  ((new-test-path 
5380: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65  (string-interspe
5390: 72 73 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70  rse (cons test-p
53a0: 61 74 68 20 28 6d 61 70 20 63 61 64 72 20 69 74  ath (map cadr it
53b0: 65 6d 64 61 74 29 29 20 22 2f 22 29 29 0a 09 20  emdat)) "/")).. 
53c0: 20 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65    (new-test-name
53d0: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65   (if (equal? ite
53e0: 6d 2d 70 61 74 68 20 22 22 29 20 74 65 73 74 2d  m-path "") test-
53f0: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d  name (conc test-
5400: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
5410: 74 68 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65  th))) ;; just ne
5420: 65 64 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71  ed it to be uniq
5430: 75 65 0a 09 20 20 20 28 74 65 73 74 64 61 74 20  ue..   (testdat 
5440: 20 20 20 20 20 20 28 64 62 3a 67 65 74 2d 74 65        (db:get-te
5450: 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69  st-info db run-i
5460: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  d test-name item
5470: 2d 70 61 74 68 29 29 0a 09 20 20 20 28 74 65 73  -path))..   (tes
5480: 74 2d 69 64 20 20 20 20 20 20 20 23 66 29 29 0a  t-id       #f)).
5490: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74        (if (not t
54a0: 65 73 74 64 61 74 29 0a 09 20 20 28 62 65 67 69  estdat)..  (begi
54b0: 6e 0a 09 20 20 20 20 3b 3b 20 65 6e 73 75 72 65  n..    ;; ensure
54c0: 20 74 68 61 74 20 74 68 65 20 70 61 74 68 20 65   that the path e
54d0: 78 69 73 74 73 20 62 65 66 6f 72 65 20 72 65 67  xists before reg
54e0: 69 73 74 65 72 69 6e 67 20 74 68 65 20 74 65 73  istering the tes
54f0: 74 0a 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20  t..    ;; NOPE: 
5500: 43 61 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e  Cannot! Don't kn
5510: 6f 77 20 79 65 74 20 77 68 69 63 68 20 64 69 73  ow yet which dis
5520: 6b 20 61 72 65 61 20 77 69 6c 6c 20 62 65 20 61  k area will be a
5530: 73 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20  ssigned......   
5540: 20 3b 3b 20 28 73 79 73 74 65 6d 20 28 63 6f 6e   ;; (system (con
5550: 63 20 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65  c "mkdir -p " ne
5560: 77 2d 74 65 73 74 2d 70 61 74 68 29 29 0a 09 20  w-test-path)).. 
5570: 20 20 20 28 72 74 65 73 74 73 3a 72 65 67 69 73     (rtests:regis
5580: 74 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d  ter-test db run-
5590: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65  id test-name ite
55a0: 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 28 73 65  m-path)..    (se
55b0: 74 21 20 74 65 73 74 64 61 74 20 28 64 62 3a 67  t! testdat (db:g
55c0: 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20  et-test-info db 
55d0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65  run-id test-name
55e0: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 20   item-path)))). 
55f0: 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d       (set! test-
5600: 69 64 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  id (db:test-get-
5610: 69 64 20 74 65 73 74 64 61 74 29 29 0a 20 20 20  id testdat)).   
5620: 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63     (change-direc
5630: 74 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a  tory test-path).
5640: 20 20 20 20 20 20 28 63 61 73 65 20 28 69 66 20        (case (if 
5650: 66 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 3a 67  force ;; (args:g
5660: 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29  et-arg "-force")
5670: 0a 09 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a  ...'NOT_STARTED.
5680: 09 09 28 69 66 20 74 65 73 74 64 61 74 0a 09 09  ..(if testdat...
5690: 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d      (string->sym
56a0: 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74  bol (test:get-st
56b0: 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09  ate testdat))...
56c0: 20 20 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69      'failed-to-i
56d0: 6e 73 65 72 74 29 29 0a 09 28 28 66 61 69 6c 65  nsert))..((faile
56e0: 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28  d-to-insert).. (
56f0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
5700: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20  RROR: Failed to 
5710: 69 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f 72  insert the recor
5720: 64 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29  d into the db"))
5730: 0a 09 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20  ..((NOT_STARTED 
5740: 43 4f 4d 50 4c 45 54 45 44 29 0a 09 20 28 6c 65  COMPLETED).. (le
5750: 74 20 28 28 72 75 6e 66 6c 61 67 20 23 66 29 29  t ((runflag #f))
5760: 0a 09 20 20 20 28 63 6f 6e 64 0a 09 20 20 20 20  ..   (cond..    
5770: 3b 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e  ;; -force, run n
5780: 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20  o matter what.. 
5790: 20 20 20 28 66 6f 72 63 65 20 28 73 65 74 21 20     (force (set! 
57a0: 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20  runflag #t))..  
57b0: 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44    ;; NOT_STARTED
57c0: 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20  , run no matter 
57d0: 77 68 61 74 0a 09 20 20 20 20 28 28 65 71 75 61  what..    ((equa
57e0: 6c 3f 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  l? (test:get-sta
57f0: 74 65 20 74 65 73 74 64 61 74 29 20 22 4e 4f 54  te testdat) "NOT
5800: 5f 53 54 41 52 54 45 44 22 29 28 73 65 74 21 20  _STARTED")(set! 
5810: 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20  runflag #t))..  
5820: 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20    ;; not -rerun 
5830: 61 6e 64 20 50 41 53 53 2c 20 57 41 52 4e 20 6f  and PASS, WARN o
5840: 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72  r CHECK, do no r
5850: 75 6e 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6f  un..    ((and (o
5860: 72 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09  r (not rerun)...
5870: 20 20 20 20 20 20 6b 65 65 70 67 6f 69 6e 67 29        keepgoing)
5880: 0a 09 09 20 20 3b 3b 20 52 65 71 75 69 72 65 20  ...  ;; Require 
5890: 74 6f 20 66 6f 72 63 65 20 72 65 2d 72 75 6e 20  to force re-run 
58a0: 66 6f 72 20 43 4f 4d 50 4c 45 54 45 44 20 6f 72  for COMPLETED or
58b0: 20 2a 61 6e 79 74 68 69 6e 67 2a 20 2b 20 50 41   *anything* + PA
58c0: 53 53 2c 57 41 52 4e 20 6f 72 20 43 48 45 43 4b  SS,WARN or CHECK
58d0: 0a 09 09 20 20 28 6f 72 20 28 6d 65 6d 62 65 72  ...  (or (member
58e0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75   (test:get-statu
58f0: 73 20 74 65 73 74 64 61 74 29 20 27 28 22 50 41  s testdat) '("PA
5900: 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 45 43  SS" "WARN" "CHEC
5910: 4b 22 29 29 0a 09 09 20 20 20 20 20 20 28 6d 65  K"))...      (me
5920: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73  mber (test:get-s
5930: 74 61 74 65 20 20 74 65 73 74 64 61 74 29 20 27  tate  testdat) '
5940: 28 22 43 4f 4d 50 4c 45 54 45 44 22 29 29 29 29  ("COMPLETED"))))
5950: 20 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70   ..     (debug:p
5960: 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20 72 75  rint 2 "INFO: ru
5970: 6e 6e 69 6e 67 20 74 65 73 74 20 22 20 74 65 73  nning test " tes
5980: 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d  t-name "/" item-
5990: 70 61 74 68 20 22 20 73 75 70 70 72 65 73 73 65  path " suppresse
59a0: 64 20 61 73 20 69 74 20 69 73 20 22 20 28 74 65  d as it is " (te
59b0: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73  st:get-state tes
59c0: 74 64 61 74 29 20 22 20 61 6e 64 20 22 20 28 74  tdat) " and " (t
59d0: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74  est:get-status t
59e0: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 28  estdat))..     (
59f0: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29  set! runflag #f)
5a00: 29 0a 09 20 20 20 20 3b 3b 20 2d 72 65 72 75 6e  )..    ;; -rerun
5a10: 20 61 6e 64 20 73 74 61 74 75 73 20 69 73 20 6f   and status is o
5a20: 6e 65 20 6f 66 20 74 68 65 20 73 70 65 63 69 66  ne of the specif
5a30: 65 64 2c 20 72 75 6e 20 69 74 0a 09 20 20 20 20  ed, run it..    
5a40: 28 28 61 6e 64 20 72 65 72 75 6e 0a 09 09 20 20  ((and rerun...  
5a50: 28 6c 65 74 2a 20 28 28 72 65 72 75 6e 6c 73 74  (let* ((rerunlst
5a60: 20 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74     (string-split
5a70: 20 72 65 72 75 6e 20 22 2c 22 29 29 0a 09 09 09   rerun ","))....
5a80: 20 28 6d 75 73 74 2d 72 65 72 75 6e 20 28 6d 65   (must-rerun (me
5a90: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73  mber (test:get-s
5aa0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 72  tatus testdat) r
5ab0: 65 72 75 6e 6c 73 74 29 29 29 0a 09 09 20 20 20  erunlst)))...   
5ac0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20   (debug:print 3 
5ad0: 22 49 4e 46 4f 3a 20 2d 72 65 72 75 6e 20 6c 69  "INFO: -rerun li
5ae0: 73 74 3a 20 22 20 72 65 72 75 6e 20 22 2c 20 74  st: " rerun ", t
5af0: 65 73 74 2d 73 74 61 74 75 73 3a 20 22 20 28 74  est-status: " (t
5b00: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74  est:get-status t
5b10: 65 73 74 64 61 74 29 22 2c 20 6d 75 73 74 2d 72  estdat)", must-r
5b20: 65 72 75 6e 3a 20 22 20 6d 75 73 74 2d 72 65 72  erun: " must-rer
5b30: 75 6e 29 0a 09 09 20 20 20 20 6d 75 73 74 2d 72  un)...    must-r
5b40: 65 72 75 6e 29 29 0a 09 20 20 20 20 20 28 64 65  erun))..     (de
5b50: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 49 4e 46  bug:print 2 "INF
5b60: 4f 3a 20 52 65 72 75 6e 20 66 6f 72 63 65 64 20  O: Rerun forced 
5b70: 66 6f 72 20 74 65 73 74 20 22 20 74 65 73 74 2d  for test " test-
5b80: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
5b90: 74 68 29 0a 09 20 20 20 20 20 28 73 65 74 21 20  th)..     (set! 
5ba0: 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20  runflag #t))..  
5bb0: 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 2c    ;; -keepgoing,
5bc0: 20 64 6f 20 6e 6f 74 20 72 65 72 75 6e 20 46 41   do not rerun FA
5bd0: 49 4c 0a 09 20 20 20 20 28 28 61 6e 64 20 6b 65  IL..    ((and ke
5be0: 65 70 67 6f 69 6e 67 0a 09 09 20 20 28 6d 65 6d  epgoing...  (mem
5bf0: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74  ber (test:get-st
5c00: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28  atus testdat) '(
5c10: 22 46 41 49 4c 22 29 29 29 0a 09 20 20 20 20 20  "FAIL")))..     
5c20: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66  (set! runflag #f
5c30: 29 29 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6e  ))..    ((and (n
5c40: 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 28 6d  ot rerun)...  (m
5c50: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d  ember (test:get-
5c60: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20  status testdat) 
5c70: 27 28 22 46 41 49 4c 22 20 22 6e 2f 61 22 29 29  '("FAIL" "n/a"))
5c80: 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75  )..     (set! ru
5c90: 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20  nflag #t))..    
5ca0: 28 65 6c 73 65 20 28 73 65 74 21 20 72 75 6e 66  (else (set! runf
5cb0: 6c 61 67 20 23 66 29 29 29 0a 09 20 20 20 28 64  lag #f)))..   (d
5cc0: 65 62 75 67 3a 70 72 69 6e 74 20 36 20 22 52 55  ebug:print 6 "RU
5cd0: 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e 66 6c 61 67  NNING => runflag
5ce0: 3a 20 22 20 72 75 6e 66 6c 61 67 20 22 20 53 54  : " runflag " ST
5cf0: 41 54 45 3a 20 22 20 28 74 65 73 74 3a 67 65 74  ATE: " (test:get
5d00: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20  -state testdat) 
5d10: 22 20 53 54 41 54 55 53 3a 20 22 20 28 74 65 73  " STATUS: " (tes
5d20: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
5d30: 74 64 61 74 29 29 0a 09 20 20 20 28 69 66 20 28  tdat))..   (if (
5d40: 6e 6f 74 20 72 75 6e 66 6c 61 67 29 0a 09 20 20  not runflag)..  
5d50: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 70 61       (if (not pa
5d60: 72 65 6e 74 2d 74 65 73 74 29 0a 09 09 20 20 20  rent-test)...   
5d70: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
5d80: 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 61 72 74 69  NOTE: Not starti
5d90: 6e 67 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65  ng test " new-te
5da0: 73 74 2d 6e 61 6d 65 20 22 20 61 73 20 69 74 20  st-name " as it 
5db0: 69 73 20 73 74 61 74 65 20 5c 22 22 20 28 74 65  is state \"" (te
5dc0: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73  st:get-state tes
5dd0: 74 64 61 74 29 20 0a 09 09 09 09 22 5c 22 20 61  tdat) ....."\" a
5de0: 6e 64 20 73 74 61 74 75 73 20 5c 22 22 20 28 74  nd status \"" (t
5df0: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74  est:get-status t
5e00: 65 73 74 64 61 74 29 20 22 5c 22 2c 20 75 73 65  estdat) "\", use
5e10: 20 2d 72 65 72 75 6e 20 5c 22 22 20 28 74 65 73   -rerun \"" (tes
5e20: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
5e30: 74 64 61 74 29 0a 20 20 20 20 20 20 20 20 20 20  tdat).          
5e40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
5e50: 20 20 20 20 20 20 22 5c 22 20 6f 72 20 2d 66 6f        "\" or -fo
5e60: 72 63 65 20 74 6f 20 6f 76 65 72 72 69 64 65 22  rce to override"
5e70: 29 29 0a 09 20 20 20 20 20 20 20 3b 3b 20 4e 4f  ))..       ;; NO
5e80: 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 72 20 62 65  TE: No longer be
5e90: 20 63 68 65 63 6b 69 6e 67 20 70 72 65 72 65 71   checking prereq
5ea0: 75 69 73 69 74 65 73 20 68 65 72 65 21 20 57 69  uisites here! Wi
5eb0: 6c 6c 20 6e 65 76 65 72 20 67 65 74 20 68 65 72  ll never get her
5ec0: 65 20 75 6e 6c 65 73 73 20 70 72 65 72 65 71 73  e unless prereqs
5ed0: 20 61 72 65 0a 09 20 20 20 20 20 20 20 3b 3b 20   are..       ;; 
5ee0: 20 20 20 20 20 20 61 6c 72 65 61 64 79 20 6d 65        already me
5ef0: 74 2e 0a 09 20 20 20 20 20 20 20 28 69 66 20 28  t...       (if (
5f00: 6e 6f 74 20 28 6c 61 75 6e 63 68 2d 74 65 73 74  not (launch-test
5f10: 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61   db run-id runna
5f20: 6d 65 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79  me test-conf key
5f30: 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65  vallst test-name
5f40: 20 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d 64   test-path itemd
5f50: 61 74 20 66 6c 61 67 73 29 29 0a 09 09 20 20 20  at flags))...   
5f60: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28 70  (begin...     (p
5f70: 72 69 6e 74 20 22 45 52 52 4f 52 3a 20 46 61 69  rint "ERROR: Fai
5f80: 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 68  led to launch th
5f90: 65 20 74 65 73 74 2e 20 45 78 69 74 69 6e 67 20  e test. Exiting 
5fa0: 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73 69  as soon as possi
5fb0: 62 6c 65 22 29 0a 09 09 20 20 20 20 20 28 73 65  ble")...     (se
5fc0: 74 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74  t! *globalexitst
5fd0: 61 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09 20  atus* 1) ;; ... 
5fe0: 20 20 20 20 28 70 72 6f 63 65 73 73 2d 73 69 67      (process-sig
5ff0: 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 6f  nal (current-pro
6000: 63 65 73 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f  cess-id) signal/
6010: 6b 69 6c 6c 29 29 29 29 29 29 0a 09 28 28 4b 49  kill))))))..((KI
6020: 4c 4c 45 44 29 20 0a 09 20 28 64 65 62 75 67 3a  LLED) .. (debug:
6030: 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 22  print 1 "NOTE: "
6040: 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22   new-test-name "
6050: 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e   is already runn
6060: 69 6e 67 20 6f 72 20 77 61 73 20 65 78 70 6c 69  ing or was expli
6070: 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73 65  ctly killed, use
6080: 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e 63   -force to launc
6090: 68 20 69 74 2e 22 29 29 0a 09 28 28 4c 41 55 4e  h it."))..((LAUN
60a0: 43 48 45 44 20 52 45 4d 4f 54 45 48 4f 53 54 53  CHED REMOTEHOSTS
60b0: 54 41 52 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a  TART RUNNING)  .
60c0: 09 20 28 69 66 20 28 3e 20 28 2d 20 28 63 75 72  . (if (> (- (cur
60d0: 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b 20  rent-seconds)(+ 
60e0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 65 76 65  (db:test-get-eve
60f0: 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 61 74 29  nt_time testdat)
6100: 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 62 3a  .....       (db:
6110: 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75 72  test-get-run_dur
6120: 61 74 69 6f 6e 20 74 65 73 74 64 61 74 29 29 29  ation testdat)))
6130: 0a 09 09 36 30 30 29 20 3b 3b 20 69 2e 65 2e 20  ...600) ;; i.e. 
6140: 6e 6f 20 75 70 64 61 74 65 20 66 6f 72 20 6d 6f  no update for mo
6150: 72 65 20 74 68 61 6e 20 36 30 30 20 73 65 63 6f  re than 600 seco
6160: 6e 64 73 0a 09 20 20 20 20 20 28 62 65 67 69 6e  nds..     (begin
6170: 0a 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a  ..       (debug:
6180: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47  print 0 "WARNING
6190: 3a 20 54 65 73 74 20 22 20 74 65 73 74 2d 6e 61  : Test " test-na
61a0: 6d 65 20 22 20 61 70 70 65 61 72 73 20 74 6f 20  me " appears to 
61b0: 62 65 20 64 65 61 64 2e 20 46 6f 72 63 69 6e 67  be dead. Forcing
61c0: 20 69 74 20 74 6f 20 73 74 61 74 65 20 49 4e 43   it to state INC
61d0: 4f 4d 50 4c 45 54 45 20 61 6e 64 20 73 74 61 74  OMPLETE and stat
61e0: 75 73 20 53 54 55 43 4b 2f 44 45 41 44 22 29 0a  us STUCK/DEAD").
61f0: 09 20 20 20 20 20 20 20 28 74 65 73 74 2d 73 65  .       (test-se
6200: 74 2d 73 74 61 74 75 73 21 20 64 62 20 74 65 73  t-status! db tes
6210: 74 2d 69 64 20 22 49 4e 43 4f 4d 50 4c 45 54 45  t-id "INCOMPLETE
6220: 22 20 22 53 54 55 43 4b 2f 44 45 41 44 22 20 22  " "STUCK/DEAD" "
6230: 54 65 73 74 20 69 73 20 73 74 75 63 6b 20 6f 72  Test is stuck or
6240: 20 64 65 61 64 22 20 23 66 29 29 0a 09 20 20 20   dead" #f))..   
6250: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32    (debug:print 2
6260: 20 22 4e 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e   "NOTE: " test-n
6270: 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79  ame " is already
6280: 20 72 75 6e 6e 69 6e 67 22 29 29 29 0a 09 28 65   running")))..(e
6290: 6c 73 65 20 20 20 20 20 20 20 28 64 65 62 75 67  lse       (debug
62a0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
62b0: 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63   Failed to launc
62c0: 68 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73  h test " new-tes
62d0: 74 2d 6e 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f  t-name ". Unreco
62e0: 67 6e 69 73 65 64 20 73 74 61 74 65 20 22 20 28  gnised state " (
62f0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74  test:get-state t
6300: 65 73 74 64 61 74 29 29 29 29 29 29 29 0a 0a 3b  estdat)))))))..;
6310: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;===============
6320: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6330: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6340: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6350: 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f  =======.;; END O
6360: 46 20 4e 45 57 20 53 54 55 46 46 0a 3b 3b 3d 3d  F NEW STUFF.;;==
6370: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6380: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6390: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
63a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
63b0: 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 67  ====..(define (g
63c0: 65 74 2d 64 69 72 2d 75 70 2d 6e 20 64 69 72 20  et-dir-up-n dir 
63d0: 2e 20 70 61 72 61 6d 73 29 20 0a 20 20 28 6c 65  . params) .  (le
63e0: 74 20 28 28 64 70 61 72 74 73 20 20 28 73 74 72  t ((dparts  (str
63f0: 69 6e 67 2d 73 70 6c 69 74 20 64 69 72 20 22 2f  ing-split dir "/
6400: 22 29 29 0a 09 28 63 6f 75 6e 74 20 20 20 28 69  "))..(count   (i
6410: 66 20 28 6e 75 6c 6c 3f 20 70 61 72 61 6d 73 29  f (null? params)
6420: 20 31 20 28 63 61 72 20 70 61 72 61 6d 73 29 29   1 (car params))
6430: 29 29 0a 20 20 20 20 28 63 6f 6e 63 20 22 2f 22  )).    (conc "/"
6440: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70   (string-intersp
6450: 65 72 73 65 20 0a 09 20 20 20 20 20 20 20 28 74  erse ..       (t
6460: 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c  ake dparts (- (l
6470: 65 6e 67 74 68 20 64 70 61 72 74 73 29 20 63 6f  ength dparts) co
6480: 75 6e 74 29 29 0a 09 20 20 20 20 20 20 20 22 2f  unt))..       "/
6490: 22 29 29 29 29 0a 3b 3b 20 52 65 6d 6f 76 65 20  ")))).;; Remove 
64a0: 72 75 6e 73 0a 3b 3b 20 66 69 65 6c 64 73 20 61  runs.;; fields a
64b0: 72 65 20 70 61 73 73 69 6e 67 20 69 6e 20 74 68  re passing in th
64c0: 72 6f 75 67 68 20 0a 3b 3b 20 61 63 74 69 6f 6e  rough .;; action
64d0: 3a 0a 3b 3b 20 20 20 20 27 72 65 6d 6f 76 65 2d  :.;;    'remove-
64e0: 72 75 6e 73 0a 3b 3b 20 20 20 20 27 73 65 74 2d  runs.;;    'set-
64f0: 73 74 61 74 65 2d 73 74 61 74 75 73 0a 3b 3b 0a  state-status.;;.
6500: 3b 3b 20 4e 42 2f 2f 20 73 68 6f 75 6c 64 20 70  ;; NB// should p
6510: 61 73 73 20 69 6e 20 6b 65 79 73 3f 0a 3b 3b 0a  ass in keys?.;;.
6520: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 6f 70  (define (runs:op
6530: 65 72 61 74 65 2d 6f 6e 20 64 62 20 61 63 74 69  erate-on db acti
6540: 6f 6e 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 74  on runnamepatt t
6550: 65 73 74 70 61 74 74 20 69 74 65 6d 70 61 74 74  estpatt itempatt
6560: 20 23 21 6b 65 79 20 28 73 74 61 74 65 20 23 66   #!key (state #f
6570: 29 28 73 74 61 74 75 73 20 23 66 29 28 6e 65 77  )(status #f)(new
6580: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 23 66  -state-status #f
6590: 29 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79  )).  (let* ((key
65a0: 73 20 20 20 20 20 20 20 20 20 28 72 64 62 3a 67  s         (rdb:g
65b0: 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 28  et-keys db)).. (
65c0: 72 75 6e 64 61 74 20 20 20 20 20 20 20 28 72 75  rundat       (ru
65d0: 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70  ns:get-runs-by-p
65e0: 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e  att db keys runn
65f0: 61 6d 65 70 61 74 74 29 29 0a 09 20 28 68 65 61  amepatt)).. (hea
6600: 64 65 72 20 20 20 20 20 20 20 28 76 65 63 74 6f  der       (vecto
6610: 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 29  r-ref rundat 0))
6620: 0a 09 20 28 72 75 6e 73 20 20 20 20 20 20 20 20  .. (runs        
6630: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e   (vector-ref run
6640: 64 61 74 20 31 29 29 0a 09 20 28 73 74 61 74 65  dat 1)).. (state
6650: 73 20 20 20 20 20 20 20 28 69 66 20 73 74 61 74  s       (if stat
6660: 65 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74  e  (string-split
6670: 20 73 74 61 74 65 20 20 22 2c 22 29 20 27 28 29   state  ",") '()
6680: 29 29 0a 09 20 28 73 74 61 74 75 73 65 73 20 20  )).. (statuses  
6690: 20 20 20 28 69 66 20 73 74 61 74 75 73 20 28 73     (if status (s
66a0: 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 74  tring-split stat
66b0: 75 73 20 22 2c 22 29 20 27 28 29 29 29 0a 09 20  us ",") '())).. 
66c0: 28 73 74 61 74 65 2d 73 74 61 74 75 73 20 28 69  (state-status (i
66d0: 66 20 28 73 74 72 69 6e 67 3f 20 6e 65 77 2d 73  f (string? new-s
66e0: 74 61 74 65 2d 73 74 61 74 75 73 29 20 28 73 74  tate-status) (st
66f0: 72 69 6e 67 2d 73 70 6c 69 74 20 6e 65 77 2d 73  ring-split new-s
6700: 74 61 74 65 2d 73 74 61 74 75 73 20 22 2c 22 29  tate-status ",")
6710: 20 27 28 23 66 20 23 66 29 29 29 29 0a 20 20 20   '(#f #f)))).   
6720: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20   (debug:print 2 
6730: 22 48 65 61 64 65 72 3a 20 22 20 68 65 61 64 65  "Header: " heade
6740: 72 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63  r " action: " ac
6750: 74 69 6f 6e 20 22 20 6e 65 77 2d 73 74 61 74 65  tion " new-state
6760: 2d 73 74 61 74 75 73 3a 20 22 20 6e 65 77 2d 73  -status: " new-s
6770: 74 61 74 65 2d 73 74 61 74 75 73 29 0a 20 20 20  tate-status).   
6780: 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20   (for-each.     
6790: 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 20 20  (lambda (run).  
67a0: 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 6e 6b       (let ((runk
67b0: 65 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72  ey (string-inter
67c0: 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d  sperse (map (lam
67d0: 62 64 61 20 28 6b 29 0a 09 09 09 09 09 09 28 64  bda (k).......(d
67e0: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
67f0: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
6800: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 20 30   (vector-ref k 0
6810: 29 29 29 20 6b 65 79 73 29 20 22 2f 22 29 29 0a  ))) keys) "/")).
6820: 09 20 20 20 20 20 28 64 69 72 73 2d 74 6f 2d 72  .     (dirs-to-r
6830: 65 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 61 73 68  emove (make-hash
6840: 2d 74 61 62 6c 65 29 29 29 0a 09 20 28 6c 65 74  -table))).. (let
6850: 2a 20 28 28 72 75 6e 2d 69 64 20 20 20 20 28 64  * ((run-id    (d
6860: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
6870: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
6880: 20 22 69 64 22 29 29 0a 09 09 28 72 75 6e 2d 73   "id"))...(run-s
6890: 74 61 74 65 20 28 64 62 3a 67 65 74 2d 76 61 6c  tate (db:get-val
68a0: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
68b0: 20 68 65 61 64 65 72 20 22 73 74 61 74 65 22 29   header "state")
68c0: 29 0a 09 09 28 74 65 73 74 73 20 20 20 20 20 28  )...(tests     (
68d0: 69 66 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20  if (not (equal? 
68e0: 72 75 6e 2d 73 74 61 74 65 20 22 6c 6f 63 6b 65  run-state "locke
68f0: 64 22 29 29 0a 09 09 09 20 20 20 20 20 20 20 28  d"))....       (
6900: 72 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f  rdb:get-tests-fo
6910: 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74  r-run db (db:get
6920: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
6930: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22   run header "id"
6940: 29 0a 09 09 09 09 09 09 20 20 20 20 20 20 74 65  ).......      te
6950: 73 74 70 61 74 74 20 69 74 65 6d 70 61 74 74 20  stpatt itempatt 
6960: 73 74 61 74 65 73 20 73 74 61 74 75 73 65 73 0a  states statuses.
6970: 09 09 09 09 09 09 20 20 20 20 20 20 6e 6f 74 2d  ......      not-
6980: 69 6e 3a 20 20 23 66 0a 09 09 09 09 09 09 20 20  in:  #f.......  
6990: 20 20 20 20 73 6f 72 74 2d 62 79 3a 20 28 63 61      sort-by: (ca
69a0: 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 09 09 09  se action.......
69b0: 09 09 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73  .. ((remove-runs
69c0: 29 20 27 72 75 6e 64 69 72 29 0a 09 09 09 09 09  ) 'rundir)......
69d0: 09 09 09 20 28 65 6c 73 65 20 20 20 20 20 20 20  ... (else       
69e0: 20 20 20 27 65 76 65 6e 74 5f 74 69 6d 65 29 29     'event_time))
69f0: 29 0a 09 09 09 20 20 20 20 20 20 20 27 28 29 29  )....       '())
6a00: 29 0a 09 09 28 6c 61 73 74 74 70 61 74 68 20 22  )...(lasttpath "
6a10: 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f  /does/not/exist/
6a20: 49 2f 68 6f 70 65 22 29 29 0a 0a 09 20 20 20 28  I/hope"))...   (
6a30: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74  if (not (null? t
6a40: 65 73 74 73 29 29 0a 09 20 20 20 20 20 20 20 28  ests))..       (
6a50: 62 65 67 69 6e 0a 09 09 20 28 63 61 73 65 20 61  begin... (case a
6a60: 63 74 69 6f 6e 0a 09 09 20 20 20 28 28 72 65 6d  ction...   ((rem
6a70: 6f 76 65 2d 72 75 6e 73 29 0a 09 09 20 20 20 20  ove-runs)...    
6a80: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
6a90: 52 65 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 66  Removing tests f
6aa0: 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79  or run: " runkey
6ab0: 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c   " " (db:get-val
6ac0: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
6ad0: 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65   header "runname
6ae0: 22 29 29 29 0a 09 09 20 20 20 28 28 73 65 74 2d  ")))...   ((set-
6af0: 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a 09 09  state-status)...
6b00: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
6b10: 20 31 20 22 4d 6f 64 69 66 79 69 6e 67 20 73 74   1 "Modifying st
6b20: 61 74 65 20 61 6e 64 20 73 74 61 75 73 20 66 6f  ate and staus fo
6b30: 72 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a  r tests for run:
6b40: 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64   " runkey " " (d
6b50: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
6b60: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
6b70: 20 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09   "runname")))...
6b80: 20 20 20 28 65 6c 73 65 0a 09 09 20 20 20 20 28     (else...    (
6b90: 70 72 69 6e 74 20 22 49 4e 46 4f 3a 20 61 63 74  print "INFO: act
6ba0: 69 6f 6e 20 6e 6f 74 20 72 65 63 6f 67 6e 69 73  ion not recognis
6bb0: 65 64 20 22 20 61 63 74 69 6f 6e 29 29 29 0a 09  ed " action)))..
6bc0: 09 20 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 20  . (for-each...  
6bd0: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09  (lambda (test)..
6be0: 09 20 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65  .    (let* ((ite
6bf0: 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d  m-path (db:test-
6c00: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65  get-item-path te
6c10: 73 74 29 29 0a 09 09 09 20 20 20 28 74 65 73 74  st))....   (test
6c20: 2d 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67  -name (db:test-g
6c30: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74  et-testname test
6c40: 29 29 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 69  ))....   (run-di
6c50: 72 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74  r   (db:test-get
6c60: 2d 72 75 6e 64 69 72 20 74 65 73 74 29 29 29 0a  -rundir test))).
6c70: 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  ..      (debug:p
6c80: 72 69 6e 74 20 31 20 22 20 20 22 20 28 64 62 3a  rint 1 "  " (db:
6c90: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d  test-get-testnam
6ca0: 65 20 74 65 73 74 29 20 22 20 69 64 3a 20 22 20  e test) " id: " 
6cb0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
6cc0: 74 65 73 74 29 20 22 20 22 20 69 74 65 6d 2d 70  test) " " item-p
6cd0: 61 74 68 20 22 20 61 63 74 69 6f 6e 3a 20 22 20  ath " action: " 
6ce0: 61 63 74 69 6f 6e 29 0a 09 09 20 20 20 20 20 20  action)...      
6cf0: 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 09  (case action....
6d00: 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09  ((remove-runs)..
6d10: 09 09 20 28 72 64 62 3a 64 65 6c 65 74 65 2d 74  .. (rdb:delete-t
6d20: 65 73 74 2d 72 65 63 6f 72 64 73 20 64 62 20 28  est-records db (
6d30: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
6d40: 65 73 74 29 29 0a 09 09 09 20 28 64 65 62 75 67  est)).... (debug
6d50: 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20  :print 1 "INFO: 
6d60: 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 72 65  Attempting to re
6d70: 6d 6f 76 65 20 64 69 72 20 22 20 72 75 6e 2d 64  move dir " run-d
6d80: 69 72 29 0a 09 09 09 20 28 69 66 20 28 61 6e 64  ir).... (if (and
6d90: 20 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67   (> (string-leng
6da0: 74 68 20 72 75 6e 2d 64 69 72 29 20 35 29 0a 09  th run-dir) 5)..
6db0: 09 09 09 20 20 28 66 69 6c 65 2d 65 78 69 73 74  ...  (file-exist
6dc0: 73 3f 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20  s? run-dir)) ;; 
6dd0: 62 61 64 20 68 65 75 72 69 73 74 69 63 20 62 75  bad heuristic bu
6de0: 74 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e 74  t should prevent
6df0: 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e   /tmp /home etc.
6e00: 0a 09 09 09 20 20 20 20 20 28 6c 65 74 2a 20 28  ....     (let* (
6e10: 28 72 65 61 6c 70 61 74 68 20 28 72 65 73 6f 6c  (realpath (resol
6e20: 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d  ve-pathname run-
6e30: 64 69 72 29 29 29 0a 09 09 09 20 20 20 20 20 20  dir)))....      
6e40: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
6e50: 22 49 4e 46 4f 3a 20 52 65 61 6c 20 70 61 74 68  "INFO: Real path
6e60: 20 6f 66 20 69 73 20 22 20 72 65 61 6c 70 61 74   of is " realpat
6e70: 68 29 0a 09 09 09 20 20 20 20 20 20 20 28 69 66  h)....       (if
6e80: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72   (file-exists? r
6e90: 65 61 6c 70 61 74 68 29 0a 09 09 09 09 20 20 20  ealpath).....   
6ea0: 28 69 66 20 28 3e 20 28 73 79 73 74 65 6d 20 28  (if (> (system (
6eb0: 63 6f 6e 63 20 22 72 6d 20 2d 72 66 20 22 20 72  conc "rm -rf " r
6ec0: 65 61 6c 70 61 74 68 29 29 20 30 29 0a 09 09 09  ealpath)) 0)....
6ed0: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  .       (debug:p
6ee0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 54  rint 0 "ERROR: T
6ef0: 68 65 72 65 20 77 61 73 20 61 20 70 72 6f 62 6c  here was a probl
6f00: 65 6d 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 65  em removing " re
6f10: 61 6c 70 61 74 68 20 22 20 77 69 74 68 20 72 6d  alpath " with rm
6f20: 20 2d 66 22 29 29 0a 09 09 09 09 20 20 20 28 64   -f")).....   (d
6f30: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41  ebug:print 0 "WA
6f40: 52 4e 49 4e 47 3a 20 74 65 73 74 20 72 75 6e 20  RNING: test run 
6f50: 64 69 72 20 22 20 72 65 61 6c 70 61 74 68 20 22  dir " realpath "
6f60: 20 61 70 70 65 61 72 73 20 74 6f 20 6e 6f 74 20   appears to not 
6f70: 65 78 69 73 74 22 29 29 0a 09 09 09 20 20 20 20  exist"))....    
6f80: 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69     (if (file-exi
6f90: 73 74 73 3f 20 72 75 6e 2d 64 69 72 29 20 3b 3b  sts? run-dir) ;;
6fa0: 20 74 68 65 20 6c 69 6e 6b 0a 09 09 09 09 20 20   the link.....  
6fb0: 20 28 69 66 20 28 73 79 6d 62 6f 6c 69 63 2d 6c   (if (symbolic-l
6fc0: 69 6e 6b 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09  ink? run-dir)...
6fd0: 09 09 20 20 20 20 20 20 20 28 64 65 6c 65 74 65  ..       (delete
6fe0: 2d 66 69 6c 65 20 72 75 6e 2d 64 69 72 29 0a 09  -file run-dir)..
6ff0: 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28 64  ...       (if (d
7000: 69 72 65 63 74 6f 72 79 3f 20 72 75 6e 2d 64 69  irectory? run-di
7010: 72 29 0a 09 09 09 09 09 20 20 20 28 69 66 20 28  r)......   (if (
7020: 3e 20 28 64 69 72 65 63 74 6f 72 79 2d 66 6f 6c  > (directory-fol
7030: 64 20 28 6c 61 6d 62 64 61 20 28 66 20 78 29 28  d (lambda (f x)(
7040: 2b 20 31 20 78 29 29 20 30 20 72 75 6e 2d 64 69  + 1 x)) 0 run-di
7050: 72 29 20 30 29 0a 09 09 09 09 09 20 20 20 20 20  r) 0)......     
7060: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
7070: 20 22 57 41 52 4e 49 4e 47 3a 20 72 65 66 75 73   "WARNING: refus
7080: 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20  ing to remove " 
7090: 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20  run-dir " as it 
70a0: 69 73 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09  is not empty")..
70b0: 09 09 09 09 20 20 20 20 20 20 20 28 64 65 6c 65  ....       (dele
70c0: 74 65 2d 64 69 72 65 63 74 6f 72 79 20 72 75 6e  te-directory run
70d0: 2d 64 69 72 29 29 20 3b 3b 20 69 74 20 73 68 6f  -dir)) ;; it sho
70e0: 75 6c 64 20 62 65 20 65 6d 70 74 79 20 62 79 20  uld be empty by 
70f0: 68 65 72 65 20 42 55 47 20 42 55 47 2c 20 61 64  here BUG BUG, ad
7100: 64 20 65 72 72 6f 72 20 63 61 74 63 68 0a 09 09  d error catch...
7110: 09 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69  ...   (debug:pri
7120: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 72 65 66  nt 0 "ERROR: ref
7130: 75 73 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20  using to remove 
7140: 22 20 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69  " run-dir " as i
7150: 74 20 69 73 20 6e 65 69 74 68 65 72 20 61 20 73  t is neither a s
7160: 79 6d 6c 69 6e 6b 20 6e 6f 72 20 61 20 64 69 72  ymlink nor a dir
7170: 65 63 74 6f 72 79 22 29 0a 09 09 09 09 09 20 20  ectory")......  
7180: 20 29 29 29 29 0a 09 09 09 20 20 20 20 20 28 64   ))))....     (d
7190: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41  ebug:print 0 "WA
71a0: 52 4e 49 4e 47 3a 20 64 69 72 65 63 74 6f 72 79  RNING: directory
71b0: 20 61 6c 72 65 61 64 79 20 72 65 6d 6f 76 65 64   already removed
71c0: 20 22 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09   " run-dir)))...
71d0: 09 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61  .((set-state-sta
71e0: 74 75 73 29 0a 09 09 09 20 28 64 65 62 75 67 3a  tus).... (debug:
71f0: 70 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20 6e  print 2 "INFO: n
7200: 65 77 20 73 74 61 74 65 20 22 20 28 63 61 72 20  ew state " (car 
7210: 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 22 2c  state-status) ",
7220: 20 6e 65 77 20 73 74 61 74 75 73 20 22 20 28 63   new status " (c
7230: 61 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 73  adr state-status
7240: 29 29 0a 09 09 09 20 28 64 62 3a 74 65 73 74 2d  )).... (db:test-
7250: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73  set-state-status
7260: 2d 62 79 2d 69 64 20 64 62 20 28 64 62 3a 74 65  -by-id db (db:te
7270: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20  st-get-id test) 
7280: 28 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 75  (car state-statu
7290: 73 29 28 63 61 64 72 20 73 74 61 74 65 2d 73 74  s)(cadr state-st
72a0: 61 74 75 73 29 20 23 66 29 29 29 29 29 0a 09 09  atus) #f)))))...
72b0: 20 20 74 65 73 74 73 29 29 29 0a 09 20 20 20 0a    tests)))..   .
72c0: 09 20 20 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68  .   ;; remove th
72d0: 65 20 72 75 6e 20 69 66 20 7a 65 72 6f 20 74 65  e run if zero te
72e0: 73 74 73 20 72 65 6d 61 69 6e 0a 09 20 20 20 28  sts remain..   (
72f0: 69 66 20 28 65 71 3f 20 61 63 74 69 6f 6e 20 27  if (eq? action '
7300: 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 20 20  remove-runs)..  
7310: 20 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74       (let ((remt
7320: 65 73 74 73 20 28 72 64 62 3a 67 65 74 2d 74 65  ests (rdb:get-te
7330: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28  sts-for-run db (
7340: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d  db:get-value-by-
7350: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65  header run heade
7360: 72 20 22 69 64 22 29 20 23 66 20 23 66 20 27 28  r "id") #f #f '(
7370: 29 20 27 28 29 29 29 29 0a 09 09 20 28 69 66 20  ) '())))... (if 
7380: 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29  (null? remtests)
7390: 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74   ;; no more test
73a0: 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 20  s remaining...  
73b0: 20 20 20 28 6c 65 74 2a 20 28 28 64 70 61 72 74     (let* ((dpart
73c0: 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74  s  (string-split
73d0: 20 6c 61 73 74 74 70 61 74 68 20 22 2f 22 29 29   lasttpath "/"))
73e0: 0a 09 09 09 20 20 20 20 28 72 75 6e 70 61 74 68  ....    (runpath
73f0: 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69   (conc "/" (stri
7400: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a  ng-intersperse .
7410: 09 09 09 09 09 09 28 74 61 6b 65 20 64 70 61 72  ......(take dpar
7420: 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70  ts (- (length dp
7430: 61 72 74 73 29 20 31 29 29 0a 09 09 09 09 09 09  arts) 1)).......
7440: 22 2f 22 29 29 29 29 0a 09 09 20 20 20 20 20 20  "/"))))...      
7450: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
7460: 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 22  "Removing run: "
7470: 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a   runkey " " (db:
7480: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
7490: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
74a0: 72 75 6e 6e 61 6d 65 22 29 29 0a 09 09 20 20 20  runname"))...   
74b0: 20 20 20 20 28 64 62 3a 64 65 6c 65 74 65 2d 72      (db:delete-r
74c0: 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09  un db run-id)...
74d0: 20 20 20 20 20 20 20 3b 3b 20 6e 65 65 64 20 74         ;; need t
74e0: 6f 20 66 69 67 75 72 65 20 6f 75 74 20 74 68 65  o figure out the
74f0: 20 70 61 74 68 20 74 6f 20 74 68 65 20 72 75 6e   path to the run
7500: 20 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 20   dir and remove 
7510: 69 74 20 69 66 20 65 6d 70 74 79 0a 09 09 20 20  it if empty...  
7520: 20 20 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28       ;;    (if (
7530: 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e  null? (glob (con
7540: 63 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29  c runpath "/*"))
7550: 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20  )...       ;;   
7560: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20       (begin...  
7570: 20 20 20 20 20 3b 3b 20 09 20 28 64 65 62 75 67       ;; . (debug
7580: 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69  :print 1 "Removi
7590: 6e 67 20 72 75 6e 20 64 69 72 20 22 20 72 75 6e  ng run dir " run
75a0: 70 61 74 68 29 0a 09 09 20 20 20 20 20 20 20 3b  path)...       ;
75b0: 3b 20 09 20 28 73 79 73 74 65 6d 20 28 63 6f 6e  ; . (system (con
75c0: 63 20 22 72 6d 64 69 72 20 2d 70 20 22 20 72 75  c "rmdir -p " ru
75d0: 6e 70 61 74 68 29 29 29 29 0a 09 09 20 20 20 20  npath))))...    
75e0: 20 20 20 29 29 29 29 29 0a 09 20 29 29 0a 20 20     ))))).. )).  
75f0: 20 20 20 72 75 6e 73 29 29 29 0a 0a 3b 3b 3d 3d     runs)))..;;==
7600: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7620: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7630: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7640: 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73  ====.;; Routines
7650: 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e   for manipulatin
7660: 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d  g runs.;;=======
7670: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7680: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7690: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
76a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
76b0: 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 63  .;; Since many c
76c0: 61 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 65  alls to a run re
76d0: 71 75 69 72 65 20 70 72 65 74 74 79 20 6d 75 63  quire pretty muc
76e0: 68 20 74 68 65 20 73 61 6d 65 20 73 65 74 75 70  h the same setup
76f0: 20 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 70 65   .;; this wrappe
7700: 72 20 69 73 20 75 73 65 64 20 74 6f 20 72 65 64  r is used to red
7710: 75 63 65 20 74 68 65 20 72 65 70 6c 69 63 61 74  uce the replicat
7720: 69 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 66  ion of code.(def
7730: 69 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e  ine (general-run
7740: 2d 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65  -call switchname
7750: 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f   action-desc pro
7760: 63 29 0a 20 20 28 6c 65 74 20 28 28 72 75 6e 6e  c).  (let ((runn
7770: 61 6d 65 20 28 61 72 67 73 3a 67 65 74 2d 61 72  ame (args:get-ar
7780: 67 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09  g ":runname"))..
7790: 28 74 61 72 67 65 74 20 20 28 69 66 20 28 61 72  (target  (if (ar
77a0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72  gs:get-arg "-tar
77b0: 67 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72  get")...     (ar
77c0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72  gs:get-arg "-tar
77d0: 67 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72  get")...     (ar
77e0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71  gs:get-arg "-req
77f0: 74 61 72 67 22 29 29 29 0a 09 28 74 68 31 20 20  targ")))..(th1  
7800: 20 20 20 23 66 29 29 0a 20 20 20 20 28 63 6f 6e     #f)).    (con
7810: 64 0a 20 20 20 20 20 28 28 6e 6f 74 20 74 61 72  d.     ((not tar
7820: 67 65 74 29 0a 20 20 20 20 20 20 28 64 65 62 75  get).      (debu
7830: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
7840: 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72  : Missing requir
7850: 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72  ed parameter for
7860: 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c   " switchname ",
7870: 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66   you must specif
7880: 79 20 74 68 65 20 74 61 72 67 65 74 20 77 69 74  y the target wit
7890: 68 20 2d 74 61 72 67 65 74 22 29 0a 20 20 20 20  h -target").    
78a0: 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 20    (exit 3)).    
78b0: 20 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a   ((not runname).
78c0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
78d0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73  nt 0 "ERROR: Mis
78e0: 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61  sing required pa
78f0: 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77  rameter for " sw
7900: 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20  itchname ", you 
7910: 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65  must specify the
7920: 20 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a   run name with :
7930: 72 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22  runname runname"
7940: 29 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29  ).      (exit 3)
7950: 29 0a 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20  ).     (else.   
7960: 20 20 20 28 6c 65 74 20 28 28 64 62 20 20 20 23     (let ((db   #
7970: 66 29 0a 09 20 20 20 20 28 6b 65 79 73 20 23 66  f)..    (keys #f
7980: 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 65  ))..(if (not (se
7990: 74 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20  tup-for-run)).. 
79a0: 20 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 20     (begin ..    
79b0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
79c0: 20 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74 75   "Failed to setu
79d0: 70 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20 20  p, exiting")..  
79e0: 20 20 20 20 28 65 78 69 74 20 31 29 29 29 0a 09      (exit 1)))..
79f0: 28 73 65 74 21 20 64 62 20 20 20 28 6f 70 65 6e  (set! db   (open
7a00: 2d 64 62 29 29 0a 09 28 69 66 20 28 61 72 67 73  -db))..(if (args
7a10: 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65  :get-arg "-serve
7a20: 72 22 29 0a 09 20 20 20 20 28 73 65 72 76 65 72  r")..    (server
7a30: 3a 73 74 61 72 74 20 64 62 20 28 61 72 67 73 3a  :start db (args:
7a40: 67 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72  get-arg "-server
7a50: 22 29 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f  "))..    (if (no
7a60: 74 20 28 6f 72 20 28 61 72 67 73 3a 67 65 74 2d  t (or (args:get-
7a70: 61 72 67 20 22 2d 72 75 6e 61 6c 6c 22 29 0a 09  arg "-runall")..
7a80: 09 09 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72  ..  (args:get-ar
7a90: 67 20 22 2d 72 75 6e 74 65 73 74 73 22 29 29 29  g "-runtests")))
7aa0: 0a 09 09 28 73 65 72 76 65 72 3a 63 6c 69 65 6e  ...(server:clien
7ab0: 74 2d 73 65 74 75 70 20 64 62 29 29 29 0a 09 28  t-setup db)))..(
7ac0: 73 65 74 21 20 6b 65 79 73 20 28 72 64 62 3a 67  set! keys (rdb:g
7ad0: 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b  et-keys db))..;;
7ae0: 20 68 61 76 65 20 65 6e 6f 75 67 68 20 74 6f 20   have enough to 
7af0: 70 72 6f 63 65 73 73 20 2d 74 61 72 67 65 74 20  process -target 
7b00: 6f 72 20 2d 72 65 71 74 61 72 67 20 68 65 72 65  or -reqtarg here
7b10: 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d  ..(if (args:get-
7b20: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 0a  arg "-reqtarg").
7b30: 09 20 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e  .    (let* ((run
7b40: 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 20 2a  configf (conc  *
7b50: 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f  toppath* "/runco
7b60: 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 20  nfigs.config")) 
7b70: 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41  ;; DO NOT EVALUA
7b80: 54 45 20 41 4c 4c 20 0a 09 09 20 20 20 28 72 75  TE ALL ...   (ru
7b90: 6e 63 6f 6e 66 69 67 20 20 28 72 65 61 64 2d 63  nconfig  (read-c
7ba0: 6f 6e 66 69 67 20 72 75 6e 63 6f 6e 66 69 67 66  onfig runconfigf
7bb0: 20 23 66 20 23 66 20 65 6e 76 69 72 6f 6e 2d 70   #f #f environ-p
7bc0: 61 74 74 3a 20 23 66 29 29 29 20 0a 09 20 20 20  att: #f))) ..   
7bd0: 20 20 20 28 69 66 20 28 68 61 73 68 2d 74 61 62     (if (hash-tab
7be0: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 72  le-ref/default r
7bf0: 75 6e 63 6f 6e 66 69 67 20 28 61 72 67 73 3a 67  unconfig (args:g
7c00: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67  et-arg "-reqtarg
7c10: 22 29 20 23 66 29 0a 09 09 20 20 28 6b 65 79 73  ") #f)...  (keys
7c20: 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73  :target-set-args
7c30: 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d   keys (args:get-
7c40: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20  arg "-reqtarg") 
7c50: 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 0a 09  args:arg-hash)..
7c60: 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20  .  (begin...    
7c70: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
7c80: 45 52 52 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a  ERROR: [" (args:
7c90: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
7ca0: 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64  g") "] not found
7cb0: 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67 66   in " runconfigf
7cc0: 29 0a 09 09 20 20 20 20 28 73 71 6c 69 74 65 33  )...    (sqlite3
7cd0: 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09  :finalize! db)..
7ce0: 09 20 20 20 20 28 65 78 69 74 20 31 29 29 29 29  .    (exit 1))))
7cf0: 0a 09 20 20 20 20 28 69 66 20 28 61 72 67 73 3a  ..    (if (args:
7d00: 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74  get-arg "-target
7d10: 22 29 0a 09 09 28 6b 65 79 73 3a 74 61 72 67 65  ")...(keys:targe
7d20: 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20  t-set-args keys 
7d30: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
7d40: 74 61 72 67 65 74 22 20 61 72 67 73 3a 61 72 67  target" args:arg
7d50: 2d 68 61 73 68 29 20 61 72 67 73 3a 61 72 67 2d  -hash) args:arg-
7d60: 68 61 73 68 29 29 29 0a 09 28 69 66 20 28 6e 6f  hash)))..(if (no
7d70: 74 20 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e  t (car *configin
7d80: 66 6f 2a 29 29 0a 09 20 20 20 20 28 62 65 67 69  fo*))..    (begi
7d90: 6e 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a  n..      (debug:
7da0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
7db0: 41 74 74 65 6d 70 74 65 64 20 74 6f 20 22 20 61  Attempted to " a
7dc0: 63 74 69 6f 6e 2d 64 65 73 63 20 22 20 62 75 74  ction-desc " but
7dd0: 20 72 75 6e 20 61 72 65 61 20 63 6f 6e 66 69 67   run area config
7de0: 20 66 69 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 22   file not found"
7df0: 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31  )..      (exit 1
7e00: 29 29 0a 09 20 20 20 20 3b 3b 20 45 78 74 72 61  ))..    ;; Extra
7e10: 63 74 20 6f 75 74 20 73 74 75 66 66 20 6e 65 65  ct out stuff nee
7e20: 64 65 64 20 69 6e 20 6d 6f 73 74 20 6f 72 20 6d  ded in most or m
7e30: 61 6e 79 20 63 61 6c 6c 73 0a 09 20 20 20 20 3b  any calls..    ;
7e40: 3b 20 68 65 72 65 20 74 68 65 6e 20 63 61 6c 6c  ; here then call
7e50: 20 70 72 6f 63 0a 09 20 20 20 20 28 6c 65 74 2a   proc..    (let*
7e60: 20 28 28 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d   ((keynames   (m
7e70: 61 70 20 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64  ap key:get-field
7e80: 6e 61 6d 65 20 6b 65 79 73 29 29 0a 09 09 20 20  name keys))...  
7e90: 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 28 6b 65   (keyvallst  (ke
7ea0: 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73  ys->vallist keys
7eb0: 20 23 74 29 29 29 0a 09 20 20 20 20 20 20 28 70   #t)))..      (p
7ec0: 72 6f 63 20 64 62 20 74 61 72 67 65 74 20 72 75  roc db target ru
7ed0: 6e 6e 61 6d 65 20 6b 65 79 73 20 6b 65 79 6e 61  nname keys keyna
7ee0: 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74 29 29 29  mes keyvallst)))
7ef0: 0a 09 28 69 66 20 74 68 31 20 28 74 68 72 65 61  ..(if th1 (threa
7f00: 64 2d 6a 6f 69 6e 21 20 74 68 31 29 29 0a 09 28  d-join! th1))..(
7f10: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65  sqlite3:finalize
7f20: 21 20 64 62 29 0a 09 28 73 65 74 21 20 2a 64 69  ! db)..(set! *di
7f30: 64 73 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29 29  dsomething* #t))
7f40: 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d  ))))..;;========
7f50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7f60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7f70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7f80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b  ==============.;
7f90: 3b 20 4c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 72 75  ; Lock/unlock ru
7fa0: 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ns.;;===========
7fb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7fc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7fd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7fe0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65  ===========..(de
7ff0: 66 69 6e 65 20 28 72 75 6e 73 3a 68 61 6e 64 6c  fine (runs:handl
8000: 65 2d 6c 6f 63 6b 69 6e 67 20 64 62 20 74 61 72  e-locking db tar
8010: 67 65 74 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65  get keys runname
8020: 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65   lock unlock use
8030: 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 72 75 6e  r).  (let* ((run
8040: 64 61 74 20 20 20 28 72 75 6e 73 3a 67 65 74 2d  dat   (runs:get-
8050: 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20  runs-by-patt db 
8060: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 29 29 0a 09  keys runname))..
8070: 20 28 68 65 61 64 65 72 20 20 20 28 76 65 63 74   (header   (vect
8080: 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29  or-ref rundat 0)
8090: 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 28 76  ).. (runs     (v
80a0: 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74  ector-ref rundat
80b0: 20 31 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65   1))).    (for-e
80c0: 61 63 68 20 28 6c 61 6d 62 64 61 20 28 72 75 6e  ach (lambda (run
80d0: 29 0a 09 09 28 6c 65 74 20 28 28 72 75 6e 2d 69  )...(let ((run-i
80e0: 64 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  d (db:get-value-
80f0: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
8100: 61 64 65 72 20 22 69 64 22 29 29 29 0a 09 09 20  ader "id")))... 
8110: 20 28 69 66 20 28 6f 72 20 6c 6f 63 6b 0a 09 09   (if (or lock...
8120: 09 20 20 28 61 6e 64 20 75 6e 6c 6f 63 6b 0a 09  .  (and unlock..
8130: 09 09 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a  ..       (begin.
8140: 09 09 09 09 20 28 70 72 69 6e 74 20 22 44 6f 20  .... (print "Do 
8150: 79 6f 75 20 72 65 61 6c 6c 79 20 77 69 73 68 20  you really wish 
8160: 74 6f 20 75 6e 6c 6f 63 6b 20 72 75 6e 20 22 20  to unlock run " 
8170: 72 75 6e 2d 69 64 20 22 3f 5c 6e 20 20 20 79 2f  run-id "?\n   y/
8180: 6e 3a 20 22 29 0a 09 09 09 09 20 28 65 71 75 61  n: ")..... (equa
8190: 6c 3f 20 22 79 22 20 28 72 65 61 64 2d 6c 69 6e  l? "y" (read-lin
81a0: 65 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 28  e)))))...      (
81b0: 64 62 3a 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 2d 72  db:lock/unlock-r
81c0: 75 6e 20 64 62 20 72 75 6e 2d 69 64 20 6c 6f 63  un db run-id loc
81d0: 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 09  k unlock user)..
81e0: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
81f0: 69 6e 74 20 30 20 22 49 4e 46 4f 3a 20 53 6b 69  int 0 "INFO: Ski
8200: 70 70 69 6e 67 20 6c 6f 63 6b 2f 75 6e 6c 6f 63  pping lock/unloc
8210: 6b 20 6f 6e 20 22 20 72 75 6e 2d 69 64 29 29 29  k on " run-id)))
8220: 29 0a 09 20 20 20 20 20 20 72 75 6e 73 29 29 29  )..      runs)))
8230: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
8240: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8250: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8260: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8270: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c  =========.;; Rol
8280: 6c 75 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d  lup runs.;;=====
8290: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
82a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
82b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
82c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
82d0: 3d 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 68 65  =..;; Update the
82e0: 20 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65   test_meta table
82f0: 20 66 6f 72 20 74 68 69 73 20 74 65 73 74 0a 28   for this test.(
8300: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64  define (runs:upd
8310: 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62  ate-test_meta db
8320: 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d   test-name test-
8330: 63 6f 6e 66 29 0a 20 20 28 6c 65 74 20 28 28 63  conf).  (let ((c
8340: 75 72 72 72 65 63 6f 72 64 20 28 64 62 3a 74 65  urrrecord (db:te
8350: 73 74 6d 65 74 61 2d 67 65 74 2d 72 65 63 6f 72  stmeta-get-recor
8360: 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29  d db test-name))
8370: 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 63  ).    (if (not c
8380: 75 72 72 72 65 63 6f 72 64 29 0a 09 28 62 65 67  urrrecord)..(beg
8390: 69 6e 0a 09 20 20 28 73 65 74 21 20 63 75 72 72  in..  (set! curr
83a0: 72 65 63 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63  record (make-vec
83b0: 74 6f 72 20 31 30 20 23 66 29 29 0a 09 20 20 28  tor 10 #f))..  (
83c0: 64 62 3a 74 65 73 74 6d 65 74 61 2d 61 64 64 2d  db:testmeta-add-
83d0: 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e  record db test-n
83e0: 61 6d 65 29 29 29 0a 20 20 20 20 28 66 6f 72 2d  ame))).    (for-
83f0: 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62  each .     (lamb
8400: 64 61 20 28 6b 65 79 29 0a 20 20 20 20 20 20 20  da (key).       
8410: 28 6c 65 74 2a 20 28 28 69 64 78 20 28 63 61 64  (let* ((idx (cad
8420: 72 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28  r key))..      (
8430: 66 6c 64 20 28 63 61 72 20 20 6b 65 79 29 29 0a  fld (car  key)).
8440: 09 20 20 20 20 20 20 28 76 61 6c 20 28 63 6f 6e  .      (val (con
8450: 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d  fig-lookup test-
8460: 63 6f 6e 66 20 22 74 65 73 74 5f 6d 65 74 61 22  conf "test_meta"
8470: 20 66 6c 64 29 29 29 0a 09 20 3b 3b 20 28 64 65   fld))).. ;; (de
8480: 62 75 67 3a 70 72 69 6e 74 20 35 20 22 69 64 78  bug:print 5 "idx
8490: 3a 20 22 20 69 64 78 20 22 20 66 6c 64 3a 20 22  : " idx " fld: "
84a0: 20 66 6c 64 20 22 20 76 61 6c 3a 20 22 20 76 61   fld " val: " va
84b0: 6c 29 0a 09 20 28 69 66 20 28 61 6e 64 20 76 61  l).. (if (and va
84c0: 6c 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28  l (not (equal? (
84d0: 76 65 63 74 6f 72 2d 72 65 66 20 63 75 72 72 72  vector-ref currr
84e0: 65 63 6f 72 64 20 69 64 78 29 20 76 61 6c 29 29  ecord idx) val))
84f0: 29 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09  )..     (begin..
8500: 20 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 55         (print "U
8510: 70 64 61 74 69 6e 67 20 22 20 74 65 73 74 2d 6e  pdating " test-n
8520: 61 6d 65 20 22 20 22 20 66 6c 64 20 22 20 74 6f  ame " " fld " to
8530: 20 22 20 76 61 6c 29 0a 09 20 20 20 20 20 20 20   " val)..       
8540: 28 64 62 3a 74 65 73 74 6d 65 74 61 2d 75 70 64  (db:testmeta-upd
8550: 61 74 65 2d 66 69 65 6c 64 20 64 62 20 74 65 73  ate-field db tes
8560: 74 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c 29 29  t-name fld val))
8570: 29 29 29 0a 20 20 20 20 20 27 28 28 22 61 75 74  ))).     '(("aut
8580: 68 6f 72 22 20 32 29 28 22 6f 77 6e 65 72 22 20  hor" 2)("owner" 
8590: 33 29 28 22 64 65 73 63 72 69 70 74 69 6f 6e 22  3)("description"
85a0: 20 34 29 28 22 72 65 76 69 65 77 65 64 22 20 35   4)("reviewed" 5
85b0: 29 28 22 74 61 67 73 22 20 39 29 29 29 29 29 0a  )("tags" 9))))).
85c0: 0a 3b 3b 20 55 70 64 61 74 65 20 74 65 73 74 5f  .;; Update test_
85d0: 6d 65 74 61 20 66 6f 72 20 61 6c 6c 20 74 65 73  meta for all tes
85e0: 74 73 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  ts.(define (runs
85f0: 3a 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65 73 74  :update-all-test
8600: 5f 6d 65 74 61 20 64 62 29 0a 20 20 28 6c 65 74  _meta db).  (let
8610: 20 28 28 74 65 73 74 2d 6e 61 6d 65 73 20 28 67   ((test-names (g
8620: 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73  et-all-legal-tes
8630: 74 73 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65  ts))).    (for-e
8640: 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64  ach .     (lambd
8650: 61 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20  a (test-name).  
8660: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73       (let* ((tes
8670: 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20  t-path    (conc 
8680: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74  *toppath* "/test
8690: 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a  s/" test-name)).
86a0: 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e  .      (test-con
86b0: 66 69 67 66 20 28 63 6f 6e 63 20 74 65 73 74 2d  figf (conc test-
86c0: 70 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 69  path "/testconfi
86d0: 67 22 29 29 0a 09 20 20 20 20 20 20 28 74 65 73  g"))..      (tes
86e0: 74 65 78 69 73 74 73 20 20 20 28 61 6e 64 20 28  texists   (and (
86f0: 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 73  file-exists? tes
8700: 74 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d  t-configf)(file-
8710: 72 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65 73  read-access? tes
8720: 74 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 20  t-configf)))..  
8730: 20 20 20 20 3b 3b 20 72 65 61 64 20 63 6f 6e 66      ;; read conf
8740: 69 67 73 20 77 69 74 68 20 74 72 69 63 6b 73 20  igs with tricks 
8750: 74 75 72 6e 65 64 20 6f 66 66 20 28 69 2e 65 2e  turned off (i.e.
8760: 20 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20 20 20   no system)..   
8770: 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20     (test-conf   
8780: 20 28 69 66 20 74 65 73 74 65 78 69 73 74 73 20   (if testexists 
8790: 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 73  (read-config tes
87a0: 74 2d 63 6f 6e 66 69 67 66 20 23 66 20 23 66 29  t-configf #f #f)
87b0: 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65  (make-hash-table
87c0: 29 29 29 29 0a 09 20 28 72 75 6e 73 3a 75 70 64  )))).. (runs:upd
87d0: 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62  ate-test_meta db
87e0: 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d   test-name test-
87f0: 63 6f 6e 66 29 29 29 0a 20 20 20 20 20 74 65 73  conf))).     tes
8800: 74 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54  t-names)))..;; T
8810: 68 69 73 20 63 6f 75 6c 64 20 70 72 6f 62 61 62  his could probab
8820: 6c 79 20 62 65 20 72 65 66 61 63 74 6f 72 65 64  ly be refactored
8830: 20 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65   into one comple
8840: 78 20 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66  x query ....(def
8850: 69 6e 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70  ine (runs:rollup
8860: 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79  -run db keys key
8870: 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75  vallst runname u
8880: 73 65 72 29 20 3b 3b 20 77 61 73 20 74 61 72 67  ser) ;; was targ
8890: 65 74 2c 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73  et, now keyvalls
88a0: 74 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  t.  (debug:print
88b0: 20 34 20 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d   4 "runs:rollup-
88c0: 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79  run, keys: " key
88d0: 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22  s " keyvallst: "
88e0: 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 3a 72 75   keyvallst " :ru
88f0: 6e 6e 61 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20  nname " runname 
8900: 22 20 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a  " user: " user).
8910: 20 20 28 6c 65 74 2a 20 28 3b 20 28 6b 65 79 76    (let* (; (keyv
8920: 61 6c 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 79  alllst      (key
8930: 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c  s:target->keyval
8940: 20 6b 65 79 73 20 74 61 72 67 65 74 29 29 0a 09   keys target))..
8950: 20 28 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 20   (new-run-id    
8960: 20 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72    (runs:register
8970: 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79  -run db keys key
8980: 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22  vallst runname "
8990: 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29  new" "n/a" user)
89a0: 29 0a 09 20 28 70 72 65 76 2d 74 65 73 74 73 20  ).. (prev-tests 
89b0: 20 20 20 20 20 28 74 65 73 74 3a 67 65 74 2d 6d       (test:get-m
89c0: 61 74 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 73  atching-previous
89d0: 2d 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64  -test-run-record
89e0: 73 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20  s db new-run-id 
89f0: 22 25 22 20 22 25 22 29 29 0a 09 20 28 63 75 72  "%" "%")).. (cur
8a00: 72 2d 74 65 73 74 73 20 20 20 20 20 20 28 72 64  r-tests      (rd
8a10: 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d  b:get-tests-for-
8a20: 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69  run db new-run-i
8a30: 64 20 22 25 22 20 22 25 22 20 27 28 29 20 27 28  d "%" "%" '() '(
8a40: 29 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74  ))).. (curr-test
8a50: 73 2d 68 61 73 68 20 28 6d 61 6b 65 2d 68 61 73  s-hash (make-has
8a60: 68 2d 74 61 62 6c 65 29 29 29 0a 20 20 20 20 28  h-table))).    (
8a70: 64 62 3a 75 70 64 61 74 65 2d 72 75 6e 2d 65 76  db:update-run-ev
8a80: 65 6e 74 5f 74 69 6d 65 20 64 62 20 6e 65 77 2d  ent_time db new-
8a90: 72 75 6e 2d 69 64 29 0a 20 20 20 20 3b 3b 20 69  run-id).    ;; i
8aa0: 6e 64 65 78 20 74 68 65 20 61 6c 72 65 61 64 79  ndex the already
8ab0: 20 73 61 76 65 64 20 74 65 73 74 73 20 62 79 20   saved tests by 
8ac0: 74 65 73 74 6e 61 6d 65 20 61 6e 64 20 69 74 65  testname and ite
8ad0: 6d 64 61 74 20 69 6e 20 63 75 72 72 2d 74 65 73  mdat in curr-tes
8ae0: 74 73 2d 68 61 73 68 0a 20 20 20 20 28 66 6f 72  ts-hash.    (for
8af0: 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62  -each.     (lamb
8b00: 64 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 20  da (testdat).   
8b10: 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74      (let* ((test
8b20: 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67  name  (db:test-g
8b30: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74  et-testname test
8b40: 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 74  dat))..      (it
8b50: 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74  em-path (db:test
8b60: 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74  -get-item-path t
8b70: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20  estdat))..      
8b80: 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63  (full-name (conc
8b90: 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74   testname "/" it
8ba0: 65 6d 2d 70 61 74 68 29 29 29 0a 09 20 28 68 61  em-path))).. (ha
8bb0: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75  sh-table-set! cu
8bc0: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75  rr-tests-hash fu
8bd0: 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 64 61 74 29  ll-name testdat)
8be0: 29 29 0a 20 20 20 20 20 63 75 72 72 2d 74 65 73  )).     curr-tes
8bf0: 74 73 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 3a  ts).    ;; NOPE:
8c00: 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 70   Non-optimal app
8c10: 72 6f 61 63 68 2e 20 54 72 79 20 74 68 69 73 20  roach. Try this 
8c20: 69 6e 73 74 65 61 64 2e 0a 20 20 20 20 3b 3b 20  instead..    ;; 
8c30: 20 20 31 2e 20 74 65 73 74 73 20 61 72 65 20 72    1. tests are r
8c40: 65 63 65 69 76 65 64 20 69 6e 20 61 20 6c 69 73  eceived in a lis
8c50: 74 2c 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 66  t, most recent f
8c60: 69 72 73 74 0a 20 20 20 20 3b 3b 20 20 20 32 2e  irst.    ;;   2.
8c70: 20 72 65 70 6c 61 63 65 20 74 68 65 20 72 6f 6c   replace the rol
8c80: 6c 75 70 20 74 65 73 74 20 77 69 74 68 20 74 68  lup test with th
8c90: 65 20 6e 65 77 20 2a 61 6c 77 61 79 73 2a 0a 20  e new *always*. 
8ca0: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20     (for-each .  
8cb0: 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74     (lambda (test
8cc0: 64 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74  dat).       (let
8cd0: 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64  * ((testname  (d
8ce0: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e  b:test-get-testn
8cf0: 61 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 20  ame testdat)).. 
8d00: 20 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20       (item-path 
8d10: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65  (db:test-get-ite
8d20: 6d 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 29  m-path testdat))
8d30: 0a 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61  ..      (full-na
8d40: 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d  me (conc testnam
8d50: 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29  e "/" item-path)
8d60: 29 0a 09 20 20 20 20 20 20 28 70 72 65 76 2d 74  )..      (prev-t
8d70: 65 73 74 2d 64 61 74 20 28 68 61 73 68 2d 74 61  est-dat (hash-ta
8d80: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
8d90: 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20  curr-tests-hash 
8da0: 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 0a 09  full-name #f))..
8db0: 20 20 20 20 20 20 28 74 65 73 74 2d 73 74 65 70        (test-step
8dc0: 73 20 20 20 20 20 20 28 64 62 3a 67 65 74 2d 73  s      (db:get-s
8dd0: 74 65 70 73 2d 66 6f 72 2d 74 65 73 74 20 64 62  teps-for-test db
8de0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
8df0: 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 20 20   testdat)))..   
8e00: 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 72 65 63     (new-test-rec
8e10: 6f 72 64 20 23 66 29 29 0a 09 20 3b 3b 20 72 65  ord #f)).. ;; re
8e20: 70 6c 61 63 65 20 74 68 65 73 65 20 77 69 74 68  place these with
8e30: 20 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65 6c 65   insert ... sele
8e40: 63 74 0a 09 20 28 61 70 70 6c 79 20 73 71 6c 69  ct.. (apply sqli
8e50: 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 09 64  te3:execute ...d
8e60: 62 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e 53 45  b ...(conc "INSE
8e70: 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e  RT OR REPLACE IN
8e80: 54 4f 20 74 65 73 74 73 20 28 72 75 6e 5f 69 64  TO tests (run_id
8e90: 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c  ,testname,state,
8ea0: 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d  status,event_tim
8eb0: 65 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64 2c 64  e,host,cpuload,d
8ec0: 69 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c 72 75  iskfree,uname,ru
8ed0: 6e 64 69 72 2c 69 74 65 6d 5f 70 61 74 68 2c 72  ndir,item_path,r
8ee0: 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61  un_duration,fina
8ef0: 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 20  l_logf,comment) 
8f00: 22 0a 09 09 20 20 20 20 20 20 22 56 41 4c 55 45  "...      "VALUE
8f10: 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  S (?,?,?,?,?,?,?
8f20: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b  ,?,?,?,?,?,?,?);
8f30: 22 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69 64 20  ")...new-run-id 
8f40: 28 63 64 64 72 20 28 76 65 63 74 6f 72 2d 3e 6c  (cddr (vector->l
8f50: 69 73 74 20 74 65 73 74 64 61 74 29 29 29 0a 09  ist testdat)))..
8f60: 20 28 73 65 74 21 20 6e 65 77 2d 74 65 73 74 64   (set! new-testd
8f70: 61 74 20 28 63 61 72 20 28 72 64 62 3a 67 65 74  at (car (rdb:get
8f80: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64  -tests-for-run d
8f90: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 74 65 73  b new-run-id tes
8fa0: 74 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 20  tname item-path 
8fb0: 27 28 29 20 27 28 29 29 29 29 0a 09 20 28 68 61  '() '()))).. (ha
8fc0: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75  sh-table-set! cu
8fd0: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75  rr-tests-hash fu
8fe0: 6c 6c 2d 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74  ll-name new-test
8ff0: 64 61 74 29 20 3b 3b 20 74 68 69 73 20 63 6f 75  dat) ;; this cou
9000: 6c 64 20 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c  ld be confusing,
9010: 20 77 68 69 63 68 20 72 65 63 6f 72 64 20 73 68   which record sh
9020: 6f 75 6c 64 20 67 6f 20 69 6e 74 6f 20 74 68 65  ould go into the
9030: 20 6c 6f 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09   lookup table?..
9040: 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74   ;; Now duplicat
9050: 65 20 74 68 65 20 74 65 73 74 20 73 74 65 70 73  e the test steps
9060: 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .. (debug:print 
9070: 34 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72  4 "Copying recor
9080: 64 73 20 69 6e 20 74 65 73 74 5f 73 74 65 70 73  ds in test_steps
9090: 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20   from test_id=" 
90a0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
90b0: 74 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 20  testdat) " to " 
90c0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
90d0: 6e 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20  new-testdat)).. 
90e0: 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65  (sqlite3:execute
90f0: 20 0a 09 20 20 64 62 20 0a 09 20 20 28 63 6f 6e   ..  db ..  (con
9100: 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50  c "INSERT OR REP
9110: 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 73  LACE INTO test_s
9120: 74 65 70 73 20 28 74 65 73 74 5f 69 64 2c 73 74  teps (test_id,st
9130: 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61  epname,state,sta
9140: 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63  tus,event_time,c
9150: 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 22 53 45 4c  omment) "..."SEL
9160: 45 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67  ECT " (db:test-g
9170: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61  et-id new-testda
9180: 74 29 20 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74  t) ",stepname,st
9190: 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74  ate,status,event
91a0: 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52  _time,comment FR
91b0: 4f 4d 20 74 65 73 74 5f 73 74 65 70 73 20 57 48  OM test_steps WH
91c0: 45 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29  ERE test_id=?;")
91d0: 0a 09 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ..  (db:test-get
91e0: 2d 69 64 20 74 65 73 74 64 61 74 29 29 0a 09 20  -id testdat)).. 
91f0: 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65  ;; Now duplicate
9200: 20 74 68 65 20 74 65 73 74 20 64 61 74 61 0a 09   the test data..
9210: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20   (debug:print 4 
9220: 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73  "Copying records
9230: 20 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66 72   in test_data fr
9240: 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62  om test_id=" (db
9250: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
9260: 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62  tdat) " to " (db
9270: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77  :test-get-id new
9280: 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 73 71  -testdat)).. (sq
9290: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09  lite3:execute ..
92a0: 20 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 22    db ..  (conc "
92b0: 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43  INSERT OR REPLAC
92c0: 45 20 49 4e 54 4f 20 74 65 73 74 5f 64 61 74 61  E INTO test_data
92d0: 20 28 74 65 73 74 5f 69 64 2c 63 61 74 65 67 6f   (test_id,catego
92e0: 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75  ry,variable,valu
92f0: 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75  e,expected,tol,u
9300: 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a  nits,comment) ".
9310: 09 09 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a  .."SELECT " (db:
9320: 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d  test-get-id new-
9330: 74 65 73 74 64 61 74 29 20 22 2c 63 61 74 65 67  testdat) ",categ
9340: 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c  ory,variable,val
9350: 75 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c  ue,expected,tol,
9360: 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52  units,comment FR
9370: 4f 4d 20 74 65 73 74 5f 64 61 74 61 20 57 48 45  OM test_data WHE
9380: 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a  RE test_id=?;").
9390: 09 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  .  (db:test-get-
93a0: 69 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 29  id testdat)).. )
93b0: 29 0a 20 20 20 20 20 70 72 65 76 2d 74 65 73 74  ).     prev-test
93c0: 73 29 29 29 0a 09 20 0a 20 20 20 20 20 0a        s))).. .     .