Megatest

Hex Artifact Content
Login

Artifact 431f11e2ab46a8de2535c4b8a4b11f7a1ca3cae8:


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: 29 20 3b 3b 20 74 65 73 74 2d 6e 61 6d 65 29 0a  ) ;; test-name).
0460: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 76 61 6c    (let* ((keyval
0470: 6c 73 74 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69  lst (keys->valli
0480: 73 74 20 6b 65 79 73 29 29 0a 09 20 28 74 6d 70  st keys)).. (tmp
0490: 20 20 20 20 20 20 28 72 75 6e 73 3a 67 65 74 2d        (runs:get-
04a0: 73 74 64 2d 72 75 6e 2d 66 69 65 6c 64 73 20 6b  std-run-fields k
04b0: 65 79 73 20 27 28 22 69 64 22 20 22 72 75 6e 6e  eys '("id" "runn
04c0: 61 6d 65 22 20 22 73 74 61 74 65 22 20 22 73 74  ame" "state" "st
04d0: 61 74 75 73 22 20 22 6f 77 6e 65 72 22 20 22 65  atus" "owner" "e
04e0: 76 65 6e 74 5f 74 69 6d 65 22 29 29 29 0a 09 20  vent_time"))).. 
04f0: 28 6b 65 79 73 74 72 20 20 20 28 63 61 72 20 74  (keystr   (car t
0500: 6d 70 29 29 0a 09 20 28 68 65 61 64 65 72 20 20  mp)).. (header  
0510: 20 28 63 61 64 72 20 74 6d 70 29 29 0a 09 20 28   (cadr tmp)).. (
0520: 72 65 73 20 20 20 20 20 27 28 29 29 0a 09 20 28  res     '()).. (
0530: 6b 65 79 2d 70 61 74 74 20 22 22 29 0a 09 20 28  key-patt "").. (
0540: 72 75 6e 77 69 6c 64 74 79 70 65 20 28 69 66 20  runwildtype (if 
0550: 28 73 75 62 73 74 72 69 6e 67 2d 69 6e 64 65 78  (substring-index
0560: 20 22 25 22 20 72 75 6e 6e 61 6d 65 70 61 74 74   "%" runnamepatt
0570: 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f 62 22 29  ) "like" "glob")
0580: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  )).    (for-each
0590: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 76 61 6c   (lambda (keyval
05a0: 29 0a 09 09 28 6c 65 74 2a 20 28 28 6b 65 79 20  )...(let* ((key 
05b0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b     (vector-ref k
05c0: 65 79 76 61 6c 20 30 29 29 0a 09 09 20 20 20 20  eyval 0))...    
05d0: 20 20 20 28 66 75 6c 6b 65 79 20 28 63 6f 6e 63     (fulkey (conc
05e0: 20 22 3a 22 20 6b 65 79 29 29 0a 09 09 20 20 20   ":" key))...   
05f0: 20 20 20 20 28 70 61 74 74 20 20 20 28 61 72 67      (patt   (arg
0600: 73 3a 67 65 74 2d 61 72 67 20 66 75 6c 6b 65 79  s:get-arg fulkey
0610: 29 29 0a 09 09 20 20 20 20 20 20 20 28 77 69 6c  ))...       (wil
0620: 64 74 79 70 65 20 28 69 66 20 28 73 75 62 73 74  dtype (if (subst
0630: 72 69 6e 67 2d 69 6e 64 65 78 20 22 25 22 20 70  ring-index "%" p
0640: 61 74 74 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f  att) "like" "glo
0650: 62 22 29 29 29 0a 09 09 20 20 28 69 66 20 70 61  b")))...  (if pa
0660: 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 74 21  tt...      (set!
0670: 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e 63 20   key-patt (conc 
0680: 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 20 22  key-patt " AND "
0690: 20 6b 65 79 20 22 20 22 20 77 69 6c 64 74 79 70   key " " wildtyp
06a0: 65 20 22 20 27 22 20 70 61 74 74 20 22 27 22 29  e " '" patt "'")
06b0: 29 0a 09 09 20 20 20 20 20 20 28 62 65 67 69 6e  )...      (begin
06c0: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ....(debug:print
06d0: 20 30 20 22 45 52 52 4f 52 3a 20 73 65 61 72 63   0 "ERROR: searc
06e0: 68 69 6e 67 20 66 6f 72 20 72 75 6e 73 20 77 69  hing for runs wi
06f0: 74 68 20 6e 6f 20 70 61 74 74 65 72 6e 20 73 65  th no pattern se
0700: 74 20 66 6f 72 20 22 20 66 75 6c 6b 65 79 29 0a  t for " fulkey).
0710: 09 09 09 28 65 78 69 74 20 36 29 29 29 29 29 0a  ...(exit 6))))).
0720: 09 20 20 20 20 20 20 6b 65 79 73 29 0a 20 20 20  .      keys).   
0730: 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61   (sqlite3:for-ea
0740: 63 68 2d 72 6f 77 20 0a 20 20 20 20 20 28 6c 61  ch-row .     (la
0750: 6d 62 64 61 20 28 61 20 2e 20 72 29 0a 20 20 20  mbda (a . r).   
0760: 20 20 20 20 28 73 65 74 21 20 72 65 73 20 28 63      (set! res (c
0770: 6f 6e 73 20 28 6c 69 73 74 2d 3e 76 65 63 74 6f  ons (list->vecto
0780: 72 20 28 63 6f 6e 73 20 61 20 72 29 29 20 72 65  r (cons a r)) re
0790: 73 29 29 29 0a 20 20 20 20 20 64 62 20 0a 20 20  s))).     db .  
07a0: 20 20 20 28 63 6f 6e 63 20 22 53 45 4c 45 43 54     (conc "SELECT
07b0: 20 22 20 6b 65 79 73 74 72 20 22 20 46 52 4f 4d   " keystr " FROM
07c0: 20 72 75 6e 73 20 57 48 45 52 45 20 72 75 6e 6e   runs WHERE runn
07d0: 61 6d 65 20 22 20 72 75 6e 77 69 6c 64 74 79 70  ame " runwildtyp
07e0: 65 20 22 20 3f 20 22 20 6b 65 79 2d 70 61 74 74  e " ? " key-patt
07f0: 20 22 3b 22 29 0a 20 20 20 20 20 72 75 6e 6e 61   ";").     runna
0800: 6d 65 70 61 74 74 29 0a 20 20 20 20 28 76 65 63  mepatt).    (vec
0810: 74 6f 72 20 68 65 61 64 65 72 20 72 65 73 29 29  tor header res))
0820: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  )..(define (runs
0830: 3a 74 65 73 74 2d 67 65 74 2d 66 75 6c 6c 2d 70  :test-get-full-p
0840: 61 74 68 20 74 65 73 74 29 0a 20 20 28 6c 65 74  ath test).  (let
0850: 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 28 64 62  * ((testname (db
0860: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61  :test-get-testna
0870: 6d 65 20 20 20 74 65 73 74 29 29 0a 09 20 28 69  me   test)).. (i
0880: 74 65 6d 70 61 74 68 20 28 64 62 3a 74 65 73 74  tempath (db:test
0890: 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74  -get-item-path t
08a0: 65 73 74 29 29 29 0a 20 20 20 20 28 63 6f 6e 63  est))).    (conc
08b0: 20 74 65 73 74 6e 61 6d 65 20 28 69 66 20 28 65   testname (if (e
08c0: 71 75 61 6c 3f 20 69 74 65 6d 70 61 74 68 20 22  qual? itempath "
08d0: 22 29 20 22 22 20 28 63 6f 6e 63 20 22 28 22 20  ") "" (conc "(" 
08e0: 69 74 65 6d 70 61 74 68 20 22 29 22 29 29 29 29  itempath ")"))))
08f0: 29 0a 0a 3b 3b 20 41 77 66 75 6c 2e 20 50 6c 65  )..;; Awful. Ple
0900: 61 73 65 20 46 49 58 4d 45 0a 28 64 65 66 69 6e  ase FIXME.(defin
0910: 65 20 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72  e *env-vars-by-r
0920: 75 6e 2d 69 64 2a 20 28 6d 61 6b 65 2d 68 61 73  un-id* (make-has
0930: 68 2d 74 61 62 6c 65 29 29 0a 28 64 65 66 69 6e  h-table)).(defin
0940: 65 20 2a 63 75 72 72 65 6e 74 2d 72 75 6e 2d 6e  e *current-run-n
0950: 61 6d 65 2a 20 20 20 23 66 29 0a 0a 28 64 65 66  ame*   #f)..(def
0960: 69 6e 65 20 28 73 65 74 2d 6d 65 67 61 74 65 73  ine (set-megates
0970: 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72 75  t-env-vars db ru
0980: 6e 2d 69 64 29 0a 20 20 28 6c 65 74 20 28 28 6b  n-id).  (let ((k
0990: 65 79 73 20 28 64 62 3a 67 65 74 2d 6b 65 79 73  eys (db:get-keys
09a0: 20 64 62 29 29 0a 09 28 76 61 6c 73 20 28 68 61   db))..(vals (ha
09b0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
09c0: 61 75 6c 74 20 2a 65 6e 76 2d 76 61 72 73 2d 62  ault *env-vars-b
09d0: 79 2d 72 75 6e 2d 69 64 2a 20 72 75 6e 2d 69 64  y-run-id* run-id
09e0: 20 23 66 29 29 29 0a 20 20 20 20 3b 3b 20 67 65   #f))).    ;; ge
09f0: 74 20 74 68 65 20 69 6e 66 6f 20 66 72 6f 6d 20  t the info from 
0a00: 74 68 65 20 64 62 20 61 6e 64 20 70 75 74 20 69  the db and put i
0a10: 74 20 69 6e 20 74 68 65 20 63 61 63 68 65 0a 20  t in the cache. 
0a20: 20 20 20 28 69 66 20 28 6e 6f 74 20 76 61 6c 73     (if (not vals
0a30: 29 0a 09 28 6c 65 74 20 28 28 68 74 20 28 6d 61  )..(let ((ht (ma
0a40: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29  ke-hash-table)))
0a50: 0a 09 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  ..  (hash-table-
0a60: 73 65 74 21 20 2a 65 6e 76 2d 76 61 72 73 2d 62  set! *env-vars-b
0a70: 79 2d 72 75 6e 2d 69 64 2a 20 72 75 6e 2d 69 64  y-run-id* run-id
0a80: 20 68 74 29 0a 09 20 20 28 73 65 74 21 20 76 61   ht)..  (set! va
0a90: 6c 73 20 68 74 29 0a 09 20 20 28 66 6f 72 2d 65  ls ht)..  (for-e
0aa0: 61 63 68 0a 09 20 20 20 28 6c 61 6d 62 64 61 20  ach..   (lambda 
0ab0: 28 6b 65 79 29 0a 09 20 20 20 20 20 28 73 71 6c  (key)..     (sql
0ac0: 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f  ite3:for-each-ro
0ad0: 77 0a 09 20 20 20 20 20 20 28 6c 61 6d 62 64 61  w..      (lambda
0ae0: 20 28 76 61 6c 29 0a 09 09 28 68 61 73 68 2d 74   (val)...(hash-t
0af0: 61 62 6c 65 2d 73 65 74 21 20 76 61 6c 73 20 6b  able-set! vals k
0b00: 65 79 20 76 61 6c 29 29 0a 09 20 20 20 20 20 20  ey val))..      
0b10: 64 62 20 0a 09 20 20 20 20 20 20 28 63 6f 6e 63  db ..      (conc
0b20: 20 22 53 45 4c 45 43 54 20 22 20 28 6b 65 79 3a   "SELECT " (key:
0b30: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65  get-fieldname ke
0b40: 79 29 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57  y) " FROM runs W
0b50: 48 45 52 45 20 69 64 3d 3f 3b 22 29 0a 09 20 20  HERE id=?;")..  
0b60: 20 20 20 20 72 75 6e 2d 69 64 29 29 0a 09 20 20      run-id))..  
0b70: 20 6b 65 79 73 29 29 29 0a 20 20 20 20 3b 3b 20   keys))).    ;; 
0b80: 66 72 6f 6d 20 74 68 65 20 63 61 63 68 65 64 20  from the cached 
0b90: 64 61 74 61 20 73 65 74 20 74 68 65 20 76 61 72  data set the var
0ba0: 73 0a 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c  s.    (hash-tabl
0bb0: 65 2d 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20  e-for-each.     
0bc0: 76 61 6c 73 0a 20 20 20 20 20 28 6c 61 6d 62 64  vals.     (lambd
0bd0: 61 20 28 6b 65 79 20 76 61 6c 29 0a 20 20 20 20  a (key val).    
0be0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
0bf0: 32 20 22 73 65 74 65 6e 76 20 22 20 28 6b 65 79  2 "setenv " (key
0c00: 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b  :get-fieldname k
0c10: 65 79 29 20 22 20 22 20 76 61 6c 29 0a 20 20 20  ey) " " val).   
0c20: 20 20 20 20 28 73 65 74 65 6e 76 20 28 6b 65 79      (setenv (key
0c30: 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b  :get-fieldname k
0c40: 65 79 29 20 76 61 6c 29 29 29 0a 20 20 20 20 28  ey) val))).    (
0c50: 61 6c 69 73 74 2d 3e 65 6e 76 2d 76 61 72 73 20  alist->env-vars 
0c60: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
0c70: 64 65 66 61 75 6c 74 20 2a 63 6f 6e 66 69 67 64  default *configd
0c80: 61 74 2a 20 22 65 6e 76 2d 6f 76 65 72 72 69 64  at* "env-overrid
0c90: 65 22 20 27 28 29 29 29 0a 20 20 20 20 3b 3b 20  e" '())).    ;; 
0ca0: 4c 65 74 73 20 75 73 65 20 74 68 69 73 20 61 73  Lets use this as
0cb0: 20 61 6e 20 6f 70 70 6f 72 74 75 6e 69 74 79 20   an opportunity 
0cc0: 74 6f 20 70 75 74 20 4d 54 5f 52 55 4e 4e 41 4d  to put MT_RUNNAM
0cd0: 45 20 69 6e 20 74 68 65 20 65 6e 76 69 72 6f 6e  E in the environ
0ce0: 6d 65 6e 74 0a 20 20 20 20 28 69 66 20 28 6e 6f  ment.    (if (no
0cf0: 74 20 2a 63 75 72 72 65 6e 74 2d 72 75 6e 2d 6e  t *current-run-n
0d00: 61 6d 65 2a 29 0a 09 28 73 71 6c 69 74 65 33 3a  ame*)..(sqlite3:
0d10: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 09 20 28  for-each-row.. (
0d20: 6c 61 6d 62 64 61 20 28 72 75 6e 6e 61 6d 65 29  lambda (runname)
0d30: 0a 09 20 20 20 28 73 65 74 21 20 2a 63 75 72 72  ..   (set! *curr
0d40: 65 6e 74 2d 72 75 6e 2d 6e 61 6d 65 2a 20 72 75  ent-run-name* ru
0d50: 6e 6e 61 6d 65 29 29 0a 0a 09 20 64 62 0a 09 20  nname))... db.. 
0d60: 22 53 45 4c 45 43 54 20 72 75 6e 6e 61 6d 65 20  "SELECT runname 
0d70: 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20  FROM runs WHERE 
0d80: 69 64 3d 3f 3b 22 0a 09 20 72 75 6e 2d 69 64 29  id=?;".. run-id)
0d90: 29 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d  ).    (setenv "M
0da0: 54 5f 52 55 4e 4e 41 4d 45 22 20 2a 63 75 72 72  T_RUNNAME" *curr
0db0: 65 6e 74 2d 72 75 6e 2d 6e 61 6d 65 2a 29 0a 20  ent-run-name*). 
0dc0: 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52     (setenv "MT_R
0dd0: 55 4e 5f 41 52 45 41 5f 48 4f 4d 45 22 20 2a 74  UN_AREA_HOME" *t
0de0: 6f 70 70 61 74 68 2a 29 0a 20 20 20 20 29 29 0a  oppath*).    )).
0df0: 0a 28 64 65 66 69 6e 65 20 28 73 65 74 2d 69 74  .(define (set-it
0e00: 65 6d 2d 65 6e 76 2d 76 61 72 73 20 69 74 65 6d  em-env-vars item
0e10: 64 61 74 29 0a 20 20 28 66 6f 72 2d 65 61 63 68  dat).  (for-each
0e20: 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 29 0a   (lambda (item).
0e30: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
0e40: 69 6e 74 20 32 20 22 73 65 74 65 6e 76 20 22 20  int 2 "setenv " 
0e50: 28 63 61 72 20 69 74 65 6d 29 20 22 20 22 20 28  (car item) " " (
0e60: 63 61 64 72 20 69 74 65 6d 29 29 0a 09 20 20 20  cadr item))..   
0e70: 20 20 20 28 73 65 74 65 6e 76 20 28 63 61 72 20     (setenv (car 
0e80: 69 74 65 6d 29 20 28 63 61 64 72 20 69 74 65 6d  item) (cadr item
0e90: 29 29 29 0a 09 20 20 20 20 69 74 65 6d 64 61 74  )))..    itemdat
0ea0: 29 29 0a 0a 28 64 65 66 69 6e 65 20 2a 6c 61 73  ))..(define *las
0eb0: 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65  t-num-running-te
0ec0: 73 74 73 2a 20 30 29 0a 28 64 65 66 69 6e 65 20  sts* 0).(define 
0ed0: 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f  (runs:can-run-mo
0ee0: 72 65 2d 74 65 73 74 73 20 64 62 20 74 65 73 74  re-tests db test
0ef0: 2d 72 65 63 6f 72 64 29 0a 20 20 28 6c 65 74 2a  -record).  (let*
0f00: 20 28 28 74 63 6f 6e 66 69 67 20 20 20 20 20 20   ((tconfig      
0f10: 20 20 20 20 20 20 20 20 20 20 20 28 74 65 73 74             (test
0f20: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d  s:testqueue-get-
0f30: 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d  testconfig test-
0f40: 72 65 63 6f 72 64 29 29 0a 09 20 28 6a 6f 62 67  record)).. (jobg
0f50: 72 6f 75 70 20 20 20 20 20 20 20 20 20 20 20 20  roup            
0f60: 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b      (config-look
0f70: 75 70 20 74 63 6f 6e 66 69 67 20 22 72 65 71 75  up tconfig "requ
0f80: 69 72 65 6d 65 6e 74 73 22 20 22 6a 6f 62 67 72  irements" "jobgr
0f90: 6f 75 70 22 29 29 0a 09 20 28 6e 75 6d 2d 72 75  oup")).. (num-ru
0fa0: 6e 6e 69 6e 67 20 20 20 20 20 20 20 20 20 20 20  nning           
0fb0: 20 20 28 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d    (db:get-count-
0fc0: 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67 20 64 62  tests-running db
0fd0: 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e  )).. (num-runnin
0fe0: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 64  g-in-jobgroup (d
0ff0: 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74  b:get-count-test
1000: 73 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62  s-running-in-job
1010: 67 72 6f 75 70 20 64 62 20 6a 6f 62 67 72 6f 75  group db jobgrou
1020: 70 29 29 0a 09 20 28 6d 61 78 2d 63 6f 6e 63 75  p)).. (max-concu
1030: 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28  rrent-jobs     (
1040: 6c 65 74 20 28 28 6d 63 6a 20 28 63 6f 6e 66 69  let ((mcj (confi
1050: 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67  g-lookup *config
1060: 64 61 74 2a 20 22 73 65 74 75 70 22 20 20 20 20  dat* "setup"    
1070: 20 22 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74   "max_concurrent
1080: 5f 6a 6f 62 73 22 29 29 29 0a 09 09 09 09 20 20  _jobs"))).....  
1090: 20 20 28 69 66 20 28 61 6e 64 20 6d 63 6a 20 28    (if (and mcj (
10a0: 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d  string->number m
10b0: 63 6a 29 29 0a 09 09 09 09 09 28 73 74 72 69 6e  cj))......(strin
10c0: 67 2d 3e 6e 75 6d 62 65 72 20 6d 63 6a 29 0a 09  g->number mcj)..
10d0: 09 09 09 09 23 66 29 29 29 0a 09 20 28 6a 6f 62  ....#f))).. (job
10e0: 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20 20  -group-limit    
10f0: 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f       (config-loo
1100: 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20  kup *configdat* 
1110: 22 6a 6f 62 67 72 6f 75 70 73 22 20 6a 6f 62 67  "jobgroups" jobg
1120: 72 6f 75 70 29 29 29 0a 20 20 20 20 28 69 66 20  roup))).    (if 
1130: 28 6e 6f 74 20 28 65 71 3f 20 2a 6c 61 73 74 2d  (not (eq? *last-
1140: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74  num-running-test
1150: 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 29  s* num-running))
1160: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62  ..(begin..  (deb
1170: 75 67 3a 70 72 69 6e 74 20 32 20 22 6d 61 78 2d  ug:print 2 "max-
1180: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a  concurrent-jobs:
1190: 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e   " max-concurren
11a0: 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75  t-jobs ", num-ru
11b0: 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e  nning: " num-run
11c0: 6e 69 6e 67 29 0a 09 20 20 28 73 65 74 21 20 2a  ning)..  (set! *
11d0: 6c 61 73 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67  last-num-running
11e0: 2d 74 65 73 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e  -tests* num-runn
11f0: 69 6e 67 29 29 29 0a 20 20 20 20 28 69 66 20 28  ing))).    (if (
1200: 6e 6f 74 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62  not (eq? 0 *glob
1210: 61 6c 65 78 69 74 73 74 61 74 75 73 2a 29 29 0a  alexitstatus*)).
1220: 09 28 6c 69 73 74 20 23 66 20 6e 75 6d 2d 72 75  .(list #f num-ru
1230: 6e 6e 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e  nning num-runnin
1240: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d 61  g-in-jobgroup ma
1250: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
1260: 73 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69  s job-group-limi
1270: 74 29 0a 09 28 6c 65 74 20 28 28 63 61 6e 2d 6e  t)..(let ((can-n
1280: 6f 74 2d 72 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e  ot-run-more (con
1290: 64 0a 09 09 09 09 20 3b 3b 20 69 66 20 6d 61 78  d..... ;; if max
12a0: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73  -concurrent-jobs
12b0: 20 69 73 20 73 65 74 20 61 6e 64 20 74 68 65 20   is set and the 
12c0: 6e 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 20 69  number running i
12d0: 73 20 67 72 65 61 74 65 72 20 0a 09 09 09 09 20  s greater ..... 
12e0: 3b 3b 20 74 68 61 6e 20 69 74 20 74 68 61 6e 20  ;; than it than 
12f0: 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 20  cannot run more 
1300: 6a 6f 62 73 0a 09 09 09 09 20 28 28 61 6e 64 20  jobs..... ((and 
1310: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a  max-concurrent-j
1320: 6f 62 73 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e  obs (>= num-runn
1330: 69 6e 67 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65  ing max-concurre
1340: 6e 74 2d 6a 6f 62 73 29 29 0a 09 09 09 09 20 20  nt-jobs)).....  
1350: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
1360: 57 41 52 4e 49 4e 47 3a 20 4d 61 78 20 72 75 6e  WARNING: Max run
1370: 6e 69 6e 67 20 6a 6f 62 73 20 65 78 63 65 65 64  ning jobs exceed
1380: 65 64 2c 20 63 75 72 72 65 6e 74 20 6e 75 6d 62  ed, current numb
1390: 65 72 20 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75  er running: " nu
13a0: 6d 2d 72 75 6e 6e 69 6e 67 20 0a 09 09 09 09 09  m-running ......
13b0: 20 20 20 20 20 20 20 22 2c 20 6d 61 78 5f 63 6f         ", max_co
13c0: 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 22  ncurrent_jobs: "
13d0: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d   max-concurrent-
13e0: 6a 6f 62 73 29 0a 09 09 09 09 20 20 23 74 29 0a  jobs).....  #t).
13f0: 09 09 09 09 20 3b 3b 20 69 66 20 6a 6f 62 2d 67  .... ;; if job-g
1400: 72 6f 75 70 2d 6c 69 6d 69 74 20 69 73 20 73 65  roup-limit is se
1410: 74 20 61 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20  t and number of 
1420: 6a 6f 62 73 20 69 6e 20 74 68 65 20 67 72 6f 75  jobs in the grou
1430: 70 20 69 73 20 67 72 65 61 74 65 72 0a 09 09 09  p is greater....
1440: 09 20 3b 3b 20 74 68 61 6e 20 74 68 65 20 6c 69  . ;; than the li
1450: 6d 69 74 20 74 68 65 6e 20 63 61 6e 6e 6f 74 20  mit then cannot 
1460: 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 20 6f 66  run more jobs of
1470: 20 74 68 69 73 20 6b 69 6e 64 0a 09 09 09 09 20   this kind..... 
1480: 28 28 61 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 2d  ((and job-group-
1490: 6c 69 6d 69 74 0a 09 09 09 09 20 20 20 20 20 20  limit.....      
14a0: 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67   (>= num-running
14b0: 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f 62  -in-jobgroup job
14c0: 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 0a 09  -group-limit))..
14d0: 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ...  (debug:prin
14e0: 74 20 31 20 22 57 41 52 4e 49 4e 47 3a 20 6e 75  t 1 "WARNING: nu
14f0: 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 22 20 6e  mber of jobs " n
1500: 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f  um-running-in-jo
1510: 62 67 72 6f 75 70 20 0a 09 09 09 09 09 20 20 20  bgroup ......   
1520: 20 20 20 20 22 20 69 6e 20 22 20 6a 6f 62 67 72      " in " jobgr
1530: 6f 75 70 20 22 20 65 78 63 65 65 64 65 64 2c 20  oup " exceeded, 
1540: 77 69 6c 6c 20 6e 6f 74 20 72 75 6e 20 22 20 28  will not run " (
1550: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
1560: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73  get-testname tes
1570: 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 09 09 20  t-record))..... 
1580: 20 23 74 29 0a 09 09 09 09 20 28 65 6c 73 65 20   #t)..... (else 
1590: 23 66 29 29 29 29 0a 09 20 20 28 6c 69 73 74 20  #f))))..  (list 
15a0: 28 6e 6f 74 20 63 61 6e 2d 6e 6f 74 2d 72 75 6e  (not can-not-run
15b0: 2d 6d 6f 72 65 29 20 6e 75 6d 2d 72 75 6e 6e 69  -more) num-runni
15c0: 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69  ng num-running-i
15d0: 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d 61 78 2d 63  n-jobgroup max-c
15e0: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6a  oncurrent-jobs j
15f0: 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29  ob-group-limit))
1600: 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d  )))..;;=========
1610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1620: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1630: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1640: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b  =============.;;
1650: 20 4e 65 77 20 6d 65 74 68 6f 64 6f 6c 6f 67 79   New methodology
1660: 2e 20 54 68 65 73 65 20 72 6f 75 74 69 6e 65 73  . These routines
1670: 20 77 69 6c 6c 20 72 65 70 6c 61 63 65 20 74 68   will replace th
1680: 65 20 61 62 6f 76 65 20 69 6e 20 74 69 6d 65 2e  e above in time.
1690: 20 46 6f 72 0a 3b 3b 20 6e 6f 77 20 74 68 65 20   For.;; now the 
16a0: 63 6f 64 65 20 69 73 20 64 75 70 6c 69 63 61 74  code is duplicat
16b0: 65 64 2e 20 54 68 69 73 20 73 74 75 66 66 20 69  ed. This stuff i
16c0: 73 20 69 6e 69 74 69 61 6c 6c 79 20 75 73 65 64  s initially used
16d0: 20 69 6e 20 74 68 65 20 6d 6f 6e 69 74 6f 72 0a   in the monitor.
16e0: 3b 3b 20 62 61 73 65 64 20 63 6f 64 65 2e 0a 3b  ;; based code..;
16f0: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;===============
1700: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1710: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1720: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1730: 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 72 65 67 69  =======..;; regi
1740: 73 74 65 72 20 61 20 74 65 73 74 20 72 75 6e 20  ster a test run 
1750: 77 69 74 68 20 74 68 65 20 64 62 0a 28 64 65 66  with the db.(def
1760: 69 6e 65 20 28 72 75 6e 73 3a 72 65 67 69 73 74  ine (runs:regist
1770: 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b  er-run db keys k
1780: 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65  eyvallst runname
1790: 20 73 74 61 74 65 20 73 74 61 74 75 73 20 75 73   state status us
17a0: 65 72 29 0a 20 20 28 64 65 62 75 67 3a 70 72 69  er).  (debug:pri
17b0: 6e 74 20 33 20 22 72 75 6e 73 3a 72 65 67 69 73  nt 3 "runs:regis
17c0: 74 65 72 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22  ter-run, keys: "
17d0: 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73   keys " keyvalls
17e0: 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22  t: " keyvallst "
17f0: 20 72 75 6e 6e 61 6d 65 3a 20 22 20 72 75 6e 6e   runname: " runn
1800: 61 6d 65 20 22 20 73 74 61 74 65 3a 20 22 20 73  ame " state: " s
1810: 74 61 74 65 20 22 20 73 74 61 74 75 73 3a 20 22  tate " status: "
1820: 20 73 74 61 74 75 73 20 22 20 75 73 65 72 3a 20   status " user: 
1830: 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20  " user).  (let* 
1840: 28 28 6b 65 79 73 74 72 20 20 20 20 28 6b 65 79  ((keystr    (key
1850: 73 2d 3e 6b 65 79 73 74 72 20 6b 65 79 73 29 29  s->keystr keys))
1860: 0a 09 20 28 63 6f 6d 6d 61 20 20 20 20 20 28 69  .. (comma     (i
1870: 66 20 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79  f (> (length key
1880: 73 29 20 30 29 20 22 2c 22 20 22 22 29 29 0a 09  s) 0) "," ""))..
1890: 20 28 61 6e 64 73 74 72 20 20 20 20 28 69 66 20   (andstr    (if 
18a0: 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29  (> (length keys)
18b0: 20 30 29 20 22 20 41 4e 44 20 22 20 22 22 29 29   0) " AND " ""))
18c0: 0a 09 20 28 76 61 6c 73 6c 6f 74 73 20 20 28 6b  .. (valslots  (k
18d0: 65 79 73 2d 3e 76 61 6c 73 6c 6f 74 73 20 6b 65  eys->valslots ke
18e0: 79 73 29 29 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e 2e  ys)) ;; ?,?,? ..
18f0: 2e 0a 09 20 28 6b 65 79 76 61 6c 73 20 20 20 28  ... (keyvals   (
1900: 6d 61 70 20 63 61 64 72 20 6b 65 79 76 61 6c 6c  map cadr keyvall
1910: 73 74 29 29 0a 09 20 28 61 6c 6c 76 61 6c 73 20  st)).. (allvals 
1920: 20 20 28 61 70 70 65 6e 64 20 28 6c 69 73 74 20    (append (list 
1930: 72 75 6e 6e 61 6d 65 20 73 74 61 74 65 20 73 74  runname state st
1940: 61 74 75 73 20 75 73 65 72 29 20 6b 65 79 76 61  atus user) keyva
1950: 6c 73 29 29 0a 09 20 28 71 72 79 76 61 6c 73 20  ls)).. (qryvals 
1960: 20 20 28 61 70 70 65 6e 64 20 28 6c 69 73 74 20    (append (list 
1970: 72 75 6e 6e 61 6d 65 29 20 6b 65 79 76 61 6c 73  runname) keyvals
1980: 29 29 0a 09 20 28 6b 65 79 3d 3f 73 74 72 20 20  )).. (key=?str  
1990: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65  (string-interspe
19a0: 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61  rse (map (lambda
19b0: 20 28 6b 29 28 63 6f 6e 63 20 28 6b 65 79 3a 67   (k)(conc (key:g
19c0: 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 29 20  et-fieldname k) 
19d0: 22 3d 3f 22 29 29 20 6b 65 79 73 29 20 22 20 41  "=?")) keys) " A
19e0: 4e 44 20 22 29 29 29 0a 20 20 20 20 28 64 65 62  ND "))).    (deb
19f0: 75 67 3a 70 72 69 6e 74 20 33 20 22 6b 65 79 73  ug:print 3 "keys
1a00: 3a 20 22 20 6b 65 79 73 20 22 20 61 6c 6c 76 61  : " keys " allva
1a10: 6c 73 3a 20 22 20 61 6c 6c 76 61 6c 73 20 22 20  ls: " allvals " 
1a20: 6b 65 79 76 61 6c 73 3a 20 22 20 6b 65 79 76 61  keyvals: " keyva
1a30: 6c 73 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  ls).    (debug:p
1a40: 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 75 73  rint 2 "NOTE: us
1a50: 69 6e 67 20 74 61 72 67 65 74 20 22 20 28 73 74  ing target " (st
1a60: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
1a70: 20 6b 65 79 76 61 6c 73 20 22 2f 22 29 20 22 20   keyvals "/") " 
1a80: 66 6f 72 20 74 68 69 73 20 72 75 6e 22 29 0a 20  for this run"). 
1a90: 20 20 20 28 69 66 20 28 61 6e 64 20 72 75 6e 6e     (if (and runn
1aa0: 61 6d 65 20 28 6e 75 6c 6c 3f 20 28 66 69 6c 74  ame (null? (filt
1ab0: 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e  er (lambda (x)(n
1ac0: 6f 74 20 78 29 29 20 6b 65 79 76 61 6c 73 29 29  ot x)) keyvals))
1ad0: 29 20 3b 3b 20 74 68 65 72 65 20 6d 75 73 74 20  ) ;; there must 
1ae0: 62 65 20 61 20 62 65 74 74 65 72 20 77 61 79 20  be a better way 
1af0: 74 6f 20 22 61 70 70 6c 79 20 61 6e 64 22 0a 09  to "apply and"..
1b00: 28 6c 65 74 20 28 28 72 65 73 20 23 66 29 29 0a  (let ((res #f)).
1b10: 09 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65  .  (apply sqlite
1b20: 33 3a 65 78 65 63 75 74 65 20 64 62 20 28 63 6f  3:execute db (co
1b30: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 49 47  nc "INSERT OR IG
1b40: 4e 4f 52 45 20 49 4e 54 4f 20 72 75 6e 73 20 28  NORE INTO runs (
1b50: 72 75 6e 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74  runname,state,st
1b60: 61 74 75 73 2c 6f 77 6e 65 72 2c 65 76 65 6e 74  atus,owner,event
1b70: 5f 74 69 6d 65 22 20 63 6f 6d 6d 61 20 6b 65 79  _time" comma key
1b80: 73 74 72 20 22 29 20 56 41 4c 55 45 53 20 28 3f  str ") VALUES (?
1b90: 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28  ,?,?,?,strftime(
1ba0: 27 25 73 27 2c 27 6e 6f 77 27 29 22 20 63 6f 6d  '%s','now')" com
1bb0: 6d 61 20 76 61 6c 73 6c 6f 74 73 20 22 29 3b 22  ma valslots ");"
1bc0: 29 0a 09 09 20 61 6c 6c 76 61 6c 73 29 0a 09 20  )... allvals).. 
1bd0: 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a   (apply sqlite3:
1be0: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 09 20  for-each-row .. 
1bf0: 20 20 28 6c 61 6d 62 64 61 20 28 69 64 29 0a 09    (lambda (id)..
1c00: 20 20 20 20 20 28 73 65 74 21 20 72 65 73 20 69       (set! res i
1c10: 64 29 29 0a 09 20 20 20 64 62 0a 09 20 20 20 28  d))..   db..   (
1c20: 6c 65 74 20 28 28 71 72 79 20 28 63 6f 6e 63 20  let ((qry (conc 
1c30: 22 53 45 4c 45 43 54 20 69 64 20 46 52 4f 4d 20  "SELECT id FROM 
1c40: 72 75 6e 73 20 57 48 45 52 45 20 28 72 75 6e 6e  runs WHERE (runn
1c50: 61 6d 65 3d 3f 20 22 20 61 6e 64 73 74 72 20 6b  ame=? " andstr k
1c60: 65 79 3d 3f 73 74 72 20 22 29 3b 22 29 29 29 0a  ey=?str ");"))).
1c70: 09 20 20 20 20 20 3b 28 64 65 62 75 67 3a 70 72  .     ;(debug:pr
1c80: 69 6e 74 20 34 20 22 71 72 79 3a 20 22 20 71 72  int 4 "qry: " qr
1c90: 79 29 20 0a 09 20 20 20 20 20 71 72 79 29 0a 09  y) ..     qry)..
1ca0: 20 20 20 71 72 79 76 61 6c 73 29 0a 09 20 20 28     qryvals)..  (
1cb0: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20  sqlite3:execute 
1cc0: 64 62 20 22 55 50 44 41 54 45 20 72 75 6e 73 20  db "UPDATE runs 
1cd0: 53 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 74  SET state=?,stat
1ce0: 75 73 3d 3f 20 57 48 45 52 45 20 69 64 3d 3f 3b  us=? WHERE id=?;
1cf0: 22 20 73 74 61 74 65 20 73 74 61 74 75 73 20 72  " state status r
1d00: 65 73 29 0a 09 20 20 72 65 73 29 20 0a 09 28 62  es)..  res) ..(b
1d10: 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70  egin..  (debug:p
1d20: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 43  rint 0 "ERROR: C
1d30: 61 6c 6c 65 64 20 77 69 74 68 6f 75 74 20 61 6c  alled without al
1d40: 6c 20 6e 65 63 65 73 73 61 72 79 20 6b 65 79 73  l necessary keys
1d50: 22 29 0a 09 20 20 23 66 29 29 29 29 0a 0a 3b 3b  ")..  #f))))..;;
1d60: 20 54 68 69 73 20 69 73 20 61 20 64 75 70 6c 69   This is a dupli
1d70: 63 61 74 65 20 6f 66 20 72 75 6e 2d 74 65 73 74  cate of run-test
1d80: 73 20 28 77 68 69 63 68 20 68 61 73 20 62 65 65  s (which has bee
1d90: 6e 20 64 65 70 72 65 63 61 74 65 64 29 2e 20 55  n deprecated). U
1da0: 73 65 20 74 68 69 73 20 6f 6e 65 20 69 6e 73 74  se this one inst
1db0: 65 61 64 20 6f 66 20 72 75 6e 20 74 65 73 74 73  ead of run tests
1dc0: 2e 0a 3b 3b 20 6b 65 79 76 61 6c 73 0a 28 64 65  ..;; keyvals.(de
1dd0: 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74  fine (runs:run-t
1de0: 65 73 74 73 20 74 61 72 67 65 74 20 72 75 6e 6e  ests target runn
1df0: 61 6d 65 20 74 65 73 74 2d 70 61 74 74 73 20 75  ame test-patts u
1e00: 73 65 72 20 66 6c 61 67 73 29 0a 20 20 28 6c 65  ser flags).  (le
1e10: 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 20 20  t* ((db         
1e20: 20 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20 20   #f).. (keys    
1e30: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
1e40: 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20  ose db:get-keys 
1e50: 64 62 29 29 0a 09 20 28 6b 65 79 76 61 6c 6c 73  db)).. (keyvalls
1e60: 74 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74  t   (keys:target
1e70: 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61  ->keyval keys ta
1e80: 72 67 65 74 29 29 0a 09 20 28 72 75 6e 2d 69 64  rget)).. (run-id
1e90: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
1ea0: 63 6c 6f 73 65 20 72 75 6e 73 3a 72 65 67 69 73  close runs:regis
1eb0: 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20  ter-run db keys 
1ec0: 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d  keyvallst runnam
1ed0: 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73  e "new" "n/a" us
1ee0: 65 72 29 29 20 20 3b 3b 20 20 74 65 73 74 2d 6e  er))  ;;  test-n
1ef0: 61 6d 65 29 29 29 0a 09 20 28 64 65 66 65 72 72  ame))).. (deferr
1f00: 65 64 20 20 20 20 27 28 29 29 20 3b 3b 20 64 65  ed    '()) ;; de
1f10: 6c 61 79 20 72 75 6e 6e 69 6e 67 20 74 68 65 73  lay running thes
1f20: 65 20 73 69 6e 63 65 20 74 68 65 79 20 68 61 76  e since they hav
1f30: 65 20 61 20 77 61 69 74 6f 6e 20 63 6c 61 75 73  e a waiton claus
1f40: 65 0a 09 20 3b 3b 20 6b 65 65 70 67 6f 69 6e 67  e.. ;; keepgoing
1f50: 20 69 73 20 74 68 65 20 64 65 66 61 63 74 6f 20   is the defacto 
1f60: 6d 6f 64 61 6c 69 74 79 20 6e 6f 77 2c 20 77 69  modality now, wi
1f70: 6c 6c 20 61 64 64 20 68 69 74 2d 6e 2d 72 75 6e  ll add hit-n-run
1f80: 20 61 20 62 69 74 20 6c 61 74 65 72 0a 09 20 3b   a bit later.. ;
1f90: 3b 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 28  ; (keepgoing   (
1fa0: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
1fb0: 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b  efault flags "-k
1fc0: 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09  eepgoing" #f))..
1fd0: 20 28 74 65 73 74 2d 6e 61 6d 65 73 20 20 27 28   (test-names  '(
1fe0: 29 29 0a 09 20 28 72 75 6e 63 6f 6e 66 69 67 66  )).. (runconfigf
1ff0: 20 20 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61     (conc  *toppa
2000: 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73  th* "/runconfigs
2010: 2e 63 6f 6e 66 69 67 22 29 29 0a 09 20 28 72 65  .config")).. (re
2020: 71 75 69 72 65 64 2d 74 65 73 74 73 20 27 28 29  quired-tests '()
2030: 29 0a 09 20 28 74 65 73 74 2d 72 65 63 6f 72 64  ).. (test-record
2040: 73 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62  s (make-hash-tab
2050: 6c 65 29 29 29 0a 0a 20 20 20 20 28 6f 70 65 6e  le)))..    (open
2060: 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 74 2d 6d  -run-close set-m
2070: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73  egatest-env-vars
2080: 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74   db run-id) ;; t
2090: 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64  hese may be need
20a0: 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68  ed by the launch
20b0: 69 6e 67 20 70 72 6f 63 65 73 73 0a 0a 20 20 20  ing process..   
20c0: 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74   (if (file-exist
20d0: 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09  s? runconfigf)..
20e0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
20f0: 73 65 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c  setup-env-defaul
2100: 74 73 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 66  ts db runconfigf
2110: 20 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79   run-id *already
2120: 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d  -seen-runconfig-
2130: 69 6e 66 6f 2a 20 22 70 72 65 2d 6c 61 75 6e 63  info* "pre-launc
2140: 68 2d 65 6e 76 2d 76 61 72 73 22 29 0a 09 28 64  h-env-vars")..(d
2150: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41  ebug:print 0 "WA
2160: 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f  RNING: You do no
2170: 74 20 68 61 76 65 20 61 20 72 75 6e 20 63 6f 6e  t have a run con
2180: 66 69 67 20 66 69 6c 65 3a 20 22 20 72 75 6e 63  fig file: " runc
2190: 6f 6e 66 69 67 66 29 29 0a 20 20 20 20 0a 20 20  onfigf)).    .  
21a0: 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c    ;; look up all
21b0: 20 74 65 73 74 73 20 6d 61 74 63 68 69 6e 67 20   tests matching 
21c0: 74 68 65 20 63 6f 6d 6d 61 20 73 65 70 61 72 61  the comma separa
21d0: 74 65 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f 62  ted list of glob
21e0: 73 20 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73 74  s in.    ;; test
21f0: 2d 70 61 74 74 73 20 28 75 73 69 6e 67 20 25 20  -patts (using % 
2200: 61 73 20 77 69 6c 64 63 61 72 64 29 0a 20 20 20  as wildcard).   
2210: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20   (for-each .    
2220: 20 28 6c 61 6d 62 64 61 20 28 70 61 74 74 29 0a   (lambda (patt).
2230: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 65         (let ((te
2240: 73 74 73 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20  sts (glob (conc 
2250: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74  *toppath* "/test
2260: 73 2f 22 20 28 73 74 72 69 6e 67 2d 74 72 61 6e  s/" (string-tran
2270: 73 6c 61 74 65 20 70 61 74 74 20 22 25 22 20 22  slate patt "%" "
2280: 2a 22 29 29 29 29 29 0a 09 20 28 73 65 74 21 20  *"))))).. (set! 
2290: 74 65 73 74 73 20 28 66 69 6c 74 65 72 20 28 6c  tests (filter (l
22a0: 61 6d 62 64 61 20 28 74 65 73 74 29 28 66 69 6c  ambda (test)(fil
22b0: 65 2d 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 20  e-exists? (conc 
22c0: 74 65 73 74 20 22 2f 74 65 73 74 63 6f 6e 66 69  test "/testconfi
22d0: 67 22 29 29 29 20 74 65 73 74 73 29 29 0a 09 20  g"))) tests)).. 
22e0: 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73  (set! test-names
22f0: 20 28 61 70 70 65 6e 64 20 74 65 73 74 2d 6e 61   (append test-na
2300: 6d 65 73 20 0a 09 09 09 09 20 20 28 6d 61 70 20  mes .....  (map 
2310: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 70 29 0a  (lambda (testp).
2320: 09 09 09 09 09 20 28 6c 61 73 74 20 28 73 74 72  ..... (last (str
2330: 69 6e 67 2d 73 70 6c 69 74 20 74 65 73 74 70 20  ing-split testp 
2340: 22 2f 22 29 29 29 0a 09 09 09 09 20 20 20 20 20  "/"))).....     
2350: 20 20 74 65 73 74 73 29 29 29 29 29 0a 20 20 20    tests))))).   
2360: 20 20 28 69 66 20 74 65 73 74 2d 70 61 74 74 73    (if test-patts
2370: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 74   (string-split t
2380: 65 73 74 2d 70 61 74 74 73 20 22 2c 22 29 28 6c  est-patts ",")(l
2390: 69 73 74 20 22 25 22 29 29 29 0a 0a 20 20 20 20  ist "%")))..    
23a0: 20 3b 3b 20 6e 6f 77 20 72 65 6d 6f 76 65 20 64   ;; now remove d
23b0: 75 70 6c 69 63 61 74 65 73 0a 20 20 20 20 28 73  uplicates.    (s
23c0: 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28  et! test-names (
23d0: 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65  delete-duplicate
23e0: 73 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 0a  s test-names))..
23f0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
2400: 20 30 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 6e   0 "INFO: test n
2410: 61 6d 65 73 20 22 20 74 65 73 74 2d 6e 61 6d 65  ames " test-name
2420: 73 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68  s)..    ;; on th
2430: 65 20 66 69 72 73 74 20 70 61 73 73 20 6f 72 20  e first pass or 
2440: 63 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74  call to run-test
2450: 73 20 73 65 74 20 46 41 49 4c 53 20 74 6f 20 4e  s set FAILS to N
2460: 4f 54 5f 53 54 41 52 54 45 44 20 69 66 0a 20 20  OT_STARTED if.  
2470: 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20    ;; -keepgoing 
2480: 69 73 20 73 70 65 63 69 66 69 65 64 0a 20 20 20  is specified.   
2490: 20 28 69 66 20 28 65 71 3f 20 2a 70 61 73 73 6e   (if (eq? *passn
24a0: 75 6d 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a 09  um* 0)..(begin..
24b0: 20 20 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 6c    ;; have to del
24c0: 65 74 65 20 74 65 73 74 20 72 65 63 6f 72 64 73  ete test records
24d0: 20 77 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 54   where NOT_START
24e0: 45 44 20 73 69 6e 63 65 20 74 68 65 79 20 63 61  ED since they ca
24f0: 6e 20 63 61 75 73 65 20 2d 6b 65 65 70 67 6f 69  n cause -keepgoi
2500: 6e 67 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74  ng to ..  ;; get
2510: 20 73 74 75 63 6b 20 64 75 65 20 74 6f 20 62 65   stuck due to be
2520: 63 6f 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 69  coming inaccessi
2530: 62 6c 65 20 66 72 6f 6d 20 61 20 66 61 69 6c 65  ble from a faile
2540: 64 20 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 20  d test. I.e. if 
2550: 74 65 73 74 20 42 20 64 65 70 65 6e 64 73 20 0a  test B depends .
2560: 09 20 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20  .  ;; on test A 
2570: 62 75 74 20 74 65 73 74 20 42 20 72 65 61 63 68  but test B reach
2580: 65 64 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20  ed the point on 
2590: 62 65 69 6e 67 20 72 65 67 69 73 74 65 72 65 64  being registered
25a0: 20 61 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 20   as NOT_STARTED 
25b0: 61 6e 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 41  and test..  ;; A
25c0: 20 66 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65   failed for some
25d0: 20 72 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20   reason then on 
25e0: 72 65 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65  re-run using -ke
25f0: 65 70 67 6f 69 6e 67 20 74 68 65 20 72 75 6e 20  epgoing the run 
2600: 63 61 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65  can never comple
2610: 74 65 2e 0a 09 20 20 28 6f 70 65 6e 2d 72 75 6e  te...  (open-run
2620: 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65  -close db:delete
2630: 2d 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 20  -tests-in-state 
2640: 64 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53  db run-id "NOT_S
2650: 54 41 52 54 45 44 22 29 0a 09 20 20 28 6f 70 65  TARTED")..  (ope
2660: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 73  n-run-close db:s
2670: 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65 2d 73  et-tests-state-s
2680: 74 61 74 75 73 20 64 62 20 72 75 6e 2d 69 64 20  tatus db run-id 
2690: 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 22 46  test-names #f "F
26a0: 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54 45  AIL" "NOT_STARTE
26b0: 44 22 20 22 46 41 49 4c 22 29 29 29 0a 0a 20 20  D" "FAIL")))..  
26c0: 20 20 3b 3b 20 66 72 6f 6d 20 68 65 72 65 20 6f    ;; from here o
26d0: 6e 20 6f 75 74 20 74 68 65 20 64 62 20 77 69 6c  n out the db wil
26e0: 6c 20 62 65 20 6f 70 65 6e 65 64 20 61 6e 64 20  l be opened and 
26f0: 63 6c 6f 73 65 64 20 6f 6e 20 65 76 65 72 79 20  closed on every 
2700: 63 61 6c 6c 20 72 75 6e 73 3a 72 75 6e 2d 74 65  call runs:run-te
2710: 73 74 73 2d 71 75 65 75 65 0a 20 20 20 20 3b 3b  sts-queue.    ;;
2720: 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69   (sqlite3:finali
2730: 7a 65 21 20 64 62 29 20 0a 20 20 20 20 3b 3b 20  ze! db) .    ;; 
2740: 6e 6f 77 20 61 64 64 20 6e 6f 6e 2d 64 69 72 65  now add non-dire
2750: 63 74 6c 79 20 72 65 66 65 72 65 6e 63 65 64 20  ctly referenced 
2760: 64 65 70 65 6e 64 65 6e 63 69 65 73 20 28 69 2e  dependencies (i.
2770: 65 2e 20 77 61 69 74 6f 6e 29 0a 20 20 20 20 28  e. waiton).    (
2780: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74  if (not (null? t
2790: 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65  est-names))..(le
27a0: 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 28 63 61  t loop ((hed (ca
27b0: 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09  r test-names))..
27c0: 09 20 20 20 28 74 61 6c 20 28 63 64 72 20 74 65  .   (tal (cdr te
27d0: 73 74 2d 6e 61 6d 65 73 29 29 29 20 20 20 20 20  st-names)))     
27e0: 20 20 20 20 3b 3b 20 27 72 65 74 75 72 6e 2d 70      ;; 'return-p
27f0: 72 6f 63 73 20 74 65 6c 6c 73 20 74 68 65 20 63  rocs tells the c
2800: 6f 6e 66 69 67 20 72 65 61 64 65 72 20 74 6f 20  onfig reader to 
2810: 70 72 65 70 20 72 75 6e 6e 69 6e 67 20 73 79 73  prep running sys
2820: 74 65 6d 20 62 75 74 20 72 65 74 75 72 6e 20 61  tem but return a
2830: 20 70 72 6f 63 0a 09 20 20 28 64 65 62 75 67 3a   proc..  (debug:
2840: 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 68  print 4 "INFO: h
2850: 65 64 3d 22 20 68 65 64 20 22 20 61 74 20 74 6f  ed=" hed " at to
2860: 70 20 6f 66 20 6c 6f 6f 70 22 29 0a 09 20 20 28  p of loop")..  (
2870: 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20 28  let* ((config  (
2880: 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f  tests:get-testco
2890: 6e 66 69 67 20 68 65 64 20 27 72 65 74 75 72 6e  nfig hed 'return
28a0: 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61 69  -procs))... (wai
28b0: 74 6f 6e 73 20 28 69 66 20 63 6f 6e 66 69 67 20  tons (if config 
28c0: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 6c  (string-split (l
28d0: 65 74 20 28 28 77 20 28 63 6f 6e 66 69 67 2d 6c  et ((w (config-l
28e0: 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 65  ookup config "re
28f0: 71 75 69 72 65 6d 65 6e 74 73 22 20 22 77 61 69  quirements" "wai
2900: 74 6f 6e 22 29 29 29 0a 09 09 09 09 09 09 20 20  ton"))).......  
2910: 20 20 20 28 69 66 20 77 20 77 20 22 22 29 29 29     (if w w "")))
2920: 0a 09 09 09 20 20 20 20 20 20 28 62 65 67 69 6e  ....      (begin
2930: 0a 09 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e  .....(debug:prin
2940: 74 20 30 20 22 45 52 52 4f 52 3a 20 6e 6f 6e 2d  t 0 "ERROR: non-
2950: 65 78 69 73 74 65 6e 74 20 72 65 71 75 69 72 65  existent require
2960: 64 20 74 65 73 74 20 5c 22 22 20 68 65 64 20 22  d test \"" hed "
2970: 5c 22 22 29 0a 20 20 20 20 20 20 20 20 20 20 20  \"").           
2980: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2990: 20 20 20 20 20 28 69 66 20 64 62 20 28 73 71 6c       (if db (sql
29a0: 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64  ite3:finalize! d
29b0: 62 29 29 0a 09 09 09 09 28 65 78 69 74 20 31 29  b)).....(exit 1)
29c0: 29 29 29 29 0a 09 20 20 20 20 3b 3b 20 63 68 65  ))))..    ;; che
29d0: 63 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 77 61  ck for hed in wa
29e0: 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77 6f  itons => this wo
29f0: 75 6c 64 20 62 65 20 63 69 72 63 75 6c 61 72 2c  uld be circular,
2a00: 20 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 20 69   remove it and i
2a10: 73 73 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b 20  ssue an..    ;; 
2a20: 65 72 72 6f 72 0a 09 20 20 20 20 28 69 66 20 28  error..    (if (
2a30: 6d 65 6d 62 65 72 20 68 65 64 20 77 61 69 74 6f  member hed waito
2a40: 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20  ns)...(begin... 
2a50: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
2a60: 22 45 52 52 4f 52 3a 20 74 65 73 74 20 22 20 68  "ERROR: test " h
2a70: 65 64 20 22 20 68 61 73 20 6c 69 73 74 65 64 20  ed " has listed 
2a80: 69 74 73 65 6c 66 20 61 73 20 61 20 77 61 69 74  itself as a wait
2a90: 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72 65  on, please corre
2aa0: 63 74 20 74 68 69 73 21 22 29 0a 09 09 20 20 28  ct this!")...  (
2ab0: 73 65 74 21 20 77 61 69 74 6f 6e 73 20 28 66 69  set! waitons (fi
2ac0: 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29  lter (lambda (x)
2ad0: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 68  (not (equal? x h
2ae0: 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29 29  ed))) waitons)))
2af0: 29 0a 09 20 20 20 20 0a 09 20 20 20 20 3b 3b 20  )..    ..    ;; 
2b00: 28 69 74 65 6d 73 20 20 20 28 69 74 65 6d 73 3a  (items   (items:
2b10: 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63  get-items-from-c
2b20: 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 29 0a  onfig config))).
2b30: 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68  .    (if (not (h
2b40: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
2b50: 66 61 75 6c 74 20 74 65 73 74 2d 72 65 63 6f 72  fault test-recor
2b60: 64 73 20 68 65 64 20 23 66 29 29 0a 09 09 28 68  ds hed #f))...(h
2b70: 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74  ash-table-set! t
2b80: 65 73 74 2d 72 65 63 6f 72 64 73 0a 09 09 09 09  est-records.....
2b90: 20 68 65 64 20 28 76 65 63 74 6f 72 20 68 65 64   hed (vector hed
2ba0: 20 20 20 20 20 3b 3b 20 30 0a 09 09 09 09 09 20       ;; 0...... 
2bb0: 20 20 20 20 63 6f 6e 66 69 67 20 20 3b 3b 20 31      config  ;; 1
2bc0: 0a 09 09 09 09 09 20 20 20 20 20 77 61 69 74 6f  ......     waito
2bd0: 6e 73 20 3b 3b 20 32 0a 09 09 09 09 09 20 20 20  ns ;; 2......   
2be0: 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70    (config-lookup
2bf0: 20 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65   config "require
2c00: 6d 65 6e 74 73 22 20 22 70 72 69 6f 72 69 74 79  ments" "priority
2c10: 22 29 20 20 20 20 20 3b 3b 20 70 72 69 6f 72 69  ")     ;; priori
2c20: 74 79 20 33 0a 09 09 09 09 09 20 20 20 20 20 28  ty 3......     (
2c30: 6c 65 74 20 28 28 69 74 65 6d 73 20 20 20 20 20  let ((items     
2c40: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
2c50: 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20  /default config 
2c60: 22 69 74 65 6d 73 22 20 23 66 29 29 20 3b 3b 20  "items" #f)) ;; 
2c70: 69 74 65 6d 73 20 34 0a 09 09 09 09 09 09 20 20  items 4.......  
2c80: 20 28 69 74 65 6d 73 74 61 62 6c 65 20 28 68 61   (itemstable (ha
2c90: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
2ca0: 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 65  ault config "ite
2cb0: 6d 73 74 61 62 6c 65 22 20 23 66 29 29 29 20 0a  mstable" #f))) .
2cc0: 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69  .....       ;; i
2cd0: 66 20 65 69 74 68 65 72 20 69 74 65 6d 73 20 6f  f either items o
2ce0: 72 20 69 74 65 6d 73 20 74 61 62 6c 65 20 69 73  r items table is
2cf0: 20 61 20 70 72 6f 63 20 72 65 74 75 72 6e 20 69   a proc return i
2d00: 74 20 73 6f 20 74 65 73 74 20 72 75 6e 6e 69 6e  t so test runnin
2d10: 67 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b  g......       ;;
2d20: 20 70 72 6f 63 65 73 73 20 63 61 6e 20 6b 6e 6f   process can kno
2d30: 77 20 74 6f 20 63 61 6c 6c 20 69 74 65 6d 73 3a  w to call items:
2d40: 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63  get-items-from-c
2d50: 6f 6e 66 69 67 0a 09 09 09 09 09 20 20 20 20 20  onfig......     
2d60: 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20 69    ;; if either i
2d70: 73 20 61 20 6c 69 73 74 20 61 6e 64 20 6e 6f 6e  s a list and non
2d80: 65 20 69 73 20 61 20 70 72 6f 63 20 67 6f 20 61  e is a proc go a
2d90: 68 65 61 64 20 61 6e 64 20 63 61 6c 6c 20 67 65  head and call ge
2da0: 74 2d 69 74 65 6d 73 0a 09 09 09 09 09 20 20 20  t-items......   
2db0: 20 20 20 20 3b 3b 20 6f 74 68 65 72 77 69 73 65      ;; otherwise
2dc0: 20 72 65 74 75 72 6e 20 23 66 20 2d 20 74 68 69   return #f - thi
2dd0: 73 20 69 73 20 6e 6f 74 20 61 6e 20 69 74 65 72  s is not an iter
2de0: 61 74 65 64 20 74 65 73 74 0a 09 09 09 09 09 20  ated test...... 
2df0: 20 20 20 20 20 20 28 63 6f 6e 64 0a 09 09 09 09        (cond.....
2e00: 09 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20 69  ..((procedure? i
2e10: 74 65 6d 73 29 20 20 20 20 20 20 0a 09 09 09 09  tems)      .....
2e20: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .. (debug:print 
2e30: 34 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 69  4 "INFO: items i
2e40: 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77  s a procedure, w
2e50: 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29  ill calc later")
2e60: 0a 09 09 09 09 09 09 20 69 74 65 6d 73 29 20 20  ....... items)  
2e70: 20 20 20 20 20 20 20 20 20 20 3b 3b 20 63 61 6c            ;; cal
2e80: 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28  c later.......((
2e90: 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73  procedure? items
2ea0: 74 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28 64  table)....... (d
2eb0: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e  ebug:print 4 "IN
2ec0: 46 4f 3a 20 69 74 65 6d 73 74 61 62 6c 65 20 69  FO: itemstable i
2ed0: 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77  s a procedure, w
2ee0: 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29  ill calc later")
2ef0: 0a 09 09 09 09 09 09 20 69 74 65 6d 73 74 61 62  ....... itemstab
2f00: 6c 65 29 20 20 20 20 20 20 20 3b 3b 20 63 61 6c  le)       ;; cal
2f10: 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28  c later.......((
2f20: 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28  filter (lambda (
2f30: 78 29 0a 09 09 09 09 09 09 09 20 20 20 28 6c 65  x)........   (le
2f40: 74 20 28 28 76 61 6c 20 28 63 61 72 20 78 29 29  t ((val (car x))
2f50: 29 0a 09 09 09 09 09 09 09 20 20 20 20 20 28 69  )........     (i
2f60: 66 20 28 70 72 6f 63 65 64 75 72 65 3f 20 76 61  f (procedure? va
2f70: 6c 29 20 76 61 6c 20 23 66 29 29 29 0a 09 09 09  l) val #f)))....
2f80: 09 09 09 09 20 28 61 70 70 65 6e 64 20 28 69 66  .... (append (if
2f90: 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69   (list? items) i
2fa0: 74 65 6d 73 20 27 28 29 29 0a 09 09 09 09 09 09  tems '()).......
2fb0: 09 09 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74  .. (if (list? it
2fc0: 65 6d 73 74 61 62 6c 65 29 20 69 74 65 6d 73 74  emstable) itemst
2fd0: 61 62 6c 65 20 27 28 29 29 29 29 0a 09 09 09 09  able '()))).....
2fe0: 09 09 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75  .. 'have-procedu
2ff0: 72 65 29 0a 09 09 09 09 09 09 28 28 6f 72 20 28  re).......((or (
3000: 6c 69 73 74 3f 20 69 74 65 6d 73 29 28 6c 69 73  list? items)(lis
3010: 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 20  t? itemstable)) 
3020: 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09 09  ;; calc now.....
3030: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .. (debug:print 
3040: 34 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 61  4 "INFO: items a
3050: 6e 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61 72  nd itemstable ar
3060: 65 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e 6f  e lists, calc no
3070: 77 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20 20  w\n"........    
3080: 20 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22 20    "    items: " 
3090: 69 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61 62  items " itemstab
30a0: 6c 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c 65  le: " itemstable
30b0: 29 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73 3a  )....... (items:
30c0: 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63  get-items-from-c
30d0: 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a 09  onfig config))..
30e0: 09 09 09 09 09 28 65 6c 73 65 20 23 66 29 29 29  .....(else #f)))
30f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
3100: 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e 6f             ;; no
3110: 74 20 69 74 65 72 61 74 65 64 0a 09 09 09 09 09  t iterated......
3120: 20 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20       #f      ;; 
3130: 69 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09 09  itemsdat 5......
3140: 20 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20       #f      ;; 
3150: 73 70 61 72 65 20 2d 20 75 73 65 64 20 66 6f 72  spare - used for
3160: 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 09 09   item-path......
3170: 20 20 20 20 20 29 29 29 0a 09 20 20 20 20 28 66       )))..    (f
3180: 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20 28  or-each ..     (
3190: 6c 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29 0a  lambda (waiton).
31a0: 09 20 20 20 20 20 20 20 28 69 66 20 28 61 6e 64  .       (if (and
31b0: 20 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d 65   waiton (not (me
31c0: 6d 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73 74  mber waiton test
31d0: 2d 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20 28  -names)))...   (
31e0: 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73 65  begin...     (se
31f0: 74 21 20 72 65 71 75 69 72 65 64 2d 74 65 73 74  t! required-test
3200: 73 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 72  s (cons waiton r
3210: 65 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a  equired-tests)).
3220: 09 09 20 20 20 20 20 28 73 65 74 21 20 74 65 73  ..     (set! tes
3230: 74 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77 61  t-names (cons wa
3240: 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29  iton test-names)
3250: 29 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20 61  )))) ;; was an a
3260: 70 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f 6e  ppend, now a con
3270: 73 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73 29  s..     waitons)
3280: 0a 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d  ..    (let ((rem
3290: 74 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64 75  tests (delete-du
32a0: 70 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e 64  plicates (append
32b0: 20 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 29   waitons tal))))
32c0: 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74  ..      (if (not
32d0: 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73   (null? remtests
32e0: 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61  ))...  (loop (ca
32f0: 72 20 72 65 6d 74 65 73 74 73 29 28 63 64 72 20  r remtests)(cdr 
3300: 72 65 6d 74 65 73 74 73 29 29 29 29 29 29 29 0a  remtests))))))).
3310: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e  .    (if (not (n
3320: 75 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 65  ull? required-te
3330: 73 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70 72  sts))..(debug:pr
3340: 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 64 64  int 1 "INFO: Add
3350: 69 6e 67 20 22 20 72 65 71 75 69 72 65 64 2d 74  ing " required-t
3360: 65 73 74 73 20 22 20 74 6f 20 74 68 65 20 72 75  ests " to the ru
3370: 6e 20 71 75 65 75 65 22 29 29 0a 20 20 20 20 3b  n queue")).    ;
3380: 3b 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 72  ; NOTE: these ar
3390: 65 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 73  e all parent tes
33a0: 74 73 2c 20 69 74 65 6d 73 20 61 72 65 20 6e 6f  ts, items are no
33b0: 74 20 65 78 70 61 6e 64 65 64 20 79 65 74 2e 0a  t expanded yet..
33c0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
33d0: 20 34 20 22 49 4e 46 4f 3a 20 74 65 73 74 2d 72   4 "INFO: test-r
33e0: 65 63 6f 72 64 73 3d 22 20 28 68 61 73 68 2d 74  ecords=" (hash-t
33f0: 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 74  able->alist test
3400: 2d 72 65 63 6f 72 64 73 29 29 0a 20 20 20 20 28  -records)).    (
3410: 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71  runs:run-tests-q
3420: 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e 6e  ueue run-id runn
3430: 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 73  ame test-records
3440: 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 73   keyvallst flags
3450: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ).    (debug:pri
3460: 6e 74 20 34 20 22 49 4e 46 4f 3a 20 41 6c 6c 20  nt 4 "INFO: All 
3470: 64 6f 6e 65 20 62 79 20 68 65 72 65 22 29 29 29  done by here")))
3480: 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a  ..(define (runs:
3490: 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65  calc-fails prere
34a0: 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 20 20 28 66  qs-not-met).  (f
34b0: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 74  ilter (lambda (t
34c0: 65 73 74 29 0a 09 20 20 20 20 28 61 6e 64 20 28  est)..    (and (
34d0: 76 65 63 74 6f 72 3f 20 74 65 73 74 29 20 3b 3b  vector? test) ;;
34e0: 20 6e 6f 74 20 28 73 74 72 69 6e 67 3f 20 74 65   not (string? te
34f0: 73 74 29 29 0a 09 09 20 28 65 71 75 61 6c 3f 20  st))... (equal? 
3500: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61  (db:test-get-sta
3510: 74 65 20 74 65 73 74 29 20 22 43 4f 4d 50 4c 45  te test) "COMPLE
3520: 54 45 44 22 29 0a 09 09 20 28 6e 6f 74 20 28 6d  TED")... (not (m
3530: 65 6d 62 65 72 20 28 64 62 3a 74 65 73 74 2d 67  ember (db:test-g
3540: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 29 0a  et-status test).
3550: 09 09 09 20 20 20 20 20 20 27 28 22 50 41 53 53  ...      '("PASS
3560: 22 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22  " "WARN" "CHECK"
3570: 20 22 57 41 49 56 45 44 22 29 29 29 29 29 0a 09   "WAIVED")))))..
3580: 20 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65    prereqs-not-me
3590: 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75  t))..(define (ru
35a0: 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70  ns:calc-not-comp
35b0: 6c 65 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f  leted prereqs-no
35c0: 74 2d 6d 65 74 29 0a 20 20 28 66 69 6c 74 65 72  t-met).  (filter
35d0: 0a 20 20 20 28 6c 61 6d 62 64 61 20 28 74 29 0a  .   (lambda (t).
35e0: 20 20 20 20 20 28 6f 72 20 28 6e 6f 74 20 28 76       (or (not (v
35f0: 65 63 74 6f 72 3f 20 74 29 29 0a 09 20 28 6e 6f  ector? t)).. (no
3600: 74 20 28 65 71 75 61 6c 3f 20 22 43 4f 4d 50 4c  t (equal? "COMPL
3610: 45 54 45 44 22 20 28 64 62 3a 74 65 73 74 2d 67  ETED" (db:test-g
3620: 65 74 2d 73 74 61 74 65 20 74 29 29 29 29 29 0a  et-state t))))).
3630: 20 20 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d     prereqs-not-m
3640: 65 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72  et))..(define (r
3650: 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e  uns:pretty-strin
3660: 67 20 6c 73 74 29 0a 20 20 28 6d 61 70 20 28 6c  g lst).  (map (l
3670: 61 6d 62 64 61 20 28 74 29 0a 09 20 28 69 66 20  ambda (t).. (if 
3680: 28 6e 6f 74 20 28 76 65 63 74 6f 72 3f 20 74 29  (not (vector? t)
3690: 29 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 74 29  )..     (conc t)
36a0: 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 28 64 62  ..     (conc (db
36b0: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61  :test-get-testna
36c0: 6d 65 20 74 29 20 22 3a 22 20 28 64 62 3a 74 65  me t) ":" (db:te
36d0: 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 20  st-get-state t) 
36e0: 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  "/" (db:test-get
36f0: 2d 73 74 61 74 75 73 20 74 29 29 29 29 0a 20 20  -status t)))).  
3700: 20 20 20 20 20 6c 73 74 29 29 0a 0a 28 64 65 66       lst))..(def
3710: 69 6e 65 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66  ine (runs:make-f
3720: 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65  ull-test-name te
3730: 73 74 6e 61 6d 65 20 69 74 65 6d 70 61 74 68 29  stname itempath)
3740: 0a 20 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69  .  (if (equal? i
3750: 74 65 6d 70 61 74 68 20 22 22 29 20 74 65 73 74  tempath "") test
3760: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e  name (conc testn
3770: 61 6d 65 20 22 2f 22 20 69 74 65 6d 70 61 74 68  ame "/" itempath
3780: 29 29 29 0a 0a 3b 3b 20 74 65 73 74 2d 72 65 63  )))..;; test-rec
3790: 6f 72 64 73 20 69 73 20 61 20 68 61 73 68 20 74  ords is a hash t
37a0: 61 62 6c 65 20 74 65 73 74 6e 61 6d 65 3a 69 74  able testname:it
37b0: 65 6d 5f 70 61 74 68 20 3d 3e 20 76 65 63 74 6f  em_path => vecto
37c0: 72 20 3c 20 74 65 73 74 6e 61 6d 65 20 74 65 73  r < testname tes
37d0: 74 63 6f 6e 66 69 67 20 77 61 69 74 6f 6e 73 20  tconfig waitons 
37e0: 70 72 69 6f 72 69 74 79 20 69 74 65 6d 73 2d 69  priority items-i
37f0: 6e 66 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66 69 6e  nfo ... >.(defin
3800: 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74  e (runs:run-test
3810: 73 2d 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72  s-queue run-id r
3820: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f  unname test-reco
3830: 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c  rds keyvallst fl
3840: 61 67 73 29 0a 20 20 20 20 3b 3b 20 41 74 20 74  ags).    ;; At t
3850: 68 69 73 20 70 6f 69 6e 74 20 74 68 65 20 6c 69  his point the li
3860: 73 74 20 6f 66 20 70 61 72 65 6e 74 20 74 65 73  st of parent tes
3870: 74 73 20 69 73 20 65 78 70 61 6e 64 65 64 20 0a  ts is expanded .
3880: 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75      ;; NB// Shou
3890: 6c 64 20 65 78 70 61 6e 64 20 69 74 65 6d 73 20  ld expand items 
38a0: 68 65 72 65 20 61 6e 64 20 74 68 65 6e 20 69 6e  here and then in
38b0: 73 65 72 74 20 69 6e 74 6f 20 74 68 65 20 72 75  sert into the ru
38c0: 6e 20 71 75 65 75 65 2e 0a 20 20 28 64 65 62 75  n queue..  (debu
38d0: 67 3a 70 72 69 6e 74 20 35 20 22 74 65 73 74 2d  g:print 5 "test-
38e0: 72 65 63 6f 72 64 73 3a 20 22 20 74 65 73 74 2d  records: " test-
38f0: 72 65 63 6f 72 64 73 20 22 2c 20 6b 65 79 76 61  records ", keyva
3900: 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73  llst: " keyvalls
3910: 74 20 22 20 66 6c 61 67 73 3a 20 22 20 28 68 61  t " flags: " (ha
3920: 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20  sh-table->alist 
3930: 66 6c 61 67 73 29 29 0a 20 20 28 6c 65 74 20 28  flags)).  (let (
3940: 28 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d  (sorted-test-nam
3950: 65 73 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62  es (tests:sort-b
3960: 79 2d 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77  y-priority-and-w
3970: 61 69 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72  aiton test-recor
3980: 64 73 29 29 0a 09 28 69 74 65 6d 2d 70 61 74 74  ds))..(item-patt
3990: 73 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74  s        (hash-t
39a0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
39b0: 20 66 6c 61 67 73 20 22 2d 69 74 65 6d 70 61 74   flags "-itempat
39c0: 74 22 20 23 66 29 29 0a 09 28 74 65 73 74 2d 72  t" #f))..(test-r
39d0: 65 67 69 73 74 65 72 79 20 20 20 20 28 6d 61 6b  egistery    (mak
39e0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 0a 09  e-hash-table))..
39f0: 28 6e 75 6d 2d 72 65 74 72 69 65 73 20 20 20 20  (num-retries    
3a00: 20 20 20 20 30 29 0a 09 28 6d 61 78 2d 72 65 74      0)..(max-ret
3a10: 72 69 65 73 20 20 20 20 20 20 20 28 63 6f 6e 66  ries       (conf
3a20: 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69  ig-lookup *confi
3a30: 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 22 6d  gdat* "setup" "m
3a40: 61 78 72 65 74 72 69 65 73 22 29 29 29 0a 20 20  axretries"))).  
3a50: 20 20 28 73 65 74 21 20 6d 61 78 2d 72 65 74 72    (set! max-retr
3a60: 69 65 73 20 28 69 66 20 28 61 6e 64 20 6d 61 78  ies (if (and max
3a70: 2d 72 65 74 72 69 65 73 20 28 73 74 72 69 6e 67  -retries (string
3a80: 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65 74  ->number max-ret
3a90: 72 69 65 73 29 29 28 73 74 72 69 6e 67 2d 3e 6e  ries))(string->n
3aa0: 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 72 69 65  umber max-retrie
3ab0: 73 29 20 31 30 30 29 29 0a 20 20 20 20 28 69 66  s) 100)).    (if
3ac0: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f 72   (not (null? sor
3ad0: 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29  ted-test-names))
3ae0: 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65  ..(let loop ((he
3af0: 64 20 20 20 20 20 20 20 20 20 28 63 61 72 20 73  d         (car s
3b00: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73  orted-test-names
3b10: 29 29 0a 09 09 20 20 20 28 74 61 6c 20 20 20 20  ))...   (tal    
3b20: 20 20 20 20 20 28 63 64 72 20 73 6f 72 74 65 64       (cdr sorted
3b30: 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09  -test-names))...
3b40: 20 20 20 28 72 65 72 75 6e 73 20 20 20 20 20 20     (reruns      
3b50: 27 28 29 29 29 0a 09 20 20 28 69 66 20 28 6e 6f  '()))..  (if (no
3b60: 74 20 28 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 29  t (null? reruns)
3b70: 29 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20  )(debug:print 4 
3b80: 22 49 4e 46 4f 3a 20 72 65 72 75 6e 73 3d 22 20  "INFO: reruns=" 
3b90: 72 65 72 75 6e 73 29 29 0a 09 20 20 3b 3b 20 28  reruns))..  ;; (
3ba0: 70 72 69 6e 74 20 22 54 6f 70 20 6f 66 20 6c 6f  print "Top of lo
3bb0: 6f 70 2c 20 68 65 64 3d 22 20 68 65 64 20 22 2c  op, hed=" hed ",
3bc0: 20 74 61 6c 3d 22 20 74 61 6c 20 22 20 2c 72 65   tal=" tal " ,re
3bd0: 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 29 0a 09  runs=" reruns)..
3be0: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 72    (let* ((test-r
3bf0: 65 63 6f 72 64 20 28 68 61 73 68 2d 74 61 62 6c  ecord (hash-tabl
3c00: 65 2d 72 65 66 20 74 65 73 74 2d 72 65 63 6f 72  e-ref test-recor
3c10: 64 73 20 68 65 64 29 29 0a 09 09 20 28 74 65 73  ds hed))... (tes
3c20: 74 2d 6e 61 6d 65 20 20 20 28 74 65 73 74 73 3a  t-name   (tests:
3c30: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65  testqueue-get-te
3c40: 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f  stname test-reco
3c50: 72 64 29 29 0a 09 09 20 28 74 63 6f 6e 66 69 67  rd))... (tconfig
3c60: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74       (tests:test
3c70: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f  queue-get-testco
3c80: 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64  nfig test-record
3c90: 29 29 0a 09 09 20 28 74 65 73 74 6d 6f 64 65 20  ))... (testmode 
3ca0: 20 20 20 28 6c 65 74 20 28 28 6d 20 28 63 6f 6e     (let ((m (con
3cb0: 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66  fig-lookup tconf
3cc0: 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73  ig "requirements
3cd0: 22 20 22 6d 6f 64 65 22 29 29 29 0a 09 09 09 09  " "mode"))).....
3ce0: 28 69 66 20 6d 20 28 73 74 72 69 6e 67 2d 3e 73  (if m (string->s
3cf0: 79 6d 62 6f 6c 20 6d 29 20 27 6e 6f 72 6d 61 6c  ymbol m) 'normal
3d00: 29 29 29 0a 09 09 20 28 77 61 69 74 6f 6e 73 20  )))... (waitons 
3d10: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
3d20: 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73  ueue-get-waitons
3d30: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29      test-record)
3d40: 29 0a 09 09 20 28 70 72 69 6f 72 69 74 79 20 20  )... (priority  
3d50: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
3d60: 75 65 2d 67 65 74 2d 70 72 69 6f 72 69 74 79 20  ue-get-priority 
3d70: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a    test-record)).
3d80: 09 09 20 28 69 74 65 6d 64 61 74 20 20 20 20 20  .. (itemdat     
3d90: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
3da0: 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20  -get-itemdat    
3db0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b  test-record)) ;;
3dc0: 20 69 74 65 6d 64 61 74 20 63 61 6e 20 62 65 20   itemdat can be 
3dd0: 61 20 73 74 72 69 6e 67 2c 20 6c 69 73 74 20 6f  a string, list o
3de0: 72 20 23 66 0a 09 09 20 28 69 74 65 6d 73 20 20  r #f... (items  
3df0: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74       (tests:test
3e00: 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 73 20  queue-get-items 
3e10: 20 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64       test-record
3e20: 29 29 0a 09 09 20 28 69 74 65 6d 2d 70 61 74 68  ))... (item-path
3e30: 20 20 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70     (item-list->p
3e40: 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 09 09  ath itemdat))...
3e50: 20 28 6e 65 77 74 61 6c 20 20 20 20 20 20 28 61   (newtal      (a
3e60: 70 70 65 6e 64 20 74 61 6c 20 28 6c 69 73 74 20  ppend tal (list 
3e70: 68 65 64 29 29 29 29 0a 09 20 20 20 20 0a 09 20  hed))))..    .. 
3e80: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
3e90: 36 0a 09 09 09 20 22 74 65 73 74 2d 6e 61 6d 65  6.... "test-name
3ea0: 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 0a 09 09  : " test-name...
3eb0: 09 20 22 5c 6e 20 20 68 65 64 3a 20 20 20 20 20  . "\n  hed:     
3ec0: 20 20 20 20 22 20 68 65 64 0a 09 09 09 20 22 5c      " hed.... "\
3ed0: 6e 20 20 69 74 65 6d 64 61 74 3a 20 20 20 20 20  n  itemdat:     
3ee0: 22 20 69 74 65 6d 64 61 74 0a 09 09 09 20 22 5c  " itemdat.... "\
3ef0: 6e 20 20 69 74 65 6d 73 3a 20 20 20 20 20 20 20  n  items:       
3f00: 22 20 69 74 65 6d 73 0a 09 09 09 20 22 5c 6e 20  " items.... "\n 
3f10: 20 69 74 65 6d 2d 70 61 74 68 3a 20 20 20 22 20   item-path:   " 
3f20: 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 22 5c  item-path.... "\
3f30: 6e 20 20 77 61 69 74 6f 6e 73 3a 20 20 20 20 20  n  waitons:     
3f40: 22 20 77 61 69 74 6f 6e 73 0a 09 09 09 20 22 5c  " waitons.... "\
3f50: 6e 20 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a 20  n  num-retries: 
3f60: 22 20 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09 09  " num-retries...
3f70: 09 20 22 5c 6e 20 20 74 61 6c 3a 20 20 20 20 20  . "\n  tal:     
3f80: 20 20 20 20 22 20 74 61 6c 0a 09 09 09 20 22 5c      " tal.... "\
3f90: 6e 20 20 72 65 72 75 6e 73 3a 20 20 20 20 20 20  n  reruns:      
3fa0: 22 20 72 65 72 75 6e 73 29 0a 0a 09 20 20 20 20  " reruns)...    
3fb0: 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65 64  ;; check for hed
3fc0: 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74   in waitons => t
3fd0: 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69 72  his would be cir
3fe0: 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69 74  cular, remove it
3ff0: 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09 20   and issue an.. 
4000: 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20     ;; error..   
4010: 20 28 69 66 20 28 6d 65 6d 62 65 72 20 74 65 73   (if (member tes
4020: 74 2d 6e 61 6d 65 20 77 61 69 74 6f 6e 73 29 0a  t-name waitons).
4030: 09 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65  ..(begin...  (de
4040: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
4050: 4f 52 3a 20 74 65 73 74 20 22 20 74 65 73 74 2d  OR: test " test-
4060: 6e 61 6d 65 20 22 20 68 61 73 20 6c 69 73 74 65  name " has liste
4070: 64 20 69 74 73 65 6c 66 20 61 73 20 61 20 77 61  d itself as a wa
4080: 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72  iton, please cor
4090: 72 65 63 74 20 74 68 69 73 21 22 29 0a 09 09 20  rect this!")... 
40a0: 20 28 73 65 74 21 20 77 61 69 74 6f 6e 20 28 66   (set! waiton (f
40b0: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78  ilter (lambda (x
40c0: 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20  )(not (equal? x 
40d0: 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29  hed))) waitons))
40e0: 29 29 0a 0a 09 20 20 20 20 28 63 6f 6e 64 20 3b  ))...    (cond ;
40f0: 3b 20 4f 55 54 45 52 20 43 4f 4e 44 0a 09 20 20  ; OUTER COND..  
4100: 20 20 20 28 28 6e 6f 74 20 69 74 65 6d 73 29 20     ((not items) 
4110: 3b 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 74 68  ;; when false th
4120: 65 20 74 65 73 74 20 69 73 20 6f 6b 20 74 6f 20  e test is ok to 
4130: 62 65 20 68 61 6e 64 65 64 20 6f 66 66 20 74 6f  be handed off to
4140: 20 6c 61 75 6e 63 68 20 28 62 75 74 20 6e 6f 74   launch (but not
4150: 20 62 65 66 6f 72 65 29 0a 09 20 20 20 20 20 20   before)..      
4160: 28 6c 65 74 2a 20 28 28 72 75 6e 2d 6c 69 6d 69  (let* ((run-limi
4170: 74 73 2d 69 6e 66 6f 20 20 20 20 20 20 20 20 20  ts-info         
4180: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
4190: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72  runs:can-run-mor
41a0: 65 2d 74 65 73 74 73 20 23 66 20 74 65 73 74 2d  e-tests #f test-
41b0: 72 65 63 6f 72 64 29 29 20 3b 3b 20 6c 6f 6f 6b  record)) ;; look
41c0: 20 61 74 20 74 68 65 20 74 65 73 74 20 6a 6f 62   at the test job
41d0: 67 72 6f 75 70 20 61 6e 64 20 74 6f 74 20 6a 6f  group and tot jo
41e0: 62 73 20 72 75 6e 6e 69 6e 67 0a 09 09 20 20 20  bs running...   
41f0: 20 20 28 68 61 76 65 2d 72 65 73 6f 75 72 63 65    (have-resource
4200: 73 20 20 20 20 20 20 20 20 20 20 28 63 61 72 20  s          (car 
4210: 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 29  run-limits-info)
4220: 29 0a 09 09 20 20 20 20 20 28 6e 75 6d 2d 72 75  )...     (num-ru
4230: 6e 6e 69 6e 67 20 20 20 20 20 20 20 20 20 20 20  nning           
4240: 20 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d    (list-ref run-
4250: 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 31 29 29 0a  limits-info 1)).
4260: 09 09 20 20 20 20 20 28 6e 75 6d 2d 72 75 6e 6e  ..     (num-runn
4270: 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20  ing-in-jobgroup 
4280: 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69  (list-ref run-li
4290: 6d 69 74 73 2d 69 6e 66 6f 20 32 29 29 0a 09 09  mits-info 2))...
42a0: 20 20 20 20 20 28 6d 61 78 2d 63 6f 6e 63 75 72       (max-concur
42b0: 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28 6c  rent-jobs     (l
42c0: 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69  ist-ref run-limi
42d0: 74 73 2d 69 6e 66 6f 20 33 29 29 0a 09 09 20 20  ts-info 3))...  
42e0: 20 20 20 28 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69     (job-group-li
42f0: 6d 69 74 20 20 20 20 20 20 20 20 20 28 6c 69 73  mit         (lis
4300: 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73  t-ref run-limits
4310: 2d 69 6e 66 6f 20 34 29 29 0a 09 09 20 20 20 20  -info 4))...    
4320: 20 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65   (prereqs-not-me
4330: 74 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d  t         (open-
4340: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
4350: 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74  -prereqs-not-met
4360: 20 23 66 20 72 75 6e 2d 69 64 20 77 61 69 74 6f   #f run-id waito
4370: 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64  ns item-path mod
4380: 65 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a 09 09  e: testmode))...
4390: 20 20 20 20 20 28 66 61 69 6c 73 20 20 20 20 20       (fails     
43a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72                (r
43b0: 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70  uns:calc-fails p
43c0: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29  rereqs-not-met))
43d0: 0a 09 09 20 20 20 20 20 28 6e 6f 6e 2d 63 6f 6d  ...     (non-com
43e0: 70 6c 65 74 65 64 20 20 20 20 20 20 20 20 20 20  pleted          
43f0: 20 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d   (runs:calc-not-
4400: 63 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71  completed prereq
4410: 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 28  s-not-met)))...(
4420: 64 65 62 75 67 3a 70 72 69 6e 74 20 38 20 22 49  debug:print 8 "I
4430: 4e 46 4f 3a 20 68 61 76 65 2d 72 65 73 6f 75 72  NFO: have-resour
4440: 63 65 73 3a 20 22 20 68 61 76 65 2d 72 65 73 6f  ces: " have-reso
4450: 75 72 63 65 73 20 22 20 70 72 65 72 65 71 73 2d  urces " prereqs-
4460: 6e 6f 74 2d 6d 65 74 3a 20 22 20 0a 09 09 09 20  not-met: " .... 
4470: 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65      (string-inte
4480: 72 73 70 65 72 73 65 20 0a 09 09 09 20 20 20 20  rsperse ....    
4490: 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28    (map (lambda (
44a0: 74 29 0a 09 09 09 09 20 20 20 20 20 28 69 66 20  t).....     (if 
44b0: 28 76 65 63 74 6f 72 3f 20 74 29 0a 09 09 09 09  (vector? t).....
44c0: 09 20 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74  . (conc (db:test
44d0: 2d 67 65 74 2d 73 74 61 74 65 20 74 29 20 22 2f  -get-state t) "/
44e0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  " (db:test-get-s
44f0: 74 61 74 75 73 20 74 29 29 0a 09 09 09 09 09 20  tatus t))...... 
4500: 28 63 6f 6e 63 20 22 20 57 41 52 4e 49 4e 47 3a  (conc " WARNING:
4510: 20 74 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74   t is not a vect
4520: 6f 72 3d 22 20 74 20 29 29 29 0a 09 09 09 09 20  or=" t )))..... 
4530: 20 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65    prereqs-not-me
4540: 74 29 20 22 2c 20 22 29 20 22 20 66 61 69 6c 73  t) ", ") " fails
4550: 3a 20 22 20 66 61 69 6c 73 29 0a 09 09 28 64 65  : " fails)...(de
4560: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46  bug:print 4 "INF
4570: 4f 3a 20 68 65 64 3d 22 20 68 65 64 29 0a 0a 09  O: hed=" hed)...
4580: 09 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 61  .;; Don't know a
4590: 74 20 74 68 69 73 20 74 69 6d 65 20 69 66 20 74  t this time if t
45a0: 68 65 20 74 65 73 74 20 68 61 76 65 20 62 65 65  he test have bee
45b0: 6e 20 6c 61 75 6e 63 68 65 64 20 61 74 20 73 6f  n launched at so
45c0: 6d 65 20 74 69 6d 65 20 69 6e 20 74 68 65 20 70  me time in the p
45d0: 61 73 74 0a 09 09 3b 3b 20 69 2e 65 2e 20 69 73  ast...;; i.e. is
45e0: 20 74 68 69 73 20 61 20 72 65 2d 6c 61 75 6e 63   this a re-launc
45f0: 68 3f 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e  h?...(debug:prin
4600: 74 20 34 20 22 49 4e 46 4f 3a 20 72 75 6e 2d 6c  t 4 "INFO: run-l
4610: 69 6d 69 74 73 2d 69 6e 66 6f 20 3d 20 22 20 72  imits-info = " r
4620: 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 29 0a  un-limits-info).
4630: 09 09 28 63 6f 6e 64 20 3b 3b 20 49 4e 4e 45 52  ..(cond ;; INNER
4640: 20 43 4f 4e 44 20 23 31 20 66 6f 72 20 61 20 6c   COND #1 for a l
4650: 61 75 6e 63 68 61 62 6c 65 20 74 65 73 74 0a 09  aunchable test..
4660: 09 20 3b 3b 20 43 68 65 63 6b 20 69 74 65 6d 20  . ;; Check item 
4670: 70 61 74 68 20 61 67 61 69 6e 73 74 20 69 74 65  path against ite
4680: 6d 2d 70 61 74 74 73 0a 09 09 20 28 28 61 6e 64  m-patts... ((and
4690: 20 28 6e 6f 74 20 28 70 61 74 74 2d 6c 69 73 74   (not (patt-list
46a0: 2d 6d 61 74 63 68 20 69 74 65 6d 2d 70 61 74 68  -match item-path
46b0: 20 69 74 65 6d 2d 70 61 74 74 73 29 29 0a 09 09   item-patts))...
46c0: 20 20 20 20 20 20 20 28 6e 6f 74 20 28 65 71 75         (not (equ
46d0: 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22  al? item-path ""
46e0: 29 29 29 0a 09 09 20 20 3b 3b 20 65 6c 73 65 20  )))...  ;; else 
46f0: 74 68 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b  the run is stuck
4700: 2c 20 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72  , temporarily or
4710: 20 70 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 20   permanently... 
4720: 20 3b 3b 20 62 75 74 20 73 68 6f 75 6c 64 20 63   ;; but should c
4730: 68 65 63 6b 20 69 66 20 69 74 20 69 73 20 64 75  heck if it is du
4740: 65 20 74 6f 20 6c 61 63 6b 20 6f 66 20 72 65 73  e to lack of res
4750: 6f 75 72 63 65 73 20 76 73 2e 20 70 72 65 72 65  ources vs. prere
4760: 71 75 69 73 69 74 65 73 0a 09 09 20 20 28 64 65  quisites...  (de
4770: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46  bug:print 1 "INF
4780: 4f 3a 20 53 6b 69 70 70 69 6e 67 20 22 20 28 74  O: Skipping " (t
4790: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
47a0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74  et-testname test
47b0: 2d 72 65 63 6f 72 64 29 20 22 20 22 20 69 74 65  -record) " " ite
47c0: 6d 2d 70 61 74 68 20 22 20 61 73 20 69 74 20 64  m-path " as it d
47d0: 6f 65 73 6e 27 74 20 6d 61 74 63 68 20 22 20 69  oesn't match " i
47e0: 74 65 6d 2d 70 61 74 74 73 29 0a 09 09 20 20 28  tem-patts)...  (
47f0: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67  thread-sleep! *g
4800: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09  lobal-delta*)...
4810: 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c    (if (not (null
4820: 3f 20 74 61 6c 29 29 0a 09 09 20 20 20 20 20 20  ? tal))...      
4830: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28  (loop (car tal)(
4840: 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29  cdr tal) reruns)
4850: 29 29 0a 09 09 20 28 28 61 6e 64 20 28 6e 6f 74  ))... ((and (not
4860: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
4870: 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65  /default test-re
4880: 67 69 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61  gistery (runs:ma
4890: 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d  ke-full-test-nam
48a0: 65 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  e test-name item
48b0: 2d 70 61 74 68 29 20 23 66 29 29 0a 09 09 20 20  -path) #f))...  
48c0: 20 20 20 20 20 28 61 6e 64 20 6d 61 78 2d 63 6f       (and max-co
48d0: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 28 3e  ncurrent-jobs (>
48e0: 20 28 2d 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65   (- max-concurre
48f0: 6e 74 2d 6a 6f 62 73 20 6e 75 6d 2d 72 75 6e 6e  nt-jobs num-runn
4900: 69 6e 67 29 20 35 29 29 29 0a 09 09 20 20 28 6f  ing) 5)))...  (o
4910: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
4920: 3a 74 65 73 74 73 2d 72 65 67 69 73 74 65 72 2d  :tests-register-
4930: 74 65 73 74 20 23 66 20 72 75 6e 2d 69 64 20 74  test #f run-id t
4940: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61  est-name item-pa
4950: 74 68 29 0a 09 09 20 20 28 68 61 73 68 2d 74 61  th)...  (hash-ta
4960: 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65  ble-set! test-re
4970: 67 69 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61  gistery (runs:ma
4980: 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d  ke-full-test-nam
4990: 65 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  e test-name item
49a0: 2d 70 61 74 68 29 20 23 74 29 0a 09 09 20 20 28  -path) #t)...  (
49b0: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67  thread-sleep! *g
49c0: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09  lobal-delta*)...
49d0: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77    (loop (car new
49e0: 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29  tal)(cdr newtal)
49f0: 20 72 65 72 75 6e 73 29 29 0a 09 09 20 28 28 6e   reruns))... ((n
4a00: 6f 74 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65  ot have-resource
4a10: 73 29 20 3b 3b 20 73 69 6d 70 6c 79 20 74 72 79  s) ;; simply try
4a20: 20 61 67 61 69 6e 20 61 66 74 65 72 20 77 61 69   again after wai
4a30: 74 69 6e 67 20 61 20 73 65 63 6f 6e 64 0a 09 09  ting a second...
4a40: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
4a50: 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65   (+ 1 *global-de
4a60: 6c 74 61 2a 29 29 0a 09 09 20 20 28 64 65 62 75  lta*))...  (debu
4a70: 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a  g:print 1 "INFO:
4a80: 20 6e 6f 20 72 65 73 6f 75 72 63 65 73 20 74 6f   no resources to
4a90: 20 72 75 6e 20 6e 65 77 20 74 65 73 74 73 2c 20   run new tests, 
4aa0: 77 61 69 74 69 6e 67 20 2e 2e 2e 22 29 0a 09 09  waiting ...")...
4ab0: 20 20 3b 3b 20 63 6f 75 6c 64 20 68 61 76 65 20    ;; could have 
4ac0: 64 6f 6e 65 20 68 65 64 20 74 61 6c 20 68 65 72  done hed tal her
4ad0: 65 20 62 75 74 20 64 6f 69 6e 67 20 63 61 72 2f  e but doing car/
4ae0: 63 64 72 20 6f 66 20 6e 65 77 74 61 6c 20 74 6f  cdr of newtal to
4af0: 20 72 6f 74 61 74 65 20 74 65 73 74 73 0a 09 09   rotate tests...
4b00: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77    (loop (car new
4b10: 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29  tal)(cdr newtal)
4b20: 20 72 65 72 75 6e 73 29 29 0a 09 09 20 28 28 61   reruns))... ((a
4b30: 6e 64 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65  nd have-resource
4b40: 73 0a 09 09 20 20 20 20 20 20 20 28 6f 72 20 28  s...       (or (
4b50: 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f  null? prereqs-no
4b60: 74 2d 6d 65 74 29 0a 09 09 09 20 20 20 28 61 6e  t-met)....   (an
4b70: 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20  d (eq? testmode 
4b80: 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 28  'toplevel).....(
4b90: 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65  null? non-comple
4ba0: 74 65 64 29 29 29 29 0a 09 09 20 20 28 72 75 6e  ted))))...  (run
4bb0: 3a 74 65 73 74 20 72 75 6e 2d 69 64 20 72 75 6e  :test run-id run
4bc0: 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74  name keyvallst t
4bd0: 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73  est-record flags
4be0: 20 23 66 29 0a 09 09 20 20 28 74 68 72 65 61 64   #f)...  (thread
4bf0: 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d  -sleep! *global-
4c00: 64 65 6c 74 61 2a 29 0a 09 09 20 20 28 69 66 20  delta*)...  (if 
4c10: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29  (not (null? tal)
4c20: 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20  )...      (loop 
4c30: 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61  (car tal)(cdr ta
4c40: 6c 29 20 72 65 72 75 6e 73 29 29 29 0a 09 09 20  l) reruns)))... 
4c50: 28 65 6c 73 65 20 3b 3b 20 6d 75 73 74 20 62 65  (else ;; must be
4c60: 20 77 65 20 68 61 76 65 20 75 6e 6d 65 74 20 70   we have unmet p
4c70: 72 65 72 65 71 75 69 73 69 74 65 73 0a 09 09 20  rerequisites... 
4c80: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
4c90: 34 20 22 46 41 49 4c 53 3a 20 22 20 66 61 69 6c  4 "FAILS: " fail
4ca0: 73 29 0a 09 09 20 20 20 20 3b 3b 20 49 66 20 6f  s)...    ;; If o
4cb0: 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 68  ne or more of th
4cc0: 65 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  e prereqs-not-me
4cd0: 74 20 61 72 65 20 46 41 49 4c 20 74 68 65 6e 20  t are FAIL then 
4ce0: 77 65 20 63 61 6e 20 69 73 73 75 65 0a 09 09 20  we can issue... 
4cf0: 20 20 20 3b 3b 20 61 20 6d 65 73 73 61 67 65 20     ;; a message 
4d00: 61 6e 64 20 64 72 6f 70 20 68 65 64 20 66 72 6f  and drop hed fro
4d10: 6d 20 74 68 65 20 69 74 65 6d 73 20 74 6f 20 62  m the items to b
4d20: 65 20 70 72 6f 63 65 73 73 65 64 2e 0a 09 09 20  e processed.... 
4d30: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 66 61     (if (null? fa
4d40: 69 6c 73 29 0a 09 09 09 28 62 65 67 69 6e 0a 09  ils)....(begin..
4d50: 09 09 20 20 3b 3b 20 63 6f 75 6c 64 6e 27 74 20  ..  ;; couldn't 
4d60: 72 75 6e 2c 20 74 61 6b 65 20 61 20 62 72 65 61  run, take a brea
4d70: 74 68 65 72 0a 09 09 09 20 20 28 64 65 62 75 67  ther....  (debug
4d80: 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20  :print 4 "INFO: 
4d90: 53 68 6f 75 6c 64 6e 27 74 20 72 65 61 6c 6c 79  Shouldn't really
4da0: 20 67 65 74 20 68 65 72 65 2c 20 72 61 63 65 20   get here, race 
4db0: 63 6f 6e 64 69 74 69 6f 6e 3f 20 55 6e 61 62 6c  condition? Unabl
4dc0: 65 20 74 6f 20 6c 61 75 6e 63 68 20 6d 6f 72 65  e to launch more
4dd0: 20 74 65 73 74 73 20 61 74 20 74 68 69 73 20 6d   tests at this m
4de0: 6f 6d 65 6e 74 2c 20 6b 69 6c 6c 69 6e 67 20 74  oment, killing t
4df0: 69 6d 65 20 2e 2e 2e 22 29 0a 09 09 09 20 20 28  ime ...")....  (
4e00: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b  thread-sleep! (+
4e10: 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61   1 *global-delta
4e20: 2a 29 29 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65 65  *)) ;; long slee
4e30: 70 20 68 65 72 65 20 2d 20 6e 6f 20 72 65 73 6f  p here - no reso
4e40: 75 72 63 65 73 2c 20 6d 61 79 20 61 73 20 77 65  urces, may as we
4e50: 6c 6c 20 62 65 20 70 61 74 69 65 6e 74 0a 09 09  ll be patient...
4e60: 09 20 20 3b 3b 20 77 65 20 6d 61 64 65 20 6e 65  .  ;; we made ne
4e70: 77 20 74 61 6c 20 62 79 20 73 74 69 63 6b 69 6e  w tal by stickin
4e80: 67 20 68 65 64 20 61 74 20 74 68 65 20 62 61 63  g hed at the bac
4e90: 6b 20 6f 66 20 74 68 65 20 6c 69 73 74 0a 09 09  k of the list...
4ea0: 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65  .  (loop (car ne
4eb0: 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c  wtal)(cdr newtal
4ec0: 29 20 72 65 72 75 6e 73 29 29 0a 09 09 09 3b 3b  ) reruns))....;;
4ed0: 20 74 68 65 20 77 61 69 74 6f 6e 20 69 73 20 46   the waiton is F
4ee0: 41 49 4c 20 73 6f 20 6e 6f 20 70 6f 69 6e 74 20  AIL so no point 
4ef0: 69 6e 20 74 72 79 69 6e 67 20 74 6f 20 72 75 6e  in trying to run
4f00: 20 68 65 64 20 65 76 65 72 20 61 67 61 69 6e 0a   hed ever again.
4f10: 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c  ...(if (not (nul
4f20: 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20  l? tal))....    
4f30: 28 69 66 20 28 76 65 63 74 6f 72 3f 20 68 65 64  (if (vector? hed
4f40: 29 0a 09 09 09 09 28 62 65 67 69 6e 20 28 64 65  ).....(begin (de
4f50: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52  bug:print 1 "WAR
4f60: 4e 3a 20 44 72 6f 70 70 69 6e 67 20 74 65 73 74  N: Dropping test
4f70: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d   " (db:test-get-
4f80: 74 65 73 74 6e 61 6d 65 20 68 65 64 29 20 22 2f  testname hed) "/
4f90: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  " (db:test-get-i
4fa0: 74 65 6d 2d 70 61 74 68 20 68 65 64 29 0a 09 09  tem-path hed)...
4fb0: 09 09 09 09 20 20 20 20 22 20 66 72 6f 6d 20 74  ....    " from t
4fc0: 68 65 20 6c 61 75 6e 63 68 20 6c 69 73 74 20 61  he launch list a
4fd0: 73 20 69 74 20 68 61 73 20 70 72 65 72 65 71 75  s it has prerequ
4fe0: 69 73 74 65 73 20 74 68 61 74 20 61 72 65 20 46  istes that are F
4ff0: 41 49 4c 22 29 0a 09 09 09 09 20 20 20 20 20 20  AIL").....      
5000: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
5010: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a  *global-delta*).
5020: 09 09 09 09 20 20 20 20 20 20 20 28 6c 6f 6f 70  ....       (loop
5030: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74   (car tal)(cdr t
5040: 61 6c 29 20 28 63 6f 6e 73 20 68 65 64 20 72 65  al) (cons hed re
5050: 72 75 6e 73 29 29 29 0a 09 09 09 09 28 62 65 67  runs))).....(beg
5060: 69 6e 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a  in.....  (debug:
5070: 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a 20 54  print 1 "WARN: T
5080: 65 73 74 20 6e 6f 74 20 70 72 6f 63 65 73 73 65  est not processe
5090: 64 20 63 6f 72 72 65 63 74 6c 79 2e 20 43 6f 75  d correctly. Cou
50a0: 6c 64 20 62 65 20 61 20 72 61 63 65 20 63 6f 6e  ld be a race con
50b0: 64 69 74 69 6f 6e 20 69 6e 20 79 6f 75 72 20 74  dition in your t
50c0: 65 73 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69  est implementati
50d0: 6f 6e 3f 20 22 20 68 65 64 29 20 3b 3b 20 20 22  on? " hed) ;;  "
50e0: 20 61 73 20 69 74 20 68 61 73 20 70 72 65 72 65   as it has prere
50f0: 71 75 69 73 74 65 73 20 74 68 61 74 20 61 72 65  quistes that are
5100: 20 46 41 49 4c 2e 20 28 4e 4f 54 45 3a 20 68 65   FAIL. (NOTE: he
5110: 64 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f  d is not a vecto
5120: 72 29 22 29 0a 09 09 09 09 20 20 28 74 68 72 65  r)").....  (thre
5130: 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61  ad-sleep! *globa
5140: 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09 09 20 20  l-delta*).....  
5150: 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20 72 65  (loop hed tal re
5160: 72 75 6e 73 29 29 29 29 29 29 29 29 29 20 3b 3b  runs))))))))) ;;
5170: 20 45 4e 44 20 4f 46 20 49 4e 4e 45 52 20 43 4f   END OF INNER CO
5180: 4e 44 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20  ND..     ..     
5190: 3b 3b 20 63 61 73 65 20 77 68 65 72 65 20 61 6e  ;; case where an
51a0: 20 69 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61   items came in a
51b0: 73 20 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72  s a list been pr
51c0: 6f 63 65 73 73 65 64 0a 09 20 20 20 20 20 28 28  ocessed..     ((
51d0: 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73  and (list? items
51e0: 29 20 20 20 20 20 3b 3b 20 74 68 75 73 20 77 65  )     ;; thus we
51f0: 20 6b 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 20   know our items 
5200: 61 72 65 20 61 6c 72 65 61 64 79 20 63 61 6c 63  are already calc
5210: 75 6c 61 74 65 64 0a 09 09 20 20 20 28 6e 6f 74  ulated...   (not
5220: 20 20 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20     itemdat)) ;; 
5230: 61 6e 64 20 6e 6f 74 20 79 65 74 20 65 78 70 61  and not yet expa
5240: 6e 64 65 64 20 69 6e 74 6f 20 74 68 65 20 6c 69  nded into the li
5250: 73 74 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 20  st of things to 
5260: 62 65 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 28  be done..      (
5270: 69 66 20 28 61 6e 64 20 28 3e 3d 20 2a 76 65 72  if (and (>= *ver
5280: 62 6f 73 69 74 79 2a 20 31 29 0a 09 09 20 20 20  bosity* 1)...   
5290: 20 20 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 69      (> (length i
52a0: 74 65 6d 73 29 20 30 29 0a 09 09 20 20 20 20 20  tems) 0)...     
52b0: 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 28 63 61    (> (length (ca
52c0: 72 20 69 74 65 6d 73 29 29 20 30 29 29 0a 09 09  r items)) 0))...
52d0: 20 20 28 70 70 20 69 74 65 6d 73 29 29 0a 09 20    (pp items)).. 
52e0: 20 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 09       (for-each..
52f0: 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28         (lambda (
5300: 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 09 20 28  my-itemdat)... (
5310: 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d  let* ((new-test-
5320: 72 65 63 6f 72 64 20 28 6c 65 74 20 28 28 6e 65  record (let ((ne
5330: 77 72 65 63 20 28 6d 61 6b 65 2d 74 65 73 74 73  wrec (make-tests
5340: 3a 74 65 73 74 71 75 65 75 65 29 29 29 0a 09 09  :testqueue)))...
5350: 09 09 09 20 20 20 28 76 65 63 74 6f 72 2d 63 6f  ...   (vector-co
5360: 70 79 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20  py! test-record 
5370: 6e 65 77 72 65 63 29 0a 09 09 09 09 09 20 20 20  newrec)......   
5380: 6e 65 77 72 65 63 29 29 0a 09 09 09 28 6d 79 2d  newrec))....(my-
5390: 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d  item-path (item-
53a0: 6c 69 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74  list->path my-it
53b0: 65 6d 64 61 74 29 29 29 0a 09 09 20 20 20 28 69  emdat)))...   (i
53c0: 66 20 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74  f (patt-list-mat
53d0: 63 68 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20  ch my-item-path 
53e0: 69 74 65 6d 2d 70 61 74 74 73 29 20 20 20 20 20  item-patts)     
53f0: 20 20 20 20 20 20 3b 3b 20 79 65 73 2c 20 77 65        ;; yes, we
5400: 20 77 61 6e 74 20 74 6f 20 70 72 6f 63 65 73 73   want to process
5410: 20 74 68 69 73 20 69 74 65 6d 2c 20 4e 4f 54 45   this item, NOTE
5420: 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20 6e 65 65  : Should not nee
5430: 64 20 74 68 69 73 20 63 68 65 63 6b 20 68 65 72  d this check her
5440: 65 21 0a 09 09 20 20 20 20 20 20 20 28 6c 65 74  e!...       (let
5450: 20 28 28 6e 65 77 74 65 73 74 6e 61 6d 65 20 28   ((newtestname (
5460: 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74  runs:make-full-t
5470: 65 73 74 2d 6e 61 6d 65 20 68 65 64 20 6d 79 2d  est-name hed my-
5480: 69 74 65 6d 2d 70 61 74 68 29 29 29 20 20 20 20  item-path)))    
5490: 3b 3b 20 74 65 73 74 20 6e 61 6d 65 73 20 61 72  ;; test names ar
54a0: 65 20 75 6e 69 71 75 65 20 6f 6e 20 74 65 73 74  e unique on test
54b0: 6e 61 6d 65 2f 69 74 65 6d 2d 70 61 74 68 0a 09  name/item-path..
54c0: 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 71 75  .. (tests:testqu
54d0: 65 75 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 20  eue-set-items!  
54e0: 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f     new-test-reco
54f0: 72 64 20 23 66 29 0a 09 09 09 20 28 74 65 73 74  rd #f).... (test
5500: 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d  s:testqueue-set-
5510: 69 74 65 6d 64 61 74 21 20 20 20 6e 65 77 2d 74  itemdat!   new-t
5520: 65 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74  est-record my-it
5530: 65 6d 64 61 74 29 0a 09 09 09 20 28 74 65 73 74  emdat).... (test
5540: 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d  s:testqueue-set-
5550: 69 74 65 6d 5f 70 61 74 68 21 20 6e 65 77 2d 74  item_path! new-t
5560: 65 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74  est-record my-it
5570: 65 6d 2d 70 61 74 68 29 0a 09 09 09 20 28 68 61  em-path).... (ha
5580: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65  sh-table-set! te
5590: 73 74 2d 72 65 63 6f 72 64 73 20 6e 65 77 74 65  st-records newte
55a0: 73 74 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 2d  stname new-test-
55b0: 72 65 63 6f 72 64 29 0a 09 09 09 20 28 73 65 74  record).... (set
55c0: 21 20 74 61 6c 20 28 63 6f 6e 73 20 6e 65 77 74  ! tal (cons newt
55d0: 65 73 74 6e 61 6d 65 20 74 61 6c 29 29 29 29 29  estname tal)))))
55e0: 29 20 3b 3b 20 73 69 6e 63 65 20 74 68 65 73 65  ) ;; since these
55f0: 20 61 72 65 20 69 74 65 6d 69 7a 65 64 20 63 72   are itemized cr
5600: 65 61 74 65 20 6e 65 77 20 74 65 73 74 20 6e 61  eate new test na
5610: 6d 65 73 20 74 65 73 74 6e 61 6d 65 2f 69 74 65  mes testname/ite
5620: 6d 70 61 74 68 0a 09 20 20 20 20 20 20 20 69 74  mpath..       it
5630: 65 6d 73 29 0a 09 20 20 20 20 20 20 28 69 66 20  ems)..      (if 
5640: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29  (not (null? tal)
5650: 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20  )...  (begin... 
5660: 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70     (thread-sleep
5670: 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a  ! *global-delta*
5680: 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70  )...    (debug:p
5690: 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 45 6e  rint 4 "INFO: En
56a0: 64 20 6f 66 20 69 74 65 6d 73 20 6c 69 73 74 2c  d of items list,
56b0: 20 6c 6f 6f 70 69 6e 67 20 77 69 74 68 20 6e 65   looping with ne
56c0: 78 74 22 29 0a 09 09 20 20 20 20 28 6c 6f 6f 70  xt")...    (loop
56d0: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74   (car tal)(cdr t
56e0: 61 6c 29 20 72 65 72 75 6e 73 29 29 29 29 0a 0a  al) reruns))))..
56f0: 09 20 20 20 20 20 3b 3b 20 69 66 20 69 74 65 6d  .     ;; if item
5700: 73 20 69 73 20 61 20 70 72 6f 63 20 74 68 65 6e  s is a proc then
5710: 20 6e 65 65 64 20 74 6f 20 72 75 6e 20 69 74 65   need to run ite
5720: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f  ms:get-items-fro
5730: 6d 2d 63 6f 6e 66 69 67 2c 20 67 65 74 20 74 68  m-config, get th
5740: 65 20 6c 69 73 74 20 61 6e 64 20 6c 6f 6f 70 20  e list and loop 
5750: 0a 09 20 20 20 20 20 3b 3b 20 20 20 20 2d 20 62  ..     ;;    - b
5760: 75 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20  ut only do that 
5770: 69 66 20 72 65 73 6f 75 72 63 65 73 20 65 78 69  if resources exi
5780: 73 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74  st to kick off t
5790: 68 65 20 6a 6f 62 0a 09 20 20 20 20 20 28 28 6f  he job..     ((o
57a0: 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74  r (procedure? it
57b0: 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20 27  ems)(eq? items '
57c0: 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 29  have-procedure))
57d0: 0a 09 20 20 20 20 20 20 28 6c 65 74 20 28 28 63  ..      (let ((c
57e0: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 20 20 20 28  an-run-more    (
57f0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72  open-run-close r
5800: 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  uns:can-run-more
5810: 2d 74 65 73 74 73 20 23 66 20 74 65 73 74 2d 72  -tests #f test-r
5820: 65 63 6f 72 64 29 29 29 0a 09 09 28 69 66 20 63  ecord)))...(if c
5830: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09 20 20  an-run-more...  
5840: 20 20 28 6c 65 74 2a 20 28 28 70 72 65 72 65 71    (let* ((prereq
5850: 73 2d 6e 6f 74 2d 6d 65 74 20 28 6f 70 65 6e 2d  s-not-met (open-
5860: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
5870: 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74  -prereqs-not-met
5880: 20 23 66 20 72 75 6e 2d 69 64 20 77 61 69 74 6f   #f run-id waito
5890: 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64  ns item-path mod
58a0: 65 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a 09 09  e: testmode))...
58b0: 09 20 20 20 28 66 61 69 6c 73 20 20 20 20 20 20  .   (fails      
58c0: 20 20 20 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d       (runs:calc-
58d0: 66 61 69 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f  fails prereqs-no
58e0: 74 2d 6d 65 74 29 29 0a 09 09 09 20 20 20 28 6e  t-met))....   (n
58f0: 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 20 20 20 28  on-completed   (
5900: 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f  runs:calc-not-co
5910: 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71 73 2d  mpleted prereqs-
5920: 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 20 20 20  not-met)))...   
5930: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
5940: 38 20 22 49 4e 46 4f 3a 20 63 61 6e 2d 72 75 6e  8 "INFO: can-run
5950: 2d 6d 6f 72 65 3a 20 22 20 63 61 6e 2d 72 75 6e  -more: " can-run
5960: 2d 6d 6f 72 65 0a 09 09 09 09 20 20 20 22 5c 6e  -more.....   "\n
5970: 20 74 65 73 74 6e 61 6d 65 3a 20 20 20 20 20 20   testname:      
5980: 20 20 22 20 68 65 64 0a 09 09 09 09 20 20 20 22    " hed.....   "
5990: 5c 6e 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  \n prereqs-not-m
59a0: 65 74 3a 20 22 20 28 72 75 6e 73 3a 70 72 65 74  et: " (runs:pret
59b0: 74 79 2d 73 74 72 69 6e 67 20 70 72 65 72 65 71  ty-string prereq
59c0: 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 09 20  s-not-met)..... 
59d0: 20 20 22 5c 6e 20 6e 6f 6e 2d 63 6f 6d 70 6c 65    "\n non-comple
59e0: 74 65 64 3a 20 20 20 22 20 28 72 75 6e 73 3a 70  ted:   " (runs:p
59f0: 72 65 74 74 79 2d 73 74 72 69 6e 67 20 6e 6f 6e  retty-string non
5a00: 2d 63 6f 6d 70 6c 65 74 65 64 29 20 0a 09 09 09  -completed) ....
5a10: 09 20 20 20 22 5c 6e 20 66 61 69 6c 73 3a 20 20  .   "\n fails:  
5a20: 20 20 20 20 20 20 20 20 20 22 20 28 72 75 6e 73           " (runs
5a30: 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 66  :pretty-string f
5a40: 61 69 6c 73 29 0a 09 09 09 09 20 20 20 22 5c 6e  ails).....   "\n
5a50: 20 74 65 73 74 6d 6f 64 65 3a 20 20 20 20 20 20   testmode:      
5a60: 20 20 22 20 74 65 73 74 6d 6f 64 65 0a 09 09 09    " testmode....
5a70: 09 20 20 20 22 5c 6e 20 6e 75 6d 2d 72 65 74 72  .   "\n num-retr
5a80: 69 65 73 3a 20 20 20 20 20 22 20 6e 75 6d 2d 72  ies:     " num-r
5a90: 65 74 72 69 65 73 0a 09 09 09 09 20 20 20 22 5c  etries.....   "\
5aa0: 6e 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20  n (eq? testmode 
5ab0: 27 74 6f 70 6c 65 76 65 6c 29 3a 20 22 20 28 65  'toplevel): " (e
5ac0: 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70  q? testmode 'top
5ad0: 6c 65 76 65 6c 29 0a 09 09 09 09 20 20 20 22 5c  level).....   "\
5ae0: 6e 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d  n (null? non-com
5af0: 70 6c 65 74 65 64 29 3a 20 20 20 20 22 20 28 6e  pleted):    " (n
5b00: 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74  ull? non-complet
5b10: 65 64 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 72  ed).....   "\n r
5b20: 65 72 75 6e 73 3a 20 22 20 72 65 72 75 6e 73 29  eruns: " reruns)
5b30: 0a 0a 09 09 20 20 20 20 20 20 28 63 6f 6e 64 20  ....      (cond 
5b40: 3b 3b 20 49 4e 4e 45 52 20 43 4f 4e 44 20 23 32  ;; INNER COND #2
5b50: 0a 09 09 20 20 20 20 20 20 20 28 28 6f 72 20 28  ...       ((or (
5b60: 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f  null? prereqs-no
5b70: 74 2d 6d 65 74 29 20 3b 3b 20 61 6c 6c 20 70 72  t-met) ;; all pr
5b80: 65 72 65 71 73 20 6d 65 74 2c 20 66 69 72 65 20  ereqs met, fire 
5b90: 6f 66 66 20 74 68 65 20 74 65 73 74 0a 09 09 09  off the test....
5ba0: 20 20 20 20 3b 3b 20 6f 72 2c 20 69 66 20 69 74      ;; or, if it
5bb0: 20 69 73 20 61 20 27 74 6f 70 6c 65 76 65 6c 20   is a 'toplevel 
5bc0: 74 65 73 74 20 61 6e 64 20 61 6c 6c 20 70 72 65  test and all pre
5bd0: 72 65 71 73 20 6e 6f 74 20 6d 65 74 20 61 72 65  reqs not met are
5be0: 20 43 4f 4d 50 4c 45 54 45 44 20 74 68 65 6e 20   COMPLETED then 
5bf0: 6c 61 75 6e 63 68 0a 09 09 09 20 20 20 20 28 61  launch....    (a
5c00: 6e 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65  nd (eq? testmode
5c10: 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09   'toplevel).....
5c20: 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70   (null? non-comp
5c30: 6c 65 74 65 64 29 29 29 0a 09 09 09 28 6c 65 74  leted)))....(let
5c40: 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 65   ((test-name (te
5c50: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
5c60: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d  t-testname test-
5c70: 72 65 63 6f 72 64 29 29 29 0a 09 09 09 20 20 28  record)))....  (
5c80: 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f  setenv "MT_TEST_
5c90: 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29  NAME" test-name)
5ca0: 20 3b 3b 20 0a 09 09 09 20 20 28 73 65 74 65 6e   ;; ....  (seten
5cb0: 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20  v "MT_RUNNAME"  
5cc0: 20 72 75 6e 6e 61 6d 65 29 0a 09 09 09 20 20 28   runname)....  (
5cd0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73  open-run-close s
5ce0: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d  et-megatest-env-
5cf0: 76 61 72 73 20 23 66 20 72 75 6e 2d 69 64 29 20  vars #f run-id) 
5d00: 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20  ;; these may be 
5d10: 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61  needed by the la
5d20: 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a  unching process.
5d30: 09 09 09 20 20 28 6c 65 74 20 28 28 69 74 65 6d  ...  (let ((item
5d40: 73 2d 6c 69 73 74 20 28 69 74 65 6d 73 3a 67 65  s-list (items:ge
5d50: 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e  t-items-from-con
5d60: 66 69 67 20 74 63 6f 6e 66 69 67 29 29 29 0a 09  fig tconfig)))..
5d70: 09 09 20 20 20 20 28 69 66 20 28 6c 69 73 74 3f  ..    (if (list?
5d80: 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09   items-list)....
5d90: 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 74  .(begin.....  (t
5da0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73  ests:testqueue-s
5db0: 65 74 2d 69 74 65 6d 73 21 20 74 65 73 74 2d 72  et-items! test-r
5dc0: 65 63 6f 72 64 20 69 74 65 6d 73 2d 6c 69 73 74  ecord items-list
5dd0: 29 0a 09 09 09 09 20 20 28 74 68 72 65 61 64 2d  ).....  (thread-
5de0: 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64  sleep! *global-d
5df0: 65 6c 74 61 2a 29 0a 09 09 09 09 20 20 28 6c 6f  elta*).....  (lo
5e00: 6f 70 20 68 65 64 20 74 61 6c 20 72 65 72 75 6e  op hed tal rerun
5e10: 73 29 29 0a 09 09 09 09 28 62 65 67 69 6e 0a 09  s)).....(begin..
5e20: 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ...  (debug:prin
5e30: 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 20  t 0 "ERROR: The 
5e40: 70 72 6f 63 20 66 72 6f 6d 20 72 65 61 64 69 6e  proc from readin
5e50: 67 20 74 68 65 20 73 65 74 75 70 20 64 69 64 20  g the setup did 
5e60: 6e 6f 74 20 79 69 65 6c 64 20 61 20 6c 69 73 74  not yield a list
5e70: 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74   - please report
5e80: 20 74 68 69 73 22 29 0a 09 09 09 09 20 20 28 65   this").....  (e
5e90: 78 69 74 20 31 29 29 29 29 29 29 0a 09 09 20 20  xit 1))))))...  
5ea0: 20 20 20 20 20 28 28 6e 75 6c 6c 3f 20 66 61 69       ((null? fai
5eb0: 6c 73 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72  ls)....(debug:pr
5ec0: 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 66 61 69  int 4 "INFO: fai
5ed0: 6c 73 20 69 73 20 6e 75 6c 6c 2c 20 6d 6f 76 69  ls is null, movi
5ee0: 6e 67 20 6f 6e 20 69 6e 20 74 68 65 20 71 75 65  ng on in the que
5ef0: 75 65 20 62 75 74 20 6b 65 65 70 69 6e 67 20 22  ue but keeping "
5f00: 20 68 65 64 20 22 20 66 6f 72 20 6e 6f 77 22 29   hed " for now")
5f10: 0a 09 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65  ....(thread-slee
5f20: 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61  p! *global-delta
5f30: 2a 29 0a 09 09 09 28 6c 6f 6f 70 20 28 63 61 72  *)....(loop (car
5f40: 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77   newtal)(cdr new
5f50: 74 61 6c 29 20 72 65 72 75 6e 73 29 29 20 3b 3b  tal) reruns)) ;;
5f60: 20 61 6e 20 69 73 73 75 65 20 77 69 74 68 20 70   an issue with p
5f70: 72 65 72 65 71 73 20 6e 6f 74 20 79 65 74 20 6d  rereqs not yet m
5f80: 65 74 3f 0a 09 09 20 20 20 20 20 20 20 28 28 61  et?...       ((a
5f90: 6e 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 66  nd (not (null? f
5fa0: 61 69 6c 73 29 29 28 65 71 3f 20 74 65 73 74 6d  ails))(eq? testm
5fb0: 6f 64 65 20 27 6e 6f 72 6d 61 6c 29 29 0a 09 09  ode 'normal))...
5fc0: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20  .(debug:print 1 
5fd0: 22 49 4e 46 4f 3a 20 74 65 73 74 20 22 20 20 68  "INFO: test "  h
5fe0: 65 64 20 22 20 28 6d 6f 64 65 3d 22 20 74 65 73  ed " (mode=" tes
5ff0: 74 6d 6f 64 65 20 22 29 20 68 61 73 20 66 61 69  tmode ") has fai
6000: 6c 65 64 20 70 72 65 72 65 71 75 69 73 69 74 65  led prerequisite
6010: 28 73 29 3b 20 22 0a 09 09 09 09 20 20 20 20 20  (s); ".....     
6020: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65  (string-interspe
6030: 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61  rse (map (lambda
6040: 20 28 74 29 28 63 6f 6e 63 20 28 64 62 3a 74 65   (t)(conc (db:te
6050: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  st-get-testname 
6060: 74 29 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d  t) ":" (db:test-
6070: 67 65 74 2d 73 74 61 74 65 20 74 29 22 2f 22 28  get-state t)"/"(
6080: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74  db:test-get-stat
6090: 75 73 20 74 29 29 29 20 66 61 69 6c 73 29 20 22  us t))) fails) "
60a0: 2c 20 22 29 0a 09 09 09 09 20 20 20 20 20 22 2c  , ").....     ",
60b0: 20 72 65 6d 6f 76 69 6e 67 20 69 74 20 66 72 6f   removing it fro
60c0: 6d 20 74 6f 2d 64 6f 20 6c 69 73 74 22 29 0a 09  m to-do list")..
60d0: 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c  ..(if (not (null
60e0: 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28  ? tal))....    (
60f0: 62 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20 28  begin....      (
6100: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67  thread-sleep! *g
6110: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09  lobal-delta*)...
6120: 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61  .      (loop (ca
6130: 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 28  r tal)(cdr tal)(
6140: 63 6f 6e 73 20 68 65 64 20 72 65 72 75 6e 73 29  cons hed reruns)
6150: 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 65  ))))...       (e
6160: 6c 73 65 0a 09 09 09 28 64 65 62 75 67 3a 70 72  lse....(debug:pr
6170: 69 6e 74 20 38 20 22 45 52 52 4f 52 3a 20 4e 6f  int 8 "ERROR: No
6180: 20 68 61 6e 64 6c 65 72 20 66 6f 72 20 74 68 69   handler for thi
6190: 73 20 63 6f 6e 64 69 74 69 6f 6e 2e 22 29 0a 09  s condition.")..
61a0: 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  ..(thread-sleep!
61b0: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
61c0: 0a 09 09 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e  ....(loop (car n
61d0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
61e0: 6c 29 20 72 65 72 75 6e 73 29 29 29 29 20 3b 3b  l) reruns)))) ;;
61f0: 20 45 4e 44 20 4f 46 20 49 46 20 43 41 4e 20 52   END OF IF CAN R
6200: 55 4e 20 4d 4f 52 45 0a 0a 09 09 20 20 20 20 3b  UN MORE....    ;
6210: 3b 20 69 66 20 63 61 6e 27 74 20 72 75 6e 20 6d  ; if can't run m
6220: 6f 72 65 20 6a 75 73 74 20 6c 6f 6f 70 20 77 69  ore just loop wi
6230: 74 68 20 6e 65 78 74 20 70 6f 73 73 69 62 6c 65  th next possible
6240: 20 74 65 73 74 0a 09 09 20 20 20 20 28 62 65 67   test...    (beg
6250: 69 6e 0a 09 09 20 20 20 20 20 20 28 64 65 62 75  in...      (debu
6260: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a  g:print 4 "INFO:
6270: 20 70 72 6f 63 65 73 73 69 6e 67 20 74 68 65 20   processing the 
6280: 63 61 73 65 20 77 69 74 68 20 61 20 6c 61 6d 62  case with a lamb
6290: 64 61 20 66 6f 72 20 69 74 65 6d 73 20 6f 72 20  da for items or 
62a0: 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 2e  'have-procedure.
62b0: 20 4d 6f 76 69 6e 67 20 74 68 72 6f 75 67 68 20   Moving through 
62c0: 74 68 65 20 71 75 65 75 65 20 77 69 74 68 6f 75  the queue withou
62d0: 74 20 64 72 6f 70 70 69 6e 67 20 22 20 68 65 64  t dropping " hed
62e0: 29 0a 09 09 20 20 20 20 20 20 28 74 68 72 65 61  )...      (threa
62f0: 64 2d 73 6c 65 65 70 21 20 28 2b 20 31 20 2a 67  d-sleep! (+ 1 *g
6300: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09  lobal-delta*))..
6310: 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61  .      (loop (ca
6320: 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65  r newtal)(cdr ne
6330: 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29 29  wtal) reruns))))
6340: 29 20 3b 3b 20 45 4e 44 20 4f 46 20 28 6f 72 20  ) ;; END OF (or 
6350: 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d  (procedure? item
6360: 73 29 28 65 71 3f 20 69 74 65 6d 73 20 27 68 61  s)(eq? items 'ha
6370: 76 65 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 09  ve-procedure))..
6380: 20 20 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 74       ..     ;; t
6390: 68 69 73 20 63 61 73 65 20 73 68 6f 75 6c 64 20  his case should 
63a0: 6e 6f 74 20 68 61 70 70 65 6e 2c 20 61 64 64 65  not happen, adde
63b0: 64 20 74 6f 20 68 65 6c 70 20 63 61 74 63 68 20  d to help catch 
63c0: 61 6e 79 20 62 75 67 73 0a 09 20 20 20 20 20 28  any bugs..     (
63d0: 28 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d  (and (list? item
63e0: 73 29 20 69 74 65 6d 64 61 74 29 0a 09 20 20 20  s) itemdat)..   
63f0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
6400: 30 20 22 45 52 52 4f 52 3a 20 53 68 6f 75 6c 64  0 "ERROR: Should
6410: 20 6e 6f 74 20 68 61 76 65 20 61 20 6c 69 73 74   not have a list
6420: 20 6f 66 20 69 74 65 6d 73 20 69 6e 20 61 20 74   of items in a t
6430: 65 73 74 20 61 6e 64 20 74 68 65 20 69 74 65 6d  est and the item
6440: 73 70 61 74 68 20 73 65 74 20 2d 20 70 6c 65 61  spath set - plea
6450: 73 65 20 72 65 70 6f 72 74 20 74 68 69 73 22 29  se report this")
6460: 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29  ..      (exit 1)
6470: 29 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 28 6e  )..     ((not (n
6480: 75 6c 6c 3f 20 72 65 72 75 6e 73 29 29 0a 09 20  ull? reruns)).. 
6490: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77       (let* ((new
64a0: 6c 73 74 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c  lst (open-run-cl
64b0: 6f 73 65 20 74 65 73 74 73 3a 66 69 6c 74 65 72  ose tests:filter
64c0: 2d 6e 6f 6e 2d 72 75 6e 6e 61 62 6c 65 20 23 66  -non-runnable #f
64d0: 20 72 75 6e 2d 69 64 20 74 61 6c 20 74 65 73 74   run-id tal test
64e0: 2d 72 65 63 6f 72 64 73 29 29 20 3b 3b 20 69 2e  -records)) ;; i.
64f0: 65 2e 20 6e 6f 74 20 46 41 49 4c 2c 20 57 41 49  e. not FAIL, WAI
6500: 56 45 44 2c 20 49 4e 43 4f 4d 50 4c 45 54 45 2c  VED, INCOMPLETE,
6510: 20 50 41 53 53 2c 20 4b 49 4c 4c 45 44 2c 0a 09   PASS, KILLED,..
6520: 09 20 20 20 20 20 28 6a 75 6e 6b 65 64 20 28 6c  .     (junked (l
6530: 73 65 74 2d 64 69 66 66 65 72 65 6e 63 65 20 65  set-difference e
6540: 71 75 61 6c 3f 20 74 61 6c 20 6e 65 77 6c 73 74  qual? tal newlst
6550: 29 29 29 0a 09 09 28 64 65 62 75 67 3a 70 72 69  )))...(debug:pri
6560: 6e 74 20 34 20 22 49 4e 46 4f 3a 20 66 75 6c 6c  nt 4 "INFO: full
6570: 20 64 72 6f 70 20 74 68 72 6f 75 67 68 2c 20 69   drop through, i
6580: 66 20 72 65 72 75 6e 73 20 69 73 20 6c 65 73 73  f reruns is less
6590: 20 74 68 61 6e 20 31 30 30 20 77 65 20 77 69 6c   than 100 we wil
65a0: 6c 20 66 6f 72 63 65 20 72 65 74 72 79 20 74 68  l force retry th
65b0: 65 6d 2c 20 72 65 72 75 6e 73 3d 22 20 72 65 72  em, reruns=" rer
65c0: 75 6e 73 20 22 2c 20 74 61 6c 3d 22 20 74 61 6c  uns ", tal=" tal
65d0: 29 0a 09 09 28 69 66 20 28 3c 20 6e 75 6d 2d 72  )...(if (< num-r
65e0: 65 74 72 69 65 73 20 6d 61 78 2d 72 65 74 72 69  etries max-retri
65f0: 65 73 29 0a 09 09 20 20 20 20 28 73 65 74 21 20  es)...    (set! 
6600: 6e 65 77 6c 73 74 20 28 61 70 70 65 6e 64 20 72  newlst (append r
6610: 65 72 75 6e 73 20 6e 65 77 6c 73 74 29 29 29 0a  eruns newlst))).
6620: 09 09 28 73 65 74 21 20 6e 75 6d 2d 72 65 74 72  ..(set! num-retr
6630: 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69  ies (+ num-retri
6640: 65 73 20 31 29 29 0a 09 09 28 74 68 72 65 61 64  es 1))...(thread
6650: 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d  -sleep! *global-
6660: 64 65 6c 74 61 2a 29 0a 09 09 28 69 66 20 28 6e  delta*)...(if (n
6670: 6f 74 20 28 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74  ot (null? newlst
6680: 29 29 0a 09 09 20 20 20 20 3b 3b 20 73 69 6e 63  ))...    ;; sinc
6690: 65 20 72 65 72 75 6e 73 20 68 61 76 65 20 62 65  e reruns have be
66a0: 65 6e 20 74 61 63 6b 65 64 20 6f 6e 20 74 6f 20  en tacked on to 
66b0: 6e 65 77 6c 73 74 20 63 72 65 61 74 65 20 6e 65  newlst create ne
66c0: 77 20 72 65 72 75 6e 73 20 66 72 6f 6d 20 6a 75  w reruns from ju
66d0: 6e 6b 65 64 0a 09 09 20 20 20 20 28 6c 6f 6f 70  nked...    (loop
66e0: 20 28 63 61 72 20 6e 65 77 6c 73 74 29 28 63 64   (car newlst)(cd
66f0: 72 20 6e 65 77 6c 73 74 29 28 64 65 6c 65 74 65  r newlst)(delete
6700: 2d 64 75 70 6c 69 63 61 74 65 73 20 6a 75 6e 6b  -duplicates junk
6710: 65 64 29 29 29 29 29 0a 09 20 20 20 20 20 28 28  ed)))))..     ((
6720: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29  not (null? tal))
6730: 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  ..      (debug:p
6740: 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 49 27  rint 4 "INFO: I'
6750: 6d 20 70 72 65 74 74 79 20 73 75 72 65 20 49 20  m pretty sure I 
6760: 73 68 6f 75 6c 64 6e 27 74 20 67 65 74 20 68 65  shouldn't get he
6770: 72 65 2e 22 29 29 0a 09 20 20 20 20 20 28 65 6c  re."))..     (el
6780: 73 65 0a 09 20 20 20 20 20 20 28 64 65 62 75 67  se..      (debug
6790: 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20  :print 4 "INFO: 
67a0: 45 78 69 74 69 6e 67 20 6c 6f 6f 70 20 77 69 74  Exiting loop wit
67b0: 68 2e 2e 2e 5c 6e 20 20 68 65 64 3d 22 20 68 65  h...\n  hed=" he
67c0: 64 20 22 5c 6e 20 20 74 61 6c 3d 22 20 74 61 6c  d "\n  tal=" tal
67d0: 20 22 5c 6e 20 20 72 65 72 75 6e 73 3d 22 20 72   "\n  reruns=" r
67e0: 65 72 75 6e 73 29 29 0a 09 20 20 20 20 20 29 29  eruns))..     ))
67f0: 29 29 20 3b 3b 20 4c 45 54 2a 20 28 28 74 65 73  )) ;; LET* ((tes
6800: 74 2d 72 65 63 6f 72 64 0a 0a 20 20 20 20 3b 3b  t-record..    ;;
6810: 20 77 65 20 67 65 74 20 68 65 72 65 20 6f 6e 20   we get here on 
6820: 22 64 72 6f 70 20 74 68 72 6f 75 67 68 22 20 2d  "drop through" -
6830: 20 6c 6f 6f 70 20 66 6f 72 20 6e 65 78 74 20 74   loop for next t
6840: 65 73 74 20 69 6e 20 71 75 65 75 65 0a 20 20 20  est in queue.   
6850: 20 3b 3b 20 46 49 58 4d 45 21 21 21 21 20 54 48   ;; FIXME!!!! TH
6860: 49 53 20 53 48 4f 55 4c 44 20 4e 4f 54 20 52 45  IS SHOULD NOT RE
6870: 51 55 49 52 45 20 41 4e 20 45 58 49 54 21 21 21  QUIRE AN EXIT!!!
6880: 21 21 21 21 0a 20 20 20 20 0a 20 20 20 20 28 64  !!!!.    .    (d
6890: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e  ebug:print 1 "IN
68a0: 46 4f 3a 20 41 6c 6c 20 74 65 73 74 73 20 6c 61  FO: All tests la
68b0: 75 6e 63 68 65 64 22 29 0a 20 20 20 20 28 74 68  unched").    (th
68c0: 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 35 29  read-sleep! 0.5)
68d0: 0a 20 20 20 20 3b 3b 20 46 49 58 4d 45 21 20 54  .    ;; FIXME! T
68e0: 68 69 73 20 68 61 72 73 68 20 65 78 69 74 20 73  his harsh exit s
68f0: 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 6e 65 63  hould not be nec
6900: 65 73 73 61 72 79 2e 2e 2e 2e 0a 20 20 20 20 3b  essary.....    ;
6910: 3b 20 28 69 66 20 28 6e 6f 74 20 2a 72 75 6e 72  ; (if (not *runr
6920: 65 6d 6f 74 65 2a 29 28 65 78 69 74 29 29 20 3b  emote*)(exit)) ;
6930: 3b 20 0a 20 20 20 20 23 66 29 29 20 3b 3b 20 72  ; .    #f)) ;; r
6940: 65 74 75 72 6e 20 61 20 23 66 20 61 73 20 61 20  eturn a #f as a 
6950: 68 69 6e 74 20 74 68 61 74 20 77 65 20 61 72 65  hint that we are
6960: 20 64 6f 6e 65 0a 20 20 3b 3b 20 48 65 72 65 20   done.  ;; Here 
6970: 77 65 20 6e 65 65 64 20 74 6f 20 63 68 65 63 6b  we need to check
6980: 20 74 68 61 74 20 61 6c 6c 20 74 68 65 20 74 65   that all the te
6990: 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 20 74 6f  sts remaining to
69a0: 20 62 65 20 72 75 6e 20 61 72 65 20 65 6c 69 67   be run are elig
69b0: 69 62 6c 65 20 74 6f 20 72 75 6e 0a 20 20 3b 3b  ible to run.  ;;
69c0: 20 61 6e 64 20 61 72 65 20 6e 6f 74 20 62 6c 6f   and are not blo
69d0: 63 6b 65 64 20 62 79 20 66 61 69 6c 65 64 0a 20  cked by failed. 
69e0: 20 0a 0a 3b 3b 20 70 61 72 65 6e 74 2d 74 65 73   ..;; parent-tes
69f0: 74 20 69 73 20 74 68 65 72 65 20 61 73 20 61 20  t is there as a 
6a00: 70 6c 61 63 65 68 6f 6c 64 65 72 20 66 6f 72 20  placeholder for 
6a10: 77 68 65 6e 20 70 61 72 65 6e 74 2d 74 65 73 74  when parent-test
6a20: 73 20 63 61 6e 20 62 65 20 72 75 6e 20 61 73 20  s can be run as 
6a30: 61 20 73 65 74 75 70 20 73 74 65 70 0a 28 64 65  a setup step.(de
6a40: 66 69 6e 65 20 28 72 75 6e 3a 74 65 73 74 20 72  fine (run:test r
6a50: 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65  un-id runname ke
6a60: 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63  yvallst test-rec
6a70: 6f 72 64 20 66 6c 61 67 73 20 70 61 72 65 6e 74  ord flags parent
6a80: 2d 74 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c 20  -test).  ;; All 
6a90: 74 68 65 73 65 20 76 61 72 73 20 6d 69 67 68 74  these vars might
6aa0: 20 62 65 20 72 65 66 65 72 65 6e 63 65 64 20 62   be referenced b
6ab0: 79 20 74 68 65 20 74 65 73 74 63 6f 6e 66 69 67  y the testconfig
6ac0: 20 66 69 6c 65 20 72 65 61 64 65 72 0a 20 20 28   file reader.  (
6ad0: 6c 65 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d 65  let* ((test-name
6ae0: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
6af0: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d  ueue-get-testnam
6b00: 65 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29  e   test-record)
6b10: 29 0a 09 20 28 74 65 73 74 2d 77 61 69 74 6f 6e  ).. (test-waiton
6b20: 73 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65  s (tests:testque
6b30: 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20  ue-get-waitons  
6b40: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a    test-record)).
6b50: 09 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20  . (test-conf    
6b60: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
6b70: 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20  -get-testconfig 
6b80: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20  test-record)).. 
6b90: 28 69 74 65 6d 64 61 74 20 20 20 20 20 20 28 74  (itemdat      (t
6ba0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
6bb0: 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65  et-itemdat    te
6bc0: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74  st-record)).. (t
6bd0: 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e  est-path    (con
6be0: 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65  c *toppath* "/te
6bf0: 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29  sts/" test-name)
6c00: 29 20 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20 74  ) ;; could use t
6c10: 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e  ests:get-testcon
6c20: 66 69 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28  fig here ..... (
6c30: 66 6f 72 63 65 20 20 20 20 20 20 20 20 28 68 61  force        (ha
6c40: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
6c50: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f 72  ault flags "-for
6c60: 63 65 22 20 23 66 29 29 0a 09 20 28 72 65 72 75  ce" #f)).. (reru
6c70: 6e 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74  n        (hash-t
6c80: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
6c90: 20 66 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 20   flags "-rerun" 
6ca0: 23 66 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 6e  #f)).. (keepgoin
6cb0: 67 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65  g    (hash-table
6cc0: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61  -ref/default fla
6cd0: 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20  gs "-keepgoing" 
6ce0: 23 66 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74  #f)).. (item-pat
6cf0: 68 20 20 20 20 20 22 22 29 0a 09 20 28 64 62 20  h     "").. (db 
6d00: 20 20 20 20 20 20 20 20 20 20 23 66 29 29 0a 20            #f)). 
6d10: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
6d20: 34 0a 09 09 20 22 74 65 73 74 2d 63 6f 6e 66 69  4... "test-confi
6d30: 67 3a 20 22 20 28 68 61 73 68 2d 74 61 62 6c 65  g: " (hash-table
6d40: 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d 63 6f 6e  ->alist test-con
6d50: 66 29 0a 09 09 20 22 5c 6e 20 20 20 69 74 65 6d  f)... "\n   item
6d60: 64 61 74 3a 20 22 20 69 74 65 6d 64 61 74 0a 09  dat: " itemdat..
6d70: 09 20 29 0a 20 20 20 20 3b 3b 20 73 65 74 74 69  . ).    ;; setti
6d80: 6e 67 20 69 74 65 6d 64 61 74 20 74 6f 20 61 20  ng itemdat to a 
6d90: 6c 69 73 74 20 69 66 20 69 74 20 69 73 20 23 66  list if it is #f
6da0: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 69 74  .    (if (not it
6db0: 65 6d 64 61 74 29 28 73 65 74 21 20 69 74 65 6d  emdat)(set! item
6dc0: 64 61 74 20 27 28 29 29 29 0a 20 20 20 20 28 73  dat '())).    (s
6dd0: 65 74 21 20 69 74 65 6d 2d 70 61 74 68 20 28 69  et! item-path (i
6de0: 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69  tem-list->path i
6df0: 74 65 6d 64 61 74 29 29 0a 20 20 20 20 28 64 65  temdat)).    (de
6e00: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 41 74 74  bug:print 2 "Att
6e10: 65 6d 70 74 69 6e 67 20 74 6f 20 6c 61 75 6e 63  empting to launc
6e20: 68 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61  h test " test-na
6e30: 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69  me (if (equal? i
6e40: 74 65 6d 2d 70 61 74 68 20 22 2f 22 29 20 22 2f  tem-path "/") "/
6e50: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 20 20  " item-path)).  
6e60: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45    (setenv "MT_TE
6e70: 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61  ST_NAME" test-na
6e80: 6d 65 29 20 3b 3b 20 0a 20 20 20 20 28 73 65 74  me) ;; .    (set
6e90: 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22  env "MT_RUNNAME"
6ea0: 20 20 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20     runname).    
6eb0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
6ec0: 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76  set-megatest-env
6ed0: 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29  -vars db run-id)
6ee0: 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65   ;; these may be
6ef0: 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c   needed by the l
6f00: 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73  aunching process
6f10: 0a 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72  .    (change-dir
6f20: 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a  ectory *toppath*
6f30: 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65 20 69  )..    ;; Here i
6f40: 73 20 77 68 65 72 65 20 74 68 65 20 74 65 73 74  s where the test
6f50: 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73 20 62  _meta table is b
6f60: 65 73 74 20 75 70 64 61 74 65 64 0a 20 20 20 20  est updated.    
6f70: 3b 3b 20 59 65 73 2c 20 61 6e 6f 74 68 65 72 20  ;; Yes, another 
6f80: 75 73 65 20 6f 66 20 61 20 67 6c 6f 62 61 6c 20  use of a global 
6f90: 66 6f 72 20 63 61 63 68 69 6e 67 2e 20 4e 65 65  for caching. Nee
6fa0: 64 20 61 20 62 65 74 74 65 72 20 77 61 79 3f 0a  d a better way?.
6fb0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61      (if (not (ha
6fc0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
6fd0: 61 75 6c 74 20 2a 74 65 73 74 2d 6d 65 74 61 2d  ault *test-meta-
6fe0: 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61  updated* test-na
6ff0: 6d 65 20 23 66 29 29 0a 20 20 20 20 20 20 20 20  me #f)).        
7000: 28 62 65 67 69 6e 0a 09 20 20 20 28 68 61 73 68  (begin..   (hash
7010: 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a 74 65 73  -table-set! *tes
7020: 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a 20  t-meta-updated* 
7030: 74 65 73 74 2d 6e 61 6d 65 20 23 74 29 0a 20 20  test-name #t).  
7040: 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72           (open-r
7050: 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 75 70  un-close runs:up
7060: 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64  date-test_meta d
7070: 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74  b test-name test
7080: 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 0a 20 20  -conf))).    .  
7090: 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69 74    ;; (lambda (it
70a0: 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 69 70  emdat) ;;; ((rip
70b0: 65 6e 65 73 73 20 22 6f 76 65 72 72 69 70 65 22  eness "overripe"
70c0: 29 20 28 74 65 6d 70 65 72 61 74 75 72 65 20 22  ) (temperature "
70d0: 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20 22  cool") (season "
70e0: 73 75 6d 6d 65 72 22 29 29 0a 20 20 20 20 28 6c  summer")).    (l
70f0: 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 70  et* ((new-test-p
7100: 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e 74 65  ath (string-inte
7110: 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20 74 65  rsperse (cons te
7120: 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63 61 64  st-path (map cad
7130: 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f 22 29  r itemdat)) "/")
7140: 29 0a 09 20 20 20 28 6e 65 77 2d 74 65 73 74 2d  )..   (new-test-
7150: 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f  name (if (equal?
7160: 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 20 74   item-path "") t
7170: 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74  est-name (conc t
7180: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65  est-name "/" ite
7190: 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a 75 73  m-path))) ;; jus
71a0: 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62 65 20  t need it to be 
71b0: 75 6e 69 71 75 65 0a 09 20 20 20 28 74 65 73 74  unique..   (test
71c0: 2d 69 64 20 20 20 20 20 20 20 28 6f 70 65 6e 2d  -id       (open-
71d0: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
71e0: 2d 74 65 73 74 2d 69 64 20 64 62 20 20 72 75 6e  -test-id db  run
71f0: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  -id test-name it
7200: 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 28 74  em-path))..   (t
7210: 65 73 74 64 61 74 20 20 20 20 20 20 20 28 6f 70  estdat       (op
7220: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
7230: 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79  get-test-info-by
7240: 2d 69 64 20 64 62 20 74 65 73 74 2d 69 64 29 29  -id db test-id))
7250: 29 0a 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74  ).      (if (not
7260: 20 74 65 73 74 64 61 74 29 0a 09 20 20 28 62 65   testdat)..  (be
7270: 67 69 6e 0a 09 20 20 20 20 3b 3b 20 65 6e 73 75  gin..    ;; ensu
7280: 72 65 20 74 68 61 74 20 74 68 65 20 70 61 74 68  re that the path
7290: 20 65 78 69 73 74 73 20 62 65 66 6f 72 65 20 72   exists before r
72a0: 65 67 69 73 74 65 72 69 6e 67 20 74 68 65 20 74  egistering the t
72b0: 65 73 74 0a 09 20 20 20 20 3b 3b 20 4e 4f 50 45  est..    ;; NOPE
72c0: 3a 20 43 61 6e 6e 6f 74 21 20 44 6f 6e 27 74 20  : Cannot! Don't 
72d0: 6b 6e 6f 77 20 79 65 74 20 77 68 69 63 68 20 64  know yet which d
72e0: 69 73 6b 20 61 72 65 61 20 77 69 6c 6c 20 62 65  isk area will be
72f0: 20 61 73 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20   assigned...... 
7300: 20 20 20 3b 3b 20 28 73 79 73 74 65 6d 20 28 63     ;; (system (c
7310: 6f 6e 63 20 22 6d 6b 64 69 72 20 2d 70 20 22 20  onc "mkdir -p " 
7320: 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 29 29 0a  new-test-path)).
7330: 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20  .    ;;..    ;; 
7340: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
7350: 74 65 73 74 73 3a 72 65 67 69 73 74 65 72 2d 74  tests:register-t
7360: 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65  est db run-id te
7370: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74  st-name item-pat
7380: 68 29 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20 20  h)..    ;;..    
7390: 3b 3b 20 4e 42 2f 2f 20 66 6f 72 20 74 68 65 20  ;; NB// for the 
73a0: 61 62 6f 76 65 20 6c 69 6e 65 2e 20 49 20 77 61  above line. I wa
73b0: 6e 74 20 74 68 65 20 74 65 73 74 20 74 6f 20 62  nt the test to b
73c0: 65 20 72 65 67 69 73 74 65 72 65 64 20 6c 6f 6e  e registered lon
73d0: 67 20 62 65 66 6f 72 65 20 74 68 69 73 20 72 6f  g before this ro
73e0: 75 74 69 6e 65 20 67 65 74 73 20 63 61 6c 6c 65  utine gets calle
73f0: 64 21 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20 20  d!..    ;;..    
7400: 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 28 6f  (set! test-id (o
7410: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
7420: 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 64 62 20  :get-test-id db 
7430: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65  run-id test-name
7440: 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20   item-path))..  
7450: 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74 2d    (if (not test-
7460: 69 64 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20  id)...(begin... 
7470: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20   (debug:print 2 
7480: 22 57 41 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20  "WARN: Test not 
7490: 70 72 65 2d 63 72 65 61 74 65 64 3f 20 74 65 73  pre-created? tes
74a0: 74 2d 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61  t-name=" test-na
74b0: 6d 65 20 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d  me ", item-path=
74c0: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 2c 20 72  " item-path ", r
74d0: 75 6e 2d 69 64 3d 22 20 72 75 6e 2d 69 64 29 0a  un-id=" run-id).
74e0: 09 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c  ..  (open-run-cl
74f0: 6f 73 65 20 64 62 3a 74 65 73 74 73 2d 72 65 67  ose db:tests-reg
7500: 69 73 74 65 72 2d 74 65 73 74 20 23 66 20 72 75  ister-test #f ru
7510: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69  n-id test-name i
7520: 74 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 28 73  tem-path)...  (s
7530: 65 74 21 20 74 65 73 74 2d 69 64 20 28 6f 70 65  et! test-id (ope
7540: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67  n-run-close db:g
7550: 65 74 2d 74 65 73 74 2d 69 64 20 64 62 20 72 75  et-test-id db ru
7560: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69  n-id test-name i
7570: 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 09 20 20  tem-path))))..  
7580: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34    (debug:print 4
7590: 20 22 49 4e 46 4f 3a 20 74 65 73 74 2d 69 64 3d   "INFO: test-id=
75a0: 22 20 74 65 73 74 2d 69 64 20 22 2c 20 72 75 6e  " test-id ", run
75b0: 2d 69 64 3d 22 20 72 75 6e 2d 69 64 20 22 2c 20  -id=" run-id ", 
75c0: 74 65 73 74 2d 6e 61 6d 65 3d 22 20 74 65 73 74  test-name=" test
75d0: 2d 6e 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70 61  -name ", item-pa
75e0: 74 68 3d 5c 22 22 20 69 74 65 6d 2d 70 61 74 68  th=\"" item-path
75f0: 20 22 5c 22 22 29 0a 09 20 20 20 20 28 73 65 74   "\"")..    (set
7600: 21 20 74 65 73 74 64 61 74 20 28 6f 70 65 6e 2d  ! testdat (open-
7610: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
7620: 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64  -test-info-by-id
7630: 20 64 62 20 74 65 73 74 2d 69 64 29 29 29 29 0a   db test-id)))).
7640: 20 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74        (set! test
7650: 2d 69 64 20 28 64 62 3a 74 65 73 74 2d 67 65 74  -id (db:test-get
7660: 2d 69 64 20 74 65 73 74 64 61 74 29 29 0a 20 20  -id testdat)).  
7670: 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65      (change-dire
7680: 63 74 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29  ctory test-path)
7690: 0a 20 20 20 20 20 20 28 63 61 73 65 20 28 69 66  .      (case (if
76a0: 20 66 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 3a   force ;; (args:
76b0: 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22  get-arg "-force"
76c0: 29 0a 09 09 27 4e 4f 54 5f 53 54 41 52 54 45 44  )...'NOT_STARTED
76d0: 0a 09 09 28 69 66 20 74 65 73 74 64 61 74 0a 09  ...(if testdat..
76e0: 09 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79  .    (string->sy
76f0: 6d 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73  mbol (test:get-s
7700: 74 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09  tate testdat))..
7710: 09 20 20 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d  .    'failed-to-
7720: 69 6e 73 65 72 74 29 29 0a 09 28 28 66 61 69 6c  insert))..((fail
7730: 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20  ed-to-insert).. 
7740: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
7750: 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f  ERROR: Failed to
7760: 20 69 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f   insert the reco
7770: 72 64 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29  rd into the db")
7780: 29 0a 09 28 28 4e 4f 54 5f 53 54 41 52 54 45 44  )..((NOT_STARTED
7790: 20 43 4f 4d 50 4c 45 54 45 44 20 44 45 4c 45 54   COMPLETED DELET
77a0: 45 44 29 0a 09 20 28 6c 65 74 20 28 28 72 75 6e  ED).. (let ((run
77b0: 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 28 63  flag #f))..   (c
77c0: 6f 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72  ond..    ;; -for
77d0: 63 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65  ce, run no matte
77e0: 72 20 77 68 61 74 0a 09 20 20 20 20 28 66 6f 72  r what..    (for
77f0: 63 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67  ce (set! runflag
7800: 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f   #t))..    ;; NO
7810: 54 5f 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e  T_STARTED, run n
7820: 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20  o matter what.. 
7830: 20 20 20 28 28 6d 65 6d 62 65 72 20 28 74 65 73     ((member (tes
7840: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74  t:get-state test
7850: 64 61 74 29 20 27 28 22 44 45 4c 45 54 45 44 22  dat) '("DELETED"
7860: 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 29   "NOT_STARTED"))
7870: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74  (set! runflag #t
7880: 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f 74 20 2d  ))..    ;; not -
7890: 72 65 72 75 6e 20 61 6e 64 20 50 41 53 53 2c 20  rerun and PASS, 
78a0: 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c 20 64  WARN or CHECK, d
78b0: 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20 20 28 28  o no run..    ((
78c0: 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72 65 72  and (or (not rer
78d0: 75 6e 29 0a 09 09 20 20 20 20 20 20 6b 65 65 70  un)...      keep
78e0: 67 6f 69 6e 67 29 0a 09 09 20 20 3b 3b 20 52 65  going)...  ;; Re
78f0: 71 75 69 72 65 20 74 6f 20 66 6f 72 63 65 20 72  quire to force r
7900: 65 2d 72 75 6e 20 66 6f 72 20 43 4f 4d 50 4c 45  e-run for COMPLE
7910: 54 45 44 20 6f 72 20 2a 61 6e 79 74 68 69 6e 67  TED or *anything
7920: 2a 20 2b 20 50 41 53 53 2c 57 41 52 4e 20 6f 72  * + PASS,WARN or
7930: 20 43 48 45 43 4b 0a 09 09 20 20 28 6f 72 20 28   CHECK...  (or (
7940: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74  member (test:get
7950: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
7960: 20 27 28 22 50 41 53 53 22 20 22 57 41 52 4e 22   '("PASS" "WARN"
7970: 20 22 43 48 45 43 4b 22 29 29 0a 09 09 20 20 20   "CHECK"))...   
7980: 20 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74     (member (test
7990: 3a 67 65 74 2d 73 74 61 74 65 20 20 74 65 73 74  :get-state  test
79a0: 64 61 74 29 20 27 28 22 43 4f 4d 50 4c 45 54 45  dat) '("COMPLETE
79b0: 44 22 29 29 29 29 20 0a 09 20 20 20 20 20 28 64  D")))) ..     (d
79c0: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 49 4e  ebug:print 2 "IN
79d0: 46 4f 3a 20 72 75 6e 6e 69 6e 67 20 74 65 73 74  FO: running test
79e0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22   " test-name "/"
79f0: 20 69 74 65 6d 2d 70 61 74 68 20 22 20 73 75 70   item-path " sup
7a00: 70 72 65 73 73 65 64 20 61 73 20 69 74 20 69 73  pressed as it is
7a10: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
7a20: 74 65 20 74 65 73 74 64 61 74 29 20 22 20 61 6e  te testdat) " an
7a30: 64 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74  d " (test:get-st
7a40: 61 74 75 73 20 74 65 73 74 64 61 74 29 29 0a 09  atus testdat))..
7a50: 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c       (set! runfl
7a60: 61 67 20 23 66 29 29 0a 09 20 20 20 20 3b 3b 20  ag #f))..    ;; 
7a70: 2d 72 65 72 75 6e 20 61 6e 64 20 73 74 61 74 75  -rerun and statu
7a80: 73 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20  s is one of the 
7a90: 73 70 65 63 69 66 65 64 2c 20 72 75 6e 20 69 74  specifed, run it
7aa0: 0a 09 20 20 20 20 28 28 61 6e 64 20 72 65 72 75  ..    ((and reru
7ab0: 6e 0a 09 09 20 20 28 6c 65 74 2a 20 28 28 72 65  n...  (let* ((re
7ac0: 72 75 6e 6c 73 74 20 20 20 28 73 74 72 69 6e 67  runlst   (string
7ad0: 2d 73 70 6c 69 74 20 72 65 72 75 6e 20 22 2c 22  -split rerun ","
7ae0: 29 29 0a 09 09 09 20 28 6d 75 73 74 2d 72 65 72  )).... (must-rer
7af0: 75 6e 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74  un (member (test
7b00: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74  :get-status test
7b10: 64 61 74 29 20 72 65 72 75 6e 6c 73 74 29 29 29  dat) rerunlst)))
7b20: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  ...    (debug:pr
7b30: 69 6e 74 20 33 20 22 49 4e 46 4f 3a 20 2d 72 65  int 3 "INFO: -re
7b40: 72 75 6e 20 6c 69 73 74 3a 20 22 20 72 65 72 75  run list: " reru
7b50: 6e 20 22 2c 20 74 65 73 74 2d 73 74 61 74 75 73  n ", test-status
7b60: 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74  : " (test:get-st
7b70: 61 74 75 73 20 74 65 73 74 64 61 74 29 22 2c 20  atus testdat)", 
7b80: 6d 75 73 74 2d 72 65 72 75 6e 3a 20 22 20 6d 75  must-rerun: " mu
7b90: 73 74 2d 72 65 72 75 6e 29 0a 09 09 20 20 20 20  st-rerun)...    
7ba0: 6d 75 73 74 2d 72 65 72 75 6e 29 29 0a 09 20 20  must-rerun))..  
7bb0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
7bc0: 32 20 22 49 4e 46 4f 3a 20 52 65 72 75 6e 20 66  2 "INFO: Rerun f
7bd0: 6f 72 63 65 64 20 66 6f 72 20 74 65 73 74 20 22  orced for test "
7be0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69   test-name "/" i
7bf0: 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 20  tem-path)..     
7c00: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74  (set! runflag #t
7c10: 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65 70  ))..    ;; -keep
7c20: 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65  going, do not re
7c30: 72 75 6e 20 46 41 49 4c 0a 09 20 20 20 20 28 28  run FAIL..    ((
7c40: 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09  and keepgoing...
7c50: 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a    (member (test:
7c60: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
7c70: 61 74 29 20 27 28 22 46 41 49 4c 22 29 29 29 0a  at) '("FAIL"))).
7c80: 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66  .     (set! runf
7c90: 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 28 28  lag #f))..    ((
7ca0: 61 6e 64 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a  and (not rerun).
7cb0: 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73  ..  (member (tes
7cc0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
7cd0: 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 20 22  tdat) '("FAIL" "
7ce0: 6e 2f 61 22 29 29 29 0a 09 20 20 20 20 20 28 73  n/a")))..     (s
7cf0: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29  et! runflag #t))
7d00: 0a 09 20 20 20 20 28 65 6c 73 65 20 28 73 65 74  ..    (else (set
7d10: 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 29 0a  ! runflag #f))).
7d20: 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  .   (debug:print
7d30: 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72   6 "RUNNING => r
7d40: 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61  unflag: " runfla
7d50: 67 20 22 20 53 54 41 54 45 3a 20 22 20 28 74 65  g " STATE: " (te
7d60: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73  st:get-state tes
7d70: 74 64 61 74 29 20 22 20 53 54 41 54 55 53 3a 20  tdat) " STATUS: 
7d80: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
7d90: 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 20 20  us testdat))..  
7da0: 20 28 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61   (if (not runfla
7db0: 67 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 28  g)..       (if (
7dc0: 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 73 74 29  not parent-test)
7dd0: 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69  ...   (debug:pri
7de0: 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20  nt 1 "NOTE: Not 
7df0: 73 74 61 72 74 69 6e 67 20 74 65 73 74 20 22 20  starting test " 
7e00: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20  new-test-name " 
7e10: 61 73 20 69 74 20 69 73 20 73 74 61 74 65 20 5c  as it is state \
7e20: 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  "" (test:get-sta
7e30: 74 65 20 74 65 73 74 64 61 74 29 20 0a 09 09 09  te testdat) ....
7e40: 09 22 5c 22 20 61 6e 64 20 73 74 61 74 75 73 20  ."\" and status 
7e50: 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74  \"" (test:get-st
7e60: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 22 5c  atus testdat) "\
7e70: 22 2c 20 75 73 65 20 2d 72 65 72 75 6e 20 5c 22  ", use -rerun \"
7e80: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
7e90: 75 73 20 74 65 73 74 64 61 74 29 0a 20 20 20 20  us testdat).    
7ea0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
7eb0: 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 20              "\" 
7ec0: 6f 72 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65  or -force to ove
7ed0: 72 72 69 64 65 22 29 29 0a 09 20 20 20 20 20 20  rride"))..      
7ee0: 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e   ;; NOTE: No lon
7ef0: 67 65 72 20 62 65 20 63 68 65 63 6b 69 6e 67 20  ger be checking 
7f00: 70 72 65 72 65 71 75 69 73 69 74 65 73 20 68 65  prerequisites he
7f10: 72 65 21 20 57 69 6c 6c 20 6e 65 76 65 72 20 67  re! Will never g
7f20: 65 74 20 68 65 72 65 20 75 6e 6c 65 73 73 20 70  et here unless p
7f30: 72 65 72 65 71 73 20 61 72 65 0a 09 20 20 20 20  rereqs are..    
7f40: 20 20 20 3b 3b 20 20 20 20 20 20 20 61 6c 72 65     ;;       alre
7f50: 61 64 79 20 6d 65 74 2e 0a 09 20 20 20 20 20 20  ady met...      
7f60: 20 28 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e 63   (if (not (launc
7f70: 68 2d 74 65 73 74 20 23 66 20 72 75 6e 2d 69 64  h-test #f run-id
7f80: 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63 6f   runname test-co
7f90: 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73  nf keyvallst tes
7fa0: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 68  t-name test-path
7fb0: 20 69 74 65 6d 64 61 74 20 66 6c 61 67 73 29 29   itemdat flags))
7fc0: 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20  ...   (begin... 
7fd0: 20 20 20 20 28 70 72 69 6e 74 20 22 45 52 52 4f      (print "ERRO
7fe0: 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75  R: Failed to lau
7ff0: 6e 63 68 20 74 68 65 20 74 65 73 74 2e 20 45 78  nch the test. Ex
8000: 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73  iting as soon as
8010: 20 70 6f 73 73 69 62 6c 65 22 29 0a 09 09 20 20   possible")...  
8020: 20 20 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c     (set! *global
8030: 65 78 69 74 73 74 61 74 75 73 2a 20 31 29 20 3b  exitstatus* 1) ;
8040: 3b 20 0a 09 09 20 20 20 20 20 28 70 72 6f 63 65  ; ...     (proce
8050: 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 65  ss-signal (curre
8060: 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 73  nt-process-id) s
8070: 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 29  ignal/kill))))))
8080: 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20 28  ..((KILLED) .. (
8090: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e  debug:print 1 "N
80a0: 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d  OTE: " new-test-
80b0: 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64  name " is alread
80c0: 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73  y running or was
80d0: 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65   explictly kille
80e0: 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 20 74 6f  d, use -force to
80f0: 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 29 0a 09   launch it."))..
8100: 28 28 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f 54  ((LAUNCHED REMOT
8110: 45 48 4f 53 54 53 54 41 52 54 20 52 55 4e 4e 49  EHOSTSTART RUNNI
8120: 4e 47 29 20 20 0a 09 20 28 69 66 20 28 3e 20 28  NG)  .. (if (> (
8130: 2d 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e  - (current-secon
8140: 64 73 29 28 2b 20 28 64 62 3a 74 65 73 74 2d 67  ds)(+ (db:test-g
8150: 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 65  et-event_time te
8160: 73 74 64 61 74 29 0a 09 09 09 09 20 20 20 20 20  stdat).....     
8170: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72    (db:test-get-r
8180: 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 74  un_duration test
8190: 64 61 74 29 29 29 0a 09 09 36 30 30 29 20 3b 3b  dat)))...600) ;;
81a0: 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 20   i.e. no update 
81b0: 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e 20 36 30  for more than 60
81c0: 30 20 73 65 63 6f 6e 64 73 0a 09 20 20 20 20 20  0 seconds..     
81d0: 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28  (begin..       (
81e0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57  debug:print 0 "W
81f0: 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 74  ARNING: Test " t
8200: 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 61  est-name " appea
8210: 72 73 20 74 6f 20 62 65 20 64 65 61 64 2e 20 46  rs to be dead. F
8220: 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 73 74 61  orcing it to sta
8230: 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e  te INCOMPLETE an
8240: 64 20 73 74 61 74 75 73 20 53 54 55 43 4b 2f 44  d status STUCK/D
8250: 45 41 44 22 29 0a 09 20 20 20 20 20 20 20 28 74  EAD")..       (t
8260: 65 73 74 73 3a 74 65 73 74 2d 73 65 74 2d 73 74  ests:test-set-st
8270: 61 74 75 73 21 20 74 65 73 74 2d 69 64 20 22 49  atus! test-id "I
8280: 4e 43 4f 4d 50 4c 45 54 45 22 20 22 53 54 55 43  NCOMPLETE" "STUC
8290: 4b 2f 44 45 41 44 22 20 22 54 65 73 74 20 69 73  K/DEAD" "Test is
82a0: 20 73 74 75 63 6b 20 6f 72 20 64 65 61 64 22 20   stuck or dead" 
82b0: 23 66 29 29 0a 09 20 20 20 20 20 28 64 65 62 75  #f))..     (debu
82c0: 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a  g:print 2 "NOTE:
82d0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 69   " test-name " i
82e0: 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e  s already runnin
82f0: 67 22 29 29 29 0a 09 28 65 6c 73 65 20 20 20 20  g")))..(else    
8300: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
8310: 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64  0 "ERROR: Failed
8320: 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 20   to launch test 
8330: 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20  " new-test-name 
8340: 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73 65 64 20  ". Unrecognised 
8350: 73 74 61 74 65 20 22 20 28 74 65 73 74 3a 67 65  state " (test:ge
8360: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29  t-state testdat)
8370: 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d  ))))))..;;======
8380: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8390: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
83a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
83b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
83c0: 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20 53  .;; END OF NEW S
83d0: 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d  TUFF.;;=========
83e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
83f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8400: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8410: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28  =============..(
8420: 64 65 66 69 6e 65 20 28 67 65 74 2d 64 69 72 2d  define (get-dir-
8430: 75 70 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 6d  up-n dir . param
8440: 73 29 20 0a 20 20 28 6c 65 74 20 28 28 64 70 61  s) .  (let ((dpa
8450: 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c  rts  (string-spl
8460: 69 74 20 64 69 72 20 22 2f 22 29 29 0a 09 28 63  it dir "/"))..(c
8470: 6f 75 6e 74 20 20 20 28 69 66 20 28 6e 75 6c 6c  ount   (if (null
8480: 3f 20 70 61 72 61 6d 73 29 20 31 20 28 63 61 72  ? params) 1 (car
8490: 20 70 61 72 61 6d 73 29 29 29 29 0a 20 20 20 20   params)))).    
84a0: 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e  (conc "/" (strin
84b0: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09  g-intersperse ..
84c0: 20 20 20 20 20 20 20 28 74 61 6b 65 20 64 70 61         (take dpa
84d0: 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64  rts (- (length d
84e0: 70 61 72 74 73 29 20 63 6f 75 6e 74 29 29 0a 09  parts) count))..
84f0: 20 20 20 20 20 20 20 22 2f 22 29 29 29 29 0a 3b         "/")))).;
8500: 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b  ; Remove runs.;;
8510: 20 66 69 65 6c 64 73 20 61 72 65 20 70 61 73 73   fields are pass
8520: 69 6e 67 20 69 6e 20 74 68 72 6f 75 67 68 20 0a  ing in through .
8530: 3b 3b 20 61 63 74 69 6f 6e 3a 0a 3b 3b 20 20 20  ;; action:.;;   
8540: 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73 0a 3b 3b   'remove-runs.;;
8550: 20 20 20 20 27 73 65 74 2d 73 74 61 74 65 2d 73      'set-state-s
8560: 74 61 74 75 73 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f  tatus.;;.;; NB//
8570: 20 73 68 6f 75 6c 64 20 70 61 73 73 20 69 6e 20   should pass in 
8580: 6b 65 79 73 3f 0a 3b 3b 0a 28 64 65 66 69 6e 65  keys?.;;.(define
8590: 20 28 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f   (runs:operate-o
85a0: 6e 20 61 63 74 69 6f 6e 20 72 75 6e 6e 61 6d 65  n action runname
85b0: 70 61 74 74 20 74 65 73 74 70 61 74 74 20 69 74  patt testpatt it
85c0: 65 6d 70 61 74 74 20 23 21 6b 65 79 20 28 73 74  empatt #!key (st
85d0: 61 74 65 20 23 66 29 28 73 74 61 74 75 73 20 23  ate #f)(status #
85e0: 66 29 28 6e 65 77 2d 73 74 61 74 65 2d 73 74 61  f)(new-state-sta
85f0: 74 75 73 20 23 66 29 29 0a 20 20 28 6c 65 74 2a  tus #f)).  (let*
8600: 20 28 28 64 62 20 20 20 20 20 20 20 20 20 20 20   ((db           
8610: 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20 20 20  #f).. (keys     
8620: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
8630: 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20  ose db:get-keys 
8640: 64 62 29 29 0a 09 20 28 72 75 6e 64 61 74 20 20  db)).. (rundat  
8650: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
8660: 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d 72 75  lose runs:get-ru
8670: 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65  ns-by-patt db ke
8680: 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 29  ys runnamepatt))
8690: 0a 09 20 28 68 65 61 64 65 72 20 20 20 20 20 20  .. (header      
86a0: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e   (vector-ref run
86b0: 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20  dat 0)).. (runs 
86c0: 20 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d          (vector-
86d0: 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 0a 09  ref rundat 1))..
86e0: 20 28 73 74 61 74 65 73 20 20 20 20 20 20 20 28   (states       (
86f0: 69 66 20 73 74 61 74 65 20 20 28 73 74 72 69 6e  if state  (strin
8700: 67 2d 73 70 6c 69 74 20 73 74 61 74 65 20 20 22  g-split state  "
8710: 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 74 61  ,") '())).. (sta
8720: 74 75 73 65 73 20 20 20 20 20 28 69 66 20 73 74  tuses     (if st
8730: 61 74 75 73 20 28 73 74 72 69 6e 67 2d 73 70 6c  atus (string-spl
8740: 69 74 20 73 74 61 74 75 73 20 22 2c 22 29 20 27  it status ",") '
8750: 28 29 29 29 0a 09 20 28 73 74 61 74 65 2d 73 74  ())).. (state-st
8760: 61 74 75 73 20 28 69 66 20 28 73 74 72 69 6e 67  atus (if (string
8770: 3f 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74  ? new-state-stat
8780: 75 73 29 20 28 73 74 72 69 6e 67 2d 73 70 6c 69  us) (string-spli
8790: 74 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74  t new-state-stat
87a0: 75 73 20 22 2c 22 29 20 27 28 23 66 20 23 66 29  us ",") '(#f #f)
87b0: 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  ))).    (debug:p
87c0: 72 69 6e 74 20 32 20 22 48 65 61 64 65 72 3a 20  rint 2 "Header: 
87d0: 22 20 68 65 61 64 65 72 20 22 20 61 63 74 69 6f  " header " actio
87e0: 6e 3a 20 22 20 61 63 74 69 6f 6e 20 22 20 6e 65  n: " action " ne
87f0: 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 3a 20  w-state-status: 
8800: 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74  " new-state-stat
8810: 75 73 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63  us).    (for-eac
8820: 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28  h.     (lambda (
8830: 72 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74  run).       (let
8840: 20 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69 6e   ((runkey (strin
8850: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d  g-intersperse (m
8860: 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09  ap (lambda (k)..
8870: 09 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61 6c  .....(db:get-val
8880: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
8890: 20 68 65 61 64 65 72 20 28 76 65 63 74 6f 72 2d   header (vector-
88a0: 72 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73 29  ref k 0))) keys)
88b0: 20 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64 69   "/"))..     (di
88c0: 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61  rs-to-remove (ma
88d0: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29  ke-hash-table)))
88e0: 0a 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69  .. (let* ((run-i
88f0: 64 20 20 20 20 28 64 62 3a 67 65 74 2d 76 61 6c  d    (db:get-val
8900: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
8910: 20 68 65 61 64 65 72 20 22 69 64 22 29 29 0a 09   header "id"))..
8920: 09 28 72 75 6e 2d 73 74 61 74 65 20 28 64 62 3a  .(run-state (db:
8930: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
8940: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
8950: 73 74 61 74 65 22 29 29 0a 09 09 28 74 65 73 74  state"))...(test
8960: 73 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  s     (if (not (
8970: 65 71 75 61 6c 3f 20 72 75 6e 2d 73 74 61 74 65  equal? run-state
8980: 20 22 6c 6f 63 6b 65 64 22 29 29 0a 09 09 09 20   "locked")).... 
8990: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
89a0: 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73  close db:get-tes
89b0: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64  ts-for-run db (d
89c0: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
89d0: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
89e0: 20 22 69 64 22 29 0a 09 09 09 09 09 09 20 20 20   "id").......   
89f0: 20 20 20 74 65 73 74 70 61 74 74 20 69 74 65 6d     testpatt item
8a00: 70 61 74 74 20 73 74 61 74 65 73 20 73 74 61 74  patt states stat
8a10: 75 73 65 73 0a 09 09 09 09 09 09 20 20 20 20 20  uses.......     
8a20: 20 6e 6f 74 2d 69 6e 3a 20 20 23 66 0a 09 09 09   not-in:  #f....
8a30: 09 09 09 20 20 20 20 20 20 73 6f 72 74 2d 62 79  ...      sort-by
8a40: 3a 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09  : (case action..
8a50: 09 09 09 09 09 09 09 20 28 28 72 65 6d 6f 76 65  ....... ((remove
8a60: 2d 72 75 6e 73 29 20 27 72 75 6e 64 69 72 29 0a  -runs) 'rundir).
8a70: 09 09 09 09 09 09 09 09 20 28 65 6c 73 65 20 20  ........ (else  
8a80: 20 20 20 20 20 20 20 20 27 65 76 65 6e 74 5f 74          'event_t
8a90: 69 6d 65 29 29 29 0a 09 09 09 20 20 20 20 20 20  ime)))....      
8aa0: 20 27 28 29 29 29 0a 09 09 28 6c 61 73 74 74 70   '()))...(lasttp
8ab0: 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65  ath "/does/not/e
8ac0: 78 69 73 74 2f 49 2f 68 6f 70 65 22 29 29 0a 09  xist/I/hope"))..
8ad0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
8ae0: 34 20 22 49 4e 46 4f 3a 20 72 75 6e 73 3a 6f 70  4 "INFO: runs:op
8af0: 65 72 61 74 65 2d 6f 6e 20 72 75 6e 3d 22 20 72  erate-on run=" r
8b00: 75 6e 20 22 2c 20 68 65 61 64 65 72 3d 22 20 68  un ", header=" h
8b10: 65 61 64 65 72 29 0a 09 20 20 20 28 69 66 20 28  eader)..   (if (
8b20: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73  not (null? tests
8b30: 29 29 0a 09 20 20 20 20 20 20 20 28 62 65 67 69  ))..       (begi
8b40: 6e 0a 09 09 20 28 63 61 73 65 20 61 63 74 69 6f  n... (case actio
8b50: 6e 0a 09 09 20 20 20 28 28 72 65 6d 6f 76 65 2d  n...   ((remove-
8b60: 72 75 6e 73 29 0a 09 09 20 20 20 20 28 64 65 62  runs)...    (deb
8b70: 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f  ug:print 1 "Remo
8b80: 76 69 6e 67 20 74 65 73 74 73 20 66 6f 72 20 72  ving tests for r
8b90: 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22  un: " runkey " "
8ba0: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62   (db:get-value-b
8bb0: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61  y-header run hea
8bc0: 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 29  der "runname")))
8bd0: 0a 09 09 20 20 20 28 28 73 65 74 2d 73 74 61 74  ...   ((set-stat
8be0: 65 2d 73 74 61 74 75 73 29 0a 09 09 20 20 20 20  e-status)...    
8bf0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
8c00: 4d 6f 64 69 66 79 69 6e 67 20 73 74 61 74 65 20  Modifying state 
8c10: 61 6e 64 20 73 74 61 75 73 20 66 6f 72 20 74 65  and staus for te
8c20: 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72  sts for run: " r
8c30: 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65  unkey " " (db:ge
8c40: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65  t-value-by-heade
8c50: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75  r run header "ru
8c60: 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28  nname")))...   (
8c70: 28 70 72 69 6e 74 2d 72 75 6e 29 0a 09 09 20 20  (print-run)...  
8c80: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31    (debug:print 1
8c90: 20 22 50 72 69 6e 74 69 6e 67 20 69 6e 66 6f 20   "Printing info 
8ca0: 66 6f 72 20 72 75 6e 20 22 20 72 75 6e 6b 65 79  for run " runkey
8cb0: 20 22 2c 20 72 75 6e 3d 22 20 72 75 6e 20 22 2c   ", run=" run ",
8cc0: 20 74 65 73 74 73 3d 22 20 74 65 73 74 73 20 22   tests=" tests "
8cd0: 2c 20 68 65 61 64 65 72 3d 22 20 68 65 61 64 65  , header=" heade
8ce0: 72 29 29 0a 09 09 20 20 20 28 65 6c 73 65 0a 09  r))...   (else..
8cf0: 09 20 20 20 20 28 70 72 69 6e 74 20 22 49 4e 46  .    (print "INF
8d00: 4f 3a 20 61 63 74 69 6f 6e 20 6e 6f 74 20 72 65  O: action not re
8d10: 63 6f 67 6e 69 73 65 64 20 22 20 61 63 74 69 6f  cognised " actio
8d20: 6e 29 29 29 0a 09 09 20 28 66 6f 72 2d 65 61 63  n)))... (for-eac
8d30: 68 0a 09 09 20 20 28 6c 61 6d 62 64 61 20 28 74  h...  (lambda (t
8d40: 65 73 74 29 0a 09 09 20 20 20 20 28 6c 65 74 2a  est)...    (let*
8d50: 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62   ((item-path (db
8d60: 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70  :test-get-item-p
8d70: 61 74 68 20 74 65 73 74 29 29 0a 09 09 09 20 20  ath test))....  
8d80: 20 28 74 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a   (test-name (db:
8d90: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d  test-get-testnam
8da0: 65 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28  e test))....   (
8db0: 72 75 6e 2d 64 69 72 20 20 20 28 64 62 3a 74 65  run-dir   (db:te
8dc0: 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 74 65  st-get-rundir te
8dd0: 73 74 29 29 0a 09 09 09 20 20 20 28 74 65 73 74  st))....   (test
8de0: 2d 69 64 20 20 20 28 64 62 3a 74 65 73 74 2d 67  -id   (db:test-g
8df0: 65 74 2d 69 64 20 74 65 73 74 29 29 29 0a 09 09  et-id test)))...
8e00: 20 20 20 20 20 20 3b 3b 20 20 20 28 74 64 62 20        ;;   (tdb 
8e10: 20 20 20 20 20 20 28 64 62 3a 6f 70 65 6e 2d 74        (db:open-t
8e20: 65 73 74 2d 64 62 20 72 75 6e 2d 64 69 72 29 29  est-db run-dir))
8e30: 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67  )...      (debug
8e40: 3a 70 72 69 6e 74 20 31 20 22 20 20 22 20 28 64  :print 1 "  " (d
8e50: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e  b:test-get-testn
8e60: 61 6d 65 20 74 65 73 74 29 20 22 20 69 64 3a 20  ame test) " id: 
8e70: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  " (db:test-get-i
8e80: 64 20 74 65 73 74 29 20 22 20 22 20 69 74 65 6d  d test) " " item
8e90: 2d 70 61 74 68 20 22 20 61 63 74 69 6f 6e 3a 20  -path " action: 
8ea0: 22 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 20 20  " action)...    
8eb0: 20 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09    (case action..
8ec0: 09 09 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29  ..((remove-runs)
8ed0: 20 3b 3b 20 74 68 65 20 74 64 62 20 69 73 20 66   ;; the tdb is f
8ee0: 6f 72 20 66 75 74 75 72 65 20 70 6f 73 73 69 62  or future possib
8ef0: 6c 65 2e 20 0a 09 09 09 20 28 6f 70 65 6e 2d 72  le. .... (open-r
8f00: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65  un-close db:dele
8f10: 74 65 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20  te-test-records 
8f20: 64 62 20 23 66 20 28 64 62 3a 74 65 73 74 2d 67  db #f (db:test-g
8f30: 65 74 2d 69 64 20 74 65 73 74 29 29 0a 09 09 09  et-id test))....
8f40: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
8f50: 22 49 4e 46 4f 3a 20 41 74 74 65 6d 70 74 69 6e  "INFO: Attemptin
8f60: 67 20 74 6f 20 72 65 6d 6f 76 65 20 64 69 72 20  g to remove dir 
8f70: 22 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 28  " run-dir).... (
8f80: 69 66 20 28 61 6e 64 20 28 3e 20 28 73 74 72 69  if (and (> (stri
8f90: 6e 67 2d 6c 65 6e 67 74 68 20 72 75 6e 2d 64 69  ng-length run-di
8fa0: 72 29 20 35 29 0a 09 09 09 09 20 20 28 66 69 6c  r) 5).....  (fil
8fb0: 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d 64 69  e-exists? run-di
8fc0: 72 29 29 20 3b 3b 20 62 61 64 20 68 65 75 72 69  r)) ;; bad heuri
8fd0: 73 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64 20  stic but should 
8fe0: 70 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f  prevent /tmp /ho
8ff0: 6d 65 20 65 74 63 2e 0a 09 09 09 20 20 20 20 20  me etc.....     
9000: 28 6c 65 74 2a 20 28 28 72 65 61 6c 70 61 74 68  (let* ((realpath
9010: 20 28 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e 61   (resolve-pathna
9020: 6d 65 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09  me run-dir)))...
9030: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  .       (debug:p
9040: 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 52 65  rint 1 "INFO: Re
9050: 61 6c 20 70 61 74 68 20 6f 66 20 69 73 20 22 20  al path of is " 
9060: 72 65 61 6c 70 61 74 68 29 0a 09 09 09 20 20 20  realpath)....   
9070: 20 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78      (if (file-ex
9080: 69 73 74 73 3f 20 72 65 61 6c 70 61 74 68 29 0a  ists? realpath).
9090: 09 09 09 09 20 20 20 28 69 66 20 28 3e 20 28 73  ....   (if (> (s
90a0: 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20  ystem (conc "rm 
90b0: 2d 72 66 20 22 20 72 65 61 6c 70 61 74 68 29 29  -rf " realpath))
90c0: 20 30 29 0a 09 09 09 09 20 20 20 20 20 20 20 28   0).....       (
90d0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
90e0: 52 52 4f 52 3a 20 54 68 65 72 65 20 77 61 73 20  RROR: There was 
90f0: 61 20 70 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 69  a problem removi
9100: 6e 67 20 22 20 72 65 61 6c 70 61 74 68 20 22 20  ng " realpath " 
9110: 77 69 74 68 20 72 6d 20 2d 66 22 29 29 0a 09 09  with rm -f"))...
9120: 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ..   (debug:prin
9130: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 74 65  t 0 "WARNING: te
9140: 73 74 20 72 75 6e 20 64 69 72 20 22 20 72 65 61  st run dir " rea
9150: 6c 70 61 74 68 20 22 20 61 70 70 65 61 72 73 20  lpath " appears 
9160: 74 6f 20 6e 6f 74 20 65 78 69 73 74 22 29 29 0a  to not exist")).
9170: 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28 66  ...       (if (f
9180: 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d  ile-exists? run-
9190: 64 69 72 29 20 3b 3b 20 74 68 65 20 6c 69 6e 6b  dir) ;; the link
91a0: 0a 09 09 09 09 20 20 20 28 69 66 20 28 73 79 6d  .....   (if (sym
91b0: 62 6f 6c 69 63 2d 6c 69 6e 6b 3f 20 72 75 6e 2d  bolic-link? run-
91c0: 64 69 72 29 0a 09 09 09 09 20 20 20 20 20 20 20  dir).....       
91d0: 28 64 65 6c 65 74 65 2d 66 69 6c 65 20 72 75 6e  (delete-file run
91e0: 2d 64 69 72 29 0a 09 09 09 09 20 20 20 20 20 20  -dir).....      
91f0: 20 28 69 66 20 28 64 69 72 65 63 74 6f 72 79 3f   (if (directory?
9200: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 09 20   run-dir)...... 
9210: 20 20 28 69 66 20 28 3e 20 28 64 69 72 65 63 74    (if (> (direct
9220: 6f 72 79 2d 66 6f 6c 64 20 28 6c 61 6d 62 64 61  ory-fold (lambda
9230: 20 28 66 20 78 29 28 2b 20 31 20 78 29 29 20 30   (f x)(+ 1 x)) 0
9240: 20 72 75 6e 2d 64 69 72 29 20 30 29 0a 09 09 09   run-dir) 0)....
9250: 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a  ..       (debug:
9260: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47  print 0 "WARNING
9270: 3a 20 72 65 66 75 73 69 6e 67 20 74 6f 20 72 65  : refusing to re
9280: 6d 6f 76 65 20 22 20 72 75 6e 2d 64 69 72 20 22  move " run-dir "
9290: 20 61 73 20 69 74 20 69 73 20 6e 6f 74 20 65 6d   as it is not em
92a0: 70 74 79 22 29 0a 09 09 09 09 09 20 20 20 20 20  pty")......     
92b0: 20 20 28 64 65 6c 65 74 65 2d 64 69 72 65 63 74    (delete-direct
92c0: 6f 72 79 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b  ory run-dir)) ;;
92d0: 20 69 74 20 73 68 6f 75 6c 64 20 62 65 20 65 6d   it should be em
92e0: 70 74 79 20 62 79 20 68 65 72 65 20 42 55 47 20  pty by here BUG 
92f0: 42 55 47 2c 20 61 64 64 20 65 72 72 6f 72 20 63  BUG, add error c
9300: 61 74 63 68 0a 09 09 09 09 09 20 20 20 28 64 65  atch......   (de
9310: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
9320: 4f 52 3a 20 72 65 66 75 73 69 6e 67 20 74 6f 20  OR: refusing to 
9330: 72 65 6d 6f 76 65 20 22 20 72 75 6e 2d 64 69 72  remove " run-dir
9340: 20 22 20 61 73 20 69 74 20 69 73 20 6e 65 69 74   " as it is neit
9350: 68 65 72 20 61 20 73 79 6d 6c 69 6e 6b 20 6e 6f  her a symlink no
9360: 72 20 61 20 64 69 72 65 63 74 6f 72 79 22 29 0a  r a directory").
9370: 09 09 09 09 09 20 20 20 29 29 29 29 0a 09 09 09  .....   ))))....
9380: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
9390: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 64 69  t 0 "WARNING: di
93a0: 72 65 63 74 6f 72 79 20 61 6c 72 65 61 64 79 20  rectory already 
93b0: 72 65 6d 6f 76 65 64 20 22 20 72 75 6e 2d 64 69  removed " run-di
93c0: 72 29 29 29 0a 09 09 09 28 28 73 65 74 2d 73 74  r)))....((set-st
93d0: 61 74 65 2d 73 74 61 74 75 73 29 0a 09 09 09 20  ate-status).... 
93e0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22  (debug:print 2 "
93f0: 49 4e 46 4f 3a 20 6e 65 77 20 73 74 61 74 65 20  INFO: new state 
9400: 22 20 28 63 61 72 20 73 74 61 74 65 2d 73 74 61  " (car state-sta
9410: 74 75 73 29 20 22 2c 20 6e 65 77 20 73 74 61 74  tus) ", new stat
9420: 75 73 20 22 20 28 63 61 64 72 20 73 74 61 74 65  us " (cadr state
9430: 2d 73 74 61 74 75 73 29 29 0a 09 09 09 20 28 6f  -status)).... (o
9440: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
9450: 3a 74 65 73 74 2d 73 65 74 2d 73 74 61 74 65 2d  :test-set-state-
9460: 73 74 61 74 75 73 2d 62 79 2d 69 64 20 64 62 20  status-by-id db 
9470: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
9480: 74 65 73 74 29 20 28 63 61 72 20 73 74 61 74 65  test) (car state
9490: 2d 73 74 61 74 75 73 29 28 63 61 64 72 20 73 74  -status)(cadr st
94a0: 61 74 65 2d 73 74 61 74 75 73 29 20 23 66 29 29  ate-status) #f))
94b0: 29 29 29 0a 09 09 20 20 74 65 73 74 73 29 29 29  )))...  tests)))
94c0: 0a 09 20 20 20 0a 09 20 20 20 3b 3b 20 72 65 6d  ..   ..   ;; rem
94d0: 6f 76 65 20 74 68 65 20 72 75 6e 20 69 66 20 7a  ove the run if z
94e0: 65 72 6f 20 74 65 73 74 73 20 72 65 6d 61 69 6e  ero tests remain
94f0: 0a 09 20 20 20 28 69 66 20 28 65 71 3f 20 61 63  ..   (if (eq? ac
9500: 74 69 6f 6e 20 27 72 65 6d 6f 76 65 2d 72 75 6e  tion 'remove-run
9510: 73 29 0a 09 20 20 20 20 20 20 20 28 6c 65 74 20  s)..       (let 
9520: 28 28 72 65 6d 74 65 73 74 73 20 28 6f 70 65 6e  ((remtests (open
9530: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65  -run-close db:ge
9540: 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20  t-tests-for-run 
9550: 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65  db (db:get-value
9560: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
9570: 65 61 64 65 72 20 22 69 64 22 29 20 23 66 20 23  eader "id") #f #
9580: 66 20 27 28 22 44 45 4c 45 54 45 44 22 29 20 27  f '("DELETED") '
9590: 28 22 6e 2f 61 22 29 20 6e 6f 74 2d 69 6e 3a 20  ("n/a") not-in: 
95a0: 23 74 29 29 29 0a 09 09 20 28 69 66 20 28 6e 75  #t)))... (if (nu
95b0: 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b  ll? remtests) ;;
95c0: 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72   no more tests r
95d0: 65 6d 61 69 6e 69 6e 67 0a 09 09 20 20 20 20 20  emaining...     
95e0: 28 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 20  (let* ((dparts  
95f0: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61  (string-split la
9600: 73 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09  sttpath "/"))...
9610: 09 20 20 20 20 28 72 75 6e 70 61 74 68 20 28 63  .    (runpath (c
9620: 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d  onc "/" (string-
9630: 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09  intersperse ....
9640: 09 09 09 28 74 61 6b 65 20 64 70 61 72 74 73 20  ...(take dparts 
9650: 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74  (- (length dpart
9660: 73 29 20 31 29 29 0a 09 09 09 09 09 09 22 2f 22  s) 1))......."/"
9670: 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 64  ))))...       (d
9680: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65  ebug:print 1 "Re
9690: 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75  moving run: " ru
96a0: 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74  nkey " " (db:get
96b0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
96c0: 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e   run header "run
96d0: 6e 61 6d 65 22 29 20 22 20 61 6e 64 20 72 65 6c  name") " and rel
96e0: 61 74 65 64 20 72 65 63 6f 72 64 22 29 0a 09 09  ated record")...
96f0: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
9700: 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65  -close db:delete
9710: 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a  -run db run-id).
9720: 09 09 20 20 20 20 20 20 20 3b 3b 20 54 68 69 73  ..       ;; This
9730: 20 69 73 20 61 20 70 72 65 74 74 79 20 67 6f 6f   is a pretty goo
9740: 64 20 70 6c 61 63 65 20 74 6f 20 70 75 72 67 65  d place to purge
9750: 20 6f 6c 64 20 44 45 4c 45 54 45 44 20 74 65 73   old DELETED tes
9760: 74 73 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65  ts...       (ope
9770: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64  n-run-close db:d
9780: 65 6c 65 74 65 2d 74 65 73 74 73 2d 66 6f 72 2d  elete-tests-for-
9790: 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09  run db run-id)..
97a0: 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75  .       (open-ru
97b0: 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74  n-close db:delet
97c0: 65 2d 6f 6c 64 2d 64 65 6c 65 74 65 64 2d 74 65  e-old-deleted-te
97d0: 73 74 2d 72 65 63 6f 72 64 73 20 64 62 29 0a 09  st-records db)..
97e0: 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75  .       (open-ru
97f0: 6e 2d 63 6c 6f 73 65 20 64 62 3a 73 65 74 2d 76  n-close db:set-v
9800: 61 72 20 64 62 20 22 44 45 4c 45 54 45 44 5f 54  ar db "DELETED_T
9810: 45 53 54 53 22 20 28 63 75 72 72 65 6e 74 2d 73  ESTS" (current-s
9820: 65 63 6f 6e 64 73 29 29 0a 09 09 20 20 20 20 20  econds))...     
9830: 20 20 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 67    ;; need to fig
9840: 75 72 65 20 6f 75 74 20 74 68 65 20 70 61 74 68  ure out the path
9850: 20 74 6f 20 74 68 65 20 72 75 6e 20 64 69 72 20   to the run dir 
9860: 61 6e 64 20 72 65 6d 6f 76 65 20 69 74 20 69 66  and remove it if
9870: 20 65 6d 70 74 79 0a 09 09 20 20 20 20 20 20 20   empty...       
9880: 3b 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f  ;;    (if (null?
9890: 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e   (glob (conc run
98a0: 70 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 20  path "/*")))... 
98b0: 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20        ;;        
98c0: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 20 20  (begin...       
98d0: 3b 3b 20 09 20 28 64 65 62 75 67 3a 70 72 69 6e  ;; . (debug:prin
98e0: 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75  t 1 "Removing ru
98f0: 6e 20 64 69 72 20 22 20 72 75 6e 70 61 74 68 29  n dir " runpath)
9900: 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28  ...       ;; . (
9910: 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d  system (conc "rm
9920: 64 69 72 20 2d 70 20 22 20 72 75 6e 70 61 74 68  dir -p " runpath
9930: 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 29 29  ))))...       ))
9940: 29 29 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75  ))).. )).     ru
9950: 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d  ns)))..;;=======
9960: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9970: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9980: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9990: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
99a0: 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f 72 20  ;; Routines for 
99b0: 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 72 75 6e  manipulating run
99c0: 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  s.;;============
99d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
99e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
99f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9a00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53  ==========..;; S
9a10: 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73 20  ince many calls 
9a20: 74 6f 20 61 20 72 75 6e 20 72 65 71 75 69 72 65  to a run require
9a30: 20 70 72 65 74 74 79 20 6d 75 63 68 20 74 68 65   pretty much the
9a40: 20 73 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b 20   same setup .;; 
9a50: 74 68 69 73 20 77 72 61 70 70 65 72 20 69 73 20  this wrapper is 
9a60: 75 73 65 64 20 74 6f 20 72 65 64 75 63 65 20 74  used to reduce t
9a70: 68 65 20 72 65 70 6c 69 63 61 74 69 6f 6e 20 6f  he replication o
9a80: 66 20 63 6f 64 65 0a 28 64 65 66 69 6e 65 20 28  f code.(define (
9a90: 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c  general-run-call
9aa0: 20 73 77 69 74 63 68 6e 61 6d 65 20 61 63 74 69   switchname acti
9ab0: 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a 20 20  on-desc proc).  
9ac0: 28 6c 65 74 20 28 28 72 75 6e 6e 61 6d 65 20 28  (let ((runname (
9ad0: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72  args:get-arg ":r
9ae0: 75 6e 6e 61 6d 65 22 29 29 0a 09 28 74 61 72 67  unname"))..(targ
9af0: 65 74 20 20 28 69 66 20 28 61 72 67 73 3a 67 65  et  (if (args:ge
9b00: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29  t-arg "-target")
9b10: 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 65  ...     (args:ge
9b20: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29  t-arg "-target")
9b30: 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 65  ...     (args:ge
9b40: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22  t-arg "-reqtarg"
9b50: 29 29 29 0a 09 28 74 68 31 20 20 20 20 20 23 66  )))..(th1     #f
9b60: 29 29 0a 20 20 20 20 28 63 6f 6e 64 0a 20 20 20  )).    (cond.   
9b70: 20 20 28 28 6e 6f 74 20 74 61 72 67 65 74 29 0a    ((not target).
9b80: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
9b90: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73  nt 0 "ERROR: Mis
9ba0: 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61  sing required pa
9bb0: 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77  rameter for " sw
9bc0: 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20  itchname ", you 
9bd0: 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65  must specify the
9be0: 20 74 61 72 67 65 74 20 77 69 74 68 20 2d 74 61   target with -ta
9bf0: 72 67 65 74 22 29 0a 20 20 20 20 20 20 28 65 78  rget").      (ex
9c00: 69 74 20 33 29 29 0a 20 20 20 20 20 28 28 6e 6f  it 3)).     ((no
9c10: 74 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 20  t runname).     
9c20: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
9c30: 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20  "ERROR: Missing 
9c40: 72 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 74  required paramet
9c50: 65 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e  er for " switchn
9c60: 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20  ame ", you must 
9c70: 73 70 65 63 69 66 79 20 74 68 65 20 72 75 6e 20  specify the run 
9c80: 6e 61 6d 65 20 77 69 74 68 20 3a 72 75 6e 6e 61  name with :runna
9c90: 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a 20 20 20  me runname").   
9ca0: 20 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 20     (exit 3)).   
9cb0: 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 28 6c    (else.      (l
9cc0: 65 74 20 28 28 64 62 20 20 20 23 66 29 0a 09 20  et ((db   #f).. 
9cd0: 20 20 20 28 6b 65 79 73 20 23 66 29 29 0a 09 28     (keys #f))..(
9ce0: 69 66 20 28 6e 6f 74 20 28 73 65 74 75 70 2d 66  if (not (setup-f
9cf0: 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 20 28 62  or-run))..    (b
9d00: 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64 65  egin ..      (de
9d10: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 46 61 69  bug:print 0 "Fai
9d20: 6c 65 64 20 74 6f 20 73 65 74 75 70 2c 20 65 78  led to setup, ex
9d30: 69 74 69 6e 67 22 29 0a 09 20 20 20 20 20 20 28  iting")..      (
9d40: 65 78 69 74 20 31 29 29 29 0a 09 28 69 66 20 28  exit 1)))..(if (
9d50: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73  args:get-arg "-s
9d60: 65 72 76 65 72 22 29 0a 09 20 20 20 20 28 6f 70  erver")..    (op
9d70: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 72  en-run-close ser
9d80: 76 65 72 3a 73 74 61 72 74 20 64 62 20 28 61 72  ver:start db (ar
9d90: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 72  gs:get-arg "-ser
9da0: 76 65 72 22 29 29 0a 20 09 20 20 20 20 28 69 66  ver")). .    (if
9db0: 20 28 6e 6f 74 20 28 6f 72 20 28 61 72 67 73 3a   (not (or (args:
9dc0: 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 61 6c 6c  get-arg "-runall
9dd0: 22 29 20 20 20 20 20 3b 3b 20 72 75 6e 61 6c 6c  ")     ;; runall
9de0: 20 61 6e 64 20 72 75 6e 74 65 73 74 73 20 61 72   and runtests ar
9df0: 65 20 61 6c 6c 6f 77 65 64 20 74 6f 20 62 65 20  e allowed to be 
9e00: 73 65 72 76 65 72 73 0a 20 09 09 09 20 28 61 72  servers. ... (ar
9e10: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e  gs:get-arg "-run
9e20: 74 65 73 74 73 22 29 29 29 0a 09 09 28 73 65 72  tests")))...(ser
9e30: 76 65 72 3a 63 6c 69 65 6e 74 2d 73 65 74 75 70  ver:client-setup
9e40: 29 29 29 0a 09 28 73 65 74 21 20 6b 65 79 73 20  )))..(set! keys 
9e50: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
9e60: 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29  db:get-keys db))
9e70: 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f 75 67 68  ..;; have enough
9e80: 20 74 6f 20 70 72 6f 63 65 73 73 20 2d 74 61 72   to process -tar
9e90: 67 65 74 20 6f 72 20 2d 72 65 71 74 61 72 67 20  get or -reqtarg 
9ea0: 68 65 72 65 0a 09 28 69 66 20 28 61 72 67 73 3a  here..(if (args:
9eb0: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
9ec0: 67 22 29 0a 09 20 20 20 20 28 6c 65 74 2a 20 28  g")..    (let* (
9ed0: 28 72 75 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e  (runconfigf (con
9ee0: 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72  c  *toppath* "/r
9ef0: 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67  unconfigs.config
9f00: 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56  ")) ;; DO NOT EV
9f10: 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09 09 20 20  ALUATE ALL ...  
9f20: 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 28 72 65   (runconfig  (re
9f30: 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e  ad-config runcon
9f40: 66 69 67 66 20 23 66 20 23 66 20 65 6e 76 69 72  figf #f #f envir
9f50: 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29 29 20 0a  on-patt: #f))) .
9f60: 09 20 20 20 20 20 20 28 69 66 20 28 68 61 73 68  .      (if (hash
9f70: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
9f80: 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20 28 61 72  lt runconfig (ar
9f90: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71  gs:get-arg "-req
9fa0: 74 61 72 67 22 29 20 23 66 29 0a 09 09 20 20 28  targ") #f)...  (
9fb0: 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d  keys:target-set-
9fc0: 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a  args keys (args:
9fd0: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
9fe0: 67 22 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73  g") args:arg-has
9ff0: 68 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09  h)...  (begin...
a000: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
a010: 20 30 20 22 45 52 52 4f 52 3a 20 5b 22 20 28 61   0 "ERROR: [" (a
a020: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65  rgs:get-arg "-re
a030: 71 74 61 72 67 22 29 20 22 5d 20 6e 6f 74 20 66  qtarg") "] not f
a040: 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e  ound in " runcon
a050: 66 69 67 66 29 0a 09 09 20 20 20 20 28 69 66 20  figf)...    (if 
a060: 64 62 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61  db (sqlite3:fina
a070: 6c 69 7a 65 21 20 64 62 29 29 0a 09 09 20 20 20  lize! db))...   
a080: 20 28 65 78 69 74 20 31 29 29 29 29 0a 09 20 20   (exit 1))))..  
a090: 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d    (if (args:get-
a0a0: 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09  arg "-target")..
a0b0: 09 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65  .(keys:target-se
a0c0: 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 67  t-args keys (arg
a0d0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67  s:get-arg "-targ
a0e0: 65 74 22 20 61 72 67 73 3a 61 72 67 2d 68 61 73  et" args:arg-has
a0f0: 68 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68  h) args:arg-hash
a100: 29 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 63  )))..(if (not (c
a110: 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29  ar *configinfo*)
a120: 29 0a 09 20 20 20 20 28 62 65 67 69 6e 0a 09 20  )..    (begin.. 
a130: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
a140: 74 20 30 20 22 45 52 52 4f 52 3a 20 41 74 74 65  t 0 "ERROR: Atte
a150: 6d 70 74 65 64 20 74 6f 20 22 20 61 63 74 69 6f  mpted to " actio
a160: 6e 2d 64 65 73 63 20 22 20 62 75 74 20 72 75 6e  n-desc " but run
a170: 20 61 72 65 61 20 63 6f 6e 66 69 67 20 66 69 6c   area config fil
a180: 65 20 6e 6f 74 20 66 6f 75 6e 64 22 29 0a 09 20  e not found").. 
a190: 20 20 20 20 20 28 65 78 69 74 20 31 29 29 0a 09       (exit 1))..
a1a0: 20 20 20 20 3b 3b 20 45 78 74 72 61 63 74 20 6f      ;; Extract o
a1b0: 75 74 20 73 74 75 66 66 20 6e 65 65 64 65 64 20  ut stuff needed 
a1c0: 69 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 20  in most or many 
a1d0: 63 61 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 68 65  calls..    ;; he
a1e0: 72 65 20 74 68 65 6e 20 63 61 6c 6c 20 70 72 6f  re then call pro
a1f0: 63 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 6b  c..    (let* ((k
a200: 65 79 6e 61 6d 65 73 20 20 20 28 6d 61 70 20 6b  eynames   (map k
a210: 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65  ey:get-fieldname
a220: 20 6b 65 79 73 29 29 0a 09 09 20 20 20 28 6b 65   keys))...   (ke
a230: 79 76 61 6c 6c 73 74 20 20 28 6b 65 79 73 2d 3e  yvallst  (keys->
a240: 76 61 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 29  vallist keys #t)
a250: 29 29 0a 09 20 20 20 20 20 20 28 70 72 6f 63 20  ))..      (proc 
a260: 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 6b  target runname k
a270: 65 79 73 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79  eys keynames key
a280: 76 61 6c 6c 73 74 29 29 29 0a 09 28 69 66 20 74  vallst)))..(if t
a290: 68 31 20 28 74 68 72 65 61 64 2d 6a 6f 69 6e 21  h1 (thread-join!
a2a0: 20 74 68 31 29 29 0a 09 28 69 66 20 64 62 20 28   th1))..(if db (
a2b0: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65  sqlite3:finalize
a2c0: 21 20 64 62 29 29 0a 09 28 73 65 74 21 20 2a 64  ! db))..(set! *d
a2d0: 69 64 73 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29  idsomething* #t)
a2e0: 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d  )))))..;;=======
a2f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a300: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a310: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a320: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
a330: 3b 3b 20 4c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 72  ;; Lock/unlock r
a340: 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  uns.;;==========
a350: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a360: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a370: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a380: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64  ============..(d
a390: 65 66 69 6e 65 20 28 72 75 6e 73 3a 68 61 6e 64  efine (runs:hand
a3a0: 6c 65 2d 6c 6f 63 6b 69 6e 67 20 74 61 72 67 65  le-locking targe
a3b0: 74 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 20 6c  t keys runname l
a3c0: 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29  ock unlock user)
a3d0: 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20  .  (let* ((db   
a3e0: 20 20 20 20 23 66 29 0a 09 20 28 72 75 6e 64 61      #f).. (runda
a3f0: 74 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c  t   (open-run-cl
a400: 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e  ose runs:get-run
a410: 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79  s-by-patt db key
a420: 73 20 72 75 6e 6e 61 6d 65 29 29 0a 09 20 28 68  s runname)).. (h
a430: 65 61 64 65 72 20 20 20 28 76 65 63 74 6f 72 2d  eader   (vector-
a440: 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09  ref rundat 0))..
a450: 20 28 72 75 6e 73 20 20 20 20 20 28 76 65 63 74   (runs     (vect
a460: 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29  or-ref rundat 1)
a470: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  )).    (for-each
a480: 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 09   (lambda (run)..
a490: 09 28 6c 65 74 20 28 28 72 75 6e 2d 69 64 20 28  .(let ((run-id (
a4a0: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d  db:get-value-by-
a4b0: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65  header run heade
a4c0: 72 20 22 69 64 22 29 29 29 0a 09 09 20 20 28 69  r "id")))...  (i
a4d0: 66 20 28 6f 72 20 6c 6f 63 6b 0a 09 09 09 20 20  f (or lock....  
a4e0: 28 61 6e 64 20 75 6e 6c 6f 63 6b 0a 09 09 09 20  (and unlock.... 
a4f0: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09        (begin....
a500: 09 20 28 70 72 69 6e 74 20 22 44 6f 20 79 6f 75  . (print "Do you
a510: 20 72 65 61 6c 6c 79 20 77 69 73 68 20 74 6f 20   really wish to 
a520: 75 6e 6c 6f 63 6b 20 72 75 6e 20 22 20 72 75 6e  unlock run " run
a530: 2d 69 64 20 22 3f 5c 6e 20 20 20 79 2f 6e 3a 20  -id "?\n   y/n: 
a540: 22 29 0a 09 09 09 09 20 28 65 71 75 61 6c 3f 20  ")..... (equal? 
a550: 22 79 22 20 28 72 65 61 64 2d 6c 69 6e 65 29 29  "y" (read-line))
a560: 29 29 29 0a 09 09 20 20 20 20 20 20 28 6f 70 65  )))...      (ope
a570: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 6c  n-run-close db:l
a580: 6f 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 75 6e 20 64  ock/unlock-run d
a590: 62 20 72 75 6e 2d 69 64 20 6c 6f 63 6b 20 75 6e  b run-id lock un
a5a0: 6c 6f 63 6b 20 75 73 65 72 29 0a 09 09 20 20 20  lock user)...   
a5b0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
a5c0: 30 20 22 49 4e 46 4f 3a 20 53 6b 69 70 70 69 6e  0 "INFO: Skippin
a5d0: 67 20 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e  g lock/unlock on
a5e0: 20 22 20 72 75 6e 2d 69 64 29 29 29 29 0a 09 20   " run-id)))).. 
a5f0: 20 20 20 20 20 72 75 6e 73 29 29 29 0a 3b 3b 3d       runs))).;;=
a600: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a620: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a630: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a640: 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20  =====.;; Rollup 
a650: 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d  runs.;;=========
a660: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a670: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a680: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a690: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b  =============..;
a6a0: 3b 20 55 70 64 61 74 65 20 74 68 65 20 74 65 73  ; Update the tes
a6b0: 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 66 6f 72  t_meta table for
a6c0: 20 74 68 69 73 20 74 65 73 74 0a 28 64 65 66 69   this test.(defi
a6d0: 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d  ne (runs:update-
a6e0: 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73  test_meta db tes
a6f0: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66  t-name test-conf
a700: 29 0a 20 20 28 6c 65 74 20 28 28 63 75 72 72 72  ).  (let ((currr
a710: 65 63 6f 72 64 20 28 6f 70 65 6e 2d 72 75 6e 2d  ecord (open-run-
a720: 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d 65 74  close db:testmet
a730: 61 2d 67 65 74 2d 72 65 63 6f 72 64 20 64 62 20  a-get-record db 
a740: 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20  test-name))).   
a750: 20 28 69 66 20 28 6e 6f 74 20 63 75 72 72 72 65   (if (not currre
a760: 63 6f 72 64 29 0a 09 28 62 65 67 69 6e 0a 09 20  cord)..(begin.. 
a770: 20 28 73 65 74 21 20 63 75 72 72 72 65 63 6f 72   (set! currrecor
a780: 64 20 28 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31  d (make-vector 1
a790: 30 20 23 66 29 29 0a 09 20 20 28 6f 70 65 6e 2d  0 #f))..  (open-
a7a0: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73  run-close db:tes
a7b0: 74 6d 65 74 61 2d 61 64 64 2d 72 65 63 6f 72 64  tmeta-add-record
a7c0: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29   db test-name)))
a7d0: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a  .    (for-each .
a7e0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65       (lambda (ke
a7f0: 79 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20  y).       (let* 
a800: 28 28 69 64 78 20 28 63 61 64 72 20 6b 65 79 29  ((idx (cadr key)
a810: 29 0a 09 20 20 20 20 20 20 28 66 6c 64 20 28 63  )..      (fld (c
a820: 61 72 20 20 6b 65 79 29 29 0a 09 20 20 20 20 20  ar  key))..     
a830: 20 28 76 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f   (val (config-lo
a840: 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22  okup test-conf "
a850: 74 65 73 74 5f 6d 65 74 61 22 20 66 6c 64 29 29  test_meta" fld))
a860: 29 0a 09 20 3b 3b 20 28 64 65 62 75 67 3a 70 72  ).. ;; (debug:pr
a870: 69 6e 74 20 35 20 22 69 64 78 3a 20 22 20 69 64  int 5 "idx: " id
a880: 78 20 22 20 66 6c 64 3a 20 22 20 66 6c 64 20 22  x " fld: " fld "
a890: 20 76 61 6c 3a 20 22 20 76 61 6c 29 0a 09 20 28   val: " val).. (
a8a0: 69 66 20 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74  if (and val (not
a8b0: 20 28 65 71 75 61 6c 3f 20 28 76 65 63 74 6f 72   (equal? (vector
a8c0: 2d 72 65 66 20 63 75 72 72 72 65 63 6f 72 64 20  -ref currrecord 
a8d0: 69 64 78 29 20 76 61 6c 29 29 29 0a 09 20 20 20  idx) val)))..   
a8e0: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20    (begin..      
a8f0: 20 28 70 72 69 6e 74 20 22 55 70 64 61 74 69 6e   (print "Updatin
a900: 67 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20  g " test-name " 
a910: 22 20 66 6c 64 20 22 20 74 6f 20 22 20 76 61 6c  " fld " to " val
a920: 29 0a 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d  )..       (open-
a930: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73  run-close db:tes
a940: 74 6d 65 74 61 2d 75 70 64 61 74 65 2d 66 69 65  tmeta-update-fie
a950: 6c 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20  ld db test-name 
a960: 66 6c 64 20 76 61 6c 29 29 29 29 29 0a 20 20 20  fld val))))).   
a970: 20 20 27 28 28 22 61 75 74 68 6f 72 22 20 32 29    '(("author" 2)
a980: 28 22 6f 77 6e 65 72 22 20 33 29 28 22 64 65 73  ("owner" 3)("des
a990: 63 72 69 70 74 69 6f 6e 22 20 34 29 28 22 72 65  cription" 4)("re
a9a0: 76 69 65 77 65 64 22 20 35 29 28 22 74 61 67 73  viewed" 5)("tags
a9b0: 22 20 39 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64  " 9)))))..;; Upd
a9c0: 61 74 65 20 74 65 73 74 5f 6d 65 74 61 20 66 6f  ate test_meta fo
a9d0: 72 20 61 6c 6c 20 74 65 73 74 73 0a 28 64 65 66  r all tests.(def
a9e0: 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65  ine (runs:update
a9f0: 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64  -all-test_meta d
aa00: 62 29 0a 20 20 28 6c 65 74 20 28 28 74 65 73 74  b).  (let ((test
aa10: 2d 6e 61 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d  -names (get-all-
aa20: 6c 65 67 61 6c 2d 74 65 73 74 73 29 29 29 0a 20  legal-tests))). 
aa30: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20     (for-each .  
aa40: 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74     (lambda (test
aa50: 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 28 6c  -name).       (l
aa60: 65 74 2a 20 28 28 74 65 73 74 2d 70 61 74 68 20  et* ((test-path 
aa70: 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74     (conc *toppat
aa80: 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73  h* "/tests/" tes
aa90: 74 2d 6e 61 6d 65 29 29 0a 09 20 20 20 20 20 20  t-name))..      
aaa0: 28 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 28 63  (test-configf (c
aab0: 6f 6e 63 20 74 65 73 74 2d 70 61 74 68 20 22 2f  onc test-path "/
aac0: 74 65 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 20  testconfig")).. 
aad0: 20 20 20 20 20 28 74 65 73 74 65 78 69 73 74 73       (testexists
aae0: 20 20 20 28 61 6e 64 20 28 66 69 6c 65 2d 65 78     (and (file-ex
aaf0: 69 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69  ists? test-confi
ab00: 67 66 29 28 66 69 6c 65 2d 72 65 61 64 2d 61 63  gf)(file-read-ac
ab10: 63 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69  cess? test-confi
ab20: 67 66 29 29 29 0a 09 20 20 20 20 20 20 3b 3b 20  gf)))..      ;; 
ab30: 72 65 61 64 20 63 6f 6e 66 69 67 73 20 77 69 74  read configs wit
ab40: 68 20 74 72 69 63 6b 73 20 74 75 72 6e 65 64 20  h tricks turned 
ab50: 6f 66 66 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73  off (i.e. no sys
ab60: 74 65 6d 29 0a 09 20 20 20 20 20 20 28 74 65 73  tem)..      (tes
ab70: 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 20 74 65  t-conf    (if te
ab80: 73 74 65 78 69 73 74 73 20 28 72 65 61 64 2d 63  stexists (read-c
ab90: 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e 66 69  onfig test-confi
aba0: 67 66 20 23 66 20 23 66 29 28 6d 61 6b 65 2d 68  gf #f #f)(make-h
abb0: 61 73 68 2d 74 61 62 6c 65 29 29 29 29 0a 09 20  ash-table)))).. 
abc0: 3b 3b 20 75 73 65 20 74 68 65 20 6f 70 65 6e 2d  ;; use the open-
abd0: 72 75 6e 2d 63 6c 6f 73 65 20 69 6e 73 74 65 61  run-close instea
abe0: 64 20 6f 66 20 70 61 73 73 69 6e 67 20 69 6e 20  d of passing in 
abf0: 64 62 0a 09 20 28 72 75 6e 73 3a 75 70 64 61 74  db.. (runs:updat
ac00: 65 2d 74 65 73 74 5f 6d 65 74 61 20 23 66 20 74  e-test_meta #f t
ac10: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f  est-name test-co
ac20: 6e 66 29 29 29 0a 20 20 20 20 20 74 65 73 74 2d  nf))).     test-
ac30: 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 68 69  names)))..;; Thi
ac40: 73 20 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79  s could probably
ac50: 20 62 65 20 72 65 66 61 63 74 6f 72 65 64 20 69   be refactored i
ac60: 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 20  nto one complex 
ac70: 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66 69 6e  query ....(defin
ac80: 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72  e (runs:rollup-r
ac90: 75 6e 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73  un keys keyvalls
aca0: 74 20 72 75 6e 6e 61 6d 65 20 75 73 65 72 29 20  t runname user) 
acb0: 3b 3b 20 77 61 73 20 74 61 72 67 65 74 2c 20 6e  ;; was target, n
acc0: 6f 77 20 6b 65 79 76 61 6c 6c 73 74 0a 20 20 28  ow keyvallst.  (
acd0: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 72  debug:print 4 "r
ace0: 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20  uns:rollup-run, 
acf0: 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22 20 6b  keys: " keys " k
ad00: 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76  eyvallst: " keyv
ad10: 61 6c 6c 73 74 20 22 20 3a 72 75 6e 6e 61 6d 65  allst " :runname
ad20: 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 75 73 65   " runname " use
ad30: 72 3a 20 22 20 75 73 65 72 29 0a 20 20 28 6c 65  r: " user).  (le
ad40: 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 20 20  t* ((db         
ad50: 20 20 20 20 20 23 66 29 20 3b 3b 20 28 6b 65 79       #f) ;; (key
ad60: 76 61 6c 6c 6c 73 74 20 20 20 20 20 20 28 6b 65  valllst      (ke
ad70: 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76 61  ys:target->keyva
ad80: 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29 29 0a  l keys target)).
ad90: 09 20 28 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20  . (new-run-id   
ada0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
adb0: 73 65 20 72 75 6e 73 3a 72 65 67 69 73 74 65 72  se runs:register
adc0: 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79  -run db keys key
add0: 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22  vallst runname "
ade0: 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29  new" "n/a" user)
adf0: 29 0a 09 20 28 70 72 65 76 2d 74 65 73 74 73 20  ).. (prev-tests 
ae00: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
ae10: 6c 6f 73 65 20 74 65 73 74 3a 67 65 74 2d 6d 61  lose test:get-ma
ae20: 74 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d  tching-previous-
ae30: 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73  test-run-records
ae40: 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22   db new-run-id "
ae50: 25 22 20 22 25 22 29 29 0a 09 20 28 63 75 72 72  %" "%")).. (curr
ae60: 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f 70 65  -tests      (ope
ae70: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67  n-run-close db:g
ae80: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e  et-tests-for-run
ae90: 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22   db new-run-id "
aea0: 25 22 20 22 25 22 20 27 28 29 20 27 28 29 29 29  %" "%" '() '()))
aeb0: 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 2d 68  .. (curr-tests-h
aec0: 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74  ash (make-hash-t
aed0: 61 62 6c 65 29 29 29 0a 20 20 20 20 28 6f 70 65  able))).    (ope
aee0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 75  n-run-close db:u
aef0: 70 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e 74 5f  pdate-run-event_
af00: 74 69 6d 65 20 64 62 20 6e 65 77 2d 72 75 6e 2d  time db new-run-
af10: 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64 65 78  id).    ;; index
af20: 20 74 68 65 20 61 6c 72 65 61 64 79 20 73 61 76   the already sav
af30: 65 64 20 74 65 73 74 73 20 62 79 20 74 65 73 74  ed tests by test
af40: 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d 64 61 74  name and itemdat
af50: 20 69 6e 20 63 75 72 72 2d 74 65 73 74 73 2d 68   in curr-tests-h
af60: 61 73 68 0a 20 20 20 20 28 66 6f 72 2d 65 61 63  ash.    (for-eac
af70: 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28  h.     (lambda (
af80: 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20  testdat).       
af90: 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65  (let* ((testname
afa0: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74    (db:test-get-t
afb0: 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29  estname testdat)
afc0: 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70  )..      (item-p
afd0: 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ath (db:test-get
afe0: 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64  -item-path testd
aff0: 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c  at))..      (ful
b000: 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73  l-name (conc tes
b010: 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70  tname "/" item-p
b020: 61 74 68 29 29 29 0a 09 20 28 68 61 73 68 2d 74  ath))).. (hash-t
b030: 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74  able-set! curr-t
b040: 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e  ests-hash full-n
b050: 61 6d 65 20 74 65 73 74 64 61 74 29 29 29 0a 20  ame testdat))). 
b060: 20 20 20 20 63 75 72 72 2d 74 65 73 74 73 29 0a      curr-tests).
b070: 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e      ;; NOPE: Non
b080: 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f 61 63  -optimal approac
b090: 68 2e 20 54 72 79 20 74 68 69 73 20 69 6e 73 74  h. Try this inst
b0a0: 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20 31 2e  ead..    ;;   1.
b0b0: 20 74 65 73 74 73 20 61 72 65 20 72 65 63 65 69   tests are recei
b0c0: 76 65 64 20 69 6e 20 61 20 6c 69 73 74 2c 20 6d  ved in a list, m
b0d0: 6f 73 74 20 72 65 63 65 6e 74 20 66 69 72 73 74  ost recent first
b0e0: 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 72 65 70  .    ;;   2. rep
b0f0: 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c 75 70 20  lace the rollup 
b100: 74 65 73 74 20 77 69 74 68 20 74 68 65 20 6e 65  test with the ne
b110: 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20 20 28  w *always*.    (
b120: 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28  for-each .     (
b130: 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29  lambda (testdat)
b140: 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28  .       (let* ((
b150: 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65  testname  (db:te
b160: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  st-get-testname 
b170: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20  testdat))..     
b180: 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a   (item-path (db:
b190: 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61  test-get-item-pa
b1a0: 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20  th testdat))..  
b1b0: 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28      (full-name (
b1c0: 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f  conc testname "/
b1d0: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20  " item-path)).. 
b1e0: 20 20 20 20 20 28 70 72 65 76 2d 74 65 73 74 2d       (prev-test-
b1f0: 64 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  dat (hash-table-
b200: 72 65 66 2f 64 65 66 61 75 6c 74 20 63 75 72 72  ref/default curr
b210: 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c  -tests-hash full
b220: 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 20 20 20  -name #f))..    
b230: 20 20 28 74 65 73 74 2d 73 74 65 70 73 20 20 20    (test-steps   
b240: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
b250: 73 65 20 64 62 3a 67 65 74 2d 73 74 65 70 73 2d  se db:get-steps-
b260: 66 6f 72 2d 74 65 73 74 20 64 62 20 28 64 62 3a  for-test db (db:
b270: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
b280: 64 61 74 29 29 29 0a 09 20 20 20 20 20 20 28 6e  dat)))..      (n
b290: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23  ew-test-record #
b2a0: 66 29 29 0a 09 20 3b 3b 20 72 65 70 6c 61 63 65  f)).. ;; replace
b2b0: 20 74 68 65 73 65 20 77 69 74 68 20 69 6e 73 65   these with inse
b2c0: 72 74 20 2e 2e 2e 20 73 65 6c 65 63 74 0a 09 20  rt ... select.. 
b2d0: 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65  (apply sqlite3:e
b2e0: 78 65 63 75 74 65 20 0a 09 09 64 62 20 0a 09 09  xecute ...db ...
b2f0: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52  (conc "INSERT OR
b300: 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65   REPLACE INTO te
b310: 73 74 73 20 28 72 75 6e 5f 69 64 2c 74 65 73 74  sts (run_id,test
b320: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75  name,state,statu
b330: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 68 6f 73  s,event_time,hos
b340: 74 2c 63 70 75 6c 6f 61 64 2c 64 69 73 6b 66 72  t,cpuload,diskfr
b350: 65 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 69 72 2c  ee,uname,rundir,
b360: 69 74 65 6d 5f 70 61 74 68 2c 72 75 6e 5f 64 75  item_path,run_du
b370: 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67  ration,final_log
b380: 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20  f,comment) "... 
b390: 20 20 20 20 20 22 56 41 4c 55 45 53 20 28 3f 2c       "VALUES (?,
b3a0: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c  ?,?,?,?,?,?,?,?,
b3b0: 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09  ?,?,?,?,?);")...
b3c0: 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 64 64 72  new-run-id (cddr
b3d0: 20 28 76 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74   (vector->list t
b3e0: 65 73 74 64 61 74 29 29 29 0a 09 20 28 73 65 74  estdat))).. (set
b3f0: 21 20 6e 65 77 2d 74 65 73 74 64 61 74 20 28 63  ! new-testdat (c
b400: 61 72 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  ar (open-run-clo
b410: 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d  se db:get-tests-
b420: 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72  for-run db new-r
b430: 75 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65 20 69  un-id testname i
b440: 74 65 6d 2d 70 61 74 68 20 27 28 29 20 27 28 29  tem-path '() '()
b450: 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c  ))).. (hash-tabl
b460: 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73 74  e-set! curr-test
b470: 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65  s-hash full-name
b480: 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 3b 3b   new-testdat) ;;
b490: 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65 20 63   this could be c
b4a0: 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 63 68 20  onfusing, which 
b4b0: 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 20 67 6f  record should go
b4c0: 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 70   into the lookup
b4d0: 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f 77   table?.. ;; Now
b4e0: 20 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 74   duplicate the t
b4f0: 65 73 74 20 73 74 65 70 73 0a 09 20 28 64 65 62  est steps.. (deb
b500: 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79  ug:print 4 "Copy
b510: 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74  ing records in t
b520: 65 73 74 5f 73 74 65 70 73 20 66 72 6f 6d 20 74  est_steps from t
b530: 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73  est_id=" (db:tes
b540: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74  t-get-id testdat
b550: 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73  ) " to " (db:tes
b560: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73  t-get-id new-tes
b570: 74 64 61 74 29 29 0a 09 20 28 6f 70 65 6e 2d 72  tdat)).. (open-r
b580: 75 6e 2d 63 6c 6f 73 65 20 0a 09 20 20 28 6c 61  un-close ..  (la
b590: 6d 62 64 61 20 28 29 0a 09 20 20 20 20 28 73 71  mbda ()..    (sq
b5a0: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09  lite3:execute ..
b5b0: 20 20 20 20 20 64 62 20 0a 09 20 20 20 20 20 28       db ..     (
b5c0: 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20  conc "INSERT OR 
b5d0: 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73  REPLACE INTO tes
b5e0: 74 5f 73 74 65 70 73 20 28 74 65 73 74 5f 69 64  t_steps (test_id
b5f0: 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c  ,stepname,state,
b600: 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d  status,event_tim
b610: 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20  e,comment) "... 
b620: 20 20 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a    "SELECT " (db:
b630: 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d  test-get-id new-
b640: 74 65 73 74 64 61 74 29 20 22 2c 73 74 65 70 6e  testdat) ",stepn
b650: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73  ame,state,status
b660: 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d  ,event_time,comm
b670: 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 73 74  ent FROM test_st
b680: 65 70 73 20 57 48 45 52 45 20 74 65 73 74 5f 69  eps WHERE test_i
b690: 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28 64 62  d=?;")..     (db
b6a0: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
b6b0: 74 64 61 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e  tdat))..    ;; N
b6c0: 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65  ow duplicate the
b6d0: 20 74 65 73 74 20 64 61 74 61 0a 09 20 20 20 20   test data..    
b6e0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22  (debug:print 4 "
b6f0: 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20  Copying records 
b700: 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66 72 6f  in test_data fro
b710: 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a  m test_id=" (db:
b720: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
b730: 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a  dat) " to " (db:
b740: 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d  test-get-id new-
b750: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 28  testdat))..    (
b760: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20  sqlite3:execute 
b770: 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20 20 20  ..     db ..    
b780: 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f   (conc "INSERT O
b790: 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74  R REPLACE INTO t
b7a0: 65 73 74 5f 64 61 74 61 20 28 74 65 73 74 5f 69  est_data (test_i
b7b0: 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61  d,category,varia
b7c0: 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74  ble,value,expect
b7d0: 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d  ed,tol,units,com
b7e0: 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22 53 45  ment) "...   "SE
b7f0: 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d  LECT " (db:test-
b800: 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64  get-id new-testd
b810: 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79 2c 76  at) ",category,v
b820: 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78  ariable,value,ex
b830: 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73  pected,tol,units
b840: 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65  ,comment FROM te
b850: 73 74 5f 64 61 74 61 20 57 48 45 52 45 20 74 65  st_data WHERE te
b860: 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20  st_id=?;")..    
b870: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
b880: 20 74 65 73 74 64 61 74 29 29 29 29 0a 09 20 29   testdat)))).. )
b890: 29 0a 20 20 20 20 20 70 72 65 76 2d 74 65 73 74  ).     prev-test
b8a0: 73 29 29 29 0a 09 20 0a 20 20 20 20 20 0a        s))).. .     .