Megatest

Hex Artifact Content
Login

Artifact 60fd9683ee80dda64d2e0d6e9d635a7d3fe40ac9:


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 69 66 20 63 6f 6e 66 69 67 20  tons (if config 
2370: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 6c  (string-split (l
2380: 65 74 20 28 28 77 20 28 63 6f 6e 66 69 67 2d 6c  et ((w (config-l
2390: 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 65  ookup config "re
23a0: 71 75 69 72 65 6d 65 6e 74 73 22 20 22 77 61 69  quirements" "wai
23b0: 74 6f 6e 22 29 29 29 0a 09 09 09 09 09 09 20 20  ton"))).......  
23c0: 20 20 20 28 69 66 20 77 20 77 20 22 22 29 29 29     (if w w "")))
23d0: 0a 09 09 09 20 20 20 20 20 20 28 62 65 67 69 6e  ....      (begin
23e0: 0a 09 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e  .....(debug:prin
23f0: 74 20 30 20 22 45 52 52 4f 52 3a 20 6e 6f 6e 2d  t 0 "ERROR: non-
2400: 65 78 69 73 74 65 6e 74 20 72 65 71 75 69 72 65  existent require
2410: 64 20 74 65 73 74 20 5c 22 22 20 68 65 64 20 22  d test \"" hed "
2420: 5c 22 22 29 0a 20 20 20 20 20 20 20 20 20 20 20  \"").           
2430: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2440: 20 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 69       (sqlite3:fi
2450: 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09 09 09 09  nalize! db).....
2460: 28 65 78 69 74 20 31 29 29 29 29 29 0a 09 20 20  (exit 1)))))..  
2470: 20 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68    ;; check for h
2480: 65 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e  ed in waitons =>
2490: 20 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63   this would be c
24a0: 69 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20  ircular, remove 
24b0: 69 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a  it and issue an.
24c0: 09 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20  .    ;; error.. 
24d0: 20 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20 68     (if (member h
24e0: 65 64 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62  ed waitons)...(b
24f0: 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a  egin...  (debug:
2500: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
2510: 74 65 73 74 20 22 20 68 65 64 20 22 20 68 61 73  test " hed " has
2520: 20 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20 61   listed itself a
2530: 73 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61  s a waiton, plea
2540: 73 65 20 63 6f 72 72 65 63 74 20 74 68 69 73 21  se correct this!
2550: 22 29 0a 09 09 20 20 28 73 65 74 21 20 77 61 69  ")...  (set! wai
2560: 74 6f 6e 73 20 28 66 69 6c 74 65 72 20 28 6c 61  tons (filter (la
2570: 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71  mbda (x)(not (eq
2580: 75 61 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61  ual? x hed))) wa
2590: 69 74 6f 6e 73 29 29 29 29 0a 09 20 20 20 20 0a  itons))))..    .
25a0: 09 20 20 20 20 3b 3b 20 28 69 74 65 6d 73 20 20  .    ;; (items  
25b0: 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d   (items:get-item
25c0: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f  s-from-config co
25d0: 6e 66 69 67 29 29 29 0a 09 20 20 20 20 28 69 66  nfig)))..    (if
25e0: 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c   (not (hash-tabl
25f0: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65  e-ref/default te
2600: 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 20 23  st-records hed #
2610: 66 29 29 0a 09 09 28 68 61 73 68 2d 74 61 62 6c  f))...(hash-tabl
2620: 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f  e-set! test-reco
2630: 72 64 73 0a 09 09 09 09 20 68 65 64 20 28 76 65  rds..... hed (ve
2640: 63 74 6f 72 20 68 65 64 20 20 20 20 20 3b 3b 20  ctor hed     ;; 
2650: 30 0a 09 09 09 09 09 20 20 20 20 20 63 6f 6e 66  0......     conf
2660: 69 67 20 20 3b 3b 20 31 0a 09 09 09 09 09 20 20  ig  ;; 1......  
2670: 20 20 20 77 61 69 74 6f 6e 73 20 3b 3b 20 32 0a     waitons ;; 2.
2680: 09 09 09 09 09 20 20 20 20 20 28 63 6f 6e 66 69  .....     (confi
2690: 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20  g-lookup config 
26a0: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22  "requirements" "
26b0: 70 72 69 6f 72 69 74 79 22 29 20 20 20 20 20 3b  priority")     ;
26c0: 3b 20 70 72 69 6f 72 69 74 79 20 33 0a 09 09 09  ; priority 3....
26d0: 09 09 20 20 20 20 20 28 6c 65 74 20 28 28 69 74  ..     (let ((it
26e0: 65 6d 73 20 20 20 20 20 20 28 68 61 73 68 2d 74  ems      (hash-t
26f0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
2700: 20 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 22 20   config "items" 
2710: 23 66 29 29 20 3b 3b 20 69 74 65 6d 73 20 34 0a  #f)) ;; items 4.
2720: 09 09 09 09 09 09 20 20 20 28 69 74 65 6d 73 74  ......   (itemst
2730: 61 62 6c 65 20 28 68 61 73 68 2d 74 61 62 6c 65  able (hash-table
2740: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e  -ref/default con
2750: 66 69 67 20 22 69 74 65 6d 73 74 61 62 6c 65 22  fig "itemstable"
2760: 20 23 66 29 29 29 20 0a 09 09 09 09 09 20 20 20   #f))) ......   
2770: 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72      ;; if either
2780: 20 69 74 65 6d 73 20 6f 72 20 69 74 65 6d 73 20   items or items 
2790: 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63 20  table is a proc 
27a0: 72 65 74 75 72 6e 20 69 74 20 73 6f 20 74 65 73  return it so tes
27b0: 74 20 72 75 6e 6e 69 6e 67 0a 09 09 09 09 09 20  t running...... 
27c0: 20 20 20 20 20 20 3b 3b 20 70 72 6f 63 65 73 73        ;; process
27d0: 20 63 61 6e 20 6b 6e 6f 77 20 74 6f 20 63 61 6c   can know to cal
27e0: 6c 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d  l items:get-item
27f0: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09 09  s-from-config...
2800: 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20  ...       ;; if 
2810: 65 69 74 68 65 72 20 69 73 20 61 20 6c 69 73 74  either is a list
2820: 20 61 6e 64 20 6e 6f 6e 65 20 69 73 20 61 20 70   and none is a p
2830: 72 6f 63 20 67 6f 20 61 68 65 61 64 20 61 6e 64  roc go ahead and
2840: 20 63 61 6c 6c 20 67 65 74 2d 69 74 65 6d 73 0a   call get-items.
2850: 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 6f  .....       ;; o
2860: 74 68 65 72 77 69 73 65 20 72 65 74 75 72 6e 20  therwise return 
2870: 23 66 20 2d 20 74 68 69 73 20 69 73 20 6e 6f 74  #f - this is not
2880: 20 61 6e 20 69 74 65 72 61 74 65 64 20 74 65 73   an iterated tes
2890: 74 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 63  t......       (c
28a0: 6f 6e 64 0a 09 09 09 09 09 09 28 28 70 72 6f 63  ond.......((proc
28b0: 65 64 75 72 65 3f 20 69 74 65 6d 73 29 20 20 20  edure? items)   
28c0: 20 20 20 0a 09 09 09 09 09 09 20 28 64 65 62 75     ....... (debu
28d0: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a  g:print 4 "INFO:
28e0: 20 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63   items is a proc
28f0: 65 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63  edure, will calc
2900: 20 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 20   later")....... 
2910: 69 74 65 6d 73 29 20 20 20 20 20 20 20 20 20 20  items)          
2920: 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a    ;; calc later.
2930: 09 09 09 09 09 09 28 28 70 72 6f 63 65 64 75 72  ......((procedur
2940: 65 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09  e? itemstable)..
2950: 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ..... (debug:pri
2960: 6e 74 20 34 20 22 49 4e 46 4f 3a 20 69 74 65 6d  nt 4 "INFO: item
2970: 73 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63  stable is a proc
2980: 65 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63  edure, will calc
2990: 20 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 20   later")....... 
29a0: 69 74 65 6d 73 74 61 62 6c 65 29 20 20 20 20 20  itemstable)     
29b0: 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a    ;; calc later.
29c0: 09 09 09 09 09 09 28 28 66 69 6c 74 65 72 20 28  ......((filter (
29d0: 6c 61 6d 62 64 61 20 28 78 29 0a 09 09 09 09 09  lambda (x)......
29e0: 09 09 20 20 20 28 6c 65 74 20 28 28 76 61 6c 20  ..   (let ((val 
29f0: 28 63 61 72 20 78 29 29 29 0a 09 09 09 09 09 09  (car x))).......
2a00: 09 20 20 20 20 20 28 69 66 20 28 70 72 6f 63 65  .     (if (proce
2a10: 64 75 72 65 3f 20 76 61 6c 29 20 76 61 6c 20 23  dure? val) val #
2a20: 66 29 29 29 0a 09 09 09 09 09 09 09 20 28 61 70  f)))........ (ap
2a30: 70 65 6e 64 20 28 69 66 20 28 6c 69 73 74 3f 20  pend (if (list? 
2a40: 69 74 65 6d 73 29 20 69 74 65 6d 73 20 27 28 29  items) items '()
2a50: 29 0a 09 09 09 09 09 09 09 09 20 28 69 66 20 28  )......... (if (
2a60: 6c 69 73 74 3f 20 69 74 65 6d 73 74 61 62 6c 65  list? itemstable
2a70: 29 20 69 74 65 6d 73 74 61 62 6c 65 20 27 28 29  ) itemstable '()
2a80: 29 29 29 0a 09 09 09 09 09 09 20 27 68 61 76 65  )))....... 'have
2a90: 2d 70 72 6f 63 65 64 75 72 65 29 0a 09 09 09 09  -procedure).....
2aa0: 09 09 28 28 6f 72 20 28 6c 69 73 74 3f 20 69 74  ..((or (list? it
2ab0: 65 6d 73 29 28 6c 69 73 74 3f 20 69 74 65 6d 73  ems)(list? items
2ac0: 74 61 62 6c 65 29 29 20 3b 3b 20 63 61 6c 63 20  table)) ;; calc 
2ad0: 6e 6f 77 0a 09 09 09 09 09 09 20 28 64 65 62 75  now....... (debu
2ae0: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a  g:print 4 "INFO:
2af0: 20 69 74 65 6d 73 20 61 6e 64 20 69 74 65 6d 73   items and items
2b00: 74 61 62 6c 65 20 61 72 65 20 6c 69 73 74 73 2c  table are lists,
2b10: 20 63 61 6c 63 20 6e 6f 77 5c 6e 22 0a 09 09 09   calc now\n"....
2b20: 09 09 09 09 20 20 20 20 20 20 22 20 20 20 20 69  ....      "    i
2b30: 74 65 6d 73 3a 20 22 20 69 74 65 6d 73 20 22 20  tems: " items " 
2b40: 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 20 69 74  itemstable: " it
2b50: 65 6d 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09  emstable).......
2b60: 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d   (items:get-item
2b70: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f  s-from-config co
2b80: 6e 66 69 67 29 29 0a 09 09 09 09 09 09 28 65 6c  nfig)).......(el
2b90: 73 65 20 23 66 29 29 29 20 20 20 20 20 20 20 20  se #f)))        
2ba0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2bb0: 20 20 20 3b 3b 20 6e 6f 74 20 69 74 65 72 61 74     ;; not iterat
2bc0: 65 64 0a 09 09 09 09 09 20 20 20 20 20 23 66 20  ed......     #f 
2bd0: 20 20 20 20 20 3b 3b 20 69 74 65 6d 73 64 61 74       ;; itemsdat
2be0: 20 35 0a 09 09 09 09 09 20 20 20 20 20 23 66 20   5......     #f 
2bf0: 20 20 20 20 20 3b 3b 20 73 70 61 72 65 20 2d 20       ;; spare - 
2c00: 75 73 65 64 20 66 6f 72 20 69 74 65 6d 2d 70 61  used for item-pa
2c10: 74 68 0a 09 09 09 09 09 20 20 20 20 20 29 29 29  th......     )))
2c20: 0a 09 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20  ..    (for-each 
2c30: 0a 09 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28  ..     (lambda (
2c40: 77 61 69 74 6f 6e 29 0a 09 20 20 20 20 20 20 20  waiton)..       
2c50: 28 69 66 20 28 61 6e 64 20 77 61 69 74 6f 6e 20  (if (and waiton 
2c60: 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20 77 61 69  (not (member wai
2c70: 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  ton test-names))
2c80: 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09  )...   (begin...
2c90: 20 20 20 20 20 28 73 65 74 21 20 72 65 71 75 69       (set! requi
2ca0: 72 65 64 2d 74 65 73 74 73 20 28 63 6f 6e 73 20  red-tests (cons 
2cb0: 77 61 69 74 6f 6e 20 72 65 71 75 69 72 65 64 2d  waiton required-
2cc0: 74 65 73 74 73 29 29 0a 09 09 20 20 20 20 20 28  tests))...     (
2cd0: 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20  set! test-names 
2ce0: 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 74 65 73  (cons waiton tes
2cf0: 74 2d 6e 61 6d 65 73 29 29 29 29 29 20 3b 3b 20  t-names))))) ;; 
2d00: 77 61 73 20 61 6e 20 61 70 70 65 6e 64 2c 20 6e  was an append, n
2d10: 6f 77 20 61 20 63 6f 6e 73 0a 09 20 20 20 20 20  ow a cons..     
2d20: 77 61 69 74 6f 6e 73 29 0a 09 20 20 20 20 28 6c  waitons)..    (l
2d30: 65 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 64  et ((remtests (d
2d40: 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73  elete-duplicates
2d50: 20 28 61 70 70 65 6e 64 20 77 61 69 74 6f 6e 73   (append waitons
2d60: 20 74 61 6c 29 29 29 29 0a 09 20 20 20 20 20 20   tal))))..      
2d70: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
2d80: 72 65 6d 74 65 73 74 73 29 29 0a 09 09 20 20 28  remtests))...  (
2d90: 6c 6f 6f 70 20 28 63 61 72 20 72 65 6d 74 65 73  loop (car remtes
2da0: 74 73 29 28 63 64 72 20 72 65 6d 74 65 73 74 73  ts)(cdr remtests
2db0: 29 29 29 29 29 29 29 0a 0a 20 20 20 20 28 69 66  )))))))..    (if
2dc0: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 71   (not (null? req
2dd0: 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09 28  uired-tests))..(
2de0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49  debug:print 1 "I
2df0: 4e 46 4f 3a 20 41 64 64 69 6e 67 20 22 20 72 65  NFO: Adding " re
2e00: 71 75 69 72 65 64 2d 74 65 73 74 73 20 22 20 74  quired-tests " t
2e10: 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65 22  o the run queue"
2e20: 29 29 0a 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20  )).    ;; NOTE: 
2e30: 74 68 65 73 65 20 61 72 65 20 61 6c 6c 20 70 61  these are all pa
2e40: 72 65 6e 74 20 74 65 73 74 73 2c 20 69 74 65 6d  rent tests, item
2e50: 73 20 61 72 65 20 6e 6f 74 20 65 78 70 61 6e 64  s are not expand
2e60: 65 64 20 79 65 74 2e 0a 20 20 20 20 28 72 75 6e  ed yet..    (run
2e70: 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75  s:run-tests-queu
2e80: 65 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e  e db run-id runn
2e90: 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 73  ame test-records
2ea0: 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 73   keyvallst flags
2eb0: 29 0a 20 20 20 20 28 69 66 20 2a 72 70 63 3a 6c  ).    (if *rpc:l
2ec0: 69 73 74 65 6e 65 72 2a 20 28 73 65 72 76 65 72  istener* (server
2ed0: 3a 6b 65 65 70 2d 72 75 6e 6e 69 6e 67 20 64 62  :keep-running db
2ee0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  )).    (debug:pr
2ef0: 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 41 6c 6c  int 4 "INFO: All
2f00: 20 64 6f 6e 65 20 62 79 20 68 65 72 65 22 29 29   done by here"))
2f10: 29 0a 0a 3b 3b 20 74 65 73 74 2d 72 65 63 6f 72  )..;; test-recor
2f20: 64 73 20 69 73 20 61 20 68 61 73 68 20 74 61 62  ds is a hash tab
2f30: 6c 65 20 74 65 73 74 6e 61 6d 65 3a 69 74 65 6d  le testname:item
2f40: 5f 70 61 74 68 20 3d 3e 20 76 65 63 74 6f 72 20  _path => vector 
2f50: 3c 20 74 65 73 74 6e 61 6d 65 20 74 65 73 74 63  < testname testc
2f60: 6f 6e 66 69 67 20 77 61 69 74 6f 6e 73 20 70 72  onfig waitons pr
2f70: 69 6f 72 69 74 79 20 69 74 65 6d 73 2d 69 6e 66  iority items-inf
2f80: 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66 69 6e 65 20  o ... >.(define 
2f90: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d  (runs:run-tests-
2fa0: 71 75 65 75 65 20 64 62 20 72 75 6e 2d 69 64 20  queue db run-id 
2fb0: 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63  runname test-rec
2fc0: 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66  ords keyvallst f
2fd0: 6c 61 67 73 29 0a 20 20 20 20 3b 3b 20 41 74 20  lags).    ;; At 
2fe0: 74 68 69 73 20 70 6f 69 6e 74 20 74 68 65 20 6c  this point the l
2ff0: 69 73 74 20 6f 66 20 70 61 72 65 6e 74 20 74 65  ist of parent te
3000: 73 74 73 20 69 73 20 65 78 70 61 6e 64 65 64 20  sts is expanded 
3010: 0a 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f  .    ;; NB// Sho
3020: 75 6c 64 20 65 78 70 61 6e 64 20 69 74 65 6d 73  uld expand items
3030: 20 68 65 72 65 20 61 6e 64 20 74 68 65 6e 20 69   here and then i
3040: 6e 73 65 72 74 20 69 6e 74 6f 20 74 68 65 20 72  nsert into the r
3050: 75 6e 20 71 75 65 75 65 2e 0a 20 20 28 64 65 62  un queue..  (deb
3060: 75 67 3a 70 72 69 6e 74 20 35 20 22 74 65 73 74  ug:print 5 "test
3070: 2d 72 65 63 6f 72 64 73 3a 20 22 20 74 65 73 74  -records: " test
3080: 2d 72 65 63 6f 72 64 73 20 22 2c 20 6b 65 79 76  -records ", keyv
3090: 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c  allst: " keyvall
30a0: 73 74 20 22 20 66 6c 61 67 73 3a 20 22 20 28 68  st " flags: " (h
30b0: 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74  ash-table->alist
30c0: 20 66 6c 61 67 73 29 29 0a 20 20 28 6c 65 74 20   flags)).  (let 
30d0: 28 28 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61  ((sorted-test-na
30e0: 6d 65 73 20 28 74 65 73 74 73 3a 73 6f 72 74 2d  mes (tests:sort-
30f0: 62 79 2d 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d  by-priority-and-
3100: 77 61 69 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f  waiton test-reco
3110: 72 64 73 29 29 0a 09 28 69 74 65 6d 2d 70 61 74  rds))..(item-pat
3120: 74 73 20 20 20 20 20 20 20 20 28 68 61 73 68 2d  ts        (hash-
3130: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
3140: 74 20 66 6c 61 67 73 20 22 2d 69 74 65 6d 70 61  t flags "-itempa
3150: 74 74 22 20 23 66 29 29 29 0a 20 20 20 20 28 69  tt" #f))).    (i
3160: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f  f (not (null? so
3170: 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29  rted-test-names)
3180: 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68  )..(let loop ((h
3190: 65 64 20 20 20 20 20 20 20 20 20 28 63 61 72 20  ed         (car 
31a0: 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65  sorted-test-name
31b0: 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 20 20  s))...   (tal   
31c0: 20 20 20 20 20 20 28 63 64 72 20 73 6f 72 74 65        (cdr sorte
31d0: 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a  d-test-names))).
31e0: 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70  .  (thread-sleep
31f0: 21 20 30 2e 31 29 20 3b 3b 20 67 69 76 65 20 6f  ! 0.1) ;; give o
3200: 74 68 65 72 20 61 70 70 6c 69 63 61 74 69 6f 6e  ther application
3210: 73 20 73 6f 6d 65 20 74 69 6d 65 20 77 69 74 68  s some time with
3220: 20 74 68 65 20 64 62 0a 09 20 20 28 6c 65 74 2a   the db..  (let*
3230: 20 28 28 74 65 73 74 2d 72 65 63 6f 72 64 20 28   ((test-record (
3240: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 74  hash-table-ref t
3250: 65 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 29  est-records hed)
3260: 29 0a 09 09 20 28 74 63 6f 6e 66 69 67 20 20 20  )... (tconfig   
3270: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
3280: 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69  ue-get-testconfi
3290: 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a  g test-record)).
32a0: 09 09 20 28 74 65 73 74 6d 6f 64 65 20 20 20 20  .. (testmode    
32b0: 28 6c 65 74 20 28 28 6d 20 28 63 6f 6e 66 69 67  (let ((m (config
32c0: 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20  -lookup tconfig 
32d0: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22  "requirements" "
32e0: 6d 6f 64 65 22 29 29 29 0a 09 09 09 09 28 69 66  mode"))).....(if
32f0: 20 6d 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62   m (string->symb
3300: 6f 6c 20 6d 29 20 27 6e 6f 72 6d 61 6c 29 29 29  ol m) 'normal)))
3310: 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 20 20 20  ... (waitons    
3320: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
3330: 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20  e-get-waitons   
3340: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
3350: 09 20 28 70 72 69 6f 72 69 74 79 20 20 20 20 28  . (priority    (
3360: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
3370: 67 65 74 2d 70 72 69 6f 72 69 74 79 20 20 20 74  get-priority   t
3380: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20  est-record))... 
3390: 28 69 74 65 6d 64 61 74 20 20 20 20 20 28 74 65  (itemdat     (te
33a0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
33b0: 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 73  t-itemdat    tes
33c0: 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20 69 74  t-record)) ;; it
33d0: 65 6d 64 61 74 20 63 61 6e 20 62 65 20 61 20 73  emdat can be a s
33e0: 74 72 69 6e 67 2c 20 6c 69 73 74 20 6f 72 20 23  tring, list or #
33f0: 66 0a 09 09 20 28 69 74 65 6d 73 20 20 20 20 20  f... (items     
3400: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
3410: 75 65 2d 67 65 74 2d 69 74 65 6d 73 20 20 20 20  ue-get-items    
3420: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a    test-record)).
3430: 09 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20  .. (item-path   
3440: 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68  (item-list->path
3450: 20 69 74 65 6d 64 61 74 29 29 0a 09 09 20 28 6e   itemdat))... (n
3460: 65 77 74 61 6c 20 20 20 20 20 20 28 61 70 70 65  ewtal      (appe
3470: 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64  nd tal (list hed
3480: 29 29 29 0a 09 09 20 28 63 61 6c 63 2d 66 61 69  )))... (calc-fai
3490: 6c 73 20 20 28 6c 61 6d 62 64 61 20 28 70 72 65  ls  (lambda (pre
34a0: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09  reqs-not-met)...
34b0: 09 09 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64  ..(filter (lambd
34c0: 61 20 28 74 65 73 74 29 0a 09 09 09 09 09 20 20  a (test)......  
34d0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 39 20 22  (debug:print 9 "
34e0: 74 65 73 74 3a 20 22 20 74 65 73 74 29 0a 09 09  test: " test)...
34f0: 09 09 09 20 20 28 61 6e 64 20 28 76 65 63 74 6f  ...  (and (vecto
3500: 72 3f 20 74 65 73 74 29 20 3b 3b 20 6e 6f 74 20  r? test) ;; not 
3510: 28 73 74 72 69 6e 67 3f 20 74 65 73 74 29 29 0a  (string? test)).
3520: 09 09 09 09 09 20 20 20 20 20 20 20 28 65 71 75  .....       (equ
3530: 61 6c 3f 20 28 64 62 3a 74 65 73 74 2d 67 65 74  al? (db:test-get
3540: 2d 73 74 61 74 65 20 74 65 73 74 29 20 22 43 4f  -state test) "CO
3550: 4d 50 4c 45 54 45 44 22 29 0a 09 09 09 09 09 20  MPLETED")...... 
3560: 20 20 20 20 20 20 28 6e 6f 74 20 28 6d 65 6d 62        (not (memb
3570: 65 72 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  er (db:test-get-
3580: 73 74 61 74 75 73 20 74 65 73 74 29 0a 09 09 09  status test)....
3590: 09 09 09 09 20 20 20 20 27 28 22 50 41 53 53 22  ....    '("PASS"
35a0: 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 20   "WARN" "CHECK" 
35b0: 22 57 41 49 56 45 44 22 29 29 29 29 29 0a 09 09  "WAIVED")))))...
35c0: 09 09 09 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  ...prereqs-not-m
35d0: 65 74 29 29 29 0a 09 09 20 28 63 61 6c 63 2d 6e  et)))... (calc-n
35e0: 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 28 6c 61  ot-completed (la
35f0: 6d 62 64 61 20 28 70 72 65 72 65 71 73 2d 6e 6f  mbda (prereqs-no
3600: 74 2d 6d 65 74 29 0a 09 09 09 09 20 20 20 20 20  t-met).....     
3610: 20 20 28 66 69 6c 74 65 72 0a 09 09 09 09 09 28    (filter......(
3620: 6c 61 6d 62 64 61 20 28 74 29 0a 09 09 09 09 09  lambda (t)......
3630: 20 20 28 6f 72 20 28 6e 6f 74 20 28 76 65 63 74    (or (not (vect
3640: 6f 72 3f 20 74 29 29 0a 09 09 09 09 09 20 20 20  or? t))......   
3650: 20 20 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20     (not (equal? 
3660: 22 43 4f 4d 50 4c 45 54 45 44 22 20 28 64 62 3a  "COMPLETED" (db:
3670: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74  test-get-state t
3680: 29 29 29 29 29 0a 09 09 09 09 09 70 72 65 72 65  )))))......prere
3690: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09  qs-not-met)))...
36a0: 20 28 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20   (pretty-string 
36b0: 28 6c 61 6d 62 64 61 20 28 6c 73 74 29 0a 09 09  (lambda (lst)...
36c0: 09 09 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61  ..  (map (lambda
36d0: 20 28 74 29 0a 09 09 09 09 09 20 28 69 66 20 28   (t)...... (if (
36e0: 6e 6f 74 20 28 76 65 63 74 6f 72 3f 20 74 29 29  not (vector? t))
36f0: 0a 09 09 09 09 09 20 20 20 20 20 28 63 6f 6e 63  ......     (conc
3700: 20 74 29 0a 09 09 09 09 09 20 20 20 20 20 28 63   t)......     (c
3710: 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74  onc (db:test-get
3720: 2d 74 65 73 74 6e 61 6d 65 20 74 29 20 22 3a 22  -testname t) ":"
3730: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74   (db:test-get-st
3740: 61 74 65 20 74 29 20 22 2f 22 20 28 64 62 3a 74  ate t) "/" (db:t
3750: 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74  est-get-status t
3760: 29 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 20  )))).....       
3770: 6c 73 74 29 29 29 29 0a 09 20 20 20 20 28 64 65  lst))))..    (de
3780: 62 75 67 3a 70 72 69 6e 74 20 36 0a 09 09 09 20  bug:print 6.... 
3790: 22 69 74 65 6d 64 61 74 3a 20 20 20 20 20 22 20  "itemdat:     " 
37a0: 69 74 65 6d 64 61 74 0a 09 09 09 20 22 5c 6e 20  itemdat.... "\n 
37b0: 20 69 74 65 6d 73 3a 20 20 20 20 20 22 20 69 74   items:     " it
37c0: 65 6d 73 0a 09 09 09 20 22 5c 6e 20 20 69 74 65  ems.... "\n  ite
37d0: 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 6d 2d 70  m-path: " item-p
37e0: 61 74 68 0a 09 09 09 20 22 5c 6e 20 20 77 61 69  ath.... "\n  wai
37f0: 74 6f 6e 73 3a 20 20 20 22 20 77 61 69 74 6f 6e  tons:   " waiton
3800: 73 29 0a 0a 09 20 20 20 20 3b 3b 20 63 68 65 63  s)...    ;; chec
3810: 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 77 61 69  k for hed in wai
3820: 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77 6f 75  tons => this wou
3830: 6c 64 20 62 65 20 63 69 72 63 75 6c 61 72 2c 20  ld be circular, 
3840: 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 20 69 73  remove it and is
3850: 73 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b 20 65  sue an..    ;; e
3860: 72 72 6f 72 0a 09 20 20 20 20 28 69 66 20 28 6d  rror..    (if (m
3870: 65 6d 62 65 72 20 68 65 64 20 77 61 69 74 6f 6e  ember hed waiton
3880: 73 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20  s)...(begin...  
3890: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
38a0: 45 52 52 4f 52 3a 20 74 65 73 74 20 22 20 68 65  ERROR: test " he
38b0: 64 20 22 20 68 61 73 20 6c 69 73 74 65 64 20 69  d " has listed i
38c0: 74 73 65 6c 66 20 61 73 20 61 20 77 61 69 74 6f  tself as a waito
38d0: 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72 65 63  n, please correc
38e0: 74 20 74 68 69 73 21 22 29 0a 09 09 20 20 28 73  t this!")...  (s
38f0: 65 74 21 20 77 61 69 74 6f 6e 20 28 66 69 6c 74  et! waiton (filt
3900: 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e  er (lambda (x)(n
3910: 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 68 65 64  ot (equal? x hed
3920: 29 29 29 20 77 61 69 74 6f 6e 73 29 29 29 29 0a  ))) waitons)))).
3930: 0a 09 20 20 20 20 28 63 6f 6e 64 0a 09 20 20 20  ..    (cond..   
3940: 20 20 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b    ((not items) ;
3950: 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 74 68 65  ; when false the
3960: 20 74 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 62   test is ok to b
3970: 65 20 68 61 6e 64 65 64 20 6f 66 66 20 74 6f 20  e handed off to 
3980: 6c 61 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 20  launch (but not 
3990: 62 65 66 6f 72 65 29 0a 09 20 20 20 20 20 20 28  before)..      (
39a0: 6c 65 74 2a 20 28 28 68 61 76 65 2d 72 65 73 6f  let* ((have-reso
39b0: 75 72 63 65 73 20 20 28 72 75 6e 73 3a 63 61 6e  urces  (runs:can
39c0: 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20  -run-more-tests 
39d0: 64 62 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29  db test-record))
39e0: 20 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20   ;; look at the 
39f0: 74 65 73 74 20 6a 6f 62 67 72 6f 75 70 20 61 6e  test jobgroup an
3a00: 64 20 74 6f 74 20 6a 6f 62 73 20 72 75 6e 6e 69  d tot jobs runni
3a10: 6e 67 0a 09 09 20 20 20 20 20 28 70 72 65 72 65  ng...     (prere
3a20: 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 64 62 3a 67  qs-not-met (db:g
3a30: 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  et-prereqs-not-m
3a40: 65 74 20 64 62 20 72 75 6e 2d 69 64 20 77 61 69  et db run-id wai
3a50: 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d  tons item-path m
3a60: 6f 64 65 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a  ode: testmode)).
3a70: 09 09 20 20 20 20 20 28 66 61 69 6c 73 20 20 20  ..     (fails   
3a80: 20 20 20 20 20 20 20 20 28 63 61 6c 63 2d 66 61          (calc-fa
3a90: 69 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ils prereqs-not-
3aa0: 6d 65 74 29 29 0a 09 09 20 20 20 20 20 28 6e 6f  met))...     (no
3ab0: 6e 2d 63 6f 6d 70 6c 65 74 65 64 20 20 20 28 63  n-completed   (c
3ac0: 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65  alc-not-complete
3ad0: 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  d prereqs-not-me
3ae0: 74 29 29 29 0a 09 09 28 64 65 62 75 67 3a 70 72  t)))...(debug:pr
3af0: 69 6e 74 20 38 20 22 49 4e 46 4f 3a 20 68 61 76  int 8 "INFO: hav
3b00: 65 2d 72 65 73 6f 75 72 63 65 73 3a 20 22 20 68  e-resources: " h
3b10: 61 76 65 2d 72 65 73 6f 75 72 63 65 73 20 22 20  ave-resources " 
3b20: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a  prereqs-not-met:
3b30: 20 22 20 0a 09 09 09 20 20 20 20 20 28 73 74 72   " ....     (str
3b40: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20  ing-intersperse 
3b50: 0a 09 09 09 20 20 20 20 20 20 28 6d 61 70 20 28  ....      (map (
3b60: 6c 61 6d 62 64 61 20 28 74 29 0a 09 09 09 09 20  lambda (t)..... 
3b70: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 76 65      (if (not (ve
3b80: 63 74 6f 72 3f 20 74 29 29 0a 09 09 09 09 09 20  ctor? t))...... 
3b90: 28 63 6f 6e 63 20 22 20 57 41 52 4e 49 4e 47 3a  (conc " WARNING:
3ba0: 20 74 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74   t is not a vect
3bb0: 6f 72 3d 22 20 74 20 29 0a 09 09 09 09 09 20 28  or=" t )...... (
3bc0: 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65  conc (db:test-ge
3bd0: 74 2d 73 74 61 74 65 20 74 29 20 22 2f 22 20 28  t-state t) "/" (
3be0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74  db:test-get-stat
3bf0: 75 73 20 74 29 29 29 29 0a 09 09 09 09 20 20 20  us t)))).....   
3c00: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
3c10: 20 22 2c 20 22 29 20 22 20 66 61 69 6c 73 3a 20   ", ") " fails: 
3c20: 22 20 66 61 69 6c 73 29 0a 09 09 3b 3b 20 44 6f  " fails)...;; Do
3c30: 6e 27 74 20 6b 6e 6f 77 20 61 74 20 74 68 69 73  n't know at this
3c40: 20 74 69 6d 65 20 69 66 20 74 68 65 20 74 65 73   time if the tes
3c50: 74 20 68 61 76 65 20 62 65 65 6e 20 6c 61 75 6e  t have been laun
3c60: 63 68 65 64 20 61 74 20 73 6f 6d 65 20 74 69 6d  ched at some tim
3c70: 65 20 69 6e 20 74 68 65 20 70 61 73 74 0a 09 09  e in the past...
3c80: 3b 3b 20 69 2e 65 2e 20 69 73 20 74 68 69 73 20  ;; i.e. is this 
3c90: 61 20 72 65 2d 6c 61 75 6e 63 68 3f 0a 09 09 28  a re-launch?...(
3ca0: 63 6f 6e 64 0a 09 09 20 28 28 61 6e 64 20 68 61  cond... ((and ha
3cb0: 76 65 2d 72 65 73 6f 75 72 63 65 73 0a 09 09 20  ve-resources... 
3cc0: 20 20 20 20 20 20 28 6f 72 20 28 6e 75 6c 6c 3f        (or (null?
3cd0: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
3ce0: 29 0a 09 09 09 20 20 20 28 61 6e 64 20 28 65 71  )....   (and (eq
3cf0: 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c  ? testmode 'topl
3d00: 65 76 65 6c 29 0a 09 09 09 09 28 6e 75 6c 6c 3f  evel).....(null?
3d10: 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29   non-completed))
3d20: 29 29 0a 09 09 20 20 3b 3b 20 6e 6f 20 6c 6f 6f  ))...  ;; no loo
3d30: 70 20 68 65 72 65 2c 20 6a 75 73 74 20 64 72 6f  p here, just dro
3d40: 70 20 74 68 6f 75 67 68 20 61 6e 64 20 75 73 65  p though and use
3d50: 20 74 68 65 20 6c 6f 6f 70 20 61 74 20 74 68 65   the loop at the
3d60: 20 62 6f 74 74 6f 6d 20 0a 09 09 20 20 28 69 66   bottom ...  (if
3d70: 20 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63   (patt-list-matc
3d80: 68 20 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d  h item-path item
3d90: 2d 70 61 74 74 73 29 0a 09 09 20 20 20 20 20 20  -patts)...      
3da0: 28 72 75 6e 3a 74 65 73 74 20 64 62 20 72 75 6e  (run:test db run
3db0: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76  -id runname keyv
3dc0: 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72  allst test-recor
3dd0: 64 20 66 6c 61 67 73 20 23 66 29 0a 09 09 20 20  d flags #f)...  
3de0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
3df0: 20 31 20 22 49 4e 46 4f 3a 20 53 6b 69 70 70 69   1 "INFO: Skippi
3e00: 6e 67 20 22 20 28 74 65 73 74 73 3a 74 65 73 74  ng " (tests:test
3e10: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61  queue-get-testna
3e20: 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20  me test-record) 
3e30: 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20  " " item-path " 
3e40: 61 73 20 69 74 20 64 6f 65 73 6e 27 74 20 6d 61  as it doesn't ma
3e50: 74 63 68 20 22 20 69 74 65 6d 2d 70 61 74 74 73  tch " item-patts
3e60: 29 29 0a 09 09 20 20 3b 3b 20 65 6c 73 65 20 74  ))...  ;; else t
3e70: 68 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b 2c  he run is stuck,
3e80: 20 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20   temporarily or 
3e90: 70 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 20 20  permanently...  
3ea0: 3b 3b 20 62 75 74 20 73 68 6f 75 6c 64 20 63 68  ;; but should ch
3eb0: 65 63 6b 20 69 66 20 69 74 20 69 73 20 64 75 65  eck if it is due
3ec0: 20 74 6f 20 6c 61 63 6b 20 6f 66 20 72 65 73 6f   to lack of reso
3ed0: 75 72 63 65 73 20 76 73 2e 20 70 72 65 72 65 71  urces vs. prereq
3ee0: 75 69 73 69 74 65 73 0a 09 09 20 20 29 0a 09 09  uisites...  )...
3ef0: 20 28 28 6e 6f 74 20 68 61 76 65 2d 72 65 73 6f   ((not have-reso
3f00: 75 72 63 65 73 29 20 3b 3b 20 73 69 6d 70 6c 79  urces) ;; simply
3f10: 20 74 72 79 20 61 67 61 69 6e 20 61 66 74 65 72   try again after
3f20: 20 77 61 69 74 69 6e 67 20 61 20 73 65 63 6f 6e   waiting a secon
3f30: 64 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c  d...  (thread-sl
3f40: 65 65 70 21 20 31 2e 30 29 0a 09 09 20 20 28 64  eep! 1.0)...  (d
3f50: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e  ebug:print 1 "IN
3f60: 46 4f 3a 20 6e 6f 20 72 65 73 6f 75 72 63 65 73  FO: no resources
3f70: 20 74 6f 20 72 75 6e 20 6e 65 77 20 74 65 73 74   to run new test
3f80: 73 2c 20 77 61 69 74 69 6e 67 20 2e 2e 2e 22 29  s, waiting ...")
3f90: 0a 09 09 20 20 3b 3b 20 63 6f 75 6c 64 20 68 61  ...  ;; could ha
3fa0: 76 65 20 64 6f 6e 65 20 68 65 64 20 74 61 6c 20  ve done hed tal 
3fb0: 68 65 72 65 20 62 75 74 20 64 6f 69 6e 67 20 63  here but doing c
3fc0: 61 72 2f 63 64 72 20 6f 66 20 6e 65 77 74 61 6c  ar/cdr of newtal
3fd0: 20 74 6f 20 72 6f 74 61 74 65 20 74 65 73 74 73   to rotate tests
3fe0: 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20  ...  (loop (car 
3ff0: 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74  newtal)(cdr newt
4000: 61 6c 29 29 29 0a 09 09 20 28 65 6c 73 65 20 3b  al)))... (else ;
4010: 3b 20 6d 75 73 74 20 62 65 20 77 65 20 68 61 76  ; must be we hav
4020: 65 20 75 6e 6d 65 74 20 70 72 65 72 65 71 75 69  e unmet prerequi
4030: 73 69 74 65 73 0a 09 09 20 20 20 20 28 64 65 62  sites...    (deb
4040: 75 67 3a 70 72 69 6e 74 20 34 20 22 46 41 49 4c  ug:print 4 "FAIL
4050: 53 3a 20 22 20 66 61 69 6c 73 29 0a 09 09 20 20  S: " fails)...  
4060: 20 20 3b 3b 20 49 66 20 6f 6e 65 20 6f 72 20 6d    ;; If one or m
4070: 6f 72 65 20 6f 66 20 74 68 65 20 70 72 65 72 65  ore of the prere
4080: 71 73 2d 6e 6f 74 2d 6d 65 74 20 61 72 65 20 46  qs-not-met are F
4090: 41 49 4c 20 74 68 65 6e 20 77 65 20 63 61 6e 20  AIL then we can 
40a0: 69 73 73 75 65 0a 09 09 20 20 20 20 3b 3b 20 61  issue...    ;; a
40b0: 20 6d 65 73 73 61 67 65 20 61 6e 64 20 64 72 6f   message and dro
40c0: 70 20 68 65 64 20 66 72 6f 6d 20 74 68 65 20 69  p hed from the i
40d0: 74 65 6d 73 20 74 6f 20 62 65 20 70 72 6f 63 65  tems to be proce
40e0: 73 73 65 64 2e 0a 09 09 20 20 20 20 28 69 66 20  ssed....    (if 
40f0: 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 09  (null? fails)...
4100: 09 28 62 65 67 69 6e 0a 09 09 09 20 20 3b 3b 20  .(begin....  ;; 
4110: 63 6f 75 6c 64 6e 27 74 20 72 75 6e 2c 20 74 61  couldn't run, ta
4120: 6b 65 20 61 20 62 72 65 61 74 68 65 72 0a 09 09  ke a breather...
4130: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
4140: 34 20 22 49 4e 46 4f 3a 20 53 68 6f 75 6c 64 6e  4 "INFO: Shouldn
4150: 27 74 20 72 65 61 6c 6c 79 20 67 65 74 20 68 65  't really get he
4160: 72 65 2c 20 72 61 63 65 20 63 6f 6e 64 69 74 69  re, race conditi
4170: 6f 6e 3f 20 55 6e 61 62 6c 65 20 74 6f 20 6c 61  on? Unable to la
4180: 75 6e 63 68 20 6d 6f 72 65 20 74 65 73 74 73 20  unch more tests 
4190: 61 74 20 74 68 69 73 20 6d 6f 6d 65 6e 74 2c 20  at this moment, 
41a0: 6b 69 6c 6c 69 6e 67 20 74 69 6d 65 20 2e 2e 2e  killing time ...
41b0: 22 29 0a 09 09 09 20 20 28 74 68 72 65 61 64 2d  ")....  (thread-
41c0: 73 6c 65 65 70 21 20 30 2e 31 29 20 3b 3b 20 6c  sleep! 0.1) ;; l
41d0: 6f 6e 67 20 73 6c 65 65 70 20 68 65 72 65 20 2d  ong sleep here -
41e0: 20 6e 6f 20 72 65 73 6f 75 72 63 65 73 2c 20 6d   no resources, m
41f0: 61 79 20 61 73 20 77 65 6c 6c 20 62 65 20 70 61  ay as well be pa
4200: 74 69 65 6e 74 0a 09 09 09 20 20 3b 3b 20 77 65  tient....  ;; we
4210: 20 6d 61 64 65 20 6e 65 77 20 74 61 6c 20 62 79   made new tal by
4220: 20 73 74 69 63 6b 69 6e 67 20 68 65 64 20 61 74   sticking hed at
4230: 20 74 68 65 20 62 61 63 6b 20 6f 66 20 74 68 65   the back of the
4240: 20 6c 69 73 74 0a 09 09 09 20 20 28 6c 6f 6f 70   list....  (loop
4250: 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64   (car newtal)(cd
4260: 72 20 6e 65 77 74 61 6c 29 29 29 0a 09 09 09 3b  r newtal)))....;
4270: 3b 20 74 68 65 20 77 61 69 74 6f 6e 20 69 73 20  ; the waiton is 
4280: 46 41 49 4c 20 73 6f 20 6e 6f 20 70 6f 69 6e 74  FAIL so no point
4290: 20 69 6e 20 74 72 79 69 6e 67 20 74 6f 20 72 75   in trying to ru
42a0: 6e 20 68 65 64 20 65 76 65 72 20 61 67 61 69 6e  n hed ever again
42b0: 0a 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75  ....(if (not (nu
42c0: 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20  ll? tal))....   
42d0: 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 20   (begin....     
42e0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
42f0: 22 57 41 52 4e 3a 20 44 72 6f 70 70 69 6e 67 20  "WARN: Dropping 
4300: 74 65 73 74 20 22 20 28 64 62 3a 74 65 73 74 2d  test " (db:test-
4310: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 68 65 64  get-testname hed
4320: 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67  ) "/" (db:test-g
4330: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 68 65 64  et-item-path hed
4340: 29 0a 09 09 09 09 09 20 20 20 22 20 66 72 6f 6d  )......   " from
4350: 20 74 68 65 20 6c 61 75 6e 63 68 20 6c 69 73 74   the launch list
4360: 20 61 73 20 69 74 20 68 61 73 20 70 72 65 72 65   as it has prere
4370: 71 75 69 73 74 65 73 20 74 68 61 74 20 61 72 65  quistes that are
4380: 20 46 41 49 4c 22 29 0a 09 09 09 20 20 20 20 20   FAIL")....     
4390: 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29   (loop (car tal)
43a0: 28 63 64 72 20 74 61 6c 29 29 29 29 29 29 29 29  (cdr tal))))))))
43b0: 29 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20 3b  )..     ..     ;
43c0: 3b 20 63 61 73 65 20 77 68 65 72 65 20 61 6e 20  ; case where an 
43d0: 69 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 73  items came in as
43e0: 20 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72 6f   a list been pro
43f0: 63 65 73 73 65 64 0a 09 20 20 20 20 20 28 28 61  cessed..     ((a
4400: 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29  nd (list? items)
4410: 20 20 20 20 20 3b 3b 20 74 68 75 73 20 77 65 20       ;; thus we 
4420: 6b 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 20 61  know our items a
4430: 72 65 20 61 6c 72 65 61 64 79 20 63 61 6c 63 75  re already calcu
4440: 6c 61 74 65 64 0a 09 09 20 20 20 28 6e 6f 74 20  lated...   (not 
4450: 20 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 61    itemdat)) ;; a
4460: 6e 64 20 6e 6f 74 20 79 65 74 20 65 78 70 61 6e  nd not yet expan
4470: 64 65 64 20 69 6e 74 6f 20 74 68 65 20 6c 69 73  ded into the lis
4480: 74 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 62  t of things to b
4490: 65 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 28 69  e done..      (i
44a0: 66 20 28 61 6e 64 20 28 3e 3d 20 2a 76 65 72 62  f (and (>= *verb
44b0: 6f 73 69 74 79 2a 20 31 29 0a 09 09 20 20 20 20  osity* 1)...    
44c0: 20 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 74     (> (length it
44d0: 65 6d 73 29 20 30 29 0a 09 09 20 20 20 20 20 20  ems) 0)...      
44e0: 20 28 3e 20 28 6c 65 6e 67 74 68 20 28 63 61 72   (> (length (car
44f0: 20 69 74 65 6d 73 29 29 20 30 29 29 0a 09 09 20   items)) 0))... 
4500: 20 28 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20   (pp items))..  
4510: 20 20 20 20 3b 3b 20 28 69 66 20 28 3e 3d 20 2a      ;; (if (>= *
4520: 76 65 72 62 6f 73 69 74 79 2a 20 35 29 0a 09 20  verbosity* 5).. 
4530: 20 20 20 20 20 3b 3b 20 20 20 20 20 28 62 65 67       ;;     (beg
4540: 69 6e 0a 09 20 20 20 20 20 20 3b 3b 20 20 20 20  in..      ;;    
4550: 20 20 20 28 70 72 69 6e 74 20 22 69 74 65 6d 73     (print "items
4560: 3a 20 22 29 20 20 20 20 20 28 70 70 20 28 69 74  : ")     (pp (it
4570: 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c  em-assoc->item-l
4580: 69 73 74 20 69 74 65 6d 73 29 29 0a 09 20 20 20  ist items))..   
4590: 20 20 20 3b 3b 20 20 20 20 20 20 20 28 70 72 69     ;;       (pri
45a0: 6e 74 20 22 69 74 65 6d 73 74 61 62 6c 65 3a 20  nt "itemstable: 
45b0: 22 29 28 70 70 20 28 69 74 65 6d 2d 74 61 62 6c  ")(pp (item-tabl
45c0: 65 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65  e->item-list ite
45d0: 6d 73 74 61 62 6c 65 29 29 29 29 0a 09 20 20 20  mstable))))..   
45e0: 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20     (for-each..  
45f0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 79       (lambda (my
4600: 2d 69 74 65 6d 64 61 74 29 0a 09 09 20 28 6c 65  -itemdat)... (le
4610: 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65  t* ((new-test-re
4620: 63 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72  cord (let ((newr
4630: 65 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74  ec (make-tests:t
4640: 65 73 74 71 75 65 75 65 29 29 29 0a 09 09 09 09  estqueue))).....
4650: 09 20 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 79  .   (vector-copy
4660: 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20 6e 65  ! test-record ne
4670: 77 72 65 63 29 0a 09 09 09 09 09 20 20 20 6e 65  wrec)......   ne
4680: 77 72 65 63 29 29 0a 09 09 09 28 6d 79 2d 69 74  wrec))....(my-it
4690: 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69  em-path (item-li
46a0: 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d  st->path my-item
46b0: 64 61 74 29 29 29 0a 09 09 20 20 20 28 69 66 20  dat)))...   (if 
46c0: 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68  (patt-list-match
46d0: 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 69 74   my-item-path it
46e0: 65 6d 2d 70 61 74 74 73 29 20 20 20 20 20 20 20  em-patts)       
46f0: 20 20 20 20 3b 3b 20 79 65 73 2c 20 77 65 20 77      ;; yes, we w
4700: 61 6e 74 20 74 6f 20 70 72 6f 63 65 73 73 20 74  ant to process t
4710: 68 69 73 20 69 74 65 6d 2c 20 4e 4f 54 45 3a 20  his item, NOTE: 
4720: 53 68 6f 75 6c 64 20 6e 6f 74 20 6e 65 65 64 20  Should not need 
4730: 74 68 69 73 20 63 68 65 63 6b 20 68 65 72 65 21  this check here!
4740: 0a 09 09 20 20 20 20 20 20 20 28 6c 65 74 20 28  ...       (let (
4750: 28 6e 65 77 74 65 73 74 6e 61 6d 65 20 28 63 6f  (newtestname (co
4760: 6e 63 20 68 65 64 20 22 2f 22 20 6d 79 2d 69 74  nc hed "/" my-it
4770: 65 6d 2d 70 61 74 68 29 29 29 20 20 20 20 3b 3b  em-path)))    ;;
4780: 20 74 65 73 74 20 6e 61 6d 65 73 20 61 72 65 20   test names are 
4790: 75 6e 69 71 75 65 20 6f 6e 20 74 65 73 74 6e 61  unique on testna
47a0: 6d 65 2f 69 74 65 6d 2d 70 61 74 68 0a 09 09 09  me/item-path....
47b0: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
47c0: 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 20 20 20  e-set-items!    
47d0: 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64   new-test-record
47e0: 20 23 66 29 0a 09 09 09 20 28 74 65 73 74 73 3a   #f).... (tests:
47f0: 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74  testqueue-set-it
4800: 65 6d 64 61 74 21 20 20 20 6e 65 77 2d 74 65 73  emdat!   new-tes
4810: 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d  t-record my-item
4820: 64 61 74 29 0a 09 09 09 20 28 74 65 73 74 73 3a  dat).... (tests:
4830: 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74  testqueue-set-it
4840: 65 6d 5f 70 61 74 68 21 20 6e 65 77 2d 74 65 73  em_path! new-tes
4850: 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d  t-record my-item
4860: 2d 70 61 74 68 29 0a 09 09 09 20 28 68 61 73 68  -path).... (hash
4870: 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74  -table-set! test
4880: 2d 72 65 63 6f 72 64 73 20 6e 65 77 74 65 73 74  -records newtest
4890: 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 2d 72 65  name new-test-re
48a0: 63 6f 72 64 29 0a 09 09 09 20 28 73 65 74 21 20  cord).... (set! 
48b0: 74 61 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65 73  tal (cons newtes
48c0: 74 6e 61 6d 65 20 74 61 6c 29 29 29 29 29 29 20  tname tal)))))) 
48d0: 3b 3b 20 73 69 6e 63 65 20 74 68 65 73 65 20 61  ;; since these a
48e0: 72 65 20 69 74 65 6d 69 7a 65 64 20 63 72 65 61  re itemized crea
48f0: 74 65 20 6e 65 77 20 74 65 73 74 20 6e 61 6d 65  te new test name
4900: 73 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 70  s testname/itemp
4910: 61 74 68 0a 09 20 20 20 20 20 20 20 69 74 65 6d  ath..       item
4920: 73 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e  s)..      (if (n
4930: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a  ot (null? tal)).
4940: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74  ..  (loop (car t
4950: 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29 0a  al)(cdr tal)))).
4960: 0a 09 20 20 20 20 20 3b 3b 20 69 66 20 69 74 65  ..     ;; if ite
4970: 6d 73 20 69 73 20 61 20 70 72 6f 63 20 74 68 65  ms is a proc the
4980: 6e 20 6e 65 65 64 20 74 6f 20 72 75 6e 20 69 74  n need to run it
4990: 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72  ems:get-items-fr
49a0: 6f 6d 2d 63 6f 6e 66 69 67 2c 20 67 65 74 20 74  om-config, get t
49b0: 68 65 20 6c 69 73 74 20 61 6e 64 20 6c 6f 6f 70  he list and loop
49c0: 20 0a 09 20 20 20 20 20 3b 3b 20 20 20 20 2d 20   ..     ;;    - 
49d0: 62 75 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74  but only do that
49e0: 20 69 66 20 72 65 73 6f 75 72 63 65 73 20 65 78   if resources ex
49f0: 69 73 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20  ist to kick off 
4a00: 74 68 65 20 6a 6f 62 0a 09 20 20 20 20 20 28 28  the job..     ((
4a10: 6f 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69  or (procedure? i
4a20: 74 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20  tems)(eq? items 
4a30: 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29  'have-procedure)
4a40: 29 0a 09 20 20 20 20 20 20 28 6c 65 74 20 28 28  )..      (let ((
4a50: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 20 20 20  can-run-more    
4a60: 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f  (runs:can-run-mo
4a70: 72 65 2d 74 65 73 74 73 20 64 62 20 74 65 73 74  re-tests db test
4a80: 2d 72 65 63 6f 72 64 29 29 29 0a 09 09 28 69 66  -record)))...(if
4a90: 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09   can-run-more...
4aa0: 20 20 20 20 28 6c 65 74 2a 20 28 28 70 72 65 72      (let* ((prer
4ab0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 64 62 3a  eqs-not-met (db:
4ac0: 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d  get-prereqs-not-
4ad0: 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 20 77 61  met db run-id wa
4ae0: 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 20  itons item-path 
4af0: 6d 6f 64 65 3a 20 74 65 73 74 6d 6f 64 65 29 29  mode: testmode))
4b00: 0a 09 09 09 20 20 20 28 66 61 69 6c 73 20 20 20  ....   (fails   
4b10: 20 20 20 20 20 20 20 20 28 63 61 6c 63 2d 66 61          (calc-fa
4b20: 69 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ils prereqs-not-
4b30: 6d 65 74 29 29 0a 09 09 09 20 20 20 28 6e 6f 6e  met))....   (non
4b40: 2d 63 6f 6d 70 6c 65 74 65 64 20 20 20 28 63 61  -completed   (ca
4b50: 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64  lc-not-completed
4b60: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
4b70: 29 29 29 0a 09 09 20 20 20 20 20 20 28 64 65 62  )))...      (deb
4b80: 75 67 3a 70 72 69 6e 74 20 38 20 22 49 4e 46 4f  ug:print 8 "INFO
4b90: 3a 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20  : can-run-more: 
4ba0: 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09  " can-run-more..
4bb0: 09 09 09 20 20 20 22 5c 6e 20 70 72 65 72 65 71  ...   "\n prereq
4bc0: 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 28 70 72  s-not-met: " (pr
4bd0: 65 74 74 79 2d 73 74 72 69 6e 67 20 70 72 65 72  etty-string prer
4be0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09  eqs-not-met)....
4bf0: 09 20 20 20 22 5c 6e 20 6e 6f 6e 2d 63 6f 6d 70  .   "\n non-comp
4c00: 6c 65 74 65 64 3a 20 20 20 22 20 28 70 72 65 74  leted:   " (pret
4c10: 74 79 2d 73 74 72 69 6e 67 20 6e 6f 6e 2d 63 6f  ty-string non-co
4c20: 6d 70 6c 65 74 65 64 29 20 0a 09 09 09 09 20 20  mpleted) .....  
4c30: 20 22 5c 6e 20 66 61 69 6c 73 3a 20 20 20 20 20   "\n fails:     
4c40: 20 20 20 20 20 20 22 20 28 70 72 65 74 74 79 2d        " (pretty-
4c50: 73 74 72 69 6e 67 20 66 61 69 6c 73 29 0a 09 09  string fails)...
4c60: 09 09 20 20 20 22 5c 6e 20 74 65 73 74 6d 6f 64  ..   "\n testmod
4c70: 65 3a 20 20 20 20 20 20 20 20 22 20 74 65 73 74  e:        " test
4c80: 6d 6f 64 65 0a 09 09 09 09 20 20 20 22 5c 6e 20  mode.....   "\n 
4c90: 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74  (eq? testmode 't
4ca0: 6f 70 6c 65 76 65 6c 29 20 22 20 28 65 71 3f 20  oplevel) " (eq? 
4cb0: 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76  testmode 'toplev
4cc0: 65 6c 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 28  el).....   "\n (
4cd0: 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65  null? non-comple
4ce0: 74 65 64 29 20 20 20 20 22 20 28 6e 75 6c 6c 3f  ted)    " (null?
4cf0: 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29   non-completed))
4d00: 0a 09 09 20 20 20 20 20 20 28 63 6f 6e 64 20 0a  ...      (cond .
4d10: 09 09 20 20 20 20 20 20 20 28 28 6f 72 20 28 6e  ..       ((or (n
4d20: 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74  ull? prereqs-not
4d30: 2d 6d 65 74 29 20 3b 3b 20 61 6c 6c 20 70 72 65  -met) ;; all pre
4d40: 72 65 71 73 20 6d 65 74 2c 20 66 69 72 65 20 6f  reqs met, fire o
4d50: 66 66 20 74 68 65 20 74 65 73 74 0a 09 09 09 20  ff the test.... 
4d60: 20 20 20 3b 3b 20 6f 72 2c 20 69 66 20 69 74 20     ;; or, if it 
4d70: 69 73 20 61 20 27 74 6f 70 6c 65 76 65 6c 20 74  is a 'toplevel t
4d80: 65 73 74 20 61 6e 64 20 61 6c 6c 20 70 72 65 72  est and all prer
4d90: 65 71 73 20 6e 6f 74 20 6d 65 74 20 61 72 65 20  eqs not met are 
4da0: 43 4f 4d 50 4c 45 54 45 44 20 74 68 65 6e 20 6c  COMPLETED then l
4db0: 61 75 6e 63 68 0a 09 09 09 20 20 20 20 28 61 6e  aunch....    (an
4dc0: 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20  d (eq? testmode 
4dd0: 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 20  'toplevel)..... 
4de0: 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c  (null? non-compl
4df0: 65 74 65 64 29 29 29 0a 09 09 09 28 6c 65 74 20  eted)))....(let 
4e00: 28 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 65 73  ((test-name (tes
4e10: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
4e20: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72  -testname test-r
4e30: 65 63 6f 72 64 29 29 29 0a 09 09 09 20 20 28 73  ecord)))....  (s
4e40: 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e  etenv "MT_TEST_N
4e50: 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20  AME" test-name) 
4e60: 3b 3b 20 0a 09 09 09 20 20 28 73 65 74 65 6e 76  ;; ....  (setenv
4e70: 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20   "MT_RUNNAME"   
4e80: 72 75 6e 6e 61 6d 65 29 0a 09 09 09 20 20 28 73  runname)....  (s
4e90: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d  et-megatest-env-
4ea0: 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 20  vars db run-id) 
4eb0: 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20  ;; these may be 
4ec0: 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61  needed by the la
4ed0: 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a  unching process.
4ee0: 09 09 09 20 20 28 6c 65 74 20 28 28 69 74 65 6d  ...  (let ((item
4ef0: 73 2d 6c 69 73 74 20 28 69 74 65 6d 73 3a 67 65  s-list (items:ge
4f00: 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e  t-items-from-con
4f10: 66 69 67 20 74 63 6f 6e 66 69 67 29 29 29 0a 09  fig tconfig)))..
4f20: 09 09 20 20 20 20 28 69 66 20 28 6c 69 73 74 3f  ..    (if (list?
4f30: 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09   items-list)....
4f40: 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 74  .(begin.....  (t
4f50: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73  ests:testqueue-s
4f60: 65 74 2d 69 74 65 6d 73 21 20 74 65 73 74 2d 72  et-items! test-r
4f70: 65 63 6f 72 64 20 69 74 65 6d 73 2d 6c 69 73 74  ecord items-list
4f80: 29 0a 09 09 09 09 20 20 28 6c 6f 6f 70 20 68 65  ).....  (loop he
4f90: 64 20 74 61 6c 29 29 0a 09 09 09 09 28 62 65 67  d tal)).....(beg
4fa0: 69 6e 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a  in.....  (debug:
4fb0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
4fc0: 54 68 65 20 70 72 6f 63 20 66 72 6f 6d 20 72 65  The proc from re
4fd0: 61 64 69 6e 67 20 74 68 65 20 73 65 74 75 70 20  ading the setup 
4fe0: 64 69 64 20 6e 6f 74 20 79 69 65 6c 64 20 61 20  did not yield a 
4ff0: 6c 69 73 74 20 2d 20 70 6c 65 61 73 65 20 72 65  list - please re
5000: 70 6f 72 74 20 74 68 69 73 22 29 0a 09 09 09 09  port this").....
5010: 20 20 28 65 78 69 74 20 31 29 29 29 29 29 29 0a    (exit 1)))))).
5020: 09 09 20 20 20 20 20 20 20 28 28 6e 75 6c 6c 3f  ..       ((null?
5030: 20 66 61 69 6c 73 29 0a 09 09 09 28 6c 6f 6f 70   fails)....(loop
5040: 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64   (car newtal)(cd
5050: 72 20 6e 65 77 74 61 6c 29 29 29 20 3b 3b 20 61  r newtal))) ;; a
5060: 6e 20 69 73 73 75 65 20 77 69 74 68 20 70 72 65  n issue with pre
5070: 72 65 71 73 20 6e 6f 74 20 79 65 74 20 6d 65 74  reqs not yet met
5080: 3f 0a 09 09 20 20 20 20 20 20 20 28 28 61 6e 64  ?...       ((and
5090: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 66 61 69   (not (null? fai
50a0: 6c 73 29 29 28 65 71 3f 20 74 65 73 74 6d 6f 64  ls))(eq? testmod
50b0: 65 20 27 6e 6f 72 6d 61 6c 29 29 0a 09 09 09 28  e 'normal))....(
50c0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49  debug:print 1 "I
50d0: 4e 46 4f 3a 20 74 65 73 74 20 22 20 20 68 65 64  NFO: test "  hed
50e0: 20 22 20 28 6d 6f 64 65 3d 22 20 74 65 73 74 6d   " (mode=" testm
50f0: 6f 64 65 20 22 29 20 68 61 73 20 66 61 69 6c 65  ode ") has faile
5100: 64 20 70 72 65 72 65 71 75 69 73 69 74 65 28 73  d prerequisite(s
5110: 29 3b 20 22 0a 09 09 09 09 20 20 20 20 20 28 73  ); ".....     (s
5120: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
5130: 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28  e (map (lambda (
5140: 74 29 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74  t)(conc (db:test
5150: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 29  -get-testname t)
5160: 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 65   ":" (db:test-ge
5170: 74 2d 73 74 61 74 65 20 74 29 22 2f 22 28 64 62  t-state t)"/"(db
5180: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73  :test-get-status
5190: 20 74 29 29 29 20 66 61 69 6c 73 29 20 22 2c 20   t))) fails) ", 
51a0: 22 29 0a 09 09 09 09 20 20 20 20 20 22 2c 20 72  ").....     ", r
51b0: 65 6d 6f 76 69 6e 67 20 69 74 20 66 72 6f 6d 20  emoving it from 
51c0: 74 6f 2d 64 6f 20 6c 69 73 74 22 29 0a 09 09 09  to-do list")....
51d0: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
51e0: 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 6c 6f  tal))....    (lo
51f0: 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72  op (car tal)(cdr
5200: 20 74 61 6c 29 29 29 29 0a 09 09 20 20 20 20 20   tal))))...     
5210: 20 20 28 65 6c 73 65 0a 09 09 09 28 64 65 62 75    (else....(debu
5220: 67 3a 70 72 69 6e 74 20 38 20 22 45 52 52 4f 52  g:print 8 "ERROR
5230: 3a 20 4e 6f 20 68 61 6e 64 6c 65 72 20 66 6f 72  : No handler for
5240: 20 74 68 69 73 20 63 6f 6e 64 69 74 69 6f 6e 2e   this condition.
5250: 22 29 0a 09 09 09 3b 3b 20 09 20 20 20 20 20 22  ")....;; .     "
5260: 5c 6e 20 20 68 65 64 3a 20 20 20 20 20 20 20 20  \n  hed:        
5270: 20 20 20 20 22 20 68 65 64 20 0a 09 09 09 3b 3b      " hed ....;;
5280: 20 09 20 20 20 20 20 22 5c 6e 20 66 61 69 6c 73   .     "\n fails
5290: 3a 20 20 20 20 20 20 20 20 20 20 20 22 20 28 73  :           " (s
52a0: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
52b0: 65 20 28 6d 61 70 20 64 62 3a 74 65 73 74 2d 67  e (map db:test-g
52c0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 66 61 69 6c  et-testname fail
52d0: 73 29 20 22 2c 22 29 0a 09 09 09 3b 3b 20 09 20  s) ",")....;; . 
52e0: 20 20 20 20 22 5c 6e 20 74 65 73 74 6d 6f 64 65      "\n testmode
52f0: 3a 20 20 20 20 20 20 20 20 22 20 74 65 73 74 6d  :        " testm
5300: 6f 64 65 0a 09 09 09 3b 3b 20 09 20 20 20 20 20  ode....;; .     
5310: 22 5c 6e 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  "\n prereqs-not-
5320: 6d 65 74 3a 20 22 20 28 70 72 65 74 74 79 2d 73  met: " (pretty-s
5330: 74 72 69 6e 67 20 70 72 65 72 65 71 73 2d 6e 6f  tring prereqs-no
5340: 74 2d 6d 65 74 29 0a 09 09 09 3b 3b 20 09 20 20  t-met)....;; .  
5350: 20 20 20 22 5c 6e 20 69 74 65 6d 73 3a 20 20 20     "\n items:   
5360: 20 20 20 20 20 20 20 20 22 20 69 74 65 6d 73 29          " items)
5370: 0a 09 09 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e  ....(loop (car n
5380: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
5390: 6c 29 29 29 29 29 0a 09 09 20 20 20 20 3b 3b 20  l)))))...    ;; 
53a0: 69 66 20 63 61 6e 27 74 20 72 75 6e 20 6d 6f 72  if can't run mor
53b0: 65 20 6a 75 73 74 20 6c 6f 6f 70 20 77 69 74 68  e just loop with
53c0: 20 6e 65 78 74 20 70 6f 73 73 69 62 6c 65 20 74   next possible t
53d0: 65 73 74 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20  est...    (loop 
53e0: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
53f0: 20 6e 65 77 74 61 6c 29 29 29 29 29 0a 09 20 20   newtal)))))..  
5400: 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 74 68 69     ..     ;; thi
5410: 73 20 63 61 73 65 20 73 68 6f 75 6c 64 20 6e 6f  s case should no
5420: 74 20 68 61 70 70 65 6e 2c 20 61 64 64 65 64 20  t happen, added 
5430: 74 6f 20 68 65 6c 70 20 63 61 74 63 68 20 61 6e  to help catch an
5440: 79 20 62 75 67 73 0a 09 20 20 20 20 20 28 28 61  y bugs..     ((a
5450: 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29  nd (list? items)
5460: 20 69 74 65 6d 64 61 74 29 0a 09 20 20 20 20 20   itemdat)..     
5470: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
5480: 22 45 52 52 4f 52 3a 20 53 68 6f 75 6c 64 20 6e  "ERROR: Should n
5490: 6f 74 20 68 61 76 65 20 61 20 6c 69 73 74 20 6f  ot have a list o
54a0: 66 20 69 74 65 6d 73 20 69 6e 20 61 20 74 65 73  f items in a tes
54b0: 74 20 61 6e 64 20 74 68 65 20 69 74 65 6d 73 70  t and the itemsp
54c0: 61 74 68 20 73 65 74 20 2d 20 70 6c 65 61 73 65  ath set - please
54d0: 20 72 65 70 6f 72 74 20 74 68 69 73 22 29 0a 09   report this")..
54e0: 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29 29        (exit 1)))
54f0: 29 0a 09 20 20 0a 09 20 20 3b 3b 20 77 65 20 67  )..  ..  ;; we g
5500: 65 74 20 68 65 72 65 20 6f 6e 20 22 64 72 6f 70  et here on "drop
5510: 20 74 68 72 6f 75 67 68 22 20 2d 20 6c 6f 6f 70   through" - loop
5520: 20 66 6f 72 20 6e 65 78 74 20 74 65 73 74 20 69   for next test i
5530: 6e 20 71 75 65 75 65 0a 09 20 20 28 69 66 20 28  n queue..  (if (
5540: 6e 75 6c 6c 3f 20 74 61 6c 29 0a 09 20 20 20 20  null? tal)..    
5550: 20 20 28 62 65 67 69 6e 0a 09 09 3b 3b 20 46 49    (begin...;; FI
5560: 58 4d 45 21 21 21 21 20 54 48 49 53 20 53 48 4f  XME!!!! THIS SHO
5570: 55 4c 44 20 4e 4f 54 20 52 45 51 55 49 52 45 20  ULD NOT REQUIRE 
5580: 41 4e 20 45 58 49 54 21 21 21 21 21 21 21 0a 09  AN EXIT!!!!!!!..
5590: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20  .(debug:print 1 
55a0: 22 49 4e 46 4f 3a 20 41 6c 6c 20 74 65 73 74 73  "INFO: All tests
55b0: 20 6c 61 75 6e 63 68 65 64 22 29 0a 09 09 28 74   launched")...(t
55c0: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 35  hread-sleep! 0.5
55d0: 29 0a 09 09 3b 3b 20 46 49 58 4d 45 21 20 54 68  )...;; FIXME! Th
55e0: 69 73 20 68 61 72 73 68 20 65 78 69 74 20 73 68  is harsh exit sh
55f0: 6f 75 6c 64 20 6e 6f 74 20 62 65 20 6e 65 63 65  ould not be nece
5600: 73 73 61 72 79 2e 2e 2e 2e 0a 09 09 28 69 66 20  ssary.......(if 
5610: 28 6e 6f 74 20 2a 72 75 6e 72 65 6d 6f 74 65 2a  (not *runremote*
5620: 29 28 65 78 69 74 29 29 20 3b 3b 20 0a 09 09 23  )(exit)) ;; ...#
5630: 66 29 20 3b 3b 20 72 65 74 75 72 6e 20 61 20 23  f) ;; return a #
5640: 66 20 61 73 20 61 20 68 69 6e 74 20 74 68 61 74  f as a hint that
5650: 20 77 65 20 61 72 65 20 64 6f 6e 65 0a 09 20 20   we are done..  
5660: 20 20 20 20 3b 3b 20 48 65 72 65 20 77 65 20 6e      ;; Here we n
5670: 65 65 64 20 74 6f 20 63 68 65 63 6b 20 74 68 61  eed to check tha
5680: 74 20 61 6c 6c 20 74 68 65 20 74 65 73 74 73 20  t all the tests 
5690: 72 65 6d 61 69 6e 69 6e 67 20 74 6f 20 62 65 20  remaining to be 
56a0: 72 75 6e 20 61 72 65 20 65 6c 69 67 69 62 6c 65  run are eligible
56b0: 20 74 6f 20 72 75 6e 0a 09 20 20 20 20 20 20 3b   to run..      ;
56c0: 3b 20 61 6e 64 20 61 72 65 20 6e 6f 74 20 62 6c  ; and are not bl
56d0: 6f 63 6b 65 64 20 62 79 20 66 61 69 6c 65 64 0a  ocked by failed.
56e0: 09 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65  .      (let ((ne
56f0: 77 6c 73 74 20 28 74 65 73 74 73 3a 66 69 6c 74  wlst (tests:filt
5700: 65 72 2d 6e 6f 6e 2d 72 75 6e 6e 61 62 6c 65 20  er-non-runnable 
5710: 64 62 20 72 75 6e 2d 69 64 20 74 61 6c 20 74 65  db run-id tal te
5720: 73 74 2d 72 65 63 6f 72 64 73 29 29 29 20 3b 3b  st-records))) ;;
5730: 20 69 2e 65 2e 20 6e 6f 74 20 46 41 49 4c 2c 20   i.e. not FAIL, 
5740: 57 41 49 56 45 44 2c 20 49 4e 43 4f 4d 50 4c 45  WAIVED, INCOMPLE
5750: 54 45 2c 20 50 41 53 53 2c 20 4b 49 4c 4c 45 44  TE, PASS, KILLED
5760: 2c 0a 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65  ,...(thread-slee
5770: 70 21 20 30 2e 31 29 0a 09 09 28 69 66 20 28 6e  p! 0.1)...(if (n
5780: 6f 74 20 28 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74  ot (null? newlst
5790: 29 29 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 28  ))...    (loop (
57a0: 63 61 72 20 6e 65 77 6c 73 74 29 28 63 64 72 20  car newlst)(cdr 
57b0: 6e 65 77 6c 73 74 29 29 29 29 29 29 29 29 29 0a  newlst))))))))).
57c0: 0a 3b 3b 20 70 61 72 65 6e 74 2d 74 65 73 74 20  .;; parent-test 
57d0: 69 73 20 74 68 65 72 65 20 61 73 20 61 20 70 6c  is there as a pl
57e0: 61 63 65 68 6f 6c 64 65 72 20 66 6f 72 20 77 68  aceholder for wh
57f0: 65 6e 20 70 61 72 65 6e 74 2d 74 65 73 74 73 20  en parent-tests 
5800: 63 61 6e 20 62 65 20 72 75 6e 20 61 73 20 61 20  can be run as a 
5810: 73 65 74 75 70 20 73 74 65 70 0a 28 64 65 66 69  setup step.(defi
5820: 6e 65 20 28 72 75 6e 3a 74 65 73 74 20 64 62 20  ne (run:test db 
5830: 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b  run-id runname k
5840: 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65  eyvallst test-re
5850: 63 6f 72 64 20 66 6c 61 67 73 20 70 61 72 65 6e  cord flags paren
5860: 74 2d 74 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c  t-test).  ;; All
5870: 20 74 68 65 73 65 20 76 61 72 73 20 6d 69 67 68   these vars migh
5880: 74 20 62 65 20 72 65 66 65 72 65 6e 63 65 64 20  t be referenced 
5890: 62 79 20 74 68 65 20 74 65 73 74 63 6f 6e 66 69  by the testconfi
58a0: 67 20 66 69 6c 65 20 72 65 61 64 65 72 0a 20 20  g file reader.  
58b0: 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d  (let* ((test-nam
58c0: 65 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74  e    (tests:test
58d0: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61  queue-get-testna
58e0: 6d 65 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64  me   test-record
58f0: 29 29 0a 09 20 28 74 65 73 74 2d 77 61 69 74 6f  )).. (test-waito
5900: 6e 73 20 28 74 65 73 74 73 3a 74 65 73 74 71 75  ns (tests:testqu
5910: 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20  eue-get-waitons 
5920: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29     test-record))
5930: 0a 09 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20  .. (test-conf   
5940: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
5950: 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67  e-get-testconfig
5960: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
5970: 20 28 69 74 65 6d 64 61 74 20 20 20 20 20 20 28   (itemdat      (
5980: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
5990: 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74  get-itemdat    t
59a0: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28  est-record)).. (
59b0: 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f  test-path    (co
59c0: 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74  nc *toppath* "/t
59d0: 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65  ests/" test-name
59e0: 29 29 20 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20  )) ;; could use 
59f0: 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f  tests:get-testco
5a00: 6e 66 69 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20  nfig here ..... 
5a10: 28 66 6f 72 63 65 20 20 20 20 20 20 20 20 28 68  (force        (h
5a20: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
5a30: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f  fault flags "-fo
5a40: 72 63 65 22 20 23 66 29 29 0a 09 20 28 72 65 72  rce" #f)).. (rer
5a50: 75 6e 20 20 20 20 20 20 20 20 28 68 61 73 68 2d  un        (hash-
5a60: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
5a70: 74 20 66 6c 61 67 73 20 22 2d 72 65 72 75 6e 22  t flags "-rerun"
5a80: 20 23 66 29 29 0a 09 20 28 6b 65 65 70 67 6f 69   #f)).. (keepgoi
5a90: 6e 67 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c  ng    (hash-tabl
5aa0: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c  e-ref/default fl
5ab0: 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22  ags "-keepgoing"
5ac0: 20 23 66 29 29 0a 09 20 28 69 74 65 6d 2d 70 61   #f)).. (item-pa
5ad0: 74 68 20 20 20 20 20 22 22 29 29 0a 20 20 20 20  th     "")).    
5ae0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 0a 09  (debug:print 5..
5af0: 09 20 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20  . "test-config: 
5b00: 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61  " (hash-table->a
5b10: 6c 69 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a  list test-conf).
5b20: 09 09 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 74  .. "\n   itemdat
5b30: 3a 20 22 20 69 74 65 6d 64 61 74 0a 09 09 20 29  : " itemdat... )
5b40: 0a 20 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 20  .    ;; setting 
5b50: 69 74 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 73  itemdat to a lis
5b60: 74 20 69 66 20 69 74 20 69 73 20 23 66 0a 20 20  t if it is #f.  
5b70: 20 20 28 69 66 20 28 6e 6f 74 20 69 74 65 6d 64    (if (not itemd
5b80: 61 74 29 28 73 65 74 21 20 69 74 65 6d 64 61 74  at)(set! itemdat
5b90: 20 27 28 29 29 29 0a 20 20 20 20 28 73 65 74 21   '())).    (set!
5ba0: 20 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d   item-path (item
5bb0: 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d  -list->path item
5bc0: 64 61 74 29 29 0a 20 20 20 20 28 64 65 62 75 67  dat)).    (debug
5bd0: 3a 70 72 69 6e 74 20 32 20 22 41 74 74 65 6d 70  :print 2 "Attemp
5be0: 74 69 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 74  ting to launch t
5bf0: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  est " test-name 
5c00: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 20  "/" item-path). 
5c10: 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54     (setenv "MT_T
5c20: 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e  EST_NAME" test-n
5c30: 61 6d 65 29 20 3b 3b 20 0a 20 20 20 20 28 73 65  ame) ;; .    (se
5c40: 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45  tenv "MT_RUNNAME
5c50: 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20  "   runname).   
5c60: 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65   (set-megatest-e
5c70: 6e 76 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69  nv-vars db run-i
5c80: 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20  d) ;; these may 
5c90: 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65  be needed by the
5ca0: 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65   launching proce
5cb0: 73 73 0a 20 20 20 20 28 63 68 61 6e 67 65 2d 64  ss.    (change-d
5cc0: 69 72 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74  irectory *toppat
5cd0: 68 2a 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65  h*)..    ;; Here
5ce0: 20 69 73 20 77 68 65 72 65 20 74 68 65 20 74 65   is where the te
5cf0: 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73  st_meta table is
5d00: 20 62 65 73 74 20 75 70 64 61 74 65 64 0a 20 20   best updated.  
5d10: 20 20 3b 3b 20 59 65 73 2c 20 61 6e 6f 74 68 65    ;; Yes, anothe
5d20: 72 20 75 73 65 20 6f 66 20 61 20 67 6c 6f 62 61  r use of a globa
5d30: 6c 20 66 6f 72 20 63 61 63 68 69 6e 67 2e 20 4e  l for caching. N
5d40: 65 65 64 20 61 20 62 65 74 74 65 72 20 77 61 79  eed a better way
5d50: 3f 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ?.    (if (not (
5d60: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
5d70: 65 66 61 75 6c 74 20 2a 74 65 73 74 2d 6d 65 74  efault *test-met
5d80: 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d  a-updated* test-
5d90: 6e 61 6d 65 20 23 66 29 29 0a 20 20 20 20 20 20  name #f)).      
5da0: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 28 68 61    (begin..   (ha
5db0: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a 74  sh-table-set! *t
5dc0: 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64  est-meta-updated
5dd0: 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 74 29 0a  * test-name #t).
5de0: 20 20 20 20 20 20 20 20 20 20 20 28 72 75 6e 73             (runs
5df0: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74  :update-test_met
5e00: 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74  a db test-name t
5e10: 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20  est-conf))).    
5e20: 0a 20 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20  .    ;; (lambda 
5e30: 28 69 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28  (itemdat) ;;; ((
5e40: 72 69 70 65 6e 65 73 73 20 22 6f 76 65 72 72 69  ripeness "overri
5e50: 70 65 22 29 20 28 74 65 6d 70 65 72 61 74 75 72  pe") (temperatur
5e60: 65 20 22 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f  e "cool") (seaso
5e70: 6e 20 22 73 75 6d 6d 65 72 22 29 29 0a 20 20 20  n "summer")).   
5e80: 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73   (let* ((new-tes
5e90: 74 2d 70 61 74 68 20 28 73 74 72 69 6e 67 2d 69  t-path (string-i
5ea0: 6e 74 65 72 73 70 65 72 73 65 20 28 63 6f 6e 73  ntersperse (cons
5eb0: 20 74 65 73 74 2d 70 61 74 68 20 28 6d 61 70 20   test-path (map 
5ec0: 63 61 64 72 20 69 74 65 6d 64 61 74 29 29 20 22  cadr itemdat)) "
5ed0: 2f 22 29 29 0a 09 20 20 20 28 6e 65 77 2d 74 65  /"))..   (new-te
5ee0: 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75  st-name (if (equ
5ef0: 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22  al? item-path ""
5f00: 29 20 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e  ) test-name (con
5f10: 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20  c test-name "/" 
5f20: 69 74 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20  item-path))) ;; 
5f30: 6a 75 73 74 20 6e 65 65 64 20 69 74 20 74 6f 20  just need it to 
5f40: 62 65 20 75 6e 69 71 75 65 0a 09 20 20 20 28 74  be unique..   (t
5f50: 65 73 74 2d 69 64 20 20 20 20 20 20 20 28 64 62  est-id       (db
5f60: 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 64 62 20  :get-test-id db 
5f70: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d   run-id test-nam
5f80: 65 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20  e item-path)).. 
5f90: 20 20 28 74 65 73 74 64 61 74 20 20 20 20 20 20    (testdat      
5fa0: 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e   (db:get-test-in
5fb0: 66 6f 2d 62 79 2d 69 64 20 64 62 20 74 65 73 74  fo-by-id db test
5fc0: 2d 69 64 29 29 29 0a 20 20 20 20 20 20 28 69 66  -id))).      (if
5fd0: 20 28 6e 6f 74 20 74 65 73 74 64 61 74 29 0a 09   (not testdat)..
5fe0: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b    (begin..    ;;
5ff0: 20 65 6e 73 75 72 65 20 74 68 61 74 20 74 68 65   ensure that the
6000: 20 70 61 74 68 20 65 78 69 73 74 73 20 62 65 66   path exists bef
6010: 6f 72 65 20 72 65 67 69 73 74 65 72 69 6e 67 20  ore registering 
6020: 74 68 65 20 74 65 73 74 0a 09 20 20 20 20 3b 3b  the test..    ;;
6030: 20 4e 4f 50 45 3a 20 43 61 6e 6e 6f 74 21 20 44   NOPE: Cannot! D
6040: 6f 6e 27 74 20 6b 6e 6f 77 20 79 65 74 20 77 68  on't know yet wh
6050: 69 63 68 20 64 69 73 6b 20 61 72 65 61 20 77 69  ich disk area wi
6060: 6c 6c 20 62 65 20 61 73 73 69 67 6e 65 64 2e 2e  ll be assigned..
6070: 2e 2e 0a 09 20 20 20 20 3b 3b 20 28 73 79 73 74  ....    ;; (syst
6080: 65 6d 20 28 63 6f 6e 63 20 22 6d 6b 64 69 72 20  em (conc "mkdir 
6090: 2d 70 20 22 20 6e 65 77 2d 74 65 73 74 2d 70 61  -p " new-test-pa
60a0: 74 68 29 29 0a 09 20 20 20 20 28 74 65 73 74 73  th))..    (tests
60b0: 3a 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 64  :register-test d
60c0: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61  b run-id test-na
60d0: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20  me item-path).. 
60e0: 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 64     (set! test-id
60f0: 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 64   (db:get-test-id
6100: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d   db run-id test-
6110: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29  name item-path))
6120: 0a 09 20 20 20 20 28 73 65 74 21 20 74 65 73 74  ..    (set! test
6130: 64 61 74 20 28 64 62 3a 67 65 74 2d 74 65 73 74  dat (db:get-test
6140: 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 64 62 20 74  -info-by-id db t
6150: 65 73 74 2d 69 64 29 29 29 29 0a 20 20 20 20 20  est-id)))).     
6160: 20 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 28   (set! test-id (
6170: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
6180: 65 73 74 64 61 74 29 29 0a 20 20 20 20 20 20 28  estdat)).      (
6190: 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79  change-directory
61a0: 20 74 65 73 74 2d 70 61 74 68 29 0a 20 20 20 20   test-path).    
61b0: 20 20 28 63 61 73 65 20 28 69 66 20 66 6f 72 63    (case (if forc
61c0: 65 20 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d 61  e ;; (args:get-a
61d0: 72 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 27  rg "-force")...'
61e0: 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09 09 28 69  NOT_STARTED...(i
61f0: 66 20 74 65 73 74 64 61 74 0a 09 09 20 20 20 20  f testdat...    
6200: 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20  (string->symbol 
6210: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
6220: 74 65 73 74 64 61 74 29 29 0a 09 09 20 20 20 20  testdat))...    
6230: 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72  'failed-to-inser
6240: 74 29 29 0a 09 28 28 66 61 69 6c 65 64 2d 74 6f  t))..((failed-to
6250: 2d 69 6e 73 65 72 74 29 0a 09 20 28 64 65 62 75  -insert).. (debu
6260: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
6270: 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 65  : Failed to inse
6280: 72 74 20 74 68 65 20 72 65 63 6f 72 64 20 69 6e  rt the record in
6290: 74 6f 20 74 68 65 20 64 62 22 29 29 0a 09 28 28  to the db"))..((
62a0: 4e 4f 54 5f 53 54 41 52 54 45 44 20 43 4f 4d 50  NOT_STARTED COMP
62b0: 4c 45 54 45 44 29 0a 09 20 28 6c 65 74 20 28 28  LETED).. (let ((
62c0: 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20  runflag #f))..  
62d0: 20 28 63 6f 6e 64 0a 09 20 20 20 20 3b 3b 20 2d   (cond..    ;; -
62e0: 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 6d 61  force, run no ma
62f0: 74 74 65 72 20 77 68 61 74 0a 09 20 20 20 20 28  tter what..    (
6300: 66 6f 72 63 65 20 28 73 65 74 21 20 72 75 6e 66  force (set! runf
6310: 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b  lag #t))..    ;;
6320: 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20 72 75   NOT_STARTED, ru
6330: 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74  n no matter what
6340: 0a 09 20 20 20 20 28 28 65 71 75 61 6c 3f 20 28  ..    ((equal? (
6350: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74  test:get-state t
6360: 65 73 74 64 61 74 29 20 22 4e 4f 54 5f 53 54 41  estdat) "NOT_STA
6370: 52 54 45 44 22 29 28 73 65 74 21 20 72 75 6e 66  RTED")(set! runf
6380: 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b  lag #t))..    ;;
6390: 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e 64 20   not -rerun and 
63a0: 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 43 48  PASS, WARN or CH
63b0: 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a 09  ECK, do no run..
63c0: 20 20 20 20 28 28 61 6e 64 20 28 6f 72 20 28 6e      ((and (or (n
63d0: 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 20 20  ot rerun)...    
63e0: 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 09 20    keepgoing)... 
63f0: 20 3b 3b 20 52 65 71 75 69 72 65 20 74 6f 20 66   ;; Require to f
6400: 6f 72 63 65 20 72 65 2d 72 75 6e 20 66 6f 72 20  orce re-run for 
6410: 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a 61 6e  COMPLETED or *an
6420: 79 74 68 69 6e 67 2a 20 2b 20 50 41 53 53 2c 57  ything* + PASS,W
6430: 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09 09 20  ARN or CHECK... 
6440: 20 28 6f 72 20 28 6d 65 6d 62 65 72 20 28 74 65   (or (member (te
6450: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
6460: 73 74 64 61 74 29 20 27 28 22 50 41 53 53 22 20  stdat) '("PASS" 
6470: 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 29 29  "WARN" "CHECK"))
6480: 0a 09 09 20 20 20 20 20 20 28 6d 65 6d 62 65 72  ...      (member
6490: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65   (test:get-state
64a0: 20 20 74 65 73 74 64 61 74 29 20 27 28 22 43 4f    testdat) '("CO
64b0: 4d 50 4c 45 54 45 44 22 29 29 29 29 20 0a 09 20  MPLETED")))) .. 
64c0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
64d0: 20 32 20 22 49 4e 46 4f 3a 20 72 75 6e 6e 69 6e   2 "INFO: runnin
64e0: 67 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61  g test " test-na
64f0: 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68  me "/" item-path
6500: 20 22 20 73 75 70 70 72 65 73 73 65 64 20 61 73   " suppressed as
6510: 20 69 74 20 69 73 20 22 20 28 74 65 73 74 3a 67   it is " (test:g
6520: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74  et-state testdat
6530: 29 20 22 20 61 6e 64 20 22 20 28 74 65 73 74 3a  ) " and " (test:
6540: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
6550: 61 74 29 29 0a 09 20 20 20 20 20 28 73 65 74 21  at))..     (set!
6560: 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20   runflag #f)).. 
6570: 20 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64     ;; -rerun and
6580: 20 73 74 61 74 75 73 20 69 73 20 6f 6e 65 20 6f   status is one o
6590: 66 20 74 68 65 20 73 70 65 63 69 66 65 64 2c 20  f the specifed, 
65a0: 72 75 6e 20 69 74 0a 09 20 20 20 20 28 28 61 6e  run it..    ((an
65b0: 64 20 72 65 72 75 6e 0a 09 09 20 20 28 6c 65 74  d rerun...  (let
65c0: 2a 20 28 28 72 65 72 75 6e 6c 73 74 20 20 20 28  * ((rerunlst   (
65d0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 72 65 72  string-split rer
65e0: 75 6e 20 22 2c 22 29 29 0a 09 09 09 20 28 6d 75  un ",")).... (mu
65f0: 73 74 2d 72 65 72 75 6e 20 28 6d 65 6d 62 65 72  st-rerun (member
6600: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75   (test:get-statu
6610: 73 20 74 65 73 74 64 61 74 29 20 72 65 72 75 6e  s testdat) rerun
6620: 6c 73 74 29 29 29 0a 09 09 20 20 20 20 28 64 65  lst)))...    (de
6630: 62 75 67 3a 70 72 69 6e 74 20 33 20 22 49 4e 46  bug:print 3 "INF
6640: 4f 3a 20 2d 72 65 72 75 6e 20 6c 69 73 74 3a 20  O: -rerun list: 
6650: 22 20 72 65 72 75 6e 20 22 2c 20 74 65 73 74 2d  " rerun ", test-
6660: 73 74 61 74 75 73 3a 20 22 20 28 74 65 73 74 3a  status: " (test:
6670: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
6680: 61 74 29 22 2c 20 6d 75 73 74 2d 72 65 72 75 6e  at)", must-rerun
6690: 3a 20 22 20 6d 75 73 74 2d 72 65 72 75 6e 29 0a  : " must-rerun).
66a0: 09 09 20 20 20 20 6d 75 73 74 2d 72 65 72 75 6e  ..    must-rerun
66b0: 29 29 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a  ))..     (debug:
66c0: 70 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20 52  print 2 "INFO: R
66d0: 65 72 75 6e 20 66 6f 72 63 65 64 20 66 6f 72 20  erun forced for 
66e0: 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65  test " test-name
66f0: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 0a   "/" item-path).
6700: 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66  .     (set! runf
6710: 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b  lag #t))..    ;;
6720: 20 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20   -keepgoing, do 
6730: 6e 6f 74 20 72 65 72 75 6e 20 46 41 49 4c 0a 09  not rerun FAIL..
6740: 20 20 20 20 28 28 61 6e 64 20 6b 65 65 70 67 6f      ((and keepgo
6750: 69 6e 67 0a 09 09 20 20 28 6d 65 6d 62 65 72 20  ing...  (member 
6760: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
6770: 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49   testdat) '("FAI
6780: 4c 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 74  L")))..     (set
6790: 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09  ! runflag #f))..
67a0: 20 20 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 72      ((and (not r
67b0: 65 72 75 6e 29 0a 09 09 20 20 28 6d 65 6d 62 65  erun)...  (membe
67c0: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  r (test:get-stat
67d0: 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 46  us testdat) '("F
67e0: 41 49 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09 20  AIL" "n/a"))).. 
67f0: 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61      (set! runfla
6800: 67 20 23 74 29 29 0a 09 20 20 20 20 28 65 6c 73  g #t))..    (els
6810: 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20  e (set! runflag 
6820: 23 66 29 29 29 0a 09 20 20 20 28 64 65 62 75 67  #f)))..   (debug
6830: 3a 70 72 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e  :print 6 "RUNNIN
6840: 47 20 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20  G => runflag: " 
6850: 72 75 6e 66 6c 61 67 20 22 20 53 54 41 54 45 3a  runflag " STATE:
6860: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
6870: 74 65 20 74 65 73 74 64 61 74 29 20 22 20 53 54  te testdat) " ST
6880: 41 54 55 53 3a 20 22 20 28 74 65 73 74 3a 67 65  ATUS: " (test:ge
6890: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74  t-status testdat
68a0: 29 29 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20  ))..   (if (not 
68b0: 72 75 6e 66 6c 61 67 29 0a 09 20 20 20 20 20 20  runflag)..      
68c0: 20 28 69 66 20 28 6e 6f 74 20 70 61 72 65 6e 74   (if (not parent
68d0: 2d 74 65 73 74 29 0a 09 09 20 20 20 28 64 65 62  -test)...   (deb
68e0: 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45  ug:print 1 "NOTE
68f0: 3a 20 4e 6f 74 20 73 74 61 72 74 69 6e 67 20 74  : Not starting t
6900: 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e  est " new-test-n
6910: 61 6d 65 20 22 20 61 73 20 69 74 20 69 73 20 73  ame " as it is s
6920: 74 61 74 65 20 5c 22 22 20 28 74 65 73 74 3a 67  tate \"" (test:g
6930: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74  et-state testdat
6940: 29 20 0a 09 09 09 09 22 5c 22 20 61 6e 64 20 73  ) ....."\" and s
6950: 74 61 74 75 73 20 5c 22 22 20 28 74 65 73 74 3a  tatus \"" (test:
6960: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
6970: 61 74 29 20 22 5c 22 2c 20 75 73 65 20 2d 72 65  at) "\", use -re
6980: 72 75 6e 20 5c 22 22 20 28 74 65 73 74 3a 67 65  run \"" (test:ge
6990: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74  t-status testdat
69a0: 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ).              
69b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
69c0: 20 20 22 5c 22 20 6f 72 20 2d 66 6f 72 63 65 20    "\" or -force 
69d0: 74 6f 20 6f 76 65 72 72 69 64 65 22 29 29 0a 09  to override"))..
69e0: 20 20 20 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20         ;; NOTE: 
69f0: 4e 6f 20 6c 6f 6e 67 65 72 20 62 65 20 63 68 65  No longer be che
6a00: 63 6b 69 6e 67 20 70 72 65 72 65 71 75 69 73 69  cking prerequisi
6a10: 74 65 73 20 68 65 72 65 21 20 57 69 6c 6c 20 6e  tes here! Will n
6a20: 65 76 65 72 20 67 65 74 20 68 65 72 65 20 75 6e  ever get here un
6a30: 6c 65 73 73 20 70 72 65 72 65 71 73 20 61 72 65  less prereqs are
6a40: 0a 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 20  ..       ;;     
6a50: 20 20 61 6c 72 65 61 64 79 20 6d 65 74 2e 0a 09    already met...
6a60: 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20         (if (not 
6a70: 28 6c 61 75 6e 63 68 2d 74 65 73 74 20 64 62 20  (launch-test db 
6a80: 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74  run-id runname t
6a90: 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61 6c 6c  est-conf keyvall
6aa0: 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73  st test-name tes
6ab0: 74 2d 70 61 74 68 20 69 74 65 6d 64 61 74 20 66  t-path itemdat f
6ac0: 6c 61 67 73 29 29 0a 09 09 20 20 20 28 62 65 67  lags))...   (beg
6ad0: 69 6e 0a 09 09 20 20 20 20 20 28 70 72 69 6e 74  in...     (print
6ae0: 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20   "ERROR: Failed 
6af0: 74 6f 20 6c 61 75 6e 63 68 20 74 68 65 20 74 65  to launch the te
6b00: 73 74 2e 20 45 78 69 74 69 6e 67 20 61 73 20 73  st. Exiting as s
6b10: 6f 6f 6e 20 61 73 20 70 6f 73 73 69 62 6c 65 22  oon as possible"
6b20: 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 2a  )...     (set! *
6b30: 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73  globalexitstatus
6b40: 2a 20 31 29 20 3b 3b 20 0a 09 09 20 20 20 20 20  * 1) ;; ...     
6b50: 28 70 72 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20  (process-signal 
6b60: 28 63 75 72 72 65 6e 74 2d 70 72 6f 63 65 73 73  (current-process
6b70: 2d 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c  -id) signal/kill
6b80: 29 29 29 29 29 29 0a 09 28 28 4b 49 4c 4c 45 44  ))))))..((KILLED
6b90: 29 20 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e  ) .. (debug:prin
6ba0: 74 20 31 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77  t 1 "NOTE: " new
6bb0: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20  -test-name " is 
6bc0: 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 20  already running 
6bd0: 6f 72 20 77 61 73 20 65 78 70 6c 69 63 74 6c 79  or was explictly
6be0: 20 6b 69 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f   killed, use -fo
6bf0: 72 63 65 20 74 6f 20 6c 61 75 6e 63 68 20 69 74  rce to launch it
6c00: 2e 22 29 29 0a 09 28 28 4c 41 55 4e 43 48 45 44  ."))..((LAUNCHED
6c10: 20 52 45 4d 4f 54 45 48 4f 53 54 53 54 41 52 54   REMOTEHOSTSTART
6c20: 20 52 55 4e 4e 49 4e 47 29 20 20 0a 09 20 28 69   RUNNING)  .. (i
6c30: 66 20 28 3e 20 28 2d 20 28 63 75 72 72 65 6e 74  f (> (- (current
6c40: 2d 73 65 63 6f 6e 64 73 29 28 2b 20 28 64 62 3a  -seconds)(+ (db:
6c50: 74 65 73 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74  test-get-event_t
6c60: 69 6d 65 20 74 65 73 74 64 61 74 29 0a 09 09 09  ime testdat)....
6c70: 09 20 20 20 20 20 20 20 28 64 62 3a 74 65 73 74  .       (db:test
6c80: 2d 67 65 74 2d 72 75 6e 5f 64 75 72 61 74 69 6f  -get-run_duratio
6c90: 6e 20 74 65 73 74 64 61 74 29 29 29 0a 09 09 36  n testdat)))...6
6ca0: 30 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75  00) ;; i.e. no u
6cb0: 70 64 61 74 65 20 66 6f 72 20 6d 6f 72 65 20 74  pdate for more t
6cc0: 68 61 6e 20 36 30 30 20 73 65 63 6f 6e 64 73 0a  han 600 seconds.
6cd0: 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20  .     (begin..  
6ce0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
6cf0: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 54 65  t 0 "WARNING: Te
6d00: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22  st " test-name "
6d10: 20 61 70 70 65 61 72 73 20 74 6f 20 62 65 20 64   appears to be d
6d20: 65 61 64 2e 20 46 6f 72 63 69 6e 67 20 69 74 20  ead. Forcing it 
6d30: 74 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c  to state INCOMPL
6d40: 45 54 45 20 61 6e 64 20 73 74 61 74 75 73 20 53  ETE and status S
6d50: 54 55 43 4b 2f 44 45 41 44 22 29 0a 09 20 20 20  TUCK/DEAD")..   
6d60: 20 20 20 20 28 74 65 73 74 2d 73 65 74 2d 73 74      (test-set-st
6d70: 61 74 75 73 21 20 64 62 20 74 65 73 74 2d 69 64  atus! db test-id
6d80: 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22 53   "INCOMPLETE" "S
6d90: 54 55 43 4b 2f 44 45 41 44 22 20 22 54 65 73 74  TUCK/DEAD" "Test
6da0: 20 69 73 20 73 74 75 63 6b 20 6f 72 20 64 65 61   is stuck or dea
6db0: 64 22 20 23 66 29 29 0a 09 20 20 20 20 20 28 64  d" #f))..     (d
6dc0: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f  ebug:print 2 "NO
6dd0: 54 45 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  TE: " test-name 
6de0: 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e  " is already run
6df0: 6e 69 6e 67 22 29 29 29 0a 09 28 65 6c 73 65 20  ning")))..(else 
6e00: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
6e10: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69  nt 0 "ERROR: Fai
6e20: 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 65  led to launch te
6e30: 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61  st " new-test-na
6e40: 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73  me ". Unrecognis
6e50: 65 64 20 73 74 61 74 65 20 22 20 28 74 65 73 74  ed state " (test
6e60: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
6e70: 61 74 29 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d  at)))))))..;;===
6e80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6e90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6ea0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6eb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6ec0: 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e 45  ===.;; END OF NE
6ed0: 57 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d  W STUFF.;;======
6ee0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6ef0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6f00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6f10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6f20: 0a 0a 28 64 65 66 69 6e 65 20 28 67 65 74 2d 64  ..(define (get-d
6f30: 69 72 2d 75 70 2d 6e 20 64 69 72 20 2e 20 70 61  ir-up-n dir . pa
6f40: 72 61 6d 73 29 20 0a 20 20 28 6c 65 74 20 28 28  rams) .  (let ((
6f50: 64 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d  dparts  (string-
6f60: 73 70 6c 69 74 20 64 69 72 20 22 2f 22 29 29 0a  split dir "/")).
6f70: 09 28 63 6f 75 6e 74 20 20 20 28 69 66 20 28 6e  .(count   (if (n
6f80: 75 6c 6c 3f 20 70 61 72 61 6d 73 29 20 31 20 28  ull? params) 1 (
6f90: 63 61 72 20 70 61 72 61 6d 73 29 29 29 29 0a 20  car params)))). 
6fa0: 20 20 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74     (conc "/" (st
6fb0: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
6fc0: 20 0a 09 20 20 20 20 20 20 20 28 74 61 6b 65 20   ..       (take 
6fd0: 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74  dparts (- (lengt
6fe0: 68 20 64 70 61 72 74 73 29 20 63 6f 75 6e 74 29  h dparts) count)
6ff0: 29 0a 09 20 20 20 20 20 20 20 22 2f 22 29 29 29  )..       "/")))
7000: 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73  ).;; Remove runs
7010: 0a 3b 3b 20 66 69 65 6c 64 73 20 61 72 65 20 70  .;; fields are p
7020: 61 73 73 69 6e 67 20 69 6e 20 74 68 72 6f 75 67  assing in throug
7030: 68 20 0a 3b 3b 20 61 63 74 69 6f 6e 3a 0a 3b 3b  h .;; action:.;;
7040: 20 20 20 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73      'remove-runs
7050: 0a 3b 3b 20 20 20 20 27 73 65 74 2d 73 74 61 74  .;;    'set-stat
7060: 65 2d 73 74 61 74 75 73 0a 3b 3b 0a 3b 3b 20 4e  e-status.;;.;; N
7070: 42 2f 2f 20 73 68 6f 75 6c 64 20 70 61 73 73 20  B// should pass 
7080: 69 6e 20 6b 65 79 73 3f 0a 3b 3b 0a 28 64 65 66  in keys?.;;.(def
7090: 69 6e 65 20 28 72 75 6e 73 3a 6f 70 65 72 61 74  ine (runs:operat
70a0: 65 2d 6f 6e 20 64 62 20 61 63 74 69 6f 6e 20 72  e-on db action r
70b0: 75 6e 6e 61 6d 65 70 61 74 74 20 74 65 73 74 70  unnamepatt testp
70c0: 61 74 74 20 69 74 65 6d 70 61 74 74 20 23 21 6b  att itempatt #!k
70d0: 65 79 20 28 73 74 61 74 65 20 23 66 29 28 73 74  ey (state #f)(st
70e0: 61 74 75 73 20 23 66 29 28 6e 65 77 2d 73 74 61  atus #f)(new-sta
70f0: 74 65 2d 73 74 61 74 75 73 20 23 66 29 29 0a 20  te-status #f)). 
7100: 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 20 20 20   (let* ((keys   
7110: 20 20 20 20 20 20 28 72 64 62 3a 67 65 74 2d 6b        (rdb:get-k
7120: 65 79 73 20 64 62 29 29 0a 09 20 28 72 75 6e 64  eys db)).. (rund
7130: 61 74 20 20 20 20 20 20 20 28 72 75 6e 73 3a 67  at       (runs:g
7140: 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20  et-runs-by-patt 
7150: 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70  db keys runnamep
7160: 61 74 74 29 29 0a 09 20 28 68 65 61 64 65 72 20  att)).. (header 
7170: 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65        (vector-re
7180: 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28  f rundat 0)).. (
7190: 72 75 6e 73 20 20 20 20 20 20 20 20 20 28 76 65  runs         (ve
71a0: 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20  ctor-ref rundat 
71b0: 31 29 29 0a 09 20 28 73 74 61 74 65 73 20 20 20  1)).. (states   
71c0: 20 20 20 20 28 69 66 20 73 74 61 74 65 20 20 28      (if state  (
71d0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74 61  string-split sta
71e0: 74 65 20 20 22 2c 22 29 20 27 28 29 29 29 0a 09  te  ",") '()))..
71f0: 20 28 73 74 61 74 75 73 65 73 20 20 20 20 20 28   (statuses     (
7200: 69 66 20 73 74 61 74 75 73 20 28 73 74 72 69 6e  if status (strin
7210: 67 2d 73 70 6c 69 74 20 73 74 61 74 75 73 20 22  g-split status "
7220: 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 74 61  ,") '())).. (sta
7230: 74 65 2d 73 74 61 74 75 73 20 28 69 66 20 28 73  te-status (if (s
7240: 74 72 69 6e 67 3f 20 6e 65 77 2d 73 74 61 74 65  tring? new-state
7250: 2d 73 74 61 74 75 73 29 20 28 73 74 72 69 6e 67  -status) (string
7260: 2d 73 70 6c 69 74 20 6e 65 77 2d 73 74 61 74 65  -split new-state
7270: 2d 73 74 61 74 75 73 20 22 2c 22 29 20 27 28 23  -status ",") '(#
7280: 66 20 23 66 29 29 29 29 0a 20 20 20 20 28 64 65  f #f)))).    (de
7290: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 48 65 61  bug:print 2 "Hea
72a0: 64 65 72 3a 20 22 20 68 65 61 64 65 72 20 22 20  der: " header " 
72b0: 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e  action: " action
72c0: 20 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61   " new-state-sta
72d0: 74 75 73 3a 20 22 20 6e 65 77 2d 73 74 61 74 65  tus: " new-state
72e0: 2d 73 74 61 74 75 73 29 0a 20 20 20 20 28 66 6f  -status).    (fo
72f0: 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d  r-each.     (lam
7300: 62 64 61 20 28 72 75 6e 29 0a 20 20 20 20 20 20  bda (run).      
7310: 20 28 6c 65 74 20 28 28 72 75 6e 6b 65 79 20 28   (let ((runkey (
7320: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72  string-intersper
7330: 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20  se (map (lambda 
7340: 28 6b 29 0a 09 09 09 09 09 09 28 64 62 3a 67 65  (k).......(db:ge
7350: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65  t-value-by-heade
7360: 72 20 72 75 6e 20 68 65 61 64 65 72 20 28 76 65  r run header (ve
7370: 63 74 6f 72 2d 72 65 66 20 6b 20 30 29 29 29 20  ctor-ref k 0))) 
7380: 6b 65 79 73 29 20 22 2f 22 29 29 0a 09 20 20 20  keys) "/"))..   
7390: 20 20 28 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76    (dirs-to-remov
73a0: 65 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62  e (make-hash-tab
73b0: 6c 65 29 29 29 0a 09 20 28 6c 65 74 2a 20 28 28  le))).. (let* ((
73c0: 72 75 6e 2d 69 64 20 20 20 20 28 64 62 3a 67 65  run-id    (db:ge
73d0: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65  t-value-by-heade
73e0: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64  r run header "id
73f0: 22 29 29 0a 09 09 28 72 75 6e 2d 73 74 61 74 65  "))...(run-state
7400: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62   (db:get-value-b
7410: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61  y-header run hea
7420: 64 65 72 20 22 73 74 61 74 65 22 29 29 0a 09 09  der "state"))...
7430: 28 74 65 73 74 73 20 20 20 20 20 28 69 66 20 28  (tests     (if (
7440: 6e 6f 74 20 28 65 71 75 61 6c 3f 20 72 75 6e 2d  not (equal? run-
7450: 73 74 61 74 65 20 22 6c 6f 63 6b 65 64 22 29 29  state "locked"))
7460: 0a 09 09 09 20 20 20 20 20 20 20 28 72 64 62 3a  ....       (rdb:
7470: 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75  get-tests-for-ru
7480: 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c  n db (db:get-val
7490: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
74a0: 20 68 65 61 64 65 72 20 22 69 64 22 29 0a 09 09   header "id")...
74b0: 09 09 09 09 20 20 20 20 20 20 74 65 73 74 70 61  ....      testpa
74c0: 74 74 20 69 74 65 6d 70 61 74 74 20 73 74 61 74  tt itempatt stat
74d0: 65 73 20 73 74 61 74 75 73 65 73 0a 09 09 09 09  es statuses.....
74e0: 09 09 20 20 20 20 20 20 6e 6f 74 2d 69 6e 3a 20  ..      not-in: 
74f0: 20 23 66 0a 09 09 09 09 09 09 20 20 20 20 20 20   #f.......      
7500: 73 6f 72 74 2d 62 79 3a 20 28 63 61 73 65 20 61  sort-by: (case a
7510: 63 74 69 6f 6e 0a 09 09 09 09 09 09 09 09 20 28  ction......... (
7520: 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20 27 72  (remove-runs) 'r
7530: 75 6e 64 69 72 29 0a 09 09 09 09 09 09 09 09 20  undir)......... 
7540: 28 65 6c 73 65 20 20 20 20 20 20 20 20 20 20 27  (else          '
7550: 65 76 65 6e 74 5f 74 69 6d 65 29 29 29 0a 09 09  event_time)))...
7560: 09 20 20 20 20 20 20 20 27 28 29 29 29 0a 09 09  .       '()))...
7570: 28 6c 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65  (lasttpath "/doe
7580: 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f  s/not/exist/I/ho
7590: 70 65 22 29 29 0a 0a 09 20 20 20 28 69 66 20 28  pe"))...   (if (
75a0: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73  not (null? tests
75b0: 29 29 0a 09 20 20 20 20 20 20 20 28 62 65 67 69  ))..       (begi
75c0: 6e 0a 09 09 20 28 63 61 73 65 20 61 63 74 69 6f  n... (case actio
75d0: 6e 0a 09 09 20 20 20 28 28 72 65 6d 6f 76 65 2d  n...   ((remove-
75e0: 72 75 6e 73 29 0a 09 09 20 20 20 20 28 64 65 62  runs)...    (deb
75f0: 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f  ug:print 1 "Remo
7600: 76 69 6e 67 20 74 65 73 74 73 20 66 6f 72 20 72  ving tests for r
7610: 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22  un: " runkey " "
7620: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62   (db:get-value-b
7630: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61  y-header run hea
7640: 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 29  der "runname")))
7650: 0a 09 09 20 20 20 28 28 73 65 74 2d 73 74 61 74  ...   ((set-stat
7660: 65 2d 73 74 61 74 75 73 29 0a 09 09 20 20 20 20  e-status)...    
7670: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
7680: 4d 6f 64 69 66 79 69 6e 67 20 73 74 61 74 65 20  Modifying state 
7690: 61 6e 64 20 73 74 61 75 73 20 66 6f 72 20 74 65  and staus for te
76a0: 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72  sts for run: " r
76b0: 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65  unkey " " (db:ge
76c0: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65  t-value-by-heade
76d0: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75  r run header "ru
76e0: 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28  nname")))...   (
76f0: 65 6c 73 65 0a 09 09 20 20 20 20 28 70 72 69 6e  else...    (prin
7700: 74 20 22 49 4e 46 4f 3a 20 61 63 74 69 6f 6e 20  t "INFO: action 
7710: 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65 64 20 22  not recognised "
7720: 20 61 63 74 69 6f 6e 29 29 29 0a 09 09 20 28 66   action)))... (f
7730: 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d  or-each...  (lam
7740: 62 64 61 20 28 74 65 73 74 29 0a 09 09 20 20 20  bda (test)...   
7750: 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61   (let* ((item-pa
7760: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  th (db:test-get-
7770: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29  item-path test))
7780: 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d  ....   (test-nam
7790: 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74  e (db:test-get-t
77a0: 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09  estname test))..
77b0: 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20  ..   (run-dir   
77c0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e  (db:test-get-run
77d0: 64 69 72 20 74 65 73 74 29 29 29 0a 09 09 20 20  dir test)))...  
77e0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
77f0: 20 31 20 22 20 20 22 20 28 64 62 3a 74 65 73 74   1 "  " (db:test
7800: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65  -get-testname te
7810: 73 74 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a  st) " id: " (db:
7820: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
7830: 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20  ) " " item-path 
7840: 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69  " action: " acti
7850: 6f 6e 29 0a 09 09 20 20 20 20 20 20 28 63 61 73  on)...      (cas
7860: 65 20 61 63 74 69 6f 6e 0a 09 09 09 28 28 72 65  e action....((re
7870: 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 09 09 20 28  move-runs).... (
7880: 72 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 2d  rdb:delete-test-
7890: 72 65 63 6f 72 64 73 20 64 62 20 28 64 62 3a 74  records db (db:t
78a0: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29  est-get-id test)
78b0: 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ).... (debug:pri
78c0: 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 74 74 65  nt 1 "INFO: Atte
78d0: 6d 70 74 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65  mpting to remove
78e0: 20 64 69 72 20 22 20 72 75 6e 2d 64 69 72 29 0a   dir " run-dir).
78f0: 09 09 09 20 28 69 66 20 28 61 6e 64 20 28 3e 20  ... (if (and (> 
7900: 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 72  (string-length r
7910: 75 6e 2d 64 69 72 29 20 35 29 0a 09 09 09 09 20  un-dir) 5)..... 
7920: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72   (file-exists? r
7930: 75 6e 2d 64 69 72 29 29 20 3b 3b 20 62 61 64 20  un-dir)) ;; bad 
7940: 68 65 75 72 69 73 74 69 63 20 62 75 74 20 73 68  heuristic but sh
7950: 6f 75 6c 64 20 70 72 65 76 65 6e 74 20 2f 74 6d  ould prevent /tm
7960: 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09 09  p /home etc.....
7970: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 72 65 61       (let* ((rea
7980: 6c 70 61 74 68 20 28 72 65 73 6f 6c 76 65 2d 70  lpath (resolve-p
7990: 61 74 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72 29  athname run-dir)
79a0: 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 64 65  ))....       (de
79b0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46  bug:print 1 "INF
79c0: 4f 3a 20 52 65 61 6c 20 70 61 74 68 20 6f 66 20  O: Real path of 
79d0: 69 73 20 22 20 72 65 61 6c 70 61 74 68 29 0a 09  is " realpath)..
79e0: 09 09 20 20 20 20 20 20 20 28 69 66 20 28 66 69  ..       (if (fi
79f0: 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c 70  le-exists? realp
7a00: 61 74 68 29 0a 09 09 09 09 20 20 20 28 69 66 20  ath).....   (if 
7a10: 28 3e 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63  (> (system (conc
7a20: 20 22 72 6d 20 2d 72 66 20 22 20 72 65 61 6c 70   "rm -rf " realp
7a30: 61 74 68 29 29 20 30 29 0a 09 09 09 09 20 20 20  ath)) 0).....   
7a40: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
7a50: 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 72 65   0 "ERROR: There
7a60: 20 77 61 73 20 61 20 70 72 6f 62 6c 65 6d 20 72   was a problem r
7a70: 65 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c 70 61  emoving " realpa
7a80: 74 68 20 22 20 77 69 74 68 20 72 6d 20 2d 66 22  th " with rm -f"
7a90: 29 29 0a 09 09 09 09 20 20 20 28 64 65 62 75 67  )).....   (debug
7aa0: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e  :print 0 "WARNIN
7ab0: 47 3a 20 74 65 73 74 20 72 75 6e 20 64 69 72 20  G: test run dir 
7ac0: 22 20 72 65 61 6c 70 61 74 68 20 22 20 61 70 70  " realpath " app
7ad0: 65 61 72 73 20 74 6f 20 6e 6f 74 20 65 78 69 73  ears to not exis
7ae0: 74 22 29 29 0a 09 09 09 20 20 20 20 20 20 20 28  t"))....       (
7af0: 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f  if (file-exists?
7b00: 20 72 75 6e 2d 64 69 72 29 20 3b 3b 20 74 68 65   run-dir) ;; the
7b10: 20 6c 69 6e 6b 0a 09 09 09 09 20 20 20 28 69 66   link.....   (if
7b20: 20 28 73 79 6d 62 6f 6c 69 63 2d 6c 69 6e 6b 3f   (symbolic-link?
7b30: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 20 20   run-dir).....  
7b40: 20 20 20 20 20 28 64 65 6c 65 74 65 2d 66 69 6c       (delete-fil
7b50: 65 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 20  e run-dir)..... 
7b60: 20 20 20 20 20 20 28 69 66 20 28 64 69 72 65 63        (if (direc
7b70: 74 6f 72 79 3f 20 72 75 6e 2d 64 69 72 29 0a 09  tory? run-dir)..
7b80: 09 09 09 09 20 20 20 28 69 66 20 28 3e 20 28 64  ....   (if (> (d
7b90: 69 72 65 63 74 6f 72 79 2d 66 6f 6c 64 20 28 6c  irectory-fold (l
7ba0: 61 6d 62 64 61 20 28 66 20 78 29 28 2b 20 31 20  ambda (f x)(+ 1 
7bb0: 78 29 29 20 30 20 72 75 6e 2d 64 69 72 29 20 30  x)) 0 run-dir) 0
7bc0: 29 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 64  )......       (d
7bd0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41  ebug:print 0 "WA
7be0: 52 4e 49 4e 47 3a 20 72 65 66 75 73 69 6e 67 20  RNING: refusing 
7bf0: 74 6f 20 72 65 6d 6f 76 65 20 22 20 72 75 6e 2d  to remove " run-
7c00: 64 69 72 20 22 20 61 73 20 69 74 20 69 73 20 6e  dir " as it is n
7c10: 6f 74 20 65 6d 70 74 79 22 29 0a 09 09 09 09 09  ot empty")......
7c20: 20 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d 64         (delete-d
7c30: 69 72 65 63 74 6f 72 79 20 72 75 6e 2d 64 69 72  irectory run-dir
7c40: 29 29 20 3b 3b 20 69 74 20 73 68 6f 75 6c 64 20  )) ;; it should 
7c50: 62 65 20 65 6d 70 74 79 20 62 79 20 68 65 72 65  be empty by here
7c60: 20 42 55 47 20 42 55 47 2c 20 61 64 64 20 65 72   BUG BUG, add er
7c70: 72 6f 72 20 63 61 74 63 68 0a 09 09 09 09 09 20  ror catch...... 
7c80: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
7c90: 20 22 45 52 52 4f 52 3a 20 72 65 66 75 73 69 6e   "ERROR: refusin
7ca0: 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72 75  g to remove " ru
7cb0: 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20 69 73  n-dir " as it is
7cc0: 20 6e 65 69 74 68 65 72 20 61 20 73 79 6d 6c 69   neither a symli
7cd0: 6e 6b 20 6e 6f 72 20 61 20 64 69 72 65 63 74 6f  nk nor a directo
7ce0: 72 79 22 29 0a 09 09 09 09 09 20 20 20 29 29 29  ry")......   )))
7cf0: 29 0a 09 09 09 20 20 20 20 20 28 64 65 62 75 67  )....     (debug
7d00: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e  :print 0 "WARNIN
7d10: 47 3a 20 64 69 72 65 63 74 6f 72 79 20 61 6c 72  G: directory alr
7d20: 65 61 64 79 20 72 65 6d 6f 76 65 64 20 22 20 72  eady removed " r
7d30: 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 28 28 73  un-dir)))....((s
7d40: 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29  et-state-status)
7d50: 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e  .... (debug:prin
7d60: 74 20 32 20 22 49 4e 46 4f 3a 20 6e 65 77 20 73  t 2 "INFO: new s
7d70: 74 61 74 65 20 22 20 28 63 61 72 20 73 74 61 74  tate " (car stat
7d80: 65 2d 73 74 61 74 75 73 29 20 22 2c 20 6e 65 77  e-status) ", new
7d90: 20 73 74 61 74 75 73 20 22 20 28 63 61 64 72 20   status " (cadr 
7da0: 73 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a 09  state-status))..
7db0: 09 09 20 28 64 62 3a 74 65 73 74 2d 73 65 74 2d  .. (db:test-set-
7dc0: 73 74 61 74 65 2d 73 74 61 74 75 73 2d 62 79 2d  state-status-by-
7dd0: 69 64 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67  id db (db:test-g
7de0: 65 74 2d 69 64 20 74 65 73 74 29 20 28 63 61 72  et-id test) (car
7df0: 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 28 63   state-status)(c
7e00: 61 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 73  adr state-status
7e10: 29 20 23 66 29 29 29 29 29 0a 09 09 20 20 74 65  ) #f)))))...  te
7e20: 73 74 73 29 29 29 0a 09 20 20 20 0a 09 20 20 20  sts)))..   ..   
7e30: 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65 20 72 75  ;; remove the ru
7e40: 6e 20 69 66 20 7a 65 72 6f 20 74 65 73 74 73 20  n if zero tests 
7e50: 72 65 6d 61 69 6e 0a 09 20 20 20 28 69 66 20 28  remain..   (if (
7e60: 65 71 3f 20 61 63 74 69 6f 6e 20 27 72 65 6d 6f  eq? action 'remo
7e70: 76 65 2d 72 75 6e 73 29 0a 09 20 20 20 20 20 20  ve-runs)..      
7e80: 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73   (let ((remtests
7e90: 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74 73 2d   (rdb:get-tests-
7ea0: 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67  for-run db (db:g
7eb0: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
7ec0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69  er run header "i
7ed0: 64 22 29 20 23 66 20 23 66 20 27 28 29 20 27 28  d") #f #f '() '(
7ee0: 29 29 29 29 0a 09 09 20 28 69 66 20 28 6e 75 6c  ))))... (if (nul
7ef0: 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b 20  l? remtests) ;; 
7f00: 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72 65  no more tests re
7f10: 6d 61 69 6e 69 6e 67 0a 09 09 20 20 20 20 20 28  maining...     (
7f20: 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 28  let* ((dparts  (
7f30: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73  string-split las
7f40: 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09  ttpath "/"))....
7f50: 20 20 20 20 28 72 75 6e 70 61 74 68 20 28 63 6f      (runpath (co
7f60: 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69  nc "/" (string-i
7f70: 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 09  ntersperse .....
7f80: 09 09 28 74 61 6b 65 20 64 70 61 72 74 73 20 28  ..(take dparts (
7f90: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73  - (length dparts
7fa0: 29 20 31 29 29 0a 09 09 09 09 09 09 22 2f 22 29  ) 1))......."/")
7fb0: 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 64 65  )))...       (de
7fc0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d  bug:print 1 "Rem
7fd0: 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e  oving run: " run
7fe0: 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d  key " " (db:get-
7ff0: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
8000: 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e  run header "runn
8010: 61 6d 65 22 29 29 0a 09 09 20 20 20 20 20 20 20  ame"))...       
8020: 28 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e 20 64  (db:delete-run d
8030: 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 20  b run-id)...    
8040: 20 20 20 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69     ;; need to fi
8050: 67 75 72 65 20 6f 75 74 20 74 68 65 20 70 61 74  gure out the pat
8060: 68 20 74 6f 20 74 68 65 20 72 75 6e 20 64 69 72  h to the run dir
8070: 20 61 6e 64 20 72 65 6d 6f 76 65 20 69 74 20 69   and remove it i
8080: 66 20 65 6d 70 74 79 0a 09 09 20 20 20 20 20 20  f empty...      
8090: 20 3b 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c   ;;    (if (null
80a0: 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75  ? (glob (conc ru
80b0: 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09  npath "/*")))...
80c0: 20 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20         ;;       
80d0: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 20   (begin...      
80e0: 20 3b 3b 20 09 20 28 64 65 62 75 67 3a 70 72 69   ;; . (debug:pri
80f0: 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72  nt 1 "Removing r
8100: 75 6e 20 64 69 72 20 22 20 72 75 6e 70 61 74 68  un dir " runpath
8110: 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20  )...       ;; . 
8120: 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72  (system (conc "r
8130: 6d 64 69 72 20 2d 70 20 22 20 72 75 6e 70 61 74  mdir -p " runpat
8140: 68 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 29  h))))...       )
8150: 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20 20 72  )))).. )).     r
8160: 75 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d  uns)))..;;======
8170: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8180: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8190: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
81a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
81b0: 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f 72  .;; Routines for
81c0: 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 72 75   manipulating ru
81d0: 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ns.;;===========
81e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
81f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8200: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8210: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20  ===========..;; 
8220: 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73  Since many calls
8230: 20 74 6f 20 61 20 72 75 6e 20 72 65 71 75 69 72   to a run requir
8240: 65 20 70 72 65 74 74 79 20 6d 75 63 68 20 74 68  e pretty much th
8250: 65 20 73 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b  e same setup .;;
8260: 20 74 68 69 73 20 77 72 61 70 70 65 72 20 69 73   this wrapper is
8270: 20 75 73 65 64 20 74 6f 20 72 65 64 75 63 65 20   used to reduce 
8280: 74 68 65 20 72 65 70 6c 69 63 61 74 69 6f 6e 20  the replication 
8290: 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 6e 65 20  of code.(define 
82a0: 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c  (general-run-cal
82b0: 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 61 63 74  l switchname act
82c0: 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a 20  ion-desc proc). 
82d0: 20 28 6c 65 74 20 28 28 72 75 6e 6e 61 6d 65 20   (let ((runname 
82e0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a  (args:get-arg ":
82f0: 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28 74 61 72  runname"))..(tar
8300: 67 65 74 20 20 28 69 66 20 28 61 72 67 73 3a 67  get  (if (args:g
8310: 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22  et-arg "-target"
8320: 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a 67  )...     (args:g
8330: 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22  et-arg "-target"
8340: 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a 67  )...     (args:g
8350: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67  et-arg "-reqtarg
8360: 22 29 29 29 0a 09 28 74 68 31 20 20 20 20 20 23  ")))..(th1     #
8370: 66 29 29 0a 20 20 20 20 28 63 6f 6e 64 0a 20 20  f)).    (cond.  
8380: 20 20 20 28 28 6e 6f 74 20 74 61 72 67 65 74 29     ((not target)
8390: 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
83a0: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69  int 0 "ERROR: Mi
83b0: 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70  ssing required p
83c0: 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73  arameter for " s
83d0: 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75  witchname ", you
83e0: 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68   must specify th
83f0: 65 20 74 61 72 67 65 74 20 77 69 74 68 20 2d 74  e target with -t
8400: 61 72 67 65 74 22 29 0a 20 20 20 20 20 20 28 65  arget").      (e
8410: 78 69 74 20 33 29 29 0a 20 20 20 20 20 28 28 6e  xit 3)).     ((n
8420: 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20  ot runname).    
8430: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
8440: 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67   "ERROR: Missing
8450: 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d 65   required parame
8460: 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 63 68  ter for " switch
8470: 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74  name ", you must
8480: 20 73 70 65 63 69 66 79 20 74 68 65 20 72 75 6e   specify the run
8490: 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 75 6e 6e   name with :runn
84a0: 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a 20 20  ame runname").  
84b0: 20 20 20 20 28 65 78 69 74 20 33 29 29 0a 20 20      (exit 3)).  
84c0: 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 28     (else.      (
84d0: 6c 65 74 20 28 28 64 62 20 20 20 23 66 29 0a 09  let ((db   #f)..
84e0: 20 20 20 20 28 6b 65 79 73 20 23 66 29 29 0a 09      (keys #f))..
84f0: 28 69 66 20 28 6e 6f 74 20 28 73 65 74 75 70 2d  (if (not (setup-
8500: 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 20 28  for-run))..    (
8510: 62 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64  begin ..      (d
8520: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 46 61  ebug:print 0 "Fa
8530: 69 6c 65 64 20 74 6f 20 73 65 74 75 70 2c 20 65  iled to setup, e
8540: 78 69 74 69 6e 67 22 29 0a 09 20 20 20 20 20 20  xiting")..      
8550: 28 65 78 69 74 20 31 29 29 29 0a 09 28 73 65 74  (exit 1)))..(set
8560: 21 20 64 62 20 20 20 28 6f 70 65 6e 2d 64 62 29  ! db   (open-db)
8570: 29 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 74  )..(if (args:get
8580: 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 0a  -arg "-server").
8590: 09 20 20 20 20 28 73 65 72 76 65 72 3a 73 74 61  .    (server:sta
85a0: 72 74 20 64 62 20 28 61 72 67 73 3a 67 65 74 2d  rt db (args:get-
85b0: 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 29 0a  arg "-server")).
85c0: 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6f  .    (if (not (o
85d0: 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  r (args:get-arg 
85e0: 22 2d 72 75 6e 61 6c 6c 22 29 0a 09 09 09 20 20  "-runall")....  
85f0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
8600: 72 75 6e 74 65 73 74 73 22 29 29 29 0a 09 09 28  runtests")))...(
8610: 73 65 72 76 65 72 3a 63 6c 69 65 6e 74 2d 73 65  server:client-se
8620: 74 75 70 20 64 62 29 29 29 0a 09 28 73 65 74 21  tup db)))..(set!
8630: 20 6b 65 79 73 20 28 72 64 62 3a 67 65 74 2d 6b   keys (rdb:get-k
8640: 65 79 73 20 64 62 29 29 0a 09 3b 3b 20 68 61 76  eys db))..;; hav
8650: 65 20 65 6e 6f 75 67 68 20 74 6f 20 70 72 6f 63  e enough to proc
8660: 65 73 73 20 2d 74 61 72 67 65 74 20 6f 72 20 2d  ess -target or -
8670: 72 65 71 74 61 72 67 20 68 65 72 65 0a 09 28 69  reqtarg here..(i
8680: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  f (args:get-arg 
8690: 22 2d 72 65 71 74 61 72 67 22 29 0a 09 20 20 20  "-reqtarg")..   
86a0: 20 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f 6e 66   (let* ((runconf
86b0: 69 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70  igf (conc  *topp
86c0: 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67  ath* "/runconfig
86d0: 73 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b 20 44  s.config")) ;; D
86e0: 4f 20 4e 4f 54 20 45 56 41 4c 55 41 54 45 20 41  O NOT EVALUATE A
86f0: 4c 4c 20 0a 09 09 20 20 20 28 72 75 6e 63 6f 6e  LL ...   (runcon
8700: 66 69 67 20 20 28 72 65 61 64 2d 63 6f 6e 66 69  fig  (read-confi
8710: 67 20 72 75 6e 63 6f 6e 66 69 67 66 20 23 66 20  g runconfigf #f 
8720: 23 66 20 65 6e 76 69 72 6f 6e 2d 70 61 74 74 3a  #f environ-patt:
8730: 20 23 66 29 29 29 20 0a 09 20 20 20 20 20 20 28   #f))) ..      (
8740: 69 66 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72  if (hash-table-r
8750: 65 66 2f 64 65 66 61 75 6c 74 20 72 75 6e 63 6f  ef/default runco
8760: 6e 66 69 67 20 28 61 72 67 73 3a 67 65 74 2d 61  nfig (args:get-a
8770: 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 23  rg "-reqtarg") #
8780: 66 29 0a 09 09 20 20 28 6b 65 79 73 3a 74 61 72  f)...  (keys:tar
8790: 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79  get-set-args key
87a0: 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  s (args:get-arg 
87b0: 22 2d 72 65 71 74 61 72 67 22 29 20 61 72 67 73  "-reqtarg") args
87c0: 3a 61 72 67 2d 68 61 73 68 29 0a 09 09 20 20 28  :arg-hash)...  (
87d0: 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65 62  begin...    (deb
87e0: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
87f0: 52 3a 20 5b 22 20 28 61 72 67 73 3a 67 65 74 2d  R: [" (args:get-
8800: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20  arg "-reqtarg") 
8810: 22 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69 6e 20  "] not found in 
8820: 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 09  " runconfigf)...
8830: 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 69 6e      (sqlite3:fin
8840: 61 6c 69 7a 65 21 20 64 62 29 0a 09 09 20 20 20  alize! db)...   
8850: 20 28 65 78 69 74 20 31 29 29 29 29 0a 09 20 20   (exit 1))))..  
8860: 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d    (if (args:get-
8870: 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09  arg "-target")..
8880: 09 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65  .(keys:target-se
8890: 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 67  t-args keys (arg
88a0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67  s:get-arg "-targ
88b0: 65 74 22 20 61 72 67 73 3a 61 72 67 2d 68 61 73  et" args:arg-has
88c0: 68 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68  h) args:arg-hash
88d0: 29 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 63  )))..(if (not (c
88e0: 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29  ar *configinfo*)
88f0: 29 0a 09 20 20 20 20 28 62 65 67 69 6e 0a 09 20  )..    (begin.. 
8900: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
8910: 74 20 30 20 22 45 52 52 4f 52 3a 20 41 74 74 65  t 0 "ERROR: Atte
8920: 6d 70 74 65 64 20 74 6f 20 22 20 61 63 74 69 6f  mpted to " actio
8930: 6e 2d 64 65 73 63 20 22 20 62 75 74 20 72 75 6e  n-desc " but run
8940: 20 61 72 65 61 20 63 6f 6e 66 69 67 20 66 69 6c   area config fil
8950: 65 20 6e 6f 74 20 66 6f 75 6e 64 22 29 0a 09 20  e not found").. 
8960: 20 20 20 20 20 28 65 78 69 74 20 31 29 29 0a 09       (exit 1))..
8970: 20 20 20 20 3b 3b 20 45 78 74 72 61 63 74 20 6f      ;; Extract o
8980: 75 74 20 73 74 75 66 66 20 6e 65 65 64 65 64 20  ut stuff needed 
8990: 69 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 20  in most or many 
89a0: 63 61 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 68 65  calls..    ;; he
89b0: 72 65 20 74 68 65 6e 20 63 61 6c 6c 20 70 72 6f  re then call pro
89c0: 63 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 6b  c..    (let* ((k
89d0: 65 79 6e 61 6d 65 73 20 20 20 28 6d 61 70 20 6b  eynames   (map k
89e0: 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65  ey:get-fieldname
89f0: 20 6b 65 79 73 29 29 0a 09 09 20 20 20 28 6b 65   keys))...   (ke
8a00: 79 76 61 6c 6c 73 74 20 20 28 6b 65 79 73 2d 3e  yvallst  (keys->
8a10: 76 61 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 29  vallist keys #t)
8a20: 29 29 0a 09 20 20 20 20 20 20 28 70 72 6f 63 20  ))..      (proc 
8a30: 64 62 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d  db target runnam
8a40: 65 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73 20  e keys keynames 
8a50: 6b 65 79 76 61 6c 6c 73 74 29 29 29 0a 09 28 69  keyvallst)))..(i
8a60: 66 20 74 68 31 20 28 74 68 72 65 61 64 2d 6a 6f  f th1 (thread-jo
8a70: 69 6e 21 20 74 68 31 29 29 0a 09 28 73 71 6c 69  in! th1))..(sqli
8a80: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62  te3:finalize! db
8a90: 29 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f 6d  )..(set! *didsom
8aa0: 65 74 68 69 6e 67 2a 20 23 74 29 29 29 29 29 29  ething* #t))))))
8ab0: 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ..;;============
8ac0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8ad0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8ae0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8af0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c 6f  ==========.;; Lo
8b00: 63 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73 0a 3b  ck/unlock runs.;
8b10: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;===============
8b20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b50: 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65  =======..(define
8b60: 20 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d 6c 6f   (runs:handle-lo
8b70: 63 6b 69 6e 67 20 64 62 20 74 61 72 67 65 74 20  cking db target 
8b80: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 20 6c 6f 63  keys runname loc
8b90: 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 20  k unlock user). 
8ba0: 20 28 6c 65 74 2a 20 28 28 72 75 6e 64 61 74 20   (let* ((rundat 
8bb0: 20 20 28 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73    (runs:get-runs
8bc0: 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73  -by-patt db keys
8bd0: 20 72 75 6e 6e 61 6d 65 29 29 0a 09 20 28 68 65   runname)).. (he
8be0: 61 64 65 72 20 20 20 28 76 65 63 74 6f 72 2d 72  ader   (vector-r
8bf0: 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20  ef rundat 0)).. 
8c00: 28 72 75 6e 73 20 20 20 20 20 28 76 65 63 74 6f  (runs     (vecto
8c10: 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29 29  r-ref rundat 1))
8c20: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20  ).    (for-each 
8c30: 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 09 09  (lambda (run)...
8c40: 28 6c 65 74 20 28 28 72 75 6e 2d 69 64 20 28 64  (let ((run-id (d
8c50: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
8c60: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
8c70: 20 22 69 64 22 29 29 29 0a 09 09 20 20 28 69 66   "id")))...  (if
8c80: 20 28 6f 72 20 6c 6f 63 6b 0a 09 09 09 20 20 28   (or lock....  (
8c90: 61 6e 64 20 75 6e 6c 6f 63 6b 0a 09 09 09 20 20  and unlock....  
8ca0: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09       (begin.....
8cb0: 20 28 70 72 69 6e 74 20 22 44 6f 20 79 6f 75 20   (print "Do you 
8cc0: 72 65 61 6c 6c 79 20 77 69 73 68 20 74 6f 20 75  really wish to u
8cd0: 6e 6c 6f 63 6b 20 72 75 6e 20 22 20 72 75 6e 2d  nlock run " run-
8ce0: 69 64 20 22 3f 5c 6e 20 20 20 79 2f 6e 3a 20 22  id "?\n   y/n: "
8cf0: 29 0a 09 09 09 09 20 28 65 71 75 61 6c 3f 20 22  )..... (equal? "
8d00: 79 22 20 28 72 65 61 64 2d 6c 69 6e 65 29 29 29  y" (read-line)))
8d10: 29 29 0a 09 09 20 20 20 20 20 20 28 64 62 3a 6c  ))...      (db:l
8d20: 6f 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 75 6e 20 64  ock/unlock-run d
8d30: 62 20 72 75 6e 2d 69 64 20 6c 6f 63 6b 20 75 6e  b run-id lock un
8d40: 6c 6f 63 6b 20 75 73 65 72 29 0a 09 09 20 20 20  lock user)...   
8d50: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
8d60: 30 20 22 49 4e 46 4f 3a 20 53 6b 69 70 70 69 6e  0 "INFO: Skippin
8d70: 67 20 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e  g lock/unlock on
8d80: 20 22 20 72 75 6e 2d 69 64 29 29 29 29 0a 09 20   " run-id)))).. 
8d90: 20 20 20 20 20 72 75 6e 73 29 29 29 0a 3b 3b 3d       runs))).;;=
8da0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8db0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8dc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8dd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8de0: 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20  =====.;; Rollup 
8df0: 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d  runs.;;=========
8e00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8e10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8e20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8e30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b  =============..;
8e40: 3b 20 55 70 64 61 74 65 20 74 68 65 20 74 65 73  ; Update the tes
8e50: 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 66 6f 72  t_meta table for
8e60: 20 74 68 69 73 20 74 65 73 74 0a 28 64 65 66 69   this test.(defi
8e70: 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d  ne (runs:update-
8e80: 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73  test_meta db tes
8e90: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66  t-name test-conf
8ea0: 29 0a 20 20 28 6c 65 74 20 28 28 63 75 72 72 72  ).  (let ((currr
8eb0: 65 63 6f 72 64 20 28 64 62 3a 74 65 73 74 6d 65  ecord (db:testme
8ec0: 74 61 2d 67 65 74 2d 72 65 63 6f 72 64 20 64 62  ta-get-record db
8ed0: 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20   test-name))).  
8ee0: 20 20 28 69 66 20 28 6e 6f 74 20 63 75 72 72 72    (if (not currr
8ef0: 65 63 6f 72 64 29 0a 09 28 62 65 67 69 6e 0a 09  ecord)..(begin..
8f00: 20 20 28 73 65 74 21 20 63 75 72 72 72 65 63 6f    (set! currreco
8f10: 72 64 20 28 6d 61 6b 65 2d 76 65 63 74 6f 72 20  rd (make-vector 
8f20: 31 30 20 23 66 29 29 0a 09 20 20 28 64 62 3a 74  10 #f))..  (db:t
8f30: 65 73 74 6d 65 74 61 2d 61 64 64 2d 72 65 63 6f  estmeta-add-reco
8f40: 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29  rd db test-name)
8f50: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  )).    (for-each
8f60: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28   .     (lambda (
8f70: 6b 65 79 29 0a 20 20 20 20 20 20 20 28 6c 65 74  key).       (let
8f80: 2a 20 28 28 69 64 78 20 28 63 61 64 72 20 6b 65  * ((idx (cadr ke
8f90: 79 29 29 0a 09 20 20 20 20 20 20 28 66 6c 64 20  y))..      (fld 
8fa0: 28 63 61 72 20 20 6b 65 79 29 29 0a 09 20 20 20  (car  key))..   
8fb0: 20 20 20 28 76 61 6c 20 28 63 6f 6e 66 69 67 2d     (val (config-
8fc0: 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66  lookup test-conf
8fd0: 20 22 74 65 73 74 5f 6d 65 74 61 22 20 66 6c 64   "test_meta" fld
8fe0: 29 29 29 0a 09 20 3b 3b 20 28 64 65 62 75 67 3a  ))).. ;; (debug:
8ff0: 70 72 69 6e 74 20 35 20 22 69 64 78 3a 20 22 20  print 5 "idx: " 
9000: 69 64 78 20 22 20 66 6c 64 3a 20 22 20 66 6c 64  idx " fld: " fld
9010: 20 22 20 76 61 6c 3a 20 22 20 76 61 6c 29 0a 09   " val: " val)..
9020: 20 28 69 66 20 28 61 6e 64 20 76 61 6c 20 28 6e   (if (and val (n
9030: 6f 74 20 28 65 71 75 61 6c 3f 20 28 76 65 63 74  ot (equal? (vect
9040: 6f 72 2d 72 65 66 20 63 75 72 72 72 65 63 6f 72  or-ref currrecor
9050: 64 20 69 64 78 29 20 76 61 6c 29 29 29 0a 09 20  d idx) val))).. 
9060: 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20      (begin..    
9070: 20 20 20 28 70 72 69 6e 74 20 22 55 70 64 61 74     (print "Updat
9080: 69 6e 67 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  ing " test-name 
9090: 22 20 22 20 66 6c 64 20 22 20 74 6f 20 22 20 76  " " fld " to " v
90a0: 61 6c 29 0a 09 20 20 20 20 20 20 20 28 64 62 3a  al)..       (db:
90b0: 74 65 73 74 6d 65 74 61 2d 75 70 64 61 74 65 2d  testmeta-update-
90c0: 66 69 65 6c 64 20 64 62 20 74 65 73 74 2d 6e 61  field db test-na
90d0: 6d 65 20 66 6c 64 20 76 61 6c 29 29 29 29 29 0a  me fld val))))).
90e0: 20 20 20 20 20 27 28 28 22 61 75 74 68 6f 72 22       '(("author"
90f0: 20 32 29 28 22 6f 77 6e 65 72 22 20 33 29 28 22   2)("owner" 3)("
9100: 64 65 73 63 72 69 70 74 69 6f 6e 22 20 34 29 28  description" 4)(
9110: 22 72 65 76 69 65 77 65 64 22 20 35 29 28 22 74  "reviewed" 5)("t
9120: 61 67 73 22 20 39 29 29 29 29 29 0a 0a 3b 3b 20  ags" 9)))))..;; 
9130: 55 70 64 61 74 65 20 74 65 73 74 5f 6d 65 74 61  Update test_meta
9140: 20 66 6f 72 20 61 6c 6c 20 74 65 73 74 73 0a 28   for all tests.(
9150: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64  define (runs:upd
9160: 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65 74  ate-all-test_met
9170: 61 20 64 62 29 0a 20 20 28 6c 65 74 20 28 28 74  a db).  (let ((t
9180: 65 73 74 2d 6e 61 6d 65 73 20 28 67 65 74 2d 61  est-names (get-a
9190: 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73 29 29  ll-legal-tests))
91a0: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20  ).    (for-each 
91b0: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74  .     (lambda (t
91c0: 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20  est-name).      
91d0: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 70 61   (let* ((test-pa
91e0: 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70  th    (conc *top
91f0: 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20  path* "/tests/" 
9200: 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20 20 20  test-name))..   
9210: 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 69 67 66     (test-configf
9220: 20 28 63 6f 6e 63 20 74 65 73 74 2d 70 61 74 68   (conc test-path
9230: 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29   "/testconfig"))
9240: 0a 09 20 20 20 20 20 20 28 74 65 73 74 65 78 69  ..      (testexi
9250: 73 74 73 20 20 20 28 61 6e 64 20 28 66 69 6c 65  sts   (and (file
9260: 2d 65 78 69 73 74 73 3f 20 74 65 73 74 2d 63 6f  -exists? test-co
9270: 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 65 61 64  nfigf)(file-read
9280: 2d 61 63 63 65 73 73 3f 20 74 65 73 74 2d 63 6f  -access? test-co
9290: 6e 66 69 67 66 29 29 29 0a 09 20 20 20 20 20 20  nfigf)))..      
92a0: 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69 67 73 20  ;; read configs 
92b0: 77 69 74 68 20 74 72 69 63 6b 73 20 74 75 72 6e  with tricks turn
92c0: 65 64 20 6f 66 66 20 28 69 2e 65 2e 20 6e 6f 20  ed off (i.e. no 
92d0: 73 79 73 74 65 6d 29 0a 09 20 20 20 20 20 20 28  system)..      (
92e0: 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 69 66  test-conf    (if
92f0: 20 74 65 73 74 65 78 69 73 74 73 20 28 72 65 61   testexists (rea
9300: 64 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f  d-config test-co
9310: 6e 66 69 67 66 20 23 66 20 23 66 29 28 6d 61 6b  nfigf #f #f)(mak
9320: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 29  e-hash-table))))
9330: 0a 09 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d  .. (runs:update-
9340: 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73  test_meta db tes
9350: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66  t-name test-conf
9360: 29 29 29 0a 20 20 20 20 20 74 65 73 74 2d 6e 61  ))).     test-na
9370: 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20  mes)))..;; This 
9380: 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79 20 62  could probably b
9390: 65 20 72 65 66 61 63 74 6f 72 65 64 20 69 6e 74  e refactored int
93a0: 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75  o one complex qu
93b0: 65 72 79 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20  ery ....(define 
93c0: 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e  (runs:rollup-run
93d0: 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c   db keys keyvall
93e0: 73 74 20 72 75 6e 6e 61 6d 65 20 75 73 65 72 29  st runname user)
93f0: 20 3b 3b 20 77 61 73 20 74 61 72 67 65 74 2c 20   ;; was target, 
9400: 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74 0a 20 20  now keyvallst.  
9410: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22  (debug:print 4 "
9420: 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c  runs:rollup-run,
9430: 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22 20   keys: " keys " 
9440: 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79  keyvallst: " key
9450: 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e 6e 61 6d  vallst " :runnam
9460: 65 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 75 73  e " runname " us
9470: 65 72 3a 20 22 20 75 73 65 72 29 0a 20 20 28 6c  er: " user).  (l
9480: 65 74 2a 20 28 3b 20 28 6b 65 79 76 61 6c 6c 6c  et* (; (keyvalll
9490: 73 74 20 20 20 20 20 20 28 6b 65 79 73 3a 74 61  st      (keys:ta
94a0: 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79  rget->keyval key
94b0: 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 6e 65  s target)).. (ne
94c0: 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 20 28 72  w-run-id      (r
94d0: 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e  uns:register-run
94e0: 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c   db keys keyvall
94f0: 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22  st runname "new"
9500: 20 22 6e 2f 61 22 20 75 73 65 72 29 29 0a 09 20   "n/a" user)).. 
9510: 28 70 72 65 76 2d 74 65 73 74 73 20 20 20 20 20  (prev-tests     
9520: 20 28 74 65 73 74 3a 67 65 74 2d 6d 61 74 63 68   (test:get-match
9530: 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d 74 65 73  ing-previous-tes
9540: 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 62  t-run-records db
9550: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20   new-run-id "%" 
9560: 22 25 22 29 29 0a 09 20 28 63 75 72 72 2d 74 65  "%")).. (curr-te
9570: 73 74 73 20 20 20 20 20 20 28 72 64 62 3a 67 65  sts      (rdb:ge
9580: 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20  t-tests-for-run 
9590: 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25  db new-run-id "%
95a0: 22 20 22 25 22 20 27 28 29 20 27 28 29 29 29 0a  " "%" '() '())).
95b0: 09 20 28 63 75 72 72 2d 74 65 73 74 73 2d 68 61  . (curr-tests-ha
95c0: 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61  sh (make-hash-ta
95d0: 62 6c 65 29 29 29 0a 20 20 20 20 28 64 62 3a 75  ble))).    (db:u
95e0: 70 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e 74 5f  pdate-run-event_
95f0: 74 69 6d 65 20 64 62 20 6e 65 77 2d 72 75 6e 2d  time db new-run-
9600: 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64 65 78  id).    ;; index
9610: 20 74 68 65 20 61 6c 72 65 61 64 79 20 73 61 76   the already sav
9620: 65 64 20 74 65 73 74 73 20 62 79 20 74 65 73 74  ed tests by test
9630: 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d 64 61 74  name and itemdat
9640: 20 69 6e 20 63 75 72 72 2d 74 65 73 74 73 2d 68   in curr-tests-h
9650: 61 73 68 0a 20 20 20 20 28 66 6f 72 2d 65 61 63  ash.    (for-eac
9660: 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28  h.     (lambda (
9670: 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20  testdat).       
9680: 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65  (let* ((testname
9690: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74    (db:test-get-t
96a0: 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29  estname testdat)
96b0: 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70  )..      (item-p
96c0: 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ath (db:test-get
96d0: 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64  -item-path testd
96e0: 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c  at))..      (ful
96f0: 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73  l-name (conc tes
9700: 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70  tname "/" item-p
9710: 61 74 68 29 29 29 0a 09 20 28 68 61 73 68 2d 74  ath))).. (hash-t
9720: 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74  able-set! curr-t
9730: 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e  ests-hash full-n
9740: 61 6d 65 20 74 65 73 74 64 61 74 29 29 29 0a 20  ame testdat))). 
9750: 20 20 20 20 63 75 72 72 2d 74 65 73 74 73 29 0a      curr-tests).
9760: 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e      ;; NOPE: Non
9770: 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f 61 63  -optimal approac
9780: 68 2e 20 54 72 79 20 74 68 69 73 20 69 6e 73 74  h. Try this inst
9790: 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20 31 2e  ead..    ;;   1.
97a0: 20 74 65 73 74 73 20 61 72 65 20 72 65 63 65 69   tests are recei
97b0: 76 65 64 20 69 6e 20 61 20 6c 69 73 74 2c 20 6d  ved in a list, m
97c0: 6f 73 74 20 72 65 63 65 6e 74 20 66 69 72 73 74  ost recent first
97d0: 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 72 65 70  .    ;;   2. rep
97e0: 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c 75 70 20  lace the rollup 
97f0: 74 65 73 74 20 77 69 74 68 20 74 68 65 20 6e 65  test with the ne
9800: 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20 20 28  w *always*.    (
9810: 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28  for-each .     (
9820: 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29  lambda (testdat)
9830: 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28  .       (let* ((
9840: 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65  testname  (db:te
9850: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  st-get-testname 
9860: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20  testdat))..     
9870: 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a   (item-path (db:
9880: 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61  test-get-item-pa
9890: 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20  th testdat))..  
98a0: 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28      (full-name (
98b0: 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f  conc testname "/
98c0: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20  " item-path)).. 
98d0: 20 20 20 20 20 28 70 72 65 76 2d 74 65 73 74 2d       (prev-test-
98e0: 64 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  dat (hash-table-
98f0: 72 65 66 2f 64 65 66 61 75 6c 74 20 63 75 72 72  ref/default curr
9900: 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c  -tests-hash full
9910: 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 20 20 20  -name #f))..    
9920: 20 20 28 74 65 73 74 2d 73 74 65 70 73 20 20 20    (test-steps   
9930: 20 20 20 28 64 62 3a 67 65 74 2d 73 74 65 70 73     (db:get-steps
9940: 2d 66 6f 72 2d 74 65 73 74 20 64 62 20 28 64 62  -for-test db (db
9950: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
9960: 74 64 61 74 29 29 29 0a 09 20 20 20 20 20 20 28  tdat)))..      (
9970: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20  new-test-record 
9980: 23 66 29 29 0a 09 20 3b 3b 20 72 65 70 6c 61 63  #f)).. ;; replac
9990: 65 20 74 68 65 73 65 20 77 69 74 68 20 69 6e 73  e these with ins
99a0: 65 72 74 20 2e 2e 2e 20 73 65 6c 65 63 74 0a 09  ert ... select..
99b0: 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a   (apply sqlite3:
99c0: 65 78 65 63 75 74 65 20 0a 09 09 64 62 20 0a 09  execute ...db ..
99d0: 09 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f  .(conc "INSERT O
99e0: 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74  R REPLACE INTO t
99f0: 65 73 74 73 20 28 72 75 6e 5f 69 64 2c 74 65 73  ests (run_id,tes
9a00: 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74  tname,state,stat
9a10: 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 68 6f  us,event_time,ho
9a20: 73 74 2c 63 70 75 6c 6f 61 64 2c 64 69 73 6b 66  st,cpuload,diskf
9a30: 72 65 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 69 72  ree,uname,rundir
9a40: 2c 69 74 65 6d 5f 70 61 74 68 2c 72 75 6e 5f 64  ,item_path,run_d
9a50: 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f  uration,final_lo
9a60: 67 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09  gf,comment) "...
9a70: 20 20 20 20 20 20 22 56 41 4c 55 45 53 20 28 3f        "VALUES (?
9a80: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
9a90: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09  ,?,?,?,?,?);")..
9aa0: 09 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 64 64  .new-run-id (cdd
9ab0: 72 20 28 76 65 63 74 6f 72 2d 3e 6c 69 73 74 20  r (vector->list 
9ac0: 74 65 73 74 64 61 74 29 29 29 0a 09 20 28 73 65  testdat))).. (se
9ad0: 74 21 20 6e 65 77 2d 74 65 73 74 64 61 74 20 28  t! new-testdat (
9ae0: 63 61 72 20 28 72 64 62 3a 67 65 74 2d 74 65 73  car (rdb:get-tes
9af0: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65  ts-for-run db ne
9b00: 77 2d 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 6d  w-run-id testnam
9b10: 65 20 69 74 65 6d 2d 70 61 74 68 20 27 28 29 20  e item-path '() 
9b20: 27 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74  '()))).. (hash-t
9b30: 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74  able-set! curr-t
9b40: 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e  ests-hash full-n
9b50: 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29  ame new-testdat)
9b60: 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62   ;; this could b
9b70: 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69  e confusing, whi
9b80: 63 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64  ch record should
9b90: 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f   go into the loo
9ba0: 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20  kup table?.. ;; 
9bb0: 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68  Now duplicate th
9bc0: 65 20 74 65 73 74 20 73 74 65 70 73 0a 09 20 28  e test steps.. (
9bd0: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43  debug:print 4 "C
9be0: 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69  opying records i
9bf0: 6e 20 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f  n test_steps fro
9c00: 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a  m test_id=" (db:
9c10: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
9c20: 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a  dat) " to " (db:
9c30: 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d  test-get-id new-
9c40: 74 65 73 74 64 61 74 29 29 0a 09 20 28 73 71 6c  testdat)).. (sql
9c50: 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20  ite3:execute .. 
9c60: 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 49   db ..  (conc "I
9c70: 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45  NSERT OR REPLACE
9c80: 20 49 4e 54 4f 20 74 65 73 74 5f 73 74 65 70 73   INTO test_steps
9c90: 20 28 74 65 73 74 5f 69 64 2c 73 74 65 70 6e 61   (test_id,stepna
9ca0: 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c  me,state,status,
9cb0: 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65  event_time,comme
9cc0: 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 43 54 20  nt) "..."SELECT 
9cd0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  " (db:test-get-i
9ce0: 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22  d new-testdat) "
9cf0: 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c  ,stepname,state,
9d00: 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d  status,event_tim
9d10: 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74  e,comment FROM t
9d20: 65 73 74 5f 73 74 65 70 73 20 57 48 45 52 45 20  est_steps WHERE 
9d30: 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20  test_id=?;")..  
9d40: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
9d50: 74 65 73 74 64 61 74 29 29 0a 09 20 3b 3b 20 4e  testdat)).. ;; N
9d60: 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65  ow duplicate the
9d70: 20 74 65 73 74 20 64 61 74 61 0a 09 20 28 64 65   test data.. (de
9d80: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70  bug:print 4 "Cop
9d90: 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20  ying records in 
9da0: 74 65 73 74 5f 64 61 74 61 20 66 72 6f 6d 20 74  test_data from t
9db0: 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73  est_id=" (db:tes
9dc0: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74  t-get-id testdat
9dd0: 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73  ) " to " (db:tes
9de0: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73  t-get-id new-tes
9df0: 74 64 61 74 29 29 0a 09 20 28 73 71 6c 69 74 65  tdat)).. (sqlite
9e00: 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 64 62  3:execute ..  db
9e10: 20 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e 53 45   ..  (conc "INSE
9e20: 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e  RT OR REPLACE IN
9e30: 54 4f 20 74 65 73 74 5f 64 61 74 61 20 28 74 65  TO test_data (te
9e40: 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c 76  st_id,category,v
9e50: 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78  ariable,value,ex
9e60: 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73  pected,tol,units
9e70: 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 22 53  ,comment) "..."S
9e80: 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73 74  ELECT " (db:test
9e90: 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74  -get-id new-test
9ea0: 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79 2c  dat) ",category,
9eb0: 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65  variable,value,e
9ec0: 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74  xpected,tol,unit
9ed0: 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74  s,comment FROM t
9ee0: 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 20 74  est_data WHERE t
9ef0: 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 28  est_id=?;")..  (
9f00: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
9f10: 65 73 74 64 61 74 29 29 0a 09 20 29 29 0a 20 20  estdat)).. )).  
9f20: 20 20 20 70 72 65 76 2d 74 65 73 74 73 29 29 29     prev-tests)))
9f30: 0a 09 20 0a 20 20 20 20 20 0a                    .. .     .