Megatest

Hex Artifact Content
Login

Artifact e456124e575be9942909f691ed35712fe05498c5:


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 0a 09 20 28 71 72 79 2d 73 74 72 20 20 23 66  ).. (qry-str  #f
0590: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  )).    (for-each
05a0: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 76 61 6c   (lambda (keyval
05b0: 29 0a 09 09 28 6c 65 74 2a 20 28 28 6b 65 79 20  )...(let* ((key 
05c0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b     (vector-ref k
05d0: 65 79 76 61 6c 20 30 29 29 0a 09 09 20 20 20 20  eyval 0))...    
05e0: 20 20 20 28 66 75 6c 6b 65 79 20 28 63 6f 6e 63     (fulkey (conc
05f0: 20 22 3a 22 20 6b 65 79 29 29 0a 09 09 20 20 20   ":" key))...   
0600: 20 20 20 20 28 70 61 74 74 20 20 20 28 61 72 67      (patt   (arg
0610: 73 3a 67 65 74 2d 61 72 67 20 66 75 6c 6b 65 79  s:get-arg fulkey
0620: 29 29 0a 09 09 20 20 20 20 20 20 20 28 77 69 6c  ))...       (wil
0630: 64 74 79 70 65 20 28 69 66 20 28 73 75 62 73 74  dtype (if (subst
0640: 72 69 6e 67 2d 69 6e 64 65 78 20 22 25 22 20 70  ring-index "%" p
0650: 61 74 74 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f  att) "like" "glo
0660: 62 22 29 29 29 0a 09 09 20 20 28 69 66 20 70 61  b")))...  (if pa
0670: 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 74 21  tt...      (set!
0680: 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e 63 20   key-patt (conc 
0690: 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 20 22  key-patt " AND "
06a0: 20 6b 65 79 20 22 20 22 20 77 69 6c 64 74 79 70   key " " wildtyp
06b0: 65 20 22 20 27 22 20 70 61 74 74 20 22 27 22 29  e " '" patt "'")
06c0: 29 0a 09 09 20 20 20 20 20 20 28 62 65 67 69 6e  )...      (begin
06d0: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ....(debug:print
06e0: 20 30 20 22 45 52 52 4f 52 3a 20 73 65 61 72 63   0 "ERROR: searc
06f0: 68 69 6e 67 20 66 6f 72 20 72 75 6e 73 20 77 69  hing for runs wi
0700: 74 68 20 6e 6f 20 70 61 74 74 65 72 6e 20 73 65  th no pattern se
0710: 74 20 66 6f 72 20 22 20 66 75 6c 6b 65 79 29 0a  t for " fulkey).
0720: 09 09 09 28 65 78 69 74 20 36 29 29 29 29 29 0a  ...(exit 6))))).
0730: 09 20 20 20 20 20 20 6b 65 79 73 29 0a 20 20 20  .      keys).   
0740: 20 28 73 65 74 21 20 71 72 79 2d 73 74 72 20 28   (set! qry-str (
0750: 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 20 6b  conc "SELECT " k
0760: 65 79 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e  eystr " FROM run
0770: 73 20 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 20  s WHERE runname 
0780: 22 20 72 75 6e 77 69 6c 64 74 79 70 65 20 22 20  " runwildtype " 
0790: 3f 20 22 20 6b 65 79 2d 70 61 74 74 20 22 3b 22  ? " key-patt ";"
07a0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  )).    (debug:pr
07b0: 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 72 75 6e  int 4 "INFO: run
07c0: 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61  s:get-runs-by-pa
07d0: 74 74 20 71 72 79 3d 22 20 71 72 79 2d 73 74 72  tt qry=" qry-str
07e0: 20 22 20 22 20 72 75 6e 6e 61 6d 65 70 61 74 74   " " runnamepatt
07f0: 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66  ).    (sqlite3:f
0800: 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 20 20 20  or-each-row .   
0810: 20 20 28 6c 61 6d 62 64 61 20 28 61 20 2e 20 72    (lambda (a . r
0820: 29 0a 20 20 20 20 20 20 20 28 73 65 74 21 20 72  ).       (set! r
0830: 65 73 20 28 63 6f 6e 73 20 28 6c 69 73 74 2d 3e  es (cons (list->
0840: 76 65 63 74 6f 72 20 28 63 6f 6e 73 20 61 20 72  vector (cons a r
0850: 29 29 20 72 65 73 29 29 29 0a 20 20 20 20 20 64  )) res))).     d
0860: 62 20 0a 20 20 20 20 20 71 72 79 2d 73 74 72 0a  b .     qry-str.
0870: 20 20 20 20 20 72 75 6e 6e 61 6d 65 70 61 74 74       runnamepatt
0880: 29 0a 20 20 20 20 28 76 65 63 74 6f 72 20 68 65  ).    (vector he
0890: 61 64 65 72 20 72 65 73 29 29 29 0a 0a 28 64 65  ader res)))..(de
08a0: 66 69 6e 65 20 28 72 75 6e 73 3a 74 65 73 74 2d  fine (runs:test-
08b0: 67 65 74 2d 66 75 6c 6c 2d 70 61 74 68 20 74 65  get-full-path te
08c0: 73 74 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 65  st).  (let* ((te
08d0: 73 74 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d  stname (db:test-
08e0: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74  get-testname   t
08f0: 65 73 74 29 29 0a 09 20 28 69 74 65 6d 70 61 74  est)).. (itempat
0900: 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  h (db:test-get-i
0910: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 29  tem-path test)))
0920: 0a 20 20 20 20 28 63 6f 6e 63 20 74 65 73 74 6e  .    (conc testn
0930: 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20  ame (if (equal? 
0940: 69 74 65 6d 70 61 74 68 20 22 22 29 20 22 22 20  itempath "") "" 
0950: 28 63 6f 6e 63 20 22 28 22 20 69 74 65 6d 70 61  (conc "(" itempa
0960: 74 68 20 22 29 22 29 29 29 29 29 0a 0a 3b 3b 20  th ")")))))..;; 
0970: 41 77 66 75 6c 2e 20 50 6c 65 61 73 65 20 46 49  Awful. Please FI
0980: 58 4d 45 0a 28 64 65 66 69 6e 65 20 2a 65 6e 76  XME.(define *env
0990: 2d 76 61 72 73 2d 62 79 2d 72 75 6e 2d 69 64 2a  -vars-by-run-id*
09a0: 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c   (make-hash-tabl
09b0: 65 29 29 0a 28 64 65 66 69 6e 65 20 2a 63 75 72  e)).(define *cur
09c0: 72 65 6e 74 2d 72 75 6e 2d 6e 61 6d 65 2a 20 20  rent-run-name*  
09d0: 20 23 66 29 0a 0a 28 64 65 66 69 6e 65 20 28 73   #f)..(define (s
09e0: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d  et-megatest-env-
09f0: 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 0a  vars db run-id).
0a00: 20 20 28 6c 65 74 20 28 28 6b 65 79 73 20 28 64    (let ((keys (d
0a10: 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a  b:get-keys db)).
0a20: 09 28 76 61 6c 73 20 28 68 61 73 68 2d 74 61 62  .(vals (hash-tab
0a30: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a  le-ref/default *
0a40: 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e 2d  env-vars-by-run-
0a50: 69 64 2a 20 72 75 6e 2d 69 64 20 23 66 29 29 29  id* run-id #f)))
0a60: 0a 20 20 20 20 3b 3b 20 67 65 74 20 74 68 65 20  .    ;; get the 
0a70: 69 6e 66 6f 20 66 72 6f 6d 20 74 68 65 20 64 62  info from the db
0a80: 20 61 6e 64 20 70 75 74 20 69 74 20 69 6e 20 74   and put it in t
0a90: 68 65 20 63 61 63 68 65 0a 20 20 20 20 28 69 66  he cache.    (if
0aa0: 20 28 6e 6f 74 20 76 61 6c 73 29 0a 09 28 6c 65   (not vals)..(le
0ab0: 74 20 28 28 68 74 20 28 6d 61 6b 65 2d 68 61 73  t ((ht (make-has
0ac0: 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 20 28 68  h-table)))..  (h
0ad0: 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a  ash-table-set! *
0ae0: 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e 2d  env-vars-by-run-
0af0: 69 64 2a 20 72 75 6e 2d 69 64 20 68 74 29 0a 09  id* run-id ht)..
0b00: 20 20 28 73 65 74 21 20 76 61 6c 73 20 68 74 29    (set! vals ht)
0b10: 0a 09 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20  ..  (for-each.. 
0b20: 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a    (lambda (key).
0b30: 09 20 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66  .     (sqlite3:f
0b40: 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 09 20 20 20  or-each-row..   
0b50: 20 20 20 28 6c 61 6d 62 64 61 20 28 76 61 6c 29     (lambda (val)
0b60: 0a 09 09 28 68 61 73 68 2d 74 61 62 6c 65 2d 73  ...(hash-table-s
0b70: 65 74 21 20 76 61 6c 73 20 6b 65 79 20 76 61 6c  et! vals key val
0b80: 29 29 0a 09 20 20 20 20 20 20 64 62 20 0a 09 20  ))..      db .. 
0b90: 20 20 20 20 20 28 63 6f 6e 63 20 22 53 45 4c 45       (conc "SELE
0ba0: 43 54 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69  CT " (key:get-fi
0bb0: 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 46  eldname key) " F
0bc0: 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 69  ROM runs WHERE i
0bd0: 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 20 72 75  d=?;")..      ru
0be0: 6e 2d 69 64 29 29 0a 09 20 20 20 6b 65 79 73 29  n-id))..   keys)
0bf0: 29 29 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20 74  )).    ;; from t
0c00: 68 65 20 63 61 63 68 65 64 20 64 61 74 61 20 73  he cached data s
0c10: 65 74 20 74 68 65 20 76 61 72 73 0a 20 20 20 20  et the vars.    
0c20: 28 68 61 73 68 2d 74 61 62 6c 65 2d 66 6f 72 2d  (hash-table-for-
0c30: 65 61 63 68 0a 20 20 20 20 20 76 61 6c 73 0a 20  each.     vals. 
0c40: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79      (lambda (key
0c50: 20 76 61 6c 29 0a 20 20 20 20 20 20 20 28 64 65   val).       (de
0c60: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74  bug:print 2 "set
0c70: 65 6e 76 20 22 20 28 6b 65 79 3a 67 65 74 2d 66  env " (key:get-f
0c80: 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20  ieldname key) " 
0c90: 22 20 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73  " val).       (s
0ca0: 65 74 65 6e 76 20 28 6b 65 79 3a 67 65 74 2d 66  etenv (key:get-f
0cb0: 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 76 61  ieldname key) va
0cc0: 6c 29 29 29 0a 20 20 20 20 28 61 6c 69 73 74 2d  l))).    (alist-
0cd0: 3e 65 6e 76 2d 76 61 72 73 20 28 68 61 73 68 2d  >env-vars (hash-
0ce0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
0cf0: 74 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 65  t *configdat* "e
0d00: 6e 76 2d 6f 76 65 72 72 69 64 65 22 20 27 28 29  nv-override" '()
0d10: 29 29 0a 20 20 20 20 3b 3b 20 4c 65 74 73 20 75  )).    ;; Lets u
0d20: 73 65 20 74 68 69 73 20 61 73 20 61 6e 20 6f 70  se this as an op
0d30: 70 6f 72 74 75 6e 69 74 79 20 74 6f 20 70 75 74  portunity to put
0d40: 20 4d 54 5f 52 55 4e 4e 41 4d 45 20 69 6e 20 74   MT_RUNNAME in t
0d50: 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20  he environment. 
0d60: 20 20 20 28 69 66 20 28 6e 6f 74 20 2a 63 75 72     (if (not *cur
0d70: 72 65 6e 74 2d 72 75 6e 2d 6e 61 6d 65 2a 29 0a  rent-run-name*).
0d80: 09 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61  .(sqlite3:for-ea
0d90: 63 68 2d 72 6f 77 0a 09 20 28 6c 61 6d 62 64 61  ch-row.. (lambda
0da0: 20 28 72 75 6e 6e 61 6d 65 29 0a 09 20 20 20 28   (runname)..   (
0db0: 73 65 74 21 20 2a 63 75 72 72 65 6e 74 2d 72 75  set! *current-ru
0dc0: 6e 2d 6e 61 6d 65 2a 20 72 75 6e 6e 61 6d 65 29  n-name* runname)
0dd0: 29 0a 0a 09 20 64 62 0a 09 20 22 53 45 4c 45 43  )... db.. "SELEC
0de0: 54 20 72 75 6e 6e 61 6d 65 20 46 52 4f 4d 20 72  T runname FROM r
0df0: 75 6e 73 20 57 48 45 52 45 20 69 64 3d 3f 3b 22  uns WHERE id=?;"
0e00: 0a 09 20 72 75 6e 2d 69 64 29 29 0a 20 20 20 20  .. run-id)).    
0e10: 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e  (setenv "MT_RUNN
0e20: 41 4d 45 22 20 2a 63 75 72 72 65 6e 74 2d 72 75  AME" *current-ru
0e30: 6e 2d 6e 61 6d 65 2a 29 0a 20 20 20 20 28 73 65  n-name*).    (se
0e40: 74 65 6e 76 20 22 4d 54 5f 52 55 4e 5f 41 52 45  tenv "MT_RUN_ARE
0e50: 41 5f 48 4f 4d 45 22 20 2a 74 6f 70 70 61 74 68  A_HOME" *toppath
0e60: 2a 29 0a 20 20 20 20 29 29 0a 0a 28 64 65 66 69  *).    ))..(defi
0e70: 6e 65 20 28 73 65 74 2d 69 74 65 6d 2d 65 6e 76  ne (set-item-env
0e80: 2d 76 61 72 73 20 69 74 65 6d 64 61 74 29 0a 20  -vars itemdat). 
0e90: 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62   (for-each (lamb
0ea0: 64 61 20 28 69 74 65 6d 29 0a 09 20 20 20 20 20  da (item)..     
0eb0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20   (debug:print 2 
0ec0: 22 73 65 74 65 6e 76 20 22 20 28 63 61 72 20 69  "setenv " (car i
0ed0: 74 65 6d 29 20 22 20 22 20 28 63 61 64 72 20 69  tem) " " (cadr i
0ee0: 74 65 6d 29 29 0a 09 20 20 20 20 20 20 28 73 65  tem))..      (se
0ef0: 74 65 6e 76 20 28 63 61 72 20 69 74 65 6d 29 20  tenv (car item) 
0f00: 28 63 61 64 72 20 69 74 65 6d 29 29 29 0a 09 20  (cadr item))).. 
0f10: 20 20 20 69 74 65 6d 64 61 74 29 29 0a 0a 28 64     itemdat))..(d
0f20: 65 66 69 6e 65 20 2a 6c 61 73 74 2d 6e 75 6d 2d  efine *last-num-
0f30: 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20 30  running-tests* 0
0f40: 29 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a  ).(define (runs:
0f50: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73  can-run-more-tes
0f60: 74 73 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72  ts db test-recor
0f70: 64 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 63 6f  d).  (let* ((tco
0f80: 6e 66 69 67 20 20 20 20 20 20 20 20 20 20 20 20  nfig            
0f90: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74       (tests:test
0fa0: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f  queue-get-testco
0fb0: 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64  nfig test-record
0fc0: 29 29 0a 09 20 28 6a 6f 62 67 72 6f 75 70 20 20  )).. (jobgroup  
0fd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63                (c
0fe0: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f  onfig-lookup tco
0ff0: 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e  nfig "requiremen
1000: 74 73 22 20 22 6a 6f 62 67 72 6f 75 70 22 29 29  ts" "jobgroup"))
1010: 0a 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20  .. (num-running 
1020: 20 20 20 20 20 20 20 20 20 20 20 20 28 64 62 3a              (db:
1030: 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d  get-count-tests-
1040: 72 75 6e 6e 69 6e 67 20 64 62 29 29 0a 09 20 28  running db)).. (
1050: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a  num-running-in-j
1060: 6f 62 67 72 6f 75 70 20 28 64 62 3a 67 65 74 2d  obgroup (db:get-
1070: 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e  count-tests-runn
1080: 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20  ing-in-jobgroup 
1090: 64 62 20 6a 6f 62 67 72 6f 75 70 29 29 0a 09 20  db jobgroup)).. 
10a0: 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d  (max-concurrent-
10b0: 6a 6f 62 73 20 20 20 20 20 28 6c 65 74 20 28 28  jobs     (let ((
10c0: 6d 63 6a 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b  mcj (config-look
10d0: 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22  up *configdat* "
10e0: 73 65 74 75 70 22 20 20 20 20 20 22 6d 61 78 5f  setup"     "max_
10f0: 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 22  concurrent_jobs"
1100: 29 29 29 0a 09 09 09 09 20 20 20 20 28 69 66 20  ))).....    (if 
1110: 28 61 6e 64 20 6d 63 6a 20 28 73 74 72 69 6e 67  (and mcj (string
1120: 2d 3e 6e 75 6d 62 65 72 20 6d 63 6a 29 29 0a 09  ->number mcj))..
1130: 09 09 09 09 28 73 74 72 69 6e 67 2d 3e 6e 75 6d  ....(string->num
1140: 62 65 72 20 6d 63 6a 29 0a 09 09 09 09 09 23 66  ber mcj)......#f
1150: 29 29 29 0a 09 20 28 6a 6f 62 2d 67 72 6f 75 70  ))).. (job-group
1160: 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20 20 28  -limit         (
1170: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63  config-lookup *c
1180: 6f 6e 66 69 67 64 61 74 2a 20 22 6a 6f 62 67 72  onfigdat* "jobgr
1190: 6f 75 70 73 22 20 6a 6f 62 67 72 6f 75 70 29 29  oups" jobgroup))
11a0: 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ).    (if (not (
11b0: 65 71 3f 20 2a 6c 61 73 74 2d 6e 75 6d 2d 72 75  eq? *last-num-ru
11c0: 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20 6e 75 6d  nning-tests* num
11d0: 2d 72 75 6e 6e 69 6e 67 29 29 0a 09 28 62 65 67  -running))..(beg
11e0: 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69  in..  (debug:pri
11f0: 6e 74 20 32 20 22 6d 61 78 2d 63 6f 6e 63 75 72  nt 2 "max-concur
1200: 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d 61 78  rent-jobs: " max
1210: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73  -concurrent-jobs
1220: 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 3a   ", num-running:
1230: 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 0a   " num-running).
1240: 09 20 20 28 73 65 74 21 20 2a 6c 61 73 74 2d 6e  .  (set! *last-n
1250: 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73  um-running-tests
1260: 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 29 29  * num-running)))
1270: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65  .    (if (not (e
1280: 71 3f 20 30 20 2a 67 6c 6f 62 61 6c 65 78 69 74  q? 0 *globalexit
1290: 73 74 61 74 75 73 2a 29 29 0a 09 28 6c 69 73 74  status*))..(list
12a0: 20 23 66 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20   #f num-running 
12b0: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a  num-running-in-j
12c0: 6f 62 67 72 6f 75 70 20 6d 61 78 2d 63 6f 6e 63  obgroup max-conc
12d0: 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6a 6f 62 2d  urrent-jobs job-
12e0: 67 72 6f 75 70 2d 6c 69 6d 69 74 29 0a 09 28 6c  group-limit)..(l
12f0: 65 74 20 28 28 63 61 6e 2d 6e 6f 74 2d 72 75 6e  et ((can-not-run
1300: 2d 6d 6f 72 65 20 28 63 6f 6e 64 0a 09 09 09 09  -more (cond.....
1310: 20 3b 3b 20 69 66 20 6d 61 78 2d 63 6f 6e 63 75   ;; if max-concu
1320: 72 72 65 6e 74 2d 6a 6f 62 73 20 69 73 20 73 65  rrent-jobs is se
1330: 74 20 61 6e 64 20 74 68 65 20 6e 75 6d 62 65 72  t and the number
1340: 20 72 75 6e 6e 69 6e 67 20 69 73 20 67 72 65 61   running is grea
1350: 74 65 72 20 0a 09 09 09 09 20 3b 3b 20 74 68 61  ter ..... ;; tha
1360: 6e 20 69 74 20 74 68 61 6e 20 63 61 6e 6e 6f 74  n it than cannot
1370: 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 0a 09   run more jobs..
1380: 09 09 09 20 28 28 61 6e 64 20 6d 61 78 2d 63 6f  ... ((and max-co
1390: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 28 3e  ncurrent-jobs (>
13a0: 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 6d 61  = num-running ma
13b0: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
13c0: 73 29 29 0a 09 09 09 09 20 20 28 64 65 62 75 67  s)).....  (debug
13d0: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e  :print 0 "WARNIN
13e0: 47 3a 20 4d 61 78 20 72 75 6e 6e 69 6e 67 20 6a  G: Max running j
13f0: 6f 62 73 20 65 78 63 65 65 64 65 64 2c 20 63 75  obs exceeded, cu
1400: 72 72 65 6e 74 20 6e 75 6d 62 65 72 20 72 75 6e  rrent number run
1410: 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e  ning: " num-runn
1420: 69 6e 67 20 0a 09 09 09 09 09 20 20 20 20 20 20  ing ......      
1430: 20 22 2c 20 6d 61 78 5f 63 6f 6e 63 75 72 72 65   ", max_concurre
1440: 6e 74 5f 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63  nt_jobs: " max-c
1450: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a  oncurrent-jobs).
1460: 09 09 09 09 20 20 23 74 29 0a 09 09 09 09 20 3b  ....  #t)..... ;
1470: 3b 20 69 66 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c  ; if job-group-l
1480: 69 6d 69 74 20 69 73 20 73 65 74 20 61 6e 64 20  imit is set and 
1490: 6e 75 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 69  number of jobs i
14a0: 6e 20 74 68 65 20 67 72 6f 75 70 20 69 73 20 67  n the group is g
14b0: 72 65 61 74 65 72 0a 09 09 09 09 20 3b 3b 20 74  reater..... ;; t
14c0: 68 61 6e 20 74 68 65 20 6c 69 6d 69 74 20 74 68  han the limit th
14d0: 65 6e 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f  en cannot run mo
14e0: 72 65 20 6a 6f 62 73 20 6f 66 20 74 68 69 73 20  re jobs of this 
14f0: 6b 69 6e 64 0a 09 09 09 09 20 28 28 61 6e 64 20  kind..... ((and 
1500: 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 0a  job-group-limit.
1510: 09 09 09 09 20 20 20 20 20 20 20 28 3e 3d 20 6e  ....       (>= n
1520: 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f  um-running-in-jo
1530: 62 67 72 6f 75 70 20 6a 6f 62 2d 67 72 6f 75 70  bgroup job-group
1540: 2d 6c 69 6d 69 74 29 29 0a 09 09 09 09 20 20 28  -limit)).....  (
1550: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57  debug:print 1 "W
1560: 41 52 4e 49 4e 47 3a 20 6e 75 6d 62 65 72 20 6f  ARNING: number o
1570: 66 20 6a 6f 62 73 20 22 20 6e 75 6d 2d 72 75 6e  f jobs " num-run
1580: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70  ning-in-jobgroup
1590: 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 22 20   ......       " 
15a0: 69 6e 20 22 20 6a 6f 62 67 72 6f 75 70 20 22 20  in " jobgroup " 
15b0: 65 78 63 65 65 64 65 64 2c 20 77 69 6c 6c 20 6e  exceeded, will n
15c0: 6f 74 20 72 75 6e 20 22 20 28 74 65 73 74 73 3a  ot run " (tests:
15d0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65  testqueue-get-te
15e0: 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f  stname test-reco
15f0: 72 64 29 29 0a 09 09 09 09 20 20 23 74 29 0a 09  rd)).....  #t)..
1600: 09 09 09 20 28 65 6c 73 65 20 23 66 29 29 29 29  ... (else #f))))
1610: 0a 09 20 20 28 6c 69 73 74 20 28 6e 6f 74 20 63  ..  (list (not c
1620: 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 29  an-not-run-more)
1630: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 6e 75 6d   num-running num
1640: 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67  -running-in-jobg
1650: 72 6f 75 70 20 6d 61 78 2d 63 6f 6e 63 75 72 72  roup max-concurr
1660: 65 6e 74 2d 6a 6f 62 73 20 6a 6f 62 2d 67 72 6f  ent-jobs job-gro
1670: 75 70 2d 6c 69 6d 69 74 29 29 29 29 29 0a 0a 3b  up-limit)))))..;
1680: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;===============
1690: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
16a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
16b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
16c0: 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65 77 20 6d  =======.;; New m
16d0: 65 74 68 6f 64 6f 6c 6f 67 79 2e 20 54 68 65 73  ethodology. Thes
16e0: 65 20 72 6f 75 74 69 6e 65 73 20 77 69 6c 6c 20  e routines will 
16f0: 72 65 70 6c 61 63 65 20 74 68 65 20 61 62 6f 76  replace the abov
1700: 65 20 69 6e 20 74 69 6d 65 2e 20 46 6f 72 0a 3b  e in time. For.;
1710: 3b 20 6e 6f 77 20 74 68 65 20 63 6f 64 65 20 69  ; now the code i
1720: 73 20 64 75 70 6c 69 63 61 74 65 64 2e 20 54 68  s duplicated. Th
1730: 69 73 20 73 74 75 66 66 20 69 73 20 69 6e 69 74  is stuff is init
1740: 69 61 6c 6c 79 20 75 73 65 64 20 69 6e 20 74 68  ially used in th
1750: 65 20 6d 6f 6e 69 74 6f 72 0a 3b 3b 20 62 61 73  e monitor.;; bas
1760: 65 64 20 63 6f 64 65 2e 0a 3b 3b 3d 3d 3d 3d 3d  ed code..;;=====
1770: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1780: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1790: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
17a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
17b0: 3d 0a 0a 3b 3b 20 72 65 67 69 73 74 65 72 20 61  =..;; register a
17c0: 20 74 65 73 74 20 72 75 6e 20 77 69 74 68 20 74   test run with t
17d0: 68 65 20 64 62 0a 28 64 65 66 69 6e 65 20 28 72  he db.(define (r
17e0: 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e  uns:register-run
17f0: 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c   db keys keyvall
1800: 73 74 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 65  st runname state
1810: 20 73 74 61 74 75 73 20 75 73 65 72 29 0a 20 20   status user).  
1820: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22  (debug:print 3 "
1830: 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75  runs:register-ru
1840: 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20  n, keys: " keys 
1850: 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b  " keyvallst: " k
1860: 65 79 76 61 6c 6c 73 74 20 22 20 72 75 6e 6e 61  eyvallst " runna
1870: 6d 65 3a 20 22 20 72 75 6e 6e 61 6d 65 20 22 20  me: " runname " 
1880: 73 74 61 74 65 3a 20 22 20 73 74 61 74 65 20 22  state: " state "
1890: 20 73 74 61 74 75 73 3a 20 22 20 73 74 61 74 75   status: " statu
18a0: 73 20 22 20 75 73 65 72 3a 20 22 20 75 73 65 72  s " user: " user
18b0: 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73  ).  (let* ((keys
18c0: 74 72 20 20 20 20 28 6b 65 79 73 2d 3e 6b 65 79  tr    (keys->key
18d0: 73 74 72 20 6b 65 79 73 29 29 0a 09 20 28 63 6f  str keys)).. (co
18e0: 6d 6d 61 20 20 20 20 20 28 69 66 20 28 3e 20 28  mma     (if (> (
18f0: 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20  length keys) 0) 
1900: 22 2c 22 20 22 22 29 29 0a 09 20 28 61 6e 64 73  "," "")).. (ands
1910: 74 72 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65  tr    (if (> (le
1920: 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 20  ngth keys) 0) " 
1930: 41 4e 44 20 22 20 22 22 29 29 0a 09 20 28 76 61  AND " "")).. (va
1940: 6c 73 6c 6f 74 73 20 20 28 6b 65 79 73 2d 3e 76  lslots  (keys->v
1950: 61 6c 73 6c 6f 74 73 20 6b 65 79 73 29 29 20 3b  alslots keys)) ;
1960: 3b 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 28 6b  ; ?,?,? ..... (k
1970: 65 79 76 61 6c 73 20 20 20 28 6d 61 70 20 63 61  eyvals   (map ca
1980: 64 72 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09  dr keyvallst))..
1990: 20 28 61 6c 6c 76 61 6c 73 20 20 20 28 61 70 70   (allvals   (app
19a0: 65 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d  end (list runnam
19b0: 65 20 73 74 61 74 65 20 73 74 61 74 75 73 20 75  e state status u
19c0: 73 65 72 29 20 6b 65 79 76 61 6c 73 29 29 0a 09  ser) keyvals))..
19d0: 20 28 71 72 79 76 61 6c 73 20 20 20 28 61 70 70   (qryvals   (app
19e0: 65 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d  end (list runnam
19f0: 65 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 20 28  e) keyvals)).. (
1a00: 6b 65 79 3d 3f 73 74 72 20 20 28 73 74 72 69 6e  key=?str  (strin
1a10: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d  g-intersperse (m
1a20: 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 28 63  ap (lambda (k)(c
1a30: 6f 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66 69 65  onc (key:get-fie
1a40: 6c 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 29 29  ldname k) "=?"))
1a50: 20 6b 65 79 73 29 20 22 20 41 4e 44 20 22 29 29   keys) " AND "))
1a60: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ).    (debug:pri
1a70: 6e 74 20 33 20 22 6b 65 79 73 3a 20 22 20 6b 65  nt 3 "keys: " ke
1a80: 79 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20 22 20  ys " allvals: " 
1a90: 61 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76 61 6c  allvals " keyval
1aa0: 73 3a 20 22 20 6b 65 79 76 61 6c 73 29 0a 20 20  s: " keyvals).  
1ab0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32    (debug:print 2
1ac0: 20 22 4e 4f 54 45 3a 20 75 73 69 6e 67 20 74 61   "NOTE: using ta
1ad0: 72 67 65 74 20 22 20 28 73 74 72 69 6e 67 2d 69  rget " (string-i
1ae0: 6e 74 65 72 73 70 65 72 73 65 20 6b 65 79 76 61  ntersperse keyva
1af0: 6c 73 20 22 2f 22 29 20 22 20 66 6f 72 20 74 68  ls "/") " for th
1b00: 69 73 20 72 75 6e 22 29 0a 20 20 20 20 28 69 66  is run").    (if
1b10: 20 28 61 6e 64 20 72 75 6e 6e 61 6d 65 20 28 6e   (and runname (n
1b20: 75 6c 6c 3f 20 28 66 69 6c 74 65 72 20 28 6c 61  ull? (filter (la
1b30: 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 78 29 29  mbda (x)(not x))
1b40: 20 6b 65 79 76 61 6c 73 29 29 29 20 3b 3b 20 74   keyvals))) ;; t
1b50: 68 65 72 65 20 6d 75 73 74 20 62 65 20 61 20 62  here must be a b
1b60: 65 74 74 65 72 20 77 61 79 20 74 6f 20 22 61 70  etter way to "ap
1b70: 70 6c 79 20 61 6e 64 22 0a 09 28 6c 65 74 20 28  ply and"..(let (
1b80: 28 72 65 73 20 23 66 29 29 0a 09 20 20 28 61 70  (res #f))..  (ap
1b90: 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63  ply sqlite3:exec
1ba0: 75 74 65 20 64 62 20 28 63 6f 6e 63 20 22 49 4e  ute db (conc "IN
1bb0: 53 45 52 54 20 4f 52 20 49 47 4e 4f 52 45 20 49  SERT OR IGNORE I
1bc0: 4e 54 4f 20 72 75 6e 73 20 28 72 75 6e 6e 61 6d  NTO runs (runnam
1bd0: 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 6f  e,state,status,o
1be0: 77 6e 65 72 2c 65 76 65 6e 74 5f 74 69 6d 65 22  wner,event_time"
1bf0: 20 63 6f 6d 6d 61 20 6b 65 79 73 74 72 20 22 29   comma keystr ")
1c00: 20 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f   VALUES (?,?,?,?
1c10: 2c 73 74 72 66 74 69 6d 65 28 27 25 73 27 2c 27  ,strftime('%s','
1c20: 6e 6f 77 27 29 22 20 63 6f 6d 6d 61 20 76 61 6c  now')" comma val
1c30: 73 6c 6f 74 73 20 22 29 3b 22 29 0a 09 09 20 61  slots ");")... a
1c40: 6c 6c 76 61 6c 73 29 0a 09 20 20 28 61 70 70 6c  llvals)..  (appl
1c50: 79 20 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61  y sqlite3:for-ea
1c60: 63 68 2d 72 6f 77 20 0a 09 20 20 20 28 6c 61 6d  ch-row ..   (lam
1c70: 62 64 61 20 28 69 64 29 0a 09 20 20 20 20 20 28  bda (id)..     (
1c80: 73 65 74 21 20 72 65 73 20 69 64 29 29 0a 09 20  set! res id)).. 
1c90: 20 20 64 62 0a 09 20 20 20 28 6c 65 74 20 28 28    db..   (let ((
1ca0: 71 72 79 20 28 63 6f 6e 63 20 22 53 45 4c 45 43  qry (conc "SELEC
1cb0: 54 20 69 64 20 46 52 4f 4d 20 72 75 6e 73 20 57  T id FROM runs W
1cc0: 48 45 52 45 20 28 72 75 6e 6e 61 6d 65 3d 3f 20  HERE (runname=? 
1cd0: 22 20 61 6e 64 73 74 72 20 6b 65 79 3d 3f 73 74  " andstr key=?st
1ce0: 72 20 22 29 3b 22 29 29 29 0a 09 20 20 20 20 20  r ");")))..     
1cf0: 3b 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20  ;(debug:print 4 
1d00: 22 71 72 79 3a 20 22 20 71 72 79 29 20 0a 09 20  "qry: " qry) .. 
1d10: 20 20 20 20 71 72 79 29 0a 09 20 20 20 71 72 79      qry)..   qry
1d20: 76 61 6c 73 29 0a 09 20 20 28 73 71 6c 69 74 65  vals)..  (sqlite
1d30: 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 55 50  3:execute db "UP
1d40: 44 41 54 45 20 72 75 6e 73 20 53 45 54 20 73 74  DATE runs SET st
1d50: 61 74 65 3d 3f 2c 73 74 61 74 75 73 3d 3f 20 57  ate=?,status=? W
1d60: 48 45 52 45 20 69 64 3d 3f 3b 22 20 73 74 61 74  HERE id=?;" stat
1d70: 65 20 73 74 61 74 75 73 20 72 65 73 29 0a 09 20  e status res).. 
1d80: 20 72 65 73 29 20 0a 09 28 62 65 67 69 6e 0a 09   res) ..(begin..
1d90: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
1da0: 20 22 45 52 52 4f 52 3a 20 43 61 6c 6c 65 64 20   "ERROR: Called 
1db0: 77 69 74 68 6f 75 74 20 61 6c 6c 20 6e 65 63 65  without all nece
1dc0: 73 73 61 72 79 20 6b 65 79 73 22 29 0a 09 20 20  ssary keys")..  
1dd0: 23 66 29 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20  #f))))..;; This 
1de0: 69 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 6f  is a duplicate o
1df0: 66 20 72 75 6e 2d 74 65 73 74 73 20 28 77 68 69  f run-tests (whi
1e00: 63 68 20 68 61 73 20 62 65 65 6e 20 64 65 70 72  ch has been depr
1e10: 65 63 61 74 65 64 29 2e 20 55 73 65 20 74 68 69  ecated). Use thi
1e20: 73 20 6f 6e 65 20 69 6e 73 74 65 61 64 20 6f 66  s one instead of
1e30: 20 72 75 6e 20 74 65 73 74 73 2e 0a 3b 3b 20 6b   run tests..;; k
1e40: 65 79 76 61 6c 73 0a 28 64 65 66 69 6e 65 20 28  eyvals.(define (
1e50: 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 20 74  runs:run-tests t
1e60: 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 74 65  arget runname te
1e70: 73 74 2d 70 61 74 74 73 20 75 73 65 72 20 66 6c  st-patts user fl
1e80: 61 67 73 29 0a 20 20 28 6c 65 74 2a 20 28 28 64  ags).  (let* ((d
1e90: 62 20 20 20 20 20 20 20 20 20 20 23 66 29 0a 09  b          #f)..
1ea0: 20 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 6f   (keys        (o
1eb0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
1ec0: 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09  :get-keys db))..
1ed0: 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 28 6b   (keyvallst   (k
1ee0: 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76  eys:target->keyv
1ef0: 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29 29  al keys target))
1f00: 0a 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20 20  .. (run-id      
1f10: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
1f20: 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75  runs:register-ru
1f30: 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c  n db keys keyval
1f40: 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77  lst runname "new
1f50: 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 20 20  " "n/a" user))  
1f60: 3b 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29 29 29  ;;  test-name)))
1f70: 0a 09 20 28 64 65 66 65 72 72 65 64 20 20 20 20  .. (deferred    
1f80: 27 28 29 29 20 3b 3b 20 64 65 6c 61 79 20 72 75  '()) ;; delay ru
1f90: 6e 6e 69 6e 67 20 74 68 65 73 65 20 73 69 6e 63  nning these sinc
1fa0: 65 20 74 68 65 79 20 68 61 76 65 20 61 20 77 61  e they have a wa
1fb0: 69 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20 3b 3b  iton clause.. ;;
1fc0: 20 6b 65 65 70 67 6f 69 6e 67 20 69 73 20 74 68   keepgoing is th
1fd0: 65 20 64 65 66 61 63 74 6f 20 6d 6f 64 61 6c 69  e defacto modali
1fe0: 74 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 61 64 64  ty now, will add
1ff0: 20 68 69 74 2d 6e 2d 72 75 6e 20 61 20 62 69 74   hit-n-run a bit
2000: 20 6c 61 74 65 72 0a 09 20 3b 3b 20 28 6b 65 65   later.. ;; (kee
2010: 70 67 6f 69 6e 67 20 20 20 28 68 61 73 68 2d 74  pgoing   (hash-t
2020: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
2030: 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f 69   flags "-keepgoi
2040: 6e 67 22 20 23 66 29 29 0a 09 20 28 74 65 73 74  ng" #f)).. (test
2050: 2d 6e 61 6d 65 73 20 20 27 28 29 29 0a 09 20 28  -names  '()).. (
2060: 72 75 6e 63 6f 6e 66 69 67 66 20 20 20 28 63 6f  runconfigf   (co
2070: 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f  nc  *toppath* "/
2080: 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69  runconfigs.confi
2090: 67 22 29 29 0a 09 20 28 72 65 71 75 69 72 65 64  g")).. (required
20a0: 2d 74 65 73 74 73 20 27 28 29 29 0a 09 20 28 74  -tests '()).. (t
20b0: 65 73 74 2d 72 65 63 6f 72 64 73 20 28 6d 61 6b  est-records (mak
20c0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a  e-hash-table))).
20d0: 0a 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  .    (open-run-c
20e0: 6c 6f 73 65 20 73 65 74 2d 6d 65 67 61 74 65 73  lose set-megates
20f0: 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72 75  t-env-vars db ru
2100: 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d  n-id) ;; these m
2110: 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 79 20  ay be needed by 
2120: 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72  the launching pr
2130: 6f 63 65 73 73 0a 0a 20 20 20 20 28 69 66 20 28  ocess..    (if (
2140: 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e  file-exists? run
2150: 63 6f 6e 66 69 67 66 29 0a 09 28 6f 70 65 6e 2d  configf)..(open-
2160: 72 75 6e 2d 63 6c 6f 73 65 20 73 65 74 75 70 2d  run-close setup-
2170: 65 6e 76 2d 64 65 66 61 75 6c 74 73 20 64 62 20  env-defaults db 
2180: 72 75 6e 63 6f 6e 66 69 67 66 20 72 75 6e 2d 69  runconfigf run-i
2190: 64 20 2a 61 6c 72 65 61 64 79 2d 73 65 65 6e 2d  d *already-seen-
21a0: 72 75 6e 63 6f 6e 66 69 67 2d 69 6e 66 6f 2a 20  runconfig-info* 
21b0: 22 70 72 65 2d 6c 61 75 6e 63 68 2d 65 6e 76 2d  "pre-launch-env-
21c0: 76 61 72 73 22 29 0a 09 28 64 65 62 75 67 3a 70  vars")..(debug:p
21d0: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a  rint 0 "WARNING:
21e0: 20 59 6f 75 20 64 6f 20 6e 6f 74 20 68 61 76 65   You do not have
21f0: 20 61 20 72 75 6e 20 63 6f 6e 66 69 67 20 66 69   a run config fi
2200: 6c 65 3a 20 22 20 72 75 6e 63 6f 6e 66 69 67 66  le: " runconfigf
2210: 29 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 6c  )).    .    ;; l
2220: 6f 6f 6b 20 75 70 20 61 6c 6c 20 74 65 73 74 73  ook up all tests
2230: 20 6d 61 74 63 68 69 6e 67 20 74 68 65 20 63 6f   matching the co
2240: 6d 6d 61 20 73 65 70 61 72 61 74 65 64 20 6c 69  mma separated li
2250: 73 74 20 6f 66 20 67 6c 6f 62 73 20 69 6e 0a 20  st of globs in. 
2260: 20 20 20 3b 3b 20 74 65 73 74 2d 70 61 74 74 73     ;; test-patts
2270: 20 28 75 73 69 6e 67 20 25 20 61 73 20 77 69 6c   (using % as wil
2280: 64 63 61 72 64 29 0a 0a 20 20 20 20 28 73 65 74  dcard)..    (set
2290: 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 74 65  ! test-names (te
22a0: 73 74 73 3a 67 65 74 2d 76 61 6c 69 64 2d 74 65  sts:get-valid-te
22b0: 73 74 73 20 2a 74 6f 70 70 61 74 68 2a 20 74 65  sts *toppath* te
22c0: 73 74 2d 70 61 74 74 73 20 74 65 73 74 2d 6e 61  st-patts test-na
22d0: 6d 65 73 3a 20 74 65 73 74 2d 6e 61 6d 65 73 29  mes: test-names)
22e0: 29 0a 20 20 20 20 28 73 65 74 21 20 74 65 73 74  ).    (set! test
22f0: 2d 6e 61 6d 65 73 20 28 64 65 6c 65 74 65 2d 64  -names (delete-d
2300: 75 70 6c 69 63 61 74 65 73 20 74 65 73 74 2d 6e  uplicates test-n
2310: 61 6d 65 73 29 29 0a 0a 20 20 20 20 28 64 65 62  ames))..    (deb
2320: 75 67 3a 70 72 69 6e 74 20 30 20 22 49 4e 46 4f  ug:print 0 "INFO
2330: 3a 20 74 65 73 74 20 6e 61 6d 65 73 20 22 20 74  : test names " t
2340: 65 73 74 2d 6e 61 6d 65 73 29 0a 0a 20 20 20 20  est-names)..    
2350: 3b 3b 20 6f 6e 20 74 68 65 20 66 69 72 73 74 20  ;; on the first 
2360: 70 61 73 73 20 6f 72 20 63 61 6c 6c 20 74 6f 20  pass or call to 
2370: 72 75 6e 2d 74 65 73 74 73 20 73 65 74 20 46 41  run-tests set FA
2380: 49 4c 53 20 74 6f 20 4e 4f 54 5f 53 54 41 52 54  ILS to NOT_START
2390: 45 44 20 69 66 0a 20 20 20 20 3b 3b 20 2d 6b 65  ED if.    ;; -ke
23a0: 65 70 67 6f 69 6e 67 20 69 73 20 73 70 65 63 69  epgoing is speci
23b0: 66 69 65 64 0a 20 20 20 20 28 69 66 20 28 65 71  fied.    (if (eq
23c0: 3f 20 2a 70 61 73 73 6e 75 6d 2a 20 30 29 0a 09  ? *passnum* 0)..
23d0: 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 68 61 76  (begin..  ;; hav
23e0: 65 20 74 6f 20 64 65 6c 65 74 65 20 74 65 73 74  e to delete test
23f0: 20 72 65 63 6f 72 64 73 20 77 68 65 72 65 20 4e   records where N
2400: 4f 54 5f 53 54 41 52 54 45 44 20 73 69 6e 63 65  OT_STARTED since
2410: 20 74 68 65 79 20 63 61 6e 20 63 61 75 73 65 20   they can cause 
2420: 2d 6b 65 65 70 67 6f 69 6e 67 20 74 6f 20 0a 09  -keepgoing to ..
2430: 20 20 3b 3b 20 67 65 74 20 73 74 75 63 6b 20 64    ;; get stuck d
2440: 75 65 20 74 6f 20 62 65 63 6f 6d 69 6e 67 20 69  ue to becoming i
2450: 6e 61 63 63 65 73 73 69 62 6c 65 20 66 72 6f 6d  naccessible from
2460: 20 61 20 66 61 69 6c 65 64 20 74 65 73 74 2e 20   a failed test. 
2470: 49 2e 65 2e 20 69 66 20 74 65 73 74 20 42 20 64  I.e. if test B d
2480: 65 70 65 6e 64 73 20 0a 09 20 20 3b 3b 20 6f 6e  epends ..  ;; on
2490: 20 74 65 73 74 20 41 20 62 75 74 20 74 65 73 74   test A but test
24a0: 20 42 20 72 65 61 63 68 65 64 20 74 68 65 20 70   B reached the p
24b0: 6f 69 6e 74 20 6f 6e 20 62 65 69 6e 67 20 72 65  oint on being re
24c0: 67 69 73 74 65 72 65 64 20 61 73 20 4e 4f 54 5f  gistered as NOT_
24d0: 53 54 41 52 54 45 44 20 61 6e 64 20 74 65 73 74  STARTED and test
24e0: 0a 09 20 20 3b 3b 20 41 20 66 61 69 6c 65 64 20  ..  ;; A failed 
24f0: 66 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e 20  for some reason 
2500: 74 68 65 6e 20 6f 6e 20 72 65 2d 72 75 6e 20 75  then on re-run u
2510: 73 69 6e 67 20 2d 6b 65 65 70 67 6f 69 6e 67 20  sing -keepgoing 
2520: 74 68 65 20 72 75 6e 20 63 61 6e 20 6e 65 76 65  the run can neve
2530: 72 20 63 6f 6d 70 6c 65 74 65 2e 0a 09 20 20 28  r complete...  (
2540: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
2550: 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73 2d 69  b:delete-tests-i
2560: 6e 2d 73 74 61 74 65 20 64 62 20 72 75 6e 2d 69  n-state db run-i
2570: 64 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29  d "NOT_STARTED")
2580: 0a 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c  ..  (open-run-cl
2590: 6f 73 65 20 64 62 3a 73 65 74 2d 74 65 73 74 73  ose db:set-tests
25a0: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 64 62  -state-status db
25b0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d   run-id test-nam
25c0: 65 73 20 23 66 20 22 46 41 49 4c 22 20 22 4e 4f  es #f "FAIL" "NO
25d0: 54 5f 53 54 41 52 54 45 44 22 20 22 46 41 49 4c  T_STARTED" "FAIL
25e0: 22 29 29 29 0a 0a 20 20 20 20 3b 3b 20 66 72 6f  ")))..    ;; fro
25f0: 6d 20 68 65 72 65 20 6f 6e 20 6f 75 74 20 74 68  m here on out th
2600: 65 20 64 62 20 77 69 6c 6c 20 62 65 20 6f 70 65  e db will be ope
2610: 6e 65 64 20 61 6e 64 20 63 6c 6f 73 65 64 20 6f  ned and closed o
2620: 6e 20 65 76 65 72 79 20 63 61 6c 6c 20 72 75 6e  n every call run
2630: 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75  s:run-tests-queu
2640: 65 0a 20 20 20 20 3b 3b 20 28 73 71 6c 69 74 65  e.    ;; (sqlite
2650: 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 20  3:finalize! db) 
2660: 0a 20 20 20 20 3b 3b 20 6e 6f 77 20 61 64 64 20  .    ;; now add 
2670: 6e 6f 6e 2d 64 69 72 65 63 74 6c 79 20 72 65 66  non-directly ref
2680: 65 72 65 6e 63 65 64 20 64 65 70 65 6e 64 65 6e  erenced dependen
2690: 63 69 65 73 20 28 69 2e 65 2e 20 77 61 69 74 6f  cies (i.e. waito
26a0: 6e 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20  n).    (if (not 
26b0: 28 6e 75 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d 65  (null? test-name
26c0: 73 29 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28  s))..(let loop (
26d0: 28 68 65 64 20 28 63 61 72 20 74 65 73 74 2d 6e  (hed (car test-n
26e0: 61 6d 65 73 29 29 0a 09 09 20 20 20 28 74 61 6c  ames))...   (tal
26f0: 20 28 63 64 72 20 74 65 73 74 2d 6e 61 6d 65 73   (cdr test-names
2700: 29 29 29 20 20 20 20 20 20 20 20 20 3b 3b 20 27  )))         ;; '
2710: 72 65 74 75 72 6e 2d 70 72 6f 63 73 20 74 65 6c  return-procs tel
2720: 6c 73 20 74 68 65 20 63 6f 6e 66 69 67 20 72 65  ls the config re
2730: 61 64 65 72 20 74 6f 20 70 72 65 70 20 72 75 6e  ader to prep run
2740: 6e 69 6e 67 20 73 79 73 74 65 6d 20 62 75 74 20  ning system but 
2750: 72 65 74 75 72 6e 20 61 20 70 72 6f 63 0a 09 20  return a proc.. 
2760: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20   (debug:print 4 
2770: 22 49 4e 46 4f 3a 20 68 65 64 3d 22 20 68 65 64  "INFO: hed=" hed
2780: 20 22 20 61 74 20 74 6f 70 20 6f 66 20 6c 6f 6f   " at top of loo
2790: 70 22 29 0a 09 20 20 28 6c 65 74 2a 20 28 28 63  p")..  (let* ((c
27a0: 6f 6e 66 69 67 20 20 28 74 65 73 74 73 3a 67 65  onfig  (tests:ge
27b0: 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65 64  t-testconfig hed
27c0: 20 27 72 65 74 75 72 6e 2d 70 72 6f 63 73 29 29   'return-procs))
27d0: 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 28 69 66  ... (waitons (if
27e0: 20 63 6f 6e 66 69 67 20 28 73 74 72 69 6e 67 2d   config (string-
27f0: 73 70 6c 69 74 20 28 6c 65 74 20 28 28 77 20 28  split (let ((w (
2800: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f  config-lookup co
2810: 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e  nfig "requiremen
2820: 74 73 22 20 22 77 61 69 74 6f 6e 22 29 29 29 0a  ts" "waiton"))).
2830: 09 09 09 09 09 09 20 20 20 20 20 28 69 66 20 77  ......     (if w
2840: 20 77 20 22 22 29 29 29 0a 09 09 09 20 20 20 20   w "")))....    
2850: 20 20 28 62 65 67 69 6e 0a 09 09 09 09 28 64 65    (begin.....(de
2860: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
2870: 4f 52 3a 20 6e 6f 6e 2d 65 78 69 73 74 65 6e 74  OR: non-existent
2880: 20 72 65 71 75 69 72 65 64 20 74 65 73 74 20 5c   required test \
2890: 22 22 20 68 65 64 20 22 5c 22 22 29 0a 20 20 20  "" hed "\"").   
28a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
28b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66               (if
28c0: 20 64 62 20 28 73 71 6c 69 74 65 33 3a 66 69 6e   db (sqlite3:fin
28d0: 61 6c 69 7a 65 21 20 64 62 29 29 0a 09 09 09 09  alize! db)).....
28e0: 28 65 78 69 74 20 31 29 29 29 29 29 0a 09 20 20  (exit 1)))))..  
28f0: 20 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68    ;; check for h
2900: 65 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e  ed in waitons =>
2910: 20 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63   this would be c
2920: 69 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20  ircular, remove 
2930: 69 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a  it and issue an.
2940: 09 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20  .    ;; error.. 
2950: 20 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20 68     (if (member h
2960: 65 64 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62  ed waitons)...(b
2970: 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a  egin...  (debug:
2980: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
2990: 74 65 73 74 20 22 20 68 65 64 20 22 20 68 61 73  test " hed " has
29a0: 20 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20 61   listed itself a
29b0: 73 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61  s a waiton, plea
29c0: 73 65 20 63 6f 72 72 65 63 74 20 74 68 69 73 21  se correct this!
29d0: 22 29 0a 09 09 20 20 28 73 65 74 21 20 77 61 69  ")...  (set! wai
29e0: 74 6f 6e 73 20 28 66 69 6c 74 65 72 20 28 6c 61  tons (filter (la
29f0: 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71  mbda (x)(not (eq
2a00: 75 61 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61  ual? x hed))) wa
2a10: 69 74 6f 6e 73 29 29 29 29 0a 09 20 20 20 20 0a  itons))))..    .
2a20: 09 20 20 20 20 3b 3b 20 28 69 74 65 6d 73 20 20  .    ;; (items  
2a30: 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d   (items:get-item
2a40: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f  s-from-config co
2a50: 6e 66 69 67 29 29 29 0a 09 20 20 20 20 28 69 66  nfig)))..    (if
2a60: 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c   (not (hash-tabl
2a70: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65  e-ref/default te
2a80: 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 20 23  st-records hed #
2a90: 66 29 29 0a 09 09 28 68 61 73 68 2d 74 61 62 6c  f))...(hash-tabl
2aa0: 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f  e-set! test-reco
2ab0: 72 64 73 0a 09 09 09 09 20 68 65 64 20 28 76 65  rds..... hed (ve
2ac0: 63 74 6f 72 20 68 65 64 20 20 20 20 20 3b 3b 20  ctor hed     ;; 
2ad0: 30 0a 09 09 09 09 09 20 20 20 20 20 63 6f 6e 66  0......     conf
2ae0: 69 67 20 20 3b 3b 20 31 0a 09 09 09 09 09 20 20  ig  ;; 1......  
2af0: 20 20 20 77 61 69 74 6f 6e 73 20 3b 3b 20 32 0a     waitons ;; 2.
2b00: 09 09 09 09 09 20 20 20 20 20 28 63 6f 6e 66 69  .....     (confi
2b10: 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20  g-lookup config 
2b20: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22  "requirements" "
2b30: 70 72 69 6f 72 69 74 79 22 29 20 20 20 20 20 3b  priority")     ;
2b40: 3b 20 70 72 69 6f 72 69 74 79 20 33 0a 09 09 09  ; priority 3....
2b50: 09 09 20 20 20 20 20 28 6c 65 74 20 28 28 69 74  ..     (let ((it
2b60: 65 6d 73 20 20 20 20 20 20 28 68 61 73 68 2d 74  ems      (hash-t
2b70: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
2b80: 20 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 22 20   config "items" 
2b90: 23 66 29 29 20 3b 3b 20 69 74 65 6d 73 20 34 0a  #f)) ;; items 4.
2ba0: 09 09 09 09 09 09 20 20 20 28 69 74 65 6d 73 74  ......   (itemst
2bb0: 61 62 6c 65 20 28 68 61 73 68 2d 74 61 62 6c 65  able (hash-table
2bc0: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e  -ref/default con
2bd0: 66 69 67 20 22 69 74 65 6d 73 74 61 62 6c 65 22  fig "itemstable"
2be0: 20 23 66 29 29 29 20 0a 09 09 09 09 09 20 20 20   #f))) ......   
2bf0: 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72      ;; if either
2c00: 20 69 74 65 6d 73 20 6f 72 20 69 74 65 6d 73 20   items or items 
2c10: 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63 20  table is a proc 
2c20: 72 65 74 75 72 6e 20 69 74 20 73 6f 20 74 65 73  return it so tes
2c30: 74 20 72 75 6e 6e 69 6e 67 0a 09 09 09 09 09 20  t running...... 
2c40: 20 20 20 20 20 20 3b 3b 20 70 72 6f 63 65 73 73        ;; process
2c50: 20 63 61 6e 20 6b 6e 6f 77 20 74 6f 20 63 61 6c   can know to cal
2c60: 6c 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d  l items:get-item
2c70: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09 09  s-from-config...
2c80: 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20  ...       ;; if 
2c90: 65 69 74 68 65 72 20 69 73 20 61 20 6c 69 73 74  either is a list
2ca0: 20 61 6e 64 20 6e 6f 6e 65 20 69 73 20 61 20 70   and none is a p
2cb0: 72 6f 63 20 67 6f 20 61 68 65 61 64 20 61 6e 64  roc go ahead and
2cc0: 20 63 61 6c 6c 20 67 65 74 2d 69 74 65 6d 73 0a   call get-items.
2cd0: 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 6f  .....       ;; o
2ce0: 74 68 65 72 77 69 73 65 20 72 65 74 75 72 6e 20  therwise return 
2cf0: 23 66 20 2d 20 74 68 69 73 20 69 73 20 6e 6f 74  #f - this is not
2d00: 20 61 6e 20 69 74 65 72 61 74 65 64 20 74 65 73   an iterated tes
2d10: 74 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 63  t......       (c
2d20: 6f 6e 64 0a 09 09 09 09 09 09 28 28 70 72 6f 63  ond.......((proc
2d30: 65 64 75 72 65 3f 20 69 74 65 6d 73 29 20 20 20  edure? items)   
2d40: 20 20 20 0a 09 09 09 09 09 09 20 28 64 65 62 75     ....... (debu
2d50: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a  g:print 4 "INFO:
2d60: 20 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63   items is a proc
2d70: 65 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63  edure, will calc
2d80: 20 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 20   later")....... 
2d90: 69 74 65 6d 73 29 20 20 20 20 20 20 20 20 20 20  items)          
2da0: 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a    ;; calc later.
2db0: 09 09 09 09 09 09 28 28 70 72 6f 63 65 64 75 72  ......((procedur
2dc0: 65 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09  e? itemstable)..
2dd0: 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ..... (debug:pri
2de0: 6e 74 20 34 20 22 49 4e 46 4f 3a 20 69 74 65 6d  nt 4 "INFO: item
2df0: 73 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63  stable is a proc
2e00: 65 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63  edure, will calc
2e10: 20 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 20   later")....... 
2e20: 69 74 65 6d 73 74 61 62 6c 65 29 20 20 20 20 20  itemstable)     
2e30: 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a    ;; calc later.
2e40: 09 09 09 09 09 09 28 28 66 69 6c 74 65 72 20 28  ......((filter (
2e50: 6c 61 6d 62 64 61 20 28 78 29 0a 09 09 09 09 09  lambda (x)......
2e60: 09 09 20 20 20 28 6c 65 74 20 28 28 76 61 6c 20  ..   (let ((val 
2e70: 28 63 61 72 20 78 29 29 29 0a 09 09 09 09 09 09  (car x))).......
2e80: 09 20 20 20 20 20 28 69 66 20 28 70 72 6f 63 65  .     (if (proce
2e90: 64 75 72 65 3f 20 76 61 6c 29 20 76 61 6c 20 23  dure? val) val #
2ea0: 66 29 29 29 0a 09 09 09 09 09 09 09 20 28 61 70  f)))........ (ap
2eb0: 70 65 6e 64 20 28 69 66 20 28 6c 69 73 74 3f 20  pend (if (list? 
2ec0: 69 74 65 6d 73 29 20 69 74 65 6d 73 20 27 28 29  items) items '()
2ed0: 29 0a 09 09 09 09 09 09 09 09 20 28 69 66 20 28  )......... (if (
2ee0: 6c 69 73 74 3f 20 69 74 65 6d 73 74 61 62 6c 65  list? itemstable
2ef0: 29 20 69 74 65 6d 73 74 61 62 6c 65 20 27 28 29  ) itemstable '()
2f00: 29 29 29 0a 09 09 09 09 09 09 20 27 68 61 76 65  )))....... 'have
2f10: 2d 70 72 6f 63 65 64 75 72 65 29 0a 09 09 09 09  -procedure).....
2f20: 09 09 28 28 6f 72 20 28 6c 69 73 74 3f 20 69 74  ..((or (list? it
2f30: 65 6d 73 29 28 6c 69 73 74 3f 20 69 74 65 6d 73  ems)(list? items
2f40: 74 61 62 6c 65 29 29 20 3b 3b 20 63 61 6c 63 20  table)) ;; calc 
2f50: 6e 6f 77 0a 09 09 09 09 09 09 20 28 64 65 62 75  now....... (debu
2f60: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a  g:print 4 "INFO:
2f70: 20 69 74 65 6d 73 20 61 6e 64 20 69 74 65 6d 73   items and items
2f80: 74 61 62 6c 65 20 61 72 65 20 6c 69 73 74 73 2c  table are lists,
2f90: 20 63 61 6c 63 20 6e 6f 77 5c 6e 22 0a 09 09 09   calc now\n"....
2fa0: 09 09 09 09 20 20 20 20 20 20 22 20 20 20 20 69  ....      "    i
2fb0: 74 65 6d 73 3a 20 22 20 69 74 65 6d 73 20 22 20  tems: " items " 
2fc0: 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 20 69 74  itemstable: " it
2fd0: 65 6d 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09  emstable).......
2fe0: 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d   (items:get-item
2ff0: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f  s-from-config co
3000: 6e 66 69 67 29 29 0a 09 09 09 09 09 09 28 65 6c  nfig)).......(el
3010: 73 65 20 23 66 29 29 29 20 20 20 20 20 20 20 20  se #f)))        
3020: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
3030: 20 20 20 3b 3b 20 6e 6f 74 20 69 74 65 72 61 74     ;; not iterat
3040: 65 64 0a 09 09 09 09 09 20 20 20 20 20 23 66 20  ed......     #f 
3050: 20 20 20 20 20 3b 3b 20 69 74 65 6d 73 64 61 74       ;; itemsdat
3060: 20 35 0a 09 09 09 09 09 20 20 20 20 20 23 66 20   5......     #f 
3070: 20 20 20 20 20 3b 3b 20 73 70 61 72 65 20 2d 20       ;; spare - 
3080: 75 73 65 64 20 66 6f 72 20 69 74 65 6d 2d 70 61  used for item-pa
3090: 74 68 0a 09 09 09 09 09 20 20 20 20 20 29 29 29  th......     )))
30a0: 0a 09 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20  ..    (for-each 
30b0: 0a 09 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28  ..     (lambda (
30c0: 77 61 69 74 6f 6e 29 0a 09 20 20 20 20 20 20 20  waiton)..       
30d0: 28 69 66 20 28 61 6e 64 20 77 61 69 74 6f 6e 20  (if (and waiton 
30e0: 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20 77 61 69  (not (member wai
30f0: 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  ton test-names))
3100: 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09  )...   (begin...
3110: 20 20 20 20 20 28 73 65 74 21 20 72 65 71 75 69       (set! requi
3120: 72 65 64 2d 74 65 73 74 73 20 28 63 6f 6e 73 20  red-tests (cons 
3130: 77 61 69 74 6f 6e 20 72 65 71 75 69 72 65 64 2d  waiton required-
3140: 74 65 73 74 73 29 29 0a 09 09 20 20 20 20 20 28  tests))...     (
3150: 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20  set! test-names 
3160: 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 74 65 73  (cons waiton tes
3170: 74 2d 6e 61 6d 65 73 29 29 29 29 29 20 3b 3b 20  t-names))))) ;; 
3180: 77 61 73 20 61 6e 20 61 70 70 65 6e 64 2c 20 6e  was an append, n
3190: 6f 77 20 61 20 63 6f 6e 73 0a 09 20 20 20 20 20  ow a cons..     
31a0: 77 61 69 74 6f 6e 73 29 0a 09 20 20 20 20 28 6c  waitons)..    (l
31b0: 65 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 64  et ((remtests (d
31c0: 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73  elete-duplicates
31d0: 20 28 61 70 70 65 6e 64 20 77 61 69 74 6f 6e 73   (append waitons
31e0: 20 74 61 6c 29 29 29 29 0a 09 20 20 20 20 20 20   tal))))..      
31f0: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
3200: 72 65 6d 74 65 73 74 73 29 29 0a 09 09 20 20 28  remtests))...  (
3210: 6c 6f 6f 70 20 28 63 61 72 20 72 65 6d 74 65 73  loop (car remtes
3220: 74 73 29 28 63 64 72 20 72 65 6d 74 65 73 74 73  ts)(cdr remtests
3230: 29 29 29 29 29 29 29 0a 0a 20 20 20 20 28 69 66  )))))))..    (if
3240: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 71   (not (null? req
3250: 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09 28  uired-tests))..(
3260: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49  debug:print 1 "I
3270: 4e 46 4f 3a 20 41 64 64 69 6e 67 20 22 20 72 65  NFO: Adding " re
3280: 71 75 69 72 65 64 2d 74 65 73 74 73 20 22 20 74  quired-tests " t
3290: 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65 22  o the run queue"
32a0: 29 29 0a 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20  )).    ;; NOTE: 
32b0: 74 68 65 73 65 20 61 72 65 20 61 6c 6c 20 70 61  these are all pa
32c0: 72 65 6e 74 20 74 65 73 74 73 2c 20 69 74 65 6d  rent tests, item
32d0: 73 20 61 72 65 20 6e 6f 74 20 65 78 70 61 6e 64  s are not expand
32e0: 65 64 20 79 65 74 2e 0a 20 20 20 20 28 64 65 62  ed yet..    (deb
32f0: 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f  ug:print 4 "INFO
3300: 3a 20 74 65 73 74 2d 72 65 63 6f 72 64 73 3d 22  : test-records="
3310: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c   (hash-table->al
3320: 69 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 73  ist test-records
3330: 29 29 0a 20 20 20 20 28 72 75 6e 73 3a 72 75 6e  )).    (runs:run
3340: 2d 74 65 73 74 73 2d 71 75 65 75 65 20 72 75 6e  -tests-queue run
3350: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74  -id runname test
3360: 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c  -records keyvall
3370: 73 74 20 66 6c 61 67 73 20 74 65 73 74 2d 70 61  st flags test-pa
3380: 74 74 73 29 0a 20 20 20 20 28 64 65 62 75 67 3a  tts).    (debug:
3390: 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 41  print 4 "INFO: A
33a0: 6c 6c 20 64 6f 6e 65 20 62 79 20 68 65 72 65 22  ll done by here"
33b0: 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75  )))..(define (ru
33c0: 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 72  ns:calc-fails pr
33d0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 20  ereqs-not-met). 
33e0: 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61   (filter (lambda
33f0: 20 28 74 65 73 74 29 0a 09 20 20 20 20 28 61 6e   (test)..    (an
3400: 64 20 28 76 65 63 74 6f 72 3f 20 74 65 73 74 29  d (vector? test)
3410: 20 3b 3b 20 6e 6f 74 20 28 73 74 72 69 6e 67 3f   ;; not (string?
3420: 20 74 65 73 74 29 29 0a 09 09 20 28 65 71 75 61   test))... (equa
3430: 6c 3f 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  l? (db:test-get-
3440: 73 74 61 74 65 20 74 65 73 74 29 20 22 43 4f 4d  state test) "COM
3450: 50 4c 45 54 45 44 22 29 0a 09 09 20 28 6e 6f 74  PLETED")... (not
3460: 20 28 6d 65 6d 62 65 72 20 28 64 62 3a 74 65 73   (member (db:tes
3470: 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t-get-status tes
3480: 74 29 0a 09 09 09 20 20 20 20 20 20 27 28 22 50  t)....      '("P
3490: 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 45  ASS" "WARN" "CHE
34a0: 43 4b 22 20 22 57 41 49 56 45 44 22 29 29 29 29  CK" "WAIVED"))))
34b0: 29 0a 09 20 20 70 72 65 72 65 71 73 2d 6e 6f 74  )..  prereqs-not
34c0: 2d 6d 65 74 29 29 0a 0a 28 64 65 66 69 6e 65 20  -met))..(define 
34d0: 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63  (runs:calc-not-c
34e0: 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71 73  ompleted prereqs
34f0: 2d 6e 6f 74 2d 6d 65 74 29 0a 20 20 28 66 69 6c  -not-met).  (fil
3500: 74 65 72 0a 20 20 20 28 6c 61 6d 62 64 61 20 28  ter.   (lambda (
3510: 74 29 0a 20 20 20 20 20 28 6f 72 20 28 6e 6f 74  t).     (or (not
3520: 20 28 76 65 63 74 6f 72 3f 20 74 29 29 0a 09 20   (vector? t)).. 
3530: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 22 43 4f  (not (equal? "CO
3540: 4d 50 4c 45 54 45 44 22 20 28 64 62 3a 74 65 73  MPLETED" (db:tes
3550: 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 29 29  t-get-state t)))
3560: 29 29 0a 20 20 20 70 72 65 72 65 71 73 2d 6e 6f  )).   prereqs-no
3570: 74 2d 6d 65 74 29 29 0a 0a 28 64 65 66 69 6e 65  t-met))..(define
3580: 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74   (runs:pretty-st
3590: 72 69 6e 67 20 6c 73 74 29 0a 20 20 28 6d 61 70  ring lst).  (map
35a0: 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 09 20 28   (lambda (t).. (
35b0: 69 66 20 28 6e 6f 74 20 28 76 65 63 74 6f 72 3f  if (not (vector?
35c0: 20 74 29 29 0a 09 20 20 20 20 20 28 63 6f 6e 63   t))..     (conc
35d0: 20 74 29 0a 09 20 20 20 20 20 28 63 6f 6e 63 20   t)..     (conc 
35e0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73  (db:test-get-tes
35f0: 74 6e 61 6d 65 20 74 29 20 22 3a 22 20 28 64 62  tname t) ":" (db
3600: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20  :test-get-state 
3610: 74 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d  t) "/" (db:test-
3620: 67 65 74 2d 73 74 61 74 75 73 20 74 29 29 29 29  get-status t))))
3630: 0a 20 20 20 20 20 20 20 6c 73 74 29 29 0a 0a 28  .       lst))..(
3640: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 6d 61 6b  define (runs:mak
3650: 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65  e-full-test-name
3660: 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d 70 61   testname itempa
3670: 74 68 29 0a 20 20 28 69 66 20 28 65 71 75 61 6c  th).  (if (equal
3680: 3f 20 69 74 65 6d 70 61 74 68 20 22 22 29 20 74  ? itempath "") t
3690: 65 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65  estname (conc te
36a0: 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 70  stname "/" itemp
36b0: 61 74 68 29 29 29 0a 0a 3b 3b 20 74 65 73 74 2d  ath)))..;; test-
36c0: 72 65 63 6f 72 64 73 20 69 73 20 61 20 68 61 73  records is a has
36d0: 68 20 74 61 62 6c 65 20 74 65 73 74 6e 61 6d 65  h table testname
36e0: 3a 69 74 65 6d 5f 70 61 74 68 20 3d 3e 20 76 65  :item_path => ve
36f0: 63 74 6f 72 20 3c 20 74 65 73 74 6e 61 6d 65 20  ctor < testname 
3700: 74 65 73 74 63 6f 6e 66 69 67 20 77 61 69 74 6f  testconfig waito
3710: 6e 73 20 70 72 69 6f 72 69 74 79 20 69 74 65 6d  ns priority item
3720: 73 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a 28 64 65  s-info ... >.(de
3730: 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74  fine (runs:run-t
3740: 65 73 74 73 2d 71 75 65 75 65 20 72 75 6e 2d 69  ests-queue run-i
3750: 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72  d runname test-r
3760: 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 74  ecords keyvallst
3770: 20 66 6c 61 67 73 20 74 65 73 74 2d 70 61 74 74   flags test-patt
3780: 73 29 0a 20 20 20 20 3b 3b 20 41 74 20 74 68 69  s).    ;; At thi
3790: 73 20 70 6f 69 6e 74 20 74 68 65 20 6c 69 73 74  s point the list
37a0: 20 6f 66 20 70 61 72 65 6e 74 20 74 65 73 74 73   of parent tests
37b0: 20 69 73 20 65 78 70 61 6e 64 65 64 20 0a 20 20   is expanded .  
37c0: 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 6c 64    ;; NB// Should
37d0: 20 65 78 70 61 6e 64 20 69 74 65 6d 73 20 68 65   expand items he
37e0: 72 65 20 61 6e 64 20 74 68 65 6e 20 69 6e 73 65  re and then inse
37f0: 72 74 20 69 6e 74 6f 20 74 68 65 20 72 75 6e 20  rt into the run 
3800: 71 75 65 75 65 2e 0a 20 20 28 64 65 62 75 67 3a  queue..  (debug:
3810: 70 72 69 6e 74 20 35 20 22 74 65 73 74 2d 72 65  print 5 "test-re
3820: 63 6f 72 64 73 3a 20 22 20 74 65 73 74 2d 72 65  cords: " test-re
3830: 63 6f 72 64 73 20 22 2c 20 6b 65 79 76 61 6c 6c  cords ", keyvall
3840: 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20  st: " keyvallst 
3850: 22 20 66 6c 61 67 73 3a 20 22 20 28 68 61 73 68  " flags: " (hash
3860: 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 66 6c  -table->alist fl
3870: 61 67 73 29 29 0a 20 20 28 6c 65 74 20 28 28 73  ags)).  (let ((s
3880: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73  orted-test-names
3890: 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62 79 2d   (tests:sort-by-
38a0: 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77 61 69  priority-and-wai
38b0: 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72 64 73  ton test-records
38c0: 29 29 0a 09 28 74 65 73 74 2d 72 65 67 69 73 74  ))..(test-regist
38d0: 65 72 79 20 20 20 20 28 6d 61 6b 65 2d 68 61 73  ery    (make-has
38e0: 68 2d 74 61 62 6c 65 29 29 0a 09 28 6e 75 6d 2d  h-table))..(num-
38f0: 72 65 74 72 69 65 73 20 20 20 20 20 20 20 20 30  retries        0
3900: 29 0a 09 28 6d 61 78 2d 72 65 74 72 69 65 73 20  )..(max-retries 
3910: 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f        (config-lo
3920: 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a  okup *configdat*
3930: 20 22 73 65 74 75 70 22 20 22 6d 61 78 72 65 74   "setup" "maxret
3940: 72 69 65 73 22 29 29 29 0a 20 20 20 20 28 73 65  ries"))).    (se
3950: 74 21 20 6d 61 78 2d 72 65 74 72 69 65 73 20 28  t! max-retries (
3960: 69 66 20 28 61 6e 64 20 6d 61 78 2d 72 65 74 72  if (and max-retr
3970: 69 65 73 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d  ies (string->num
3980: 62 65 72 20 6d 61 78 2d 72 65 74 72 69 65 73 29  ber max-retries)
3990: 29 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72  )(string->number
39a0: 20 6d 61 78 2d 72 65 74 72 69 65 73 29 20 31 30   max-retries) 10
39b0: 30 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74  0)).    (if (not
39c0: 20 28 6e 75 6c 6c 3f 20 73 6f 72 74 65 64 2d 74   (null? sorted-t
39d0: 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65  est-names))..(le
39e0: 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 20 20 20  t loop ((hed    
39f0: 20 20 20 20 20 28 63 61 72 20 73 6f 72 74 65 64       (car sorted
3a00: 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09  -test-names))...
3a10: 20 20 20 28 74 61 6c 20 20 20 20 20 20 20 20 20     (tal         
3a20: 28 63 64 72 20 73 6f 72 74 65 64 2d 74 65 73 74  (cdr sorted-test
3a30: 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 20 28 72  -names))...   (r
3a40: 65 72 75 6e 73 20 20 20 20 20 20 27 28 29 29 29  eruns      '()))
3a50: 0a 09 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75  ..  (if (not (nu
3a60: 6c 6c 3f 20 72 65 72 75 6e 73 29 29 28 64 65 62  ll? reruns))(deb
3a70: 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f  ug:print 4 "INFO
3a80: 3a 20 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e  : reruns=" rerun
3a90: 73 29 29 0a 09 20 20 3b 3b 20 28 70 72 69 6e 74  s))..  ;; (print
3aa0: 20 22 54 6f 70 20 6f 66 20 6c 6f 6f 70 2c 20 68   "Top of loop, h
3ab0: 65 64 3d 22 20 68 65 64 20 22 2c 20 74 61 6c 3d  ed=" hed ", tal=
3ac0: 22 20 74 61 6c 20 22 20 2c 72 65 72 75 6e 73 3d  " tal " ,reruns=
3ad0: 22 20 72 65 72 75 6e 73 29 0a 09 20 20 28 6c 65  " reruns)..  (le
3ae0: 74 2a 20 28 28 74 65 73 74 2d 72 65 63 6f 72 64  t* ((test-record
3af0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
3b00: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 68 65   test-records he
3b10: 64 29 29 0a 09 09 20 28 74 65 73 74 2d 6e 61 6d  d))... (test-nam
3b20: 65 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71  e   (tests:testq
3b30: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d  ueue-get-testnam
3b40: 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a  e test-record)).
3b50: 09 09 20 28 74 63 6f 6e 66 69 67 20 20 20 20 20  .. (tconfig     
3b60: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
3b70: 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20  -get-testconfig 
3b80: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09  test-record))...
3b90: 20 28 74 65 73 74 6d 6f 64 65 20 20 20 20 28 6c   (testmode    (l
3ba0: 65 74 20 28 28 6d 20 28 63 6f 6e 66 69 67 2d 6c  et ((m (config-l
3bb0: 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20 22 72  ookup tconfig "r
3bc0: 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 6d 6f  equirements" "mo
3bd0: 64 65 22 29 29 29 0a 09 09 09 09 28 69 66 20 6d  de"))).....(if m
3be0: 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c   (string->symbol
3bf0: 20 6d 29 20 27 6e 6f 72 6d 61 6c 29 29 29 0a 09   m) 'normal)))..
3c00: 09 20 28 77 61 69 74 6f 6e 73 20 20 20 20 20 28  . (waitons     (
3c10: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
3c20: 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 20 74  get-waitons    t
3c30: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20  est-record))... 
3c40: 28 70 72 69 6f 72 69 74 79 20 20 20 20 28 74 65  (priority    (te
3c50: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
3c60: 74 2d 70 72 69 6f 72 69 74 79 20 20 20 74 65 73  t-priority   tes
3c70: 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 69  t-record))... (i
3c80: 74 65 6d 64 61 74 20 20 20 20 20 28 74 65 73 74  temdat     (test
3c90: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d  s:testqueue-get-
3ca0: 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 74 2d  itemdat    test-
3cb0: 72 65 63 6f 72 64 29 29 20 3b 3b 20 69 74 65 6d  record)) ;; item
3cc0: 64 61 74 20 63 61 6e 20 62 65 20 61 20 73 74 72  dat can be a str
3cd0: 69 6e 67 2c 20 6c 69 73 74 20 6f 72 20 23 66 0a  ing, list or #f.
3ce0: 09 09 20 28 69 74 65 6d 73 20 20 20 20 20 20 20  .. (items       
3cf0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
3d00: 2d 67 65 74 2d 69 74 65 6d 73 20 20 20 20 20 20  -get-items      
3d10: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09  test-record))...
3d20: 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 28 69   (item-path   (i
3d30: 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69  tem-list->path i
3d40: 74 65 6d 64 61 74 29 29 0a 09 09 20 28 6e 65 77  temdat))... (new
3d50: 74 61 6c 20 20 20 20 20 20 28 61 70 70 65 6e 64  tal      (append
3d60: 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64 29 29   tal (list hed))
3d70: 29 29 0a 09 20 20 20 20 0a 09 20 20 20 20 28 64  ))..    ..    (d
3d80: 65 62 75 67 3a 70 72 69 6e 74 20 36 0a 09 09 09  ebug:print 6....
3d90: 20 22 74 65 73 74 2d 6e 61 6d 65 3a 20 22 20 74   "test-name: " t
3da0: 65 73 74 2d 6e 61 6d 65 0a 09 09 09 20 22 5c 6e  est-name.... "\n
3db0: 20 20 68 65 64 3a 20 20 20 20 20 20 20 20 20 22    hed:         "
3dc0: 20 68 65 64 0a 09 09 09 20 22 5c 6e 20 20 69 74   hed.... "\n  it
3dd0: 65 6d 64 61 74 3a 20 20 20 20 20 22 20 69 74 65  emdat:     " ite
3de0: 6d 64 61 74 0a 09 09 09 20 22 5c 6e 20 20 69 74  mdat.... "\n  it
3df0: 65 6d 73 3a 20 20 20 20 20 20 20 22 20 69 74 65  ems:       " ite
3e00: 6d 73 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d  ms.... "\n  item
3e10: 2d 70 61 74 68 3a 20 20 20 22 20 69 74 65 6d 2d  -path:   " item-
3e20: 70 61 74 68 0a 09 09 09 20 22 5c 6e 20 20 77 61  path.... "\n  wa
3e30: 69 74 6f 6e 73 3a 20 20 20 20 20 22 20 77 61 69  itons:     " wai
3e40: 74 6f 6e 73 0a 09 09 09 20 22 5c 6e 20 20 6e 75  tons.... "\n  nu
3e50: 6d 2d 72 65 74 72 69 65 73 3a 20 22 20 6e 75 6d  m-retries: " num
3e60: 2d 72 65 74 72 69 65 73 0a 09 09 09 20 22 5c 6e  -retries.... "\n
3e70: 20 20 74 61 6c 3a 20 20 20 20 20 20 20 20 20 22    tal:         "
3e80: 20 74 61 6c 0a 09 09 09 20 22 5c 6e 20 20 72 65   tal.... "\n  re
3e90: 72 75 6e 73 3a 20 20 20 20 20 20 22 20 72 65 72  runs:      " rer
3ea0: 75 6e 73 29 0a 0a 09 20 20 20 20 3b 3b 20 63 68  uns)...    ;; ch
3eb0: 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 77  eck for hed in w
3ec0: 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77  aitons => this w
3ed0: 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c 61 72  ould be circular
3ee0: 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 20  , remove it and 
3ef0: 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b  issue an..    ;;
3f00: 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69 66 20   error..    (if 
3f10: 28 6d 65 6d 62 65 72 20 74 65 73 74 2d 6e 61 6d  (member test-nam
3f20: 65 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62 65  e waitons)...(be
3f30: 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70  gin...  (debug:p
3f40: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74  rint 0 "ERROR: t
3f50: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  est " test-name 
3f60: 22 20 68 61 73 20 6c 69 73 74 65 64 20 69 74 73  " has listed its
3f70: 65 6c 66 20 61 73 20 61 20 77 61 69 74 6f 6e 2c  elf as a waiton,
3f80: 20 70 6c 65 61 73 65 20 63 6f 72 72 65 63 74 20   please correct 
3f90: 74 68 69 73 21 22 29 0a 09 09 20 20 28 73 65 74  this!")...  (set
3fa0: 21 20 77 61 69 74 6f 6e 20 28 66 69 6c 74 65 72  ! waiton (filter
3fb0: 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74   (lambda (x)(not
3fc0: 20 28 65 71 75 61 6c 3f 20 78 20 68 65 64 29 29   (equal? x hed))
3fd0: 29 20 77 61 69 74 6f 6e 73 29 29 29 29 0a 0a 09  ) waitons))))...
3fe0: 20 20 20 20 28 63 6f 6e 64 20 3b 3b 20 4f 55 54      (cond ;; OUT
3ff0: 45 52 20 43 4f 4e 44 0a 09 20 20 20 20 20 28 28  ER COND..     ((
4000: 6e 6f 74 20 69 74 65 6d 73 29 20 3b 3b 20 77 68  not items) ;; wh
4010: 65 6e 20 66 61 6c 73 65 20 74 68 65 20 74 65 73  en false the tes
4020: 74 20 69 73 20 6f 6b 20 74 6f 20 62 65 20 68 61  t is ok to be ha
4030: 6e 64 65 64 20 6f 66 66 20 74 6f 20 6c 61 75 6e  nded off to laun
4040: 63 68 20 28 62 75 74 20 6e 6f 74 20 62 65 66 6f  ch (but not befo
4050: 72 65 29 0a 09 20 20 20 20 20 20 28 6c 65 74 2a  re)..      (let*
4060: 20 28 28 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e   ((run-limits-in
4070: 66 6f 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e  fo         (open
4080: 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a  -run-close runs:
4090: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73  can-run-more-tes
40a0: 74 73 20 23 66 20 74 65 73 74 2d 72 65 63 6f 72  ts #f test-recor
40b0: 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74  d)) ;; look at t
40c0: 68 65 20 74 65 73 74 20 6a 6f 62 67 72 6f 75 70  he test jobgroup
40d0: 20 61 6e 64 20 74 6f 74 20 6a 6f 62 73 20 72 75   and tot jobs ru
40e0: 6e 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 68 61  nning...     (ha
40f0: 76 65 2d 72 65 73 6f 75 72 63 65 73 20 20 20 20  ve-resources    
4100: 20 20 20 20 20 20 28 63 61 72 20 72 75 6e 2d 6c        (car run-l
4110: 69 6d 69 74 73 2d 69 6e 66 6f 29 29 0a 09 09 20  imits-info))... 
4120: 20 20 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67      (num-running
4130: 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69               (li
4140: 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74  st-ref run-limit
4150: 73 2d 69 6e 66 6f 20 31 29 29 0a 09 09 20 20 20  s-info 1))...   
4160: 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69    (num-running-i
4170: 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 6c 69 73 74  n-jobgroup (list
4180: 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d  -ref run-limits-
4190: 69 6e 66 6f 20 32 29 29 0a 09 09 20 20 20 20 20  info 2))...     
41a0: 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d  (max-concurrent-
41b0: 6a 6f 62 73 20 20 20 20 20 28 6c 69 73 74 2d 72  jobs     (list-r
41c0: 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e  ef run-limits-in
41d0: 66 6f 20 33 29 29 0a 09 09 20 20 20 20 20 28 6a  fo 3))...     (j
41e0: 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20  ob-group-limit  
41f0: 20 20 20 20 20 20 20 28 6c 69 73 74 2d 72 65 66         (list-ref
4200: 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f   run-limits-info
4210: 20 34 29 29 0a 09 09 20 20 20 20 20 28 70 72 65   4))...     (pre
4220: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 20 20 20  reqs-not-met    
4230: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
4240: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 70 72 65 72  lose db:get-prer
4250: 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 23 66 20 72  eqs-not-met #f r
4260: 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74  un-id waitons it
4270: 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74 65  em-path mode: te
4280: 73 74 6d 6f 64 65 29 29 0a 09 09 20 20 20 20 20  stmode))...     
4290: 28 66 61 69 6c 73 20 20 20 20 20 20 20 20 20 20  (fails          
42a0: 20 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a 63           (runs:c
42b0: 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71  alc-fails prereq
42c0: 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 20 20  s-not-met))...  
42d0: 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65     (non-complete
42e0: 64 20 20 20 20 20 20 20 20 20 20 20 28 72 75 6e  d           (run
42f0: 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c  s:calc-not-compl
4300: 65 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74  eted prereqs-not
4310: 2d 6d 65 74 29 29 29 0a 09 09 28 64 65 62 75 67  -met)))...(debug
4320: 3a 70 72 69 6e 74 20 38 20 22 49 4e 46 4f 3a 20  :print 8 "INFO: 
4330: 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 3a 20  have-resources: 
4340: 22 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73  " have-resources
4350: 20 22 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d   " prereqs-not-m
4360: 65 74 3a 20 22 20 0a 09 09 09 20 20 20 20 20 28  et: " ....     (
4370: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72  string-intersper
4380: 73 65 20 0a 09 09 09 20 20 20 20 20 20 28 6d 61  se ....      (ma
4390: 70 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 09 09  p (lambda (t)...
43a0: 09 09 20 20 20 20 20 28 69 66 20 28 76 65 63 74  ..     (if (vect
43b0: 6f 72 3f 20 74 29 0a 09 09 09 09 09 20 28 63 6f  or? t)...... (co
43c0: 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  nc (db:test-get-
43d0: 73 74 61 74 65 20 74 29 20 22 2f 22 20 28 64 62  state t) "/" (db
43e0: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73  :test-get-status
43f0: 20 74 29 29 0a 09 09 09 09 09 20 28 63 6f 6e 63   t))...... (conc
4400: 20 22 20 57 41 52 4e 49 4e 47 3a 20 74 20 69 73   " WARNING: t is
4410: 20 6e 6f 74 20 61 20 76 65 63 74 6f 72 3d 22 20   not a vector=" 
4420: 74 20 29 29 29 0a 09 09 09 09 20 20 20 70 72 65  t ))).....   pre
4430: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 22 2c  reqs-not-met) ",
4440: 20 22 29 20 22 20 66 61 69 6c 73 3a 20 22 20 66   ") " fails: " f
4450: 61 69 6c 73 29 0a 09 09 28 64 65 62 75 67 3a 70  ails)...(debug:p
4460: 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 68 65  rint 4 "INFO: he
4470: 64 3d 22 20 68 65 64 29 0a 0a 09 09 3b 3b 20 44  d=" hed)....;; D
4480: 6f 6e 27 74 20 6b 6e 6f 77 20 61 74 20 74 68 69  on't know at thi
4490: 73 20 74 69 6d 65 20 69 66 20 74 68 65 20 74 65  s time if the te
44a0: 73 74 20 68 61 76 65 20 62 65 65 6e 20 6c 61 75  st have been lau
44b0: 6e 63 68 65 64 20 61 74 20 73 6f 6d 65 20 74 69  nched at some ti
44c0: 6d 65 20 69 6e 20 74 68 65 20 70 61 73 74 0a 09  me in the past..
44d0: 09 3b 3b 20 69 2e 65 2e 20 69 73 20 74 68 69 73  .;; i.e. is this
44e0: 20 61 20 72 65 2d 6c 61 75 6e 63 68 3f 0a 09 09   a re-launch?...
44f0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22  (debug:print 4 "
4500: 49 4e 46 4f 3a 20 72 75 6e 2d 6c 69 6d 69 74 73  INFO: run-limits
4510: 2d 69 6e 66 6f 20 3d 20 22 20 72 75 6e 2d 6c 69  -info = " run-li
4520: 6d 69 74 73 2d 69 6e 66 6f 29 0a 09 09 28 63 6f  mits-info)...(co
4530: 6e 64 20 3b 3b 20 49 4e 4e 45 52 20 43 4f 4e 44  nd ;; INNER COND
4540: 20 23 31 20 66 6f 72 20 61 20 6c 61 75 6e 63 68   #1 for a launch
4550: 61 62 6c 65 20 74 65 73 74 0a 09 09 20 3b 3b 20  able test... ;; 
4560: 43 68 65 63 6b 20 69 74 65 6d 20 70 61 74 68 20  Check item path 
4570: 61 67 61 69 6e 73 74 20 69 74 65 6d 2d 70 61 74  against item-pat
4580: 74 73 0a 09 09 20 28 28 6e 6f 74 20 28 74 65 73  ts... ((not (tes
4590: 74 73 3a 6d 61 74 63 68 20 74 65 73 74 2d 70 61  ts:match test-pa
45a0: 74 74 73 20 28 74 65 73 74 73 3a 74 65 73 74 71  tts (tests:testq
45b0: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d  ueue-get-testnam
45c0: 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20 69  e test-record) i
45d0: 74 65 6d 2d 70 61 74 68 29 29 20 3b 3b 20 54 68  tem-path)) ;; Th
45e0: 69 73 20 74 65 73 74 2f 69 74 65 6d 70 61 74 68  is test/itempath
45f0: 20 69 73 20 6e 6f 74 20 74 6f 20 62 65 20 72 75   is not to be ru
4600: 6e 0a 09 09 20 20 3b 3b 20 65 6c 73 65 20 74 68  n...  ;; else th
4610: 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b 2c 20  e run is stuck, 
4620: 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20 70  temporarily or p
4630: 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 20 20 3b  ermanently...  ;
4640: 3b 20 62 75 74 20 73 68 6f 75 6c 64 20 63 68 65  ; but should che
4650: 63 6b 20 69 66 20 69 74 20 69 73 20 64 75 65 20  ck if it is due 
4660: 74 6f 20 6c 61 63 6b 20 6f 66 20 72 65 73 6f 75  to lack of resou
4670: 72 63 65 73 20 76 73 2e 20 70 72 65 72 65 71 75  rces vs. prerequ
4680: 69 73 69 74 65 73 0a 09 09 20 20 28 64 65 62 75  isites...  (debu
4690: 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a  g:print 1 "INFO:
46a0: 20 53 6b 69 70 70 69 6e 67 20 22 20 28 74 65 73   Skipping " (tes
46b0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
46c0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72  -testname test-r
46d0: 65 63 6f 72 64 29 20 22 20 22 20 69 74 65 6d 2d  ecord) " " item-
46e0: 70 61 74 68 20 22 20 61 73 20 69 74 20 64 6f 65  path " as it doe
46f0: 73 6e 27 74 20 6d 61 74 63 68 20 22 20 74 65 73  sn't match " tes
4700: 74 2d 70 61 74 74 73 29 0a 09 09 20 20 28 74 68  t-patts)...  (th
4710: 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f  read-sleep! *glo
4720: 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20 20  bal-delta*)...  
4730: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
4740: 74 61 6c 29 29 0a 09 09 20 20 20 20 20 20 28 6c  tal))...      (l
4750: 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64  oop (car tal)(cd
4760: 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29  r tal) reruns)))
4770: 0a 09 09 20 28 28 61 6e 64 20 28 6e 6f 74 20 28  ... ((and (not (
4780: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
4790: 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65 67 69  efault test-regi
47a0: 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65  stery (runs:make
47b0: 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20  -full-test-name 
47c0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70  test-name item-p
47d0: 61 74 68 29 20 23 66 29 29 0a 09 09 20 20 20 20  ath) #f))...    
47e0: 20 20 20 28 61 6e 64 20 6d 61 78 2d 63 6f 6e 63     (and max-conc
47f0: 75 72 72 65 6e 74 2d 6a 6f 62 73 20 28 3e 20 28  urrent-jobs (> (
4800: 2d 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74  - max-concurrent
4810: 2d 6a 6f 62 73 20 6e 75 6d 2d 72 75 6e 6e 69 6e  -jobs num-runnin
4820: 67 29 20 35 29 29 29 0a 09 09 20 20 28 6f 70 65  g) 5)))...  (ope
4830: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74  n-run-close db:t
4840: 65 73 74 73 2d 72 65 67 69 73 74 65 72 2d 74 65  ests-register-te
4850: 73 74 20 23 66 20 72 75 6e 2d 69 64 20 74 65 73  st #f run-id tes
4860: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68  t-name item-path
4870: 29 0a 09 09 20 20 28 68 61 73 68 2d 74 61 62 6c  )...  (hash-tabl
4880: 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 67 69  e-set! test-regi
4890: 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65  stery (runs:make
48a0: 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20  -full-test-name 
48b0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70  test-name item-p
48c0: 61 74 68 29 20 23 74 29 0a 09 09 20 20 28 74 68  ath) #t)...  (th
48d0: 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f  read-sleep! *glo
48e0: 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20 20  bal-delta*)...  
48f0: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61  (loop (car newta
4900: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72  l)(cdr newtal) r
4910: 65 72 75 6e 73 29 29 0a 09 09 20 28 28 6e 6f 74  eruns))... ((not
4920: 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 29   have-resources)
4930: 20 3b 3b 20 73 69 6d 70 6c 79 20 74 72 79 20 61   ;; simply try a
4940: 67 61 69 6e 20 61 66 74 65 72 20 77 61 69 74 69  gain after waiti
4950: 6e 67 20 61 20 73 65 63 6f 6e 64 0a 09 09 20 20  ng a second...  
4960: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
4970: 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  + 1 *global-delt
4980: 61 2a 29 29 0a 09 09 20 20 28 64 65 62 75 67 3a  a*))...  (debug:
4990: 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 6e  print 1 "INFO: n
49a0: 6f 20 72 65 73 6f 75 72 63 65 73 20 74 6f 20 72  o resources to r
49b0: 75 6e 20 6e 65 77 20 74 65 73 74 73 2c 20 77 61  un new tests, wa
49c0: 69 74 69 6e 67 20 2e 2e 2e 22 29 0a 09 09 20 20  iting ...")...  
49d0: 3b 3b 20 63 6f 75 6c 64 20 68 61 76 65 20 64 6f  ;; could have do
49e0: 6e 65 20 68 65 64 20 74 61 6c 20 68 65 72 65 20  ne hed tal here 
49f0: 62 75 74 20 64 6f 69 6e 67 20 63 61 72 2f 63 64  but doing car/cd
4a00: 72 20 6f 66 20 6e 65 77 74 61 6c 20 74 6f 20 72  r of newtal to r
4a10: 6f 74 61 74 65 20 74 65 73 74 73 0a 09 09 20 20  otate tests...  
4a20: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61  (loop (car newta
4a30: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72  l)(cdr newtal) r
4a40: 65 72 75 6e 73 29 29 0a 09 09 20 28 28 61 6e 64  eruns))... ((and
4a50: 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 0a   have-resources.
4a60: 09 09 20 20 20 20 20 20 20 28 6f 72 20 28 6e 75  ..       (or (nu
4a70: 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ll? prereqs-not-
4a80: 6d 65 74 29 0a 09 09 09 20 20 20 28 61 6e 64 20  met)....   (and 
4a90: 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74  (eq? testmode 't
4aa0: 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 28 6e 75  oplevel).....(nu
4ab0: 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65  ll? non-complete
4ac0: 64 29 29 29 29 0a 09 09 20 20 28 72 75 6e 3a 74  d))))...  (run:t
4ad0: 65 73 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61  est run-id runna
4ae0: 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73  me keyvallst tes
4af0: 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20 23  t-record flags #
4b00: 66 29 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73  f)...  (thread-s
4b10: 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65  leep! *global-de
4b20: 6c 74 61 2a 29 0a 09 09 20 20 28 69 66 20 28 6e  lta*)...  (if (n
4b30: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a  ot (null? tal)).
4b40: 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63  ..      (loop (c
4b50: 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29  ar tal)(cdr tal)
4b60: 20 72 65 72 75 6e 73 29 29 29 0a 09 09 20 28 65   reruns)))... (e
4b70: 6c 73 65 20 3b 3b 20 6d 75 73 74 20 62 65 20 77  lse ;; must be w
4b80: 65 20 68 61 76 65 20 75 6e 6d 65 74 20 70 72 65  e have unmet pre
4b90: 72 65 71 75 69 73 69 74 65 73 0a 09 09 20 20 20  requisites...   
4ba0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20   (debug:print 4 
4bb0: 22 46 41 49 4c 53 3a 20 22 20 66 61 69 6c 73 29  "FAILS: " fails)
4bc0: 0a 09 09 20 20 20 20 3b 3b 20 49 66 20 6f 6e 65  ...    ;; If one
4bd0: 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 68 65 20   or more of the 
4be0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20  prereqs-not-met 
4bf0: 61 72 65 20 46 41 49 4c 20 74 68 65 6e 20 77 65  are FAIL then we
4c00: 20 63 61 6e 20 69 73 73 75 65 0a 09 09 20 20 20   can issue...   
4c10: 20 3b 3b 20 61 20 6d 65 73 73 61 67 65 20 61 6e   ;; a message an
4c20: 64 20 64 72 6f 70 20 68 65 64 20 66 72 6f 6d 20  d drop hed from 
4c30: 74 68 65 20 69 74 65 6d 73 20 74 6f 20 62 65 20  the items to be 
4c40: 70 72 6f 63 65 73 73 65 64 2e 0a 09 09 20 20 20  processed....   
4c50: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 66 61 69 6c   (if (null? fail
4c60: 73 29 0a 09 09 09 28 62 65 67 69 6e 0a 09 09 09  s)....(begin....
4c70: 20 20 3b 3b 20 63 6f 75 6c 64 6e 27 74 20 72 75    ;; couldn't ru
4c80: 6e 2c 20 74 61 6b 65 20 61 20 62 72 65 61 74 68  n, take a breath
4c90: 65 72 0a 09 09 09 20 20 28 64 65 62 75 67 3a 70  er....  (debug:p
4ca0: 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 53 68  rint 4 "INFO: Sh
4cb0: 6f 75 6c 64 6e 27 74 20 72 65 61 6c 6c 79 20 67  ouldn't really g
4cc0: 65 74 20 68 65 72 65 2c 20 72 61 63 65 20 63 6f  et here, race co
4cd0: 6e 64 69 74 69 6f 6e 3f 20 55 6e 61 62 6c 65 20  ndition? Unable 
4ce0: 74 6f 20 6c 61 75 6e 63 68 20 6d 6f 72 65 20 74  to launch more t
4cf0: 65 73 74 73 20 61 74 20 74 68 69 73 20 6d 6f 6d  ests at this mom
4d00: 65 6e 74 2c 20 6b 69 6c 6c 69 6e 67 20 74 69 6d  ent, killing tim
4d10: 65 20 2e 2e 2e 22 29 0a 09 09 09 20 20 28 74 68  e ...")....  (th
4d20: 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 31  read-sleep! (+ 1
4d30: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
4d40: 29 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65 65 70 20  ) ;; long sleep 
4d50: 68 65 72 65 20 2d 20 6e 6f 20 72 65 73 6f 75 72  here - no resour
4d60: 63 65 73 2c 20 6d 61 79 20 61 73 20 77 65 6c 6c  ces, may as well
4d70: 20 62 65 20 70 61 74 69 65 6e 74 0a 09 09 09 20   be patient.... 
4d80: 20 3b 3b 20 77 65 20 6d 61 64 65 20 6e 65 77 20   ;; we made new 
4d90: 74 61 6c 20 62 79 20 73 74 69 63 6b 69 6e 67 20  tal by sticking 
4da0: 68 65 64 20 61 74 20 74 68 65 20 62 61 63 6b 20  hed at the back 
4db0: 6f 66 20 74 68 65 20 6c 69 73 74 0a 09 09 09 20  of the list.... 
4dc0: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74   (loop (car newt
4dd0: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20  al)(cdr newtal) 
4de0: 72 65 72 75 6e 73 29 29 0a 09 09 09 3b 3b 20 74  reruns))....;; t
4df0: 68 65 20 77 61 69 74 6f 6e 20 69 73 20 46 41 49  he waiton is FAI
4e00: 4c 20 73 6f 20 6e 6f 20 70 6f 69 6e 74 20 69 6e  L so no point in
4e10: 20 74 72 79 69 6e 67 20 74 6f 20 72 75 6e 20 68   trying to run h
4e20: 65 64 20 65 76 65 72 20 61 67 61 69 6e 0a 09 09  ed ever again...
4e30: 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f  .(if (not (null?
4e40: 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 69   tal))....    (i
4e50: 66 20 28 76 65 63 74 6f 72 3f 20 68 65 64 29 0a  f (vector? hed).
4e60: 09 09 09 09 28 62 65 67 69 6e 20 28 64 65 62 75  ....(begin (debu
4e70: 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a  g:print 1 "WARN:
4e80: 20 44 72 6f 70 70 69 6e 67 20 74 65 73 74 20 22   Dropping test "
4e90: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
4ea0: 73 74 6e 61 6d 65 20 68 65 64 29 20 22 2f 22 20  stname hed) "/" 
4eb0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65  (db:test-get-ite
4ec0: 6d 2d 70 61 74 68 20 68 65 64 29 0a 09 09 09 09  m-path hed).....
4ed0: 09 09 20 20 20 20 22 20 66 72 6f 6d 20 74 68 65  ..    " from the
4ee0: 20 6c 61 75 6e 63 68 20 6c 69 73 74 20 61 73 20   launch list as 
4ef0: 69 74 20 68 61 73 20 70 72 65 72 65 71 75 69 73  it has prerequis
4f00: 74 65 73 20 74 68 61 74 20 61 72 65 20 46 41 49  tes that are FAI
4f10: 4c 22 29 0a 09 09 09 09 20 20 20 20 20 20 20 28  L").....       (
4f20: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67  thread-sleep! *g
4f30: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09  lobal-delta*)...
4f40: 09 09 20 20 20 20 20 20 20 28 6c 6f 6f 70 20 28  ..       (loop (
4f50: 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c  car tal)(cdr tal
4f60: 29 20 28 63 6f 6e 73 20 68 65 64 20 72 65 72 75  ) (cons hed reru
4f70: 6e 73 29 29 29 0a 09 09 09 09 28 62 65 67 69 6e  ns))).....(begin
4f80: 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 72  .....  (debug:pr
4f90: 69 6e 74 20 31 20 22 57 41 52 4e 3a 20 54 65 73  int 1 "WARN: Tes
4fa0: 74 20 6e 6f 74 20 70 72 6f 63 65 73 73 65 64 20  t not processed 
4fb0: 63 6f 72 72 65 63 74 6c 79 2e 20 43 6f 75 6c 64  correctly. Could
4fc0: 20 62 65 20 61 20 72 61 63 65 20 63 6f 6e 64 69   be a race condi
4fd0: 74 69 6f 6e 20 69 6e 20 79 6f 75 72 20 74 65 73  tion in your tes
4fe0: 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e  t implementation
4ff0: 3f 20 22 20 68 65 64 29 20 3b 3b 20 20 22 20 61  ? " hed) ;;  " a
5000: 73 20 69 74 20 68 61 73 20 70 72 65 72 65 71 75  s it has prerequ
5010: 69 73 74 65 73 20 74 68 61 74 20 61 72 65 20 46  istes that are F
5020: 41 49 4c 2e 20 28 4e 4f 54 45 3a 20 68 65 64 20  AIL. (NOTE: hed 
5030: 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f 72 29  is not a vector)
5040: 22 29 0a 09 09 09 09 20 20 28 74 68 72 65 61 64  ").....  (thread
5050: 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d  -sleep! *global-
5060: 64 65 6c 74 61 2a 29 0a 09 09 09 09 20 20 28 6c  delta*).....  (l
5070: 6f 6f 70 20 68 65 64 20 74 61 6c 20 72 65 72 75  oop hed tal reru
5080: 6e 73 29 29 29 29 29 29 29 29 29 20 3b 3b 20 45  ns))))))))) ;; E
5090: 4e 44 20 4f 46 20 49 4e 4e 45 52 20 43 4f 4e 44  ND OF INNER COND
50a0: 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20 3b 3b  ..     ..     ;;
50b0: 20 63 61 73 65 20 77 68 65 72 65 20 61 6e 20 69   case where an i
50c0: 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 73 20  tems came in as 
50d0: 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72 6f 63  a list been proc
50e0: 65 73 73 65 64 0a 09 20 20 20 20 20 28 28 61 6e  essed..     ((an
50f0: 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20  d (list? items) 
5100: 20 20 20 20 3b 3b 20 74 68 75 73 20 77 65 20 6b      ;; thus we k
5110: 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 20 61 72  now our items ar
5120: 65 20 61 6c 72 65 61 64 79 20 63 61 6c 63 75 6c  e already calcul
5130: 61 74 65 64 0a 09 09 20 20 20 28 6e 6f 74 20 20  ated...   (not  
5140: 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 61 6e   itemdat)) ;; an
5150: 64 20 6e 6f 74 20 79 65 74 20 65 78 70 61 6e 64  d not yet expand
5160: 65 64 20 69 6e 74 6f 20 74 68 65 20 6c 69 73 74  ed into the list
5170: 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 62 65   of things to be
5180: 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 28 69 66   done..      (if
5190: 20 28 61 6e 64 20 28 3e 3d 20 2a 76 65 72 62 6f   (and (>= *verbo
51a0: 73 69 74 79 2a 20 31 29 0a 09 09 20 20 20 20 20  sity* 1)...     
51b0: 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 74 65    (> (length ite
51c0: 6d 73 29 20 30 29 0a 09 09 20 20 20 20 20 20 20  ms) 0)...       
51d0: 28 3e 20 28 6c 65 6e 67 74 68 20 28 63 61 72 20  (> (length (car 
51e0: 69 74 65 6d 73 29 29 20 30 29 29 0a 09 09 20 20  items)) 0))...  
51f0: 28 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20 20  (pp items))..   
5200: 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20     (for-each..  
5210: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 79       (lambda (my
5220: 2d 69 74 65 6d 64 61 74 29 0a 09 09 20 28 6c 65  -itemdat)... (le
5230: 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65  t* ((new-test-re
5240: 63 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72  cord (let ((newr
5250: 65 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74  ec (make-tests:t
5260: 65 73 74 71 75 65 75 65 29 29 29 0a 09 09 09 09  estqueue))).....
5270: 09 20 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 79  .   (vector-copy
5280: 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20 6e 65  ! test-record ne
5290: 77 72 65 63 29 0a 09 09 09 09 09 20 20 20 6e 65  wrec)......   ne
52a0: 77 72 65 63 29 29 0a 09 09 09 28 6d 79 2d 69 74  wrec))....(my-it
52b0: 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69  em-path (item-li
52c0: 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d  st->path my-item
52d0: 64 61 74 29 29 29 0a 09 09 20 20 20 28 69 66 20  dat)))...   (if 
52e0: 28 74 65 73 74 73 3a 6d 61 74 63 68 20 74 65 73  (tests:match tes
52f0: 74 2d 70 61 74 74 73 20 68 65 64 20 6d 79 2d 69  t-patts hed my-i
5300: 74 65 6d 2d 70 61 74 68 29 20 3b 3b 20 28 70 61  tem-path) ;; (pa
5310: 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 6d 79  tt-list-match my
5320: 2d 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d  -item-path item-
5330: 70 61 74 74 73 29 20 20 20 20 20 20 20 20 20 20  patts)          
5340: 20 3b 3b 20 79 65 73 2c 20 77 65 20 77 61 6e 74   ;; yes, we want
5350: 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68 69 73   to process this
5360: 20 69 74 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f   item, NOTE: Sho
5370: 75 6c 64 20 6e 6f 74 20 6e 65 65 64 20 74 68 69  uld not need thi
5380: 73 20 63 68 65 63 6b 20 68 65 72 65 21 0a 09 09  s check here!...
5390: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65         (let ((ne
53a0: 77 74 65 73 74 6e 61 6d 65 20 28 72 75 6e 73 3a  wtestname (runs:
53b0: 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e  make-full-test-n
53c0: 61 6d 65 20 68 65 64 20 6d 79 2d 69 74 65 6d 2d  ame hed my-item-
53d0: 70 61 74 68 29 29 29 20 20 20 20 3b 3b 20 74 65  path)))    ;; te
53e0: 73 74 20 6e 61 6d 65 73 20 61 72 65 20 75 6e 69  st names are uni
53f0: 71 75 65 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f  que on testname/
5400: 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 28 74  item-path.... (t
5410: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73  ests:testqueue-s
5420: 65 74 2d 69 74 65 6d 73 21 20 20 20 20 20 6e 65  et-items!     ne
5430: 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66  w-test-record #f
5440: 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73  ).... (tests:tes
5450: 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 64  tqueue-set-itemd
5460: 61 74 21 20 20 20 6e 65 77 2d 74 65 73 74 2d 72  at!   new-test-r
5470: 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 74  ecord my-itemdat
5480: 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73  ).... (tests:tes
5490: 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f  tqueue-set-item_
54a0: 70 61 74 68 21 20 6e 65 77 2d 74 65 73 74 2d 72  path! new-test-r
54b0: 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61  ecord my-item-pa
54c0: 74 68 29 0a 09 09 09 20 28 68 61 73 68 2d 74 61  th).... (hash-ta
54d0: 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65  ble-set! test-re
54e0: 63 6f 72 64 73 20 6e 65 77 74 65 73 74 6e 61 6d  cords newtestnam
54f0: 65 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72  e new-test-recor
5500: 64 29 0a 09 09 09 20 28 73 65 74 21 20 74 61 6c  d).... (set! tal
5510: 20 28 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61   (cons newtestna
5520: 6d 65 20 74 61 6c 29 29 29 29 29 29 20 3b 3b 20  me tal)))))) ;; 
5530: 73 69 6e 63 65 20 74 68 65 73 65 20 61 72 65 20  since these are 
5540: 69 74 65 6d 69 7a 65 64 20 63 72 65 61 74 65 20  itemized create 
5550: 6e 65 77 20 74 65 73 74 20 6e 61 6d 65 73 20 74  new test names t
5560: 65 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68  estname/itempath
5570: 0a 09 20 20 20 20 20 20 20 69 74 65 6d 73 29 0a  ..       items).
5580: 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20  .      (if (not 
5590: 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20  (null? tal))... 
55a0: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 74   (begin...    (t
55b0: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c  hread-sleep! *gl
55c0: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20  obal-delta*)... 
55d0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
55e0: 34 20 22 49 4e 46 4f 3a 20 45 6e 64 20 6f 66 20  4 "INFO: End of 
55f0: 69 74 65 6d 73 20 6c 69 73 74 2c 20 6c 6f 6f 70  items list, loop
5600: 69 6e 67 20 77 69 74 68 20 6e 65 78 74 22 29 0a  ing with next").
5610: 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72  ..    (loop (car
5620: 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 72   tal)(cdr tal) r
5630: 65 72 75 6e 73 29 29 29 29 0a 0a 09 20 20 20 20  eruns))))...    
5640: 20 3b 3b 20 69 66 20 69 74 65 6d 73 20 69 73 20   ;; if items is 
5650: 61 20 70 72 6f 63 20 74 68 65 6e 20 6e 65 65 64  a proc then need
5660: 20 74 6f 20 72 75 6e 20 69 74 65 6d 73 3a 67 65   to run items:ge
5670: 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e  t-items-from-con
5680: 66 69 67 2c 20 67 65 74 20 74 68 65 20 6c 69 73  fig, get the lis
5690: 74 20 61 6e 64 20 6c 6f 6f 70 20 0a 09 20 20 20  t and loop ..   
56a0: 20 20 3b 3b 20 20 20 20 2d 20 62 75 74 20 6f 6e    ;;    - but on
56b0: 6c 79 20 64 6f 20 74 68 61 74 20 69 66 20 72 65  ly do that if re
56c0: 73 6f 75 72 63 65 73 20 65 78 69 73 74 20 74 6f  sources exist to
56d0: 20 6b 69 63 6b 20 6f 66 66 20 74 68 65 20 6a 6f   kick off the jo
56e0: 62 0a 09 20 20 20 20 20 28 28 6f 72 20 28 70 72  b..     ((or (pr
56f0: 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 29 28  ocedure? items)(
5700: 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76 65 2d  eq? items 'have-
5710: 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20 20 20  procedure))..   
5720: 20 20 20 28 6c 65 74 20 28 28 63 61 6e 2d 72 75     (let ((can-ru
5730: 6e 2d 6d 6f 72 65 20 20 20 20 28 6f 70 65 6e 2d  n-more    (open-
5740: 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 63  run-close runs:c
5750: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74  an-run-more-test
5760: 73 20 23 66 20 74 65 73 74 2d 72 65 63 6f 72 64  s #f test-record
5770: 29 29 29 0a 09 09 28 69 66 20 63 61 6e 2d 72 75  )))...(if can-ru
5780: 6e 2d 6d 6f 72 65 0a 09 09 20 20 20 20 28 6c 65  n-more...    (le
5790: 74 2a 20 28 28 70 72 65 72 65 71 73 2d 6e 6f 74  t* ((prereqs-not
57a0: 2d 6d 65 74 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  -met (open-run-c
57b0: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 70 72 65 72  lose db:get-prer
57c0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 23 66 20 72  eqs-not-met #f r
57d0: 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74  un-id waitons it
57e0: 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74 65  em-path mode: te
57f0: 73 74 6d 6f 64 65 29 29 0a 09 09 09 20 20 20 28  stmode))....   (
5800: 66 61 69 6c 73 20 20 20 20 20 20 20 20 20 20 20  fails           
5810: 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73  (runs:calc-fails
5820: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
5830: 29 29 0a 09 09 09 20 20 20 28 6e 6f 6e 2d 63 6f  ))....   (non-co
5840: 6d 70 6c 65 74 65 64 20 20 20 28 72 75 6e 73 3a  mpleted   (runs:
5850: 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74  calc-not-complet
5860: 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  ed prereqs-not-m
5870: 65 74 29 29 29 0a 09 09 20 20 20 20 20 20 28 64  et)))...      (d
5880: 65 62 75 67 3a 70 72 69 6e 74 20 38 20 22 49 4e  ebug:print 8 "IN
5890: 46 4f 3a 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  FO: can-run-more
58a0: 3a 20 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  : " can-run-more
58b0: 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73 74  .....   "\n test
58c0: 6e 61 6d 65 3a 20 20 20 20 20 20 20 20 22 20 68  name:        " h
58d0: 65 64 0a 09 09 09 09 20 20 20 22 5c 6e 20 70 72  ed.....   "\n pr
58e0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22  ereqs-not-met: "
58f0: 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74   (runs:pretty-st
5900: 72 69 6e 67 20 70 72 65 72 65 71 73 2d 6e 6f 74  ring prereqs-not
5910: 2d 6d 65 74 29 0a 09 09 09 09 20 20 20 22 5c 6e  -met).....   "\n
5920: 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 3a 20   non-completed: 
5930: 20 20 22 20 28 72 75 6e 73 3a 70 72 65 74 74 79    " (runs:pretty
5940: 2d 73 74 72 69 6e 67 20 6e 6f 6e 2d 63 6f 6d 70  -string non-comp
5950: 6c 65 74 65 64 29 20 0a 09 09 09 09 20 20 20 22  leted) .....   "
5960: 5c 6e 20 66 61 69 6c 73 3a 20 20 20 20 20 20 20  \n fails:       
5970: 20 20 20 20 22 20 28 72 75 6e 73 3a 70 72 65 74      " (runs:pret
5980: 74 79 2d 73 74 72 69 6e 67 20 66 61 69 6c 73 29  ty-string fails)
5990: 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73 74  .....   "\n test
59a0: 6d 6f 64 65 3a 20 20 20 20 20 20 20 20 22 20 74  mode:        " t
59b0: 65 73 74 6d 6f 64 65 0a 09 09 09 09 20 20 20 22  estmode.....   "
59c0: 5c 6e 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a 20  \n num-retries: 
59d0: 20 20 20 20 22 20 6e 75 6d 2d 72 65 74 72 69 65      " num-retrie
59e0: 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 65 71  s.....   "\n (eq
59f0: 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c  ? testmode 'topl
5a00: 65 76 65 6c 29 3a 20 22 20 28 65 71 3f 20 74 65  evel): " (eq? te
5a10: 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c  stmode 'toplevel
5a20: 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 6e 75  ).....   "\n (nu
5a30: 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65  ll? non-complete
5a40: 64 29 3a 20 20 20 20 22 20 28 6e 75 6c 6c 3f 20  d):    " (null? 
5a50: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 0a 09  non-completed)..
5a60: 09 09 09 20 20 20 22 5c 6e 20 72 65 72 75 6e 73  ...   "\n reruns
5a70: 3a 20 22 20 72 65 72 75 6e 73 29 0a 0a 09 09 20  : " reruns).... 
5a80: 20 20 20 20 20 28 63 6f 6e 64 20 3b 3b 20 49 4e       (cond ;; IN
5a90: 4e 45 52 20 43 4f 4e 44 20 23 32 0a 09 09 20 20  NER COND #2...  
5aa0: 20 20 20 20 20 28 28 6f 72 20 28 6e 75 6c 6c 3f       ((or (null?
5ab0: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
5ac0: 29 20 3b 3b 20 61 6c 6c 20 70 72 65 72 65 71 73  ) ;; all prereqs
5ad0: 20 6d 65 74 2c 20 66 69 72 65 20 6f 66 66 20 74   met, fire off t
5ae0: 68 65 20 74 65 73 74 0a 09 09 09 20 20 20 20 3b  he test....    ;
5af0: 3b 20 6f 72 2c 20 69 66 20 69 74 20 69 73 20 61  ; or, if it is a
5b00: 20 27 74 6f 70 6c 65 76 65 6c 20 74 65 73 74 20   'toplevel test 
5b10: 61 6e 64 20 61 6c 6c 20 70 72 65 72 65 71 73 20  and all prereqs 
5b20: 6e 6f 74 20 6d 65 74 20 61 72 65 20 43 4f 4d 50  not met are COMP
5b30: 4c 45 54 45 44 20 74 68 65 6e 20 6c 61 75 6e 63  LETED then launc
5b40: 68 0a 09 09 09 20 20 20 20 28 61 6e 64 20 28 65  h....    (and (e
5b50: 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70  q? testmode 'top
5b60: 6c 65 76 65 6c 29 0a 09 09 09 09 20 28 6e 75 6c  level)..... (nul
5b70: 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64  l? non-completed
5b80: 29 29 29 0a 09 09 09 28 6c 65 74 20 28 28 74 65  )))....(let ((te
5b90: 73 74 2d 6e 61 6d 65 20 28 74 65 73 74 73 3a 74  st-name (tests:t
5ba0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73  estqueue-get-tes
5bb0: 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72  tname test-recor
5bc0: 64 29 29 29 0a 09 09 09 20 20 28 73 65 74 65 6e  d)))....  (seten
5bd0: 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22  v "MT_TEST_NAME"
5be0: 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a   test-name) ;; .
5bf0: 09 09 09 20 20 28 73 65 74 65 6e 76 20 22 4d 54  ...  (setenv "MT
5c00: 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e  _RUNNAME"   runn
5c10: 61 6d 65 29 0a 09 09 09 20 20 28 6f 70 65 6e 2d  ame)....  (open-
5c20: 72 75 6e 2d 63 6c 6f 73 65 20 73 65 74 2d 6d 65  run-close set-me
5c30: 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20  gatest-env-vars 
5c40: 23 66 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68  #f run-id) ;; th
5c50: 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65  ese may be neede
5c60: 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69  d by the launchi
5c70: 6e 67 20 70 72 6f 63 65 73 73 0a 09 09 09 20 20  ng process....  
5c80: 28 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c 69 73  (let ((items-lis
5c90: 74 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65  t (items:get-ite
5ca0: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 74  ms-from-config t
5cb0: 63 6f 6e 66 69 67 29 29 29 0a 09 09 09 20 20 20  config)))....   
5cc0: 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d   (if (list? item
5cd0: 73 2d 6c 69 73 74 29 0a 09 09 09 09 28 62 65 67  s-list).....(beg
5ce0: 69 6e 0a 09 09 09 09 20 20 28 74 65 73 74 73 3a  in.....  (tests:
5cf0: 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74  testqueue-set-it
5d00: 65 6d 73 21 20 74 65 73 74 2d 72 65 63 6f 72 64  ems! test-record
5d10: 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09   items-list)....
5d20: 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70  .  (thread-sleep
5d30: 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a  ! *global-delta*
5d40: 29 0a 09 09 09 09 20 20 28 6c 6f 6f 70 20 68 65  ).....  (loop he
5d50: 64 20 74 61 6c 20 72 65 72 75 6e 73 29 29 0a 09  d tal reruns))..
5d60: 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20  ...(begin.....  
5d70: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
5d80: 45 52 52 4f 52 3a 20 54 68 65 20 70 72 6f 63 20  ERROR: The proc 
5d90: 66 72 6f 6d 20 72 65 61 64 69 6e 67 20 74 68 65  from reading the
5da0: 20 73 65 74 75 70 20 64 69 64 20 6e 6f 74 20 79   setup did not y
5db0: 69 65 6c 64 20 61 20 6c 69 73 74 20 2d 20 70 6c  ield a list - pl
5dc0: 65 61 73 65 20 72 65 70 6f 72 74 20 74 68 69 73  ease report this
5dd0: 22 29 0a 09 09 09 09 20 20 28 65 78 69 74 20 31  ").....  (exit 1
5de0: 29 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 20  ))))))...       
5df0: 28 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a 09  ((null? fails)..
5e00: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34  ..(debug:print 4
5e10: 20 22 49 4e 46 4f 3a 20 66 61 69 6c 73 20 69 73   "INFO: fails is
5e20: 20 6e 75 6c 6c 2c 20 6d 6f 76 69 6e 67 20 6f 6e   null, moving on
5e30: 20 69 6e 20 74 68 65 20 71 75 65 75 65 20 62 75   in the queue bu
5e40: 74 20 6b 65 65 70 69 6e 67 20 22 20 68 65 64 20  t keeping " hed 
5e50: 22 20 66 6f 72 20 6e 6f 77 22 29 0a 09 09 09 28  " for now")....(
5e60: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67  thread-sleep! *g
5e70: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09  lobal-delta*)...
5e80: 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74  .(loop (car newt
5e90: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20  al)(cdr newtal) 
5ea0: 72 65 72 75 6e 73 29 29 20 3b 3b 20 61 6e 20 69  reruns)) ;; an i
5eb0: 73 73 75 65 20 77 69 74 68 20 70 72 65 72 65 71  ssue with prereq
5ec0: 73 20 6e 6f 74 20 79 65 74 20 6d 65 74 3f 0a 09  s not yet met?..
5ed0: 09 20 20 20 20 20 20 20 28 28 61 6e 64 20 28 6e  .       ((and (n
5ee0: 6f 74 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29  ot (null? fails)
5ef0: 29 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27  )(eq? testmode '
5f00: 6e 6f 72 6d 61 6c 29 29 0a 09 09 09 28 64 65 62  normal))....(deb
5f10: 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f  ug:print 1 "INFO
5f20: 3a 20 74 65 73 74 20 22 20 20 68 65 64 20 22 20  : test "  hed " 
5f30: 28 6d 6f 64 65 3d 22 20 74 65 73 74 6d 6f 64 65  (mode=" testmode
5f40: 20 22 29 20 68 61 73 20 66 61 69 6c 65 64 20 70   ") has failed p
5f50: 72 65 72 65 71 75 69 73 69 74 65 28 73 29 3b 20  rerequisite(s); 
5f60: 22 0a 09 09 09 09 20 20 20 20 20 28 73 74 72 69  ".....     (stri
5f70: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28  ng-intersperse (
5f80: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 74 29 28  map (lambda (t)(
5f90: 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65  conc (db:test-ge
5fa0: 74 2d 74 65 73 74 6e 61 6d 65 20 74 29 20 22 3a  t-testname t) ":
5fb0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  " (db:test-get-s
5fc0: 74 61 74 65 20 74 29 22 2f 22 28 64 62 3a 74 65  tate t)"/"(db:te
5fd0: 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 29  st-get-status t)
5fe0: 29 29 20 66 61 69 6c 73 29 20 22 2c 20 22 29 0a  )) fails) ", ").
5ff0: 09 09 09 09 20 20 20 20 20 22 2c 20 72 65 6d 6f  ....     ", remo
6000: 76 69 6e 67 20 69 74 20 66 72 6f 6d 20 74 6f 2d  ving it from to-
6010: 64 6f 20 6c 69 73 74 22 29 0a 09 09 09 28 69 66  do list")....(if
6020: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c   (not (null? tal
6030: 29 29 0a 09 09 09 20 20 20 20 28 62 65 67 69 6e  ))....    (begin
6040: 0a 09 09 09 20 20 20 20 20 20 28 74 68 72 65 61  ....      (threa
6050: 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c  d-sleep! *global
6060: 2d 64 65 6c 74 61 2a 29 0a 09 09 09 20 20 20 20  -delta*)....    
6070: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c    (loop (car tal
6080: 29 28 63 64 72 20 74 61 6c 29 28 63 6f 6e 73 20  )(cdr tal)(cons 
6090: 68 65 64 20 72 65 72 75 6e 73 29 29 29 29 29 0a  hed reruns))))).
60a0: 09 09 20 20 20 20 20 20 20 28 65 6c 73 65 0a 09  ..       (else..
60b0: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 38  ..(debug:print 8
60c0: 20 22 45 52 52 4f 52 3a 20 4e 6f 20 68 61 6e 64   "ERROR: No hand
60d0: 6c 65 72 20 66 6f 72 20 74 68 69 73 20 63 6f 6e  ler for this con
60e0: 64 69 74 69 6f 6e 2e 22 29 0a 09 09 09 28 74 68  dition.")....(th
60f0: 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f  read-sleep! *glo
6100: 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09 28  bal-delta*)....(
6110: 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c  loop (car newtal
6120: 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65  )(cdr newtal) re
6130: 72 75 6e 73 29 29 29 29 20 3b 3b 20 45 4e 44 20  runs)))) ;; END 
6140: 4f 46 20 49 46 20 43 41 4e 20 52 55 4e 20 4d 4f  OF IF CAN RUN MO
6150: 52 45 0a 0a 09 09 20 20 20 20 3b 3b 20 69 66 20  RE....    ;; if 
6160: 63 61 6e 27 74 20 72 75 6e 20 6d 6f 72 65 20 6a  can't run more j
6170: 75 73 74 20 6c 6f 6f 70 20 77 69 74 68 20 6e 65  ust loop with ne
6180: 78 74 20 70 6f 73 73 69 62 6c 65 20 74 65 73 74  xt possible test
6190: 0a 09 09 20 20 20 20 28 62 65 67 69 6e 0a 09 09  ...    (begin...
61a0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
61b0: 6e 74 20 34 20 22 49 4e 46 4f 3a 20 70 72 6f 63  nt 4 "INFO: proc
61c0: 65 73 73 69 6e 67 20 74 68 65 20 63 61 73 65 20  essing the case 
61d0: 77 69 74 68 20 61 20 6c 61 6d 62 64 61 20 66 6f  with a lambda fo
61e0: 72 20 69 74 65 6d 73 20 6f 72 20 27 68 61 76 65  r items or 'have
61f0: 2d 70 72 6f 63 65 64 75 72 65 2e 20 4d 6f 76 69  -procedure. Movi
6200: 6e 67 20 74 68 72 6f 75 67 68 20 74 68 65 20 71  ng through the q
6210: 75 65 75 65 20 77 69 74 68 6f 75 74 20 64 72 6f  ueue without dro
6220: 70 70 69 6e 67 20 22 20 68 65 64 29 0a 09 09 20  pping " hed)... 
6230: 20 20 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65       (thread-sle
6240: 65 70 21 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c  ep! (+ 1 *global
6250: 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20  -delta*))...    
6260: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77    (loop (car new
6270: 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29  tal)(cdr newtal)
6280: 20 72 65 72 75 6e 73 29 29 29 29 29 20 3b 3b 20   reruns))))) ;; 
6290: 45 4e 44 20 4f 46 20 28 6f 72 20 28 70 72 6f 63  END OF (or (proc
62a0: 65 64 75 72 65 3f 20 69 74 65 6d 73 29 28 65 71  edure? items)(eq
62b0: 3f 20 69 74 65 6d 73 20 27 68 61 76 65 2d 70 72  ? items 'have-pr
62c0: 6f 63 65 64 75 72 65 29 29 0a 09 20 20 20 20 20  ocedure))..     
62d0: 0a 09 20 20 20 20 20 3b 3b 20 74 68 69 73 20 63  ..     ;; this c
62e0: 61 73 65 20 73 68 6f 75 6c 64 20 6e 6f 74 20 68  ase should not h
62f0: 61 70 70 65 6e 2c 20 61 64 64 65 64 20 74 6f 20  appen, added to 
6300: 68 65 6c 70 20 63 61 74 63 68 20 61 6e 79 20 62  help catch any b
6310: 75 67 73 0a 09 20 20 20 20 20 28 28 61 6e 64 20  ugs..     ((and 
6320: 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74  (list? items) it
6330: 65 6d 64 61 74 29 0a 09 20 20 20 20 20 20 28 64  emdat)..      (d
6340: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
6350: 52 4f 52 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20  ROR: Should not 
6360: 68 61 76 65 20 61 20 6c 69 73 74 20 6f 66 20 69  have a list of i
6370: 74 65 6d 73 20 69 6e 20 61 20 74 65 73 74 20 61  tems in a test a
6380: 6e 64 20 74 68 65 20 69 74 65 6d 73 70 61 74 68  nd the itemspath
6390: 20 73 65 74 20 2d 20 70 6c 65 61 73 65 20 72 65   set - please re
63a0: 70 6f 72 74 20 74 68 69 73 22 29 0a 09 20 20 20  port this")..   
63b0: 20 20 20 28 65 78 69 74 20 31 29 29 0a 09 20 20     (exit 1))..  
63c0: 20 20 20 28 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20     ((not (null? 
63d0: 72 65 72 75 6e 73 29 29 0a 09 20 20 20 20 20 20  reruns))..      
63e0: 28 6c 65 74 2a 20 28 28 6e 65 77 6c 73 74 20 28  (let* ((newlst (
63f0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74  open-run-close t
6400: 65 73 74 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d  ests:filter-non-
6410: 72 75 6e 6e 61 62 6c 65 20 23 66 20 72 75 6e 2d  runnable #f run-
6420: 69 64 20 74 61 6c 20 74 65 73 74 2d 72 65 63 6f  id tal test-reco
6430: 72 64 73 29 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f  rds)) ;; i.e. no
6440: 74 20 46 41 49 4c 2c 20 57 41 49 56 45 44 2c 20  t FAIL, WAIVED, 
6450: 49 4e 43 4f 4d 50 4c 45 54 45 2c 20 50 41 53 53  INCOMPLETE, PASS
6460: 2c 20 4b 49 4c 4c 45 44 2c 0a 09 09 20 20 20 20  , KILLED,...    
6470: 20 28 6a 75 6e 6b 65 64 20 28 6c 73 65 74 2d 64   (junked (lset-d
6480: 69 66 66 65 72 65 6e 63 65 20 65 71 75 61 6c 3f  ifference equal?
6490: 20 74 61 6c 20 6e 65 77 6c 73 74 29 29 29 0a 09   tal newlst)))..
64a0: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20  .(debug:print 4 
64b0: 22 49 4e 46 4f 3a 20 66 75 6c 6c 20 64 72 6f 70  "INFO: full drop
64c0: 20 74 68 72 6f 75 67 68 2c 20 69 66 20 72 65 72   through, if rer
64d0: 75 6e 73 20 69 73 20 6c 65 73 73 20 74 68 61 6e  uns is less than
64e0: 20 31 30 30 20 77 65 20 77 69 6c 6c 20 66 6f 72   100 we will for
64f0: 63 65 20 72 65 74 72 79 20 74 68 65 6d 2c 20 72  ce retry them, r
6500: 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 20 22  eruns=" reruns "
6510: 2c 20 74 61 6c 3d 22 20 74 61 6c 29 0a 09 09 28  , tal=" tal)...(
6520: 69 66 20 28 3c 20 6e 75 6d 2d 72 65 74 72 69 65  if (< num-retrie
6530: 73 20 6d 61 78 2d 72 65 74 72 69 65 73 29 0a 09  s max-retries)..
6540: 09 20 20 20 20 28 73 65 74 21 20 6e 65 77 6c 73  .    (set! newls
6550: 74 20 28 61 70 70 65 6e 64 20 72 65 72 75 6e 73  t (append reruns
6560: 20 6e 65 77 6c 73 74 29 29 29 0a 09 09 28 73 65   newlst)))...(se
6570: 74 21 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 28  t! num-retries (
6580: 2b 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 31 29  + num-retries 1)
6590: 29 0a 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65  )...(thread-slee
65a0: 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61  p! *global-delta
65b0: 2a 29 0a 09 09 28 69 66 20 28 6e 6f 74 20 28 6e  *)...(if (not (n
65c0: 75 6c 6c 3f 20 6e 65 77 6c 73 74 29 29 0a 09 09  ull? newlst))...
65d0: 20 20 20 20 3b 3b 20 73 69 6e 63 65 20 72 65 72      ;; since rer
65e0: 75 6e 73 20 68 61 76 65 20 62 65 65 6e 20 74 61  uns have been ta
65f0: 63 6b 65 64 20 6f 6e 20 74 6f 20 6e 65 77 6c 73  cked on to newls
6600: 74 20 63 72 65 61 74 65 20 6e 65 77 20 72 65 72  t create new rer
6610: 75 6e 73 20 66 72 6f 6d 20 6a 75 6e 6b 65 64 0a  uns from junked.
6620: 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72  ..    (loop (car
6630: 20 6e 65 77 6c 73 74 29 28 63 64 72 20 6e 65 77   newlst)(cdr new
6640: 6c 73 74 29 28 64 65 6c 65 74 65 2d 64 75 70 6c  lst)(delete-dupl
6650: 69 63 61 74 65 73 20 6a 75 6e 6b 65 64 29 29 29  icates junked)))
6660: 29 29 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 28  ))..     ((not (
6670: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 20 20 20  null? tal))..   
6680: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
6690: 34 20 22 49 4e 46 4f 3a 20 49 27 6d 20 70 72 65  4 "INFO: I'm pre
66a0: 74 74 79 20 73 75 72 65 20 49 20 73 68 6f 75 6c  tty sure I shoul
66b0: 64 6e 27 74 20 67 65 74 20 68 65 72 65 2e 22 29  dn't get here.")
66c0: 29 0a 09 20 20 20 20 20 28 65 6c 73 65 0a 09 20  )..     (else.. 
66d0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
66e0: 74 20 34 20 22 49 4e 46 4f 3a 20 45 78 69 74 69  t 4 "INFO: Exiti
66f0: 6e 67 20 6c 6f 6f 70 20 77 69 74 68 2e 2e 2e 5c  ng loop with...\
6700: 6e 20 20 68 65 64 3d 22 20 68 65 64 20 22 5c 6e  n  hed=" hed "\n
6710: 20 20 74 61 6c 3d 22 20 74 61 6c 20 22 5c 6e 20    tal=" tal "\n 
6720: 20 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73   reruns=" reruns
6730: 29 29 0a 09 20 20 20 20 20 29 29 29 29 20 3b 3b  ))..     )))) ;;
6740: 20 4c 45 54 2a 20 28 28 74 65 73 74 2d 72 65 63   LET* ((test-rec
6750: 6f 72 64 0a 0a 20 20 20 20 3b 3b 20 77 65 20 67  ord..    ;; we g
6760: 65 74 20 68 65 72 65 20 6f 6e 20 22 64 72 6f 70  et here on "drop
6770: 20 74 68 72 6f 75 67 68 22 20 2d 20 6c 6f 6f 70   through" - loop
6780: 20 66 6f 72 20 6e 65 78 74 20 74 65 73 74 20 69   for next test i
6790: 6e 20 71 75 65 75 65 0a 20 20 20 20 3b 3b 20 46  n queue.    ;; F
67a0: 49 58 4d 45 21 21 21 21 20 54 48 49 53 20 53 48  IXME!!!! THIS SH
67b0: 4f 55 4c 44 20 4e 4f 54 20 52 45 51 55 49 52 45  OULD NOT REQUIRE
67c0: 20 41 4e 20 45 58 49 54 21 21 21 21 21 21 21 0a   AN EXIT!!!!!!!.
67d0: 20 20 20 20 0a 20 20 20 20 28 64 65 62 75 67 3a      .    (debug:
67e0: 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41  print 1 "INFO: A
67f0: 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e 63 68 65  ll tests launche
6800: 64 22 29 0a 20 20 20 20 28 74 68 72 65 61 64 2d  d").    (thread-
6810: 73 6c 65 65 70 21 20 30 2e 35 29 0a 20 20 20 20  sleep! 0.5).    
6820: 3b 3b 20 46 49 58 4d 45 21 20 54 68 69 73 20 68  ;; FIXME! This h
6830: 61 72 73 68 20 65 78 69 74 20 73 68 6f 75 6c 64  arsh exit should
6840: 20 6e 6f 74 20 62 65 20 6e 65 63 65 73 73 61 72   not be necessar
6850: 79 2e 2e 2e 2e 0a 20 20 20 20 3b 3b 20 28 69 66  y.....    ;; (if
6860: 20 28 6e 6f 74 20 2a 72 75 6e 72 65 6d 6f 74 65   (not *runremote
6870: 2a 29 28 65 78 69 74 29 29 20 3b 3b 20 0a 20 20  *)(exit)) ;; .  
6880: 20 20 23 66 29 29 20 3b 3b 20 72 65 74 75 72 6e    #f)) ;; return
6890: 20 61 20 23 66 20 61 73 20 61 20 68 69 6e 74 20   a #f as a hint 
68a0: 74 68 61 74 20 77 65 20 61 72 65 20 64 6f 6e 65  that we are done
68b0: 0a 20 20 3b 3b 20 48 65 72 65 20 77 65 20 6e 65  .  ;; Here we ne
68c0: 65 64 20 74 6f 20 63 68 65 63 6b 20 74 68 61 74  ed to check that
68d0: 20 61 6c 6c 20 74 68 65 20 74 65 73 74 73 20 72   all the tests r
68e0: 65 6d 61 69 6e 69 6e 67 20 74 6f 20 62 65 20 72  emaining to be r
68f0: 75 6e 20 61 72 65 20 65 6c 69 67 69 62 6c 65 20  un are eligible 
6900: 74 6f 20 72 75 6e 0a 20 20 3b 3b 20 61 6e 64 20  to run.  ;; and 
6910: 61 72 65 20 6e 6f 74 20 62 6c 6f 63 6b 65 64 20  are not blocked 
6920: 62 79 20 66 61 69 6c 65 64 0a 20 20 0a 0a 3b 3b  by failed.  ..;;
6930: 20 70 61 72 65 6e 74 2d 74 65 73 74 20 69 73 20   parent-test is 
6940: 74 68 65 72 65 20 61 73 20 61 20 70 6c 61 63 65  there as a place
6950: 68 6f 6c 64 65 72 20 66 6f 72 20 77 68 65 6e 20  holder for when 
6960: 70 61 72 65 6e 74 2d 74 65 73 74 73 20 63 61 6e  parent-tests can
6970: 20 62 65 20 72 75 6e 20 61 73 20 61 20 73 65 74   be run as a set
6980: 75 70 20 73 74 65 70 0a 28 64 65 66 69 6e 65 20  up step.(define 
6990: 28 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d 69 64  (run:test run-id
69a0: 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c   runname keyvall
69b0: 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66  st test-record f
69c0: 6c 61 67 73 20 70 61 72 65 6e 74 2d 74 65 73 74  lags parent-test
69d0: 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65  ).  ;; All these
69e0: 20 76 61 72 73 20 6d 69 67 68 74 20 62 65 20 72   vars might be r
69f0: 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65  eferenced by the
6a00: 20 74 65 73 74 63 6f 6e 66 69 67 20 66 69 6c 65   testconfig file
6a10: 20 72 65 61 64 65 72 0a 20 20 28 6c 65 74 2a 20   reader.  (let* 
6a20: 28 28 74 65 73 74 2d 6e 61 6d 65 20 20 20 20 28  ((test-name    (
6a30: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
6a40: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74  get-testname   t
6a50: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28  est-record)).. (
6a60: 74 65 73 74 2d 77 61 69 74 6f 6e 73 20 28 74 65  test-waitons (te
6a70: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
6a80: 74 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73  t-waitons    tes
6a90: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65  t-record)).. (te
6aa0: 73 74 2d 63 6f 6e 66 20 20 20 20 28 74 65 73 74  st-conf    (test
6ab0: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d  s:testqueue-get-
6ac0: 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d  testconfig test-
6ad0: 72 65 63 6f 72 64 29 29 0a 09 20 28 69 74 65 6d  record)).. (item
6ae0: 64 61 74 20 20 20 20 20 20 28 74 65 73 74 73 3a  dat      (tests:
6af0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74  testqueue-get-it
6b00: 65 6d 64 61 74 20 20 20 20 74 65 73 74 2d 72 65  emdat    test-re
6b10: 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 70  cord)).. (test-p
6b20: 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f  ath    (conc *to
6b30: 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22  ppath* "/tests/"
6b40: 20 74 65 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20   test-name)) ;; 
6b50: 63 6f 75 6c 64 20 75 73 65 20 74 65 73 74 73 3a  could use tests:
6b60: 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68  get-testconfig h
6b70: 65 72 65 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65  ere ..... (force
6b80: 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61          (hash-ta
6b90: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
6ba0: 66 6c 61 67 73 20 22 2d 66 6f 72 63 65 22 20 23  flags "-force" #
6bb0: 66 29 29 0a 09 20 28 72 65 72 75 6e 20 20 20 20  f)).. (rerun    
6bc0: 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d      (hash-table-
6bd0: 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67  ref/default flag
6be0: 73 20 22 2d 72 65 72 75 6e 22 20 23 66 29 29 0a  s "-rerun" #f)).
6bf0: 09 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 20  . (keepgoing    
6c00: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
6c10: 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d  default flags "-
6c20: 6b 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a  keepgoing" #f)).
6c30: 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 20  . (item-path    
6c40: 20 22 22 29 0a 09 20 28 64 62 20 20 20 20 20 20   "").. (db      
6c50: 20 20 20 20 20 23 66 29 29 0a 20 20 20 20 28 64       #f)).    (d
6c60: 65 62 75 67 3a 70 72 69 6e 74 20 34 0a 09 09 20  ebug:print 4... 
6c70: 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20 22 20  "test-config: " 
6c80: 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69  (hash-table->ali
6c90: 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a 09 09  st test-conf)...
6ca0: 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 74 3a 20   "\n   itemdat: 
6cb0: 22 20 69 74 65 6d 64 61 74 0a 09 09 20 29 0a 20  " itemdat... ). 
6cc0: 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 20 69 74     ;; setting it
6cd0: 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 73 74 20  emdat to a list 
6ce0: 69 66 20 69 74 20 69 73 20 23 66 0a 20 20 20 20  if it is #f.    
6cf0: 28 69 66 20 28 6e 6f 74 20 69 74 65 6d 64 61 74  (if (not itemdat
6d00: 29 28 73 65 74 21 20 69 74 65 6d 64 61 74 20 27  )(set! itemdat '
6d10: 28 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 69  ())).    (set! i
6d20: 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c  tem-path (item-l
6d30: 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61  ist->path itemda
6d40: 74 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  t)).    (debug:p
6d50: 72 69 6e 74 20 32 20 22 41 74 74 65 6d 70 74 69  rint 2 "Attempti
6d60: 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73  ng to launch tes
6d70: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 28 69  t " test-name (i
6d80: 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70  f (equal? item-p
6d90: 61 74 68 20 22 2f 22 29 20 22 2f 22 20 69 74 65  ath "/") "/" ite
6da0: 6d 2d 70 61 74 68 29 29 0a 20 20 20 20 28 73 65  m-path)).    (se
6db0: 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41  tenv "MT_TEST_NA
6dc0: 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b  ME" test-name) ;
6dd0: 3b 20 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22  ; .    (setenv "
6de0: 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75  MT_RUNNAME"   ru
6df0: 6e 6e 61 6d 65 29 0a 20 20 20 20 28 6f 70 65 6e  nname).    (open
6e00: 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 74 2d 6d  -run-close set-m
6e10: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73  egatest-env-vars
6e20: 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74   db run-id) ;; t
6e30: 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64  hese may be need
6e40: 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68  ed by the launch
6e50: 69 6e 67 20 70 72 6f 63 65 73 73 0a 20 20 20 20  ing process.    
6e60: 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72  (change-director
6e70: 79 20 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20  y *toppath*)..  
6e80: 20 20 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65    ;; Here is whe
6e90: 72 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61  re the test_meta
6ea0: 20 74 61 62 6c 65 20 69 73 20 62 65 73 74 20 75   table is best u
6eb0: 70 64 61 74 65 64 0a 20 20 20 20 3b 3b 20 59 65  pdated.    ;; Ye
6ec0: 73 2c 20 61 6e 6f 74 68 65 72 20 75 73 65 20 6f  s, another use o
6ed0: 66 20 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20 63  f a global for c
6ee0: 61 63 68 69 6e 67 2e 20 4e 65 65 64 20 61 20 62  aching. Need a b
6ef0: 65 74 74 65 72 20 77 61 79 3f 0a 20 20 20 20 28  etter way?.    (
6f00: 69 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61  if (not (hash-ta
6f10: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
6f20: 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74  *test-meta-updat
6f30: 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 66  ed* test-name #f
6f40: 29 29 0a 20 20 20 20 20 20 20 20 28 62 65 67 69  )).        (begi
6f50: 6e 0a 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c  n..   (hash-tabl
6f60: 65 2d 73 65 74 21 20 2a 74 65 73 74 2d 6d 65 74  e-set! *test-met
6f70: 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d  a-updated* test-
6f80: 6e 61 6d 65 20 23 74 29 0a 20 20 20 20 20 20 20  name #t).       
6f90: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
6fa0: 6f 73 65 20 72 75 6e 73 3a 75 70 64 61 74 65 2d  ose runs:update-
6fb0: 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73  test_meta db tes
6fc0: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66  t-name test-conf
6fd0: 29 29 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20  ))).    .    ;; 
6fe0: 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61 74  (lambda (itemdat
6ff0: 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 73  ) ;;; ((ripeness
7000: 20 22 6f 76 65 72 72 69 70 65 22 29 20 28 74 65   "overripe") (te
7010: 6d 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c 22  mperature "cool"
7020: 29 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d 65  ) (season "summe
7030: 72 22 29 29 0a 20 20 20 20 28 6c 65 74 2a 20 28  r")).    (let* (
7040: 28 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20 28  (new-test-path (
7050: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72  string-intersper
7060: 73 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 61  se (cons test-pa
7070: 74 68 20 28 6d 61 70 20 63 61 64 72 20 69 74 65  th (map cadr ite
7080: 6d 64 61 74 29 29 20 22 2f 22 29 29 0a 09 20 20  mdat)) "/"))..  
7090: 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20   (new-test-name 
70a0: 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d  (if (equal? item
70b0: 2d 70 61 74 68 20 22 22 29 20 74 65 73 74 2d 6e  -path "") test-n
70c0: 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e  ame (conc test-n
70d0: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
70e0: 68 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65  h))) ;; just nee
70f0: 64 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71 75  d it to be uniqu
7100: 65 0a 09 20 20 20 28 74 65 73 74 2d 69 64 20 20  e..   (test-id  
7110: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
7120: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74  lose db:get-test
7130: 2d 69 64 20 64 62 20 20 72 75 6e 2d 69 64 20 74  -id db  run-id t
7140: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61  est-name item-pa
7150: 74 68 29 29 0a 09 20 20 20 28 74 65 73 74 64 61  th))..   (testda
7160: 74 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75  t       (open-ru
7170: 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74  n-close db:get-t
7180: 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 64  est-info-by-id d
7190: 62 20 74 65 73 74 2d 69 64 29 29 29 0a 20 20 20  b test-id))).   
71a0: 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74     (if (not test
71b0: 64 61 74 29 0a 09 20 20 28 62 65 67 69 6e 0a 09  dat)..  (begin..
71c0: 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 20 74 68      ;; ensure th
71d0: 61 74 20 74 68 65 20 70 61 74 68 20 65 78 69 73  at the path exis
71e0: 74 73 20 62 65 66 6f 72 65 20 72 65 67 69 73 74  ts before regist
71f0: 65 72 69 6e 67 20 74 68 65 20 74 65 73 74 0a 09  ering the test..
7200: 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43 61 6e      ;; NOPE: Can
7210: 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f 77 20  not! Don't know 
7220: 79 65 74 20 77 68 69 63 68 20 64 69 73 6b 20 61  yet which disk a
7230: 72 65 61 20 77 69 6c 6c 20 62 65 20 61 73 73 69  rea will be assi
7240: 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20 3b 3b  gned......    ;;
7250: 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22   (system (conc "
7260: 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77 2d 74  mkdir -p " new-t
7270: 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20 20 20  est-path))..    
7280: 3b 3b 0a 09 20 20 20 20 3b 3b 20 28 6f 70 65 6e  ;;..    ;; (open
7290: 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73 74 73  -run-close tests
72a0: 3a 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 64  :register-test d
72b0: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61  b run-id test-na
72c0: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20  me item-path).. 
72d0: 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 4e 42     ;;..    ;; NB
72e0: 2f 2f 20 66 6f 72 20 74 68 65 20 61 62 6f 76 65  // for the above
72f0: 20 6c 69 6e 65 2e 20 49 20 77 61 6e 74 20 74 68   line. I want th
7300: 65 20 74 65 73 74 20 74 6f 20 62 65 20 72 65 67  e test to be reg
7310: 69 73 74 65 72 65 64 20 6c 6f 6e 67 20 62 65 66  istered long bef
7320: 6f 72 65 20 74 68 69 73 20 72 6f 75 74 69 6e 65  ore this routine
7330: 20 67 65 74 73 20 63 61 6c 6c 65 64 21 0a 09 20   gets called!.. 
7340: 20 20 20 3b 3b 0a 09 20 20 20 20 28 73 65 74 21     ;;..    (set!
7350: 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e 2d 72   test-id (open-r
7360: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d  un-close db:get-
7370: 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e 2d 69  test-id db run-i
7380: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  d test-name item
7390: 2d 70 61 74 68 29 29 0a 09 20 20 20 20 28 69 66  -path))..    (if
73a0: 20 28 6e 6f 74 20 74 65 73 74 2d 69 64 29 0a 09   (not test-id)..
73b0: 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62  .(begin...  (deb
73c0: 75 67 3a 70 72 69 6e 74 20 32 20 22 57 41 52 4e  ug:print 2 "WARN
73d0: 3a 20 54 65 73 74 20 6e 6f 74 20 70 72 65 2d 63  : Test not pre-c
73e0: 72 65 61 74 65 64 3f 20 74 65 73 74 2d 6e 61 6d  reated? test-nam
73f0: 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2c  e=" test-name ",
7400: 20 69 74 65 6d 2d 70 61 74 68 3d 22 20 69 74 65   item-path=" ite
7410: 6d 2d 70 61 74 68 20 22 2c 20 72 75 6e 2d 69 64  m-path ", run-id
7420: 3d 22 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 28  =" run-id)...  (
7430: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
7440: 62 3a 74 65 73 74 73 2d 72 65 67 69 73 74 65 72  b:tests-register
7450: 2d 74 65 73 74 20 23 66 20 72 75 6e 2d 69 64 20  -test #f run-id 
7460: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70  test-name item-p
7470: 61 74 68 29 0a 09 09 20 20 28 73 65 74 21 20 74  ath)...  (set! t
7480: 65 73 74 2d 69 64 20 28 6f 70 65 6e 2d 72 75 6e  est-id (open-run
7490: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65  -close db:get-te
74a0: 73 74 2d 69 64 20 64 62 20 72 75 6e 2d 69 64 20  st-id db run-id 
74b0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70  test-name item-p
74c0: 61 74 68 29 29 29 29 0a 09 20 20 20 20 28 64 65  ath))))..    (de
74d0: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46  bug:print 4 "INF
74e0: 4f 3a 20 74 65 73 74 2d 69 64 3d 22 20 74 65 73  O: test-id=" tes
74f0: 74 2d 69 64 20 22 2c 20 72 75 6e 2d 69 64 3d 22  t-id ", run-id="
7500: 20 72 75 6e 2d 69 64 20 22 2c 20 74 65 73 74 2d   run-id ", test-
7510: 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65  name=" test-name
7520: 20 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d 5c 22   ", item-path=\"
7530: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 5c 22 22  " item-path "\""
7540: 29 0a 09 20 20 20 20 28 73 65 74 21 20 74 65 73  )..    (set! tes
7550: 74 64 61 74 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  tdat (open-run-c
7560: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74  lose db:get-test
7570: 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 64 62 20 74  -info-by-id db t
7580: 65 73 74 2d 69 64 29 29 29 29 0a 20 20 20 20 20  est-id)))).     
7590: 20 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 28   (set! test-id (
75a0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
75b0: 65 73 74 64 61 74 29 29 0a 20 20 20 20 20 20 28  estdat)).      (
75c0: 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79  change-directory
75d0: 20 74 65 73 74 2d 70 61 74 68 29 0a 20 20 20 20   test-path).    
75e0: 20 20 28 63 61 73 65 20 28 69 66 20 66 6f 72 63    (case (if forc
75f0: 65 20 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d 61  e ;; (args:get-a
7600: 72 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 27  rg "-force")...'
7610: 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09 09 28 69  NOT_STARTED...(i
7620: 66 20 74 65 73 74 64 61 74 0a 09 09 20 20 20 20  f testdat...    
7630: 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20  (string->symbol 
7640: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
7650: 74 65 73 74 64 61 74 29 29 0a 09 09 20 20 20 20  testdat))...    
7660: 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72  'failed-to-inser
7670: 74 29 29 0a 09 28 28 66 61 69 6c 65 64 2d 74 6f  t))..((failed-to
7680: 2d 69 6e 73 65 72 74 29 0a 09 20 28 64 65 62 75  -insert).. (debu
7690: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
76a0: 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 65  : Failed to inse
76b0: 72 74 20 74 68 65 20 72 65 63 6f 72 64 20 69 6e  rt the record in
76c0: 74 6f 20 74 68 65 20 64 62 22 29 29 0a 09 28 28  to the db"))..((
76d0: 4e 4f 54 5f 53 54 41 52 54 45 44 20 43 4f 4d 50  NOT_STARTED COMP
76e0: 4c 45 54 45 44 20 44 45 4c 45 54 45 44 29 0a 09  LETED DELETED)..
76f0: 20 28 6c 65 74 20 28 28 72 75 6e 66 6c 61 67 20   (let ((runflag 
7700: 23 66 29 29 0a 09 20 20 20 28 63 6f 6e 64 0a 09  #f))..   (cond..
7710: 20 20 20 20 3b 3b 20 2d 66 6f 72 63 65 2c 20 72      ;; -force, r
7720: 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61  un no matter wha
7730: 74 0a 09 20 20 20 20 28 66 6f 72 63 65 20 28 73  t..    (force (s
7740: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29  et! runflag #t))
7750: 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 5f 53 54 41  ..    ;; NOT_STA
7760: 52 54 45 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 74  RTED, run no mat
7770: 74 65 72 20 77 68 61 74 0a 09 20 20 20 20 28 28  ter what..    ((
7780: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74  member (test:get
7790: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20  -state testdat) 
77a0: 27 28 22 44 45 4c 45 54 45 44 22 20 22 4e 4f 54  '("DELETED" "NOT
77b0: 5f 53 54 41 52 54 45 44 22 29 29 28 73 65 74 21  _STARTED"))(set!
77c0: 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20   runflag #t)).. 
77d0: 20 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e     ;; not -rerun
77e0: 20 61 6e 64 20 50 41 53 53 2c 20 57 41 52 4e 20   and PASS, WARN 
77f0: 6f 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20  or CHECK, do no 
7800: 72 75 6e 0a 09 20 20 20 20 28 28 61 6e 64 20 28  run..    ((and (
7810: 6f 72 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09  or (not rerun)..
7820: 09 20 20 20 20 20 20 6b 65 65 70 67 6f 69 6e 67  .      keepgoing
7830: 29 0a 09 09 20 20 3b 3b 20 52 65 71 75 69 72 65  )...  ;; Require
7840: 20 74 6f 20 66 6f 72 63 65 20 72 65 2d 72 75 6e   to force re-run
7850: 20 66 6f 72 20 43 4f 4d 50 4c 45 54 45 44 20 6f   for COMPLETED o
7860: 72 20 2a 61 6e 79 74 68 69 6e 67 2a 20 2b 20 50  r *anything* + P
7870: 41 53 53 2c 57 41 52 4e 20 6f 72 20 43 48 45 43  ASS,WARN or CHEC
7880: 4b 0a 09 09 20 20 28 6f 72 20 28 6d 65 6d 62 65  K...  (or (membe
7890: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  r (test:get-stat
78a0: 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 50  us testdat) '("P
78b0: 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 45  ASS" "WARN" "CHE
78c0: 43 4b 22 29 29 0a 09 09 20 20 20 20 20 20 28 6d  CK"))...      (m
78d0: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d  ember (test:get-
78e0: 73 74 61 74 65 20 20 74 65 73 74 64 61 74 29 20  state  testdat) 
78f0: 27 28 22 43 4f 4d 50 4c 45 54 45 44 22 29 29 29  '("COMPLETED")))
7900: 29 20 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a  ) ..     (debug:
7910: 70 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20 72  print 2 "INFO: r
7920: 75 6e 6e 69 6e 67 20 74 65 73 74 20 22 20 74 65  unning test " te
7930: 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d  st-name "/" item
7940: 2d 70 61 74 68 20 22 20 73 75 70 70 72 65 73 73  -path " suppress
7950: 65 64 20 61 73 20 69 74 20 69 73 20 22 20 28 74  ed as it is " (t
7960: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65  est:get-state te
7970: 73 74 64 61 74 29 20 22 20 61 6e 64 20 22 20 28  stdat) " and " (
7980: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
7990: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20  testdat))..     
79a0: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66  (set! runflag #f
79b0: 29 29 0a 09 20 20 20 20 3b 3b 20 2d 72 65 72 75  ))..    ;; -reru
79c0: 6e 20 61 6e 64 20 73 74 61 74 75 73 20 69 73 20  n and status is 
79d0: 6f 6e 65 20 6f 66 20 74 68 65 20 73 70 65 63 69  one of the speci
79e0: 66 65 64 2c 20 72 75 6e 20 69 74 0a 09 20 20 20  fed, run it..   
79f0: 20 28 28 61 6e 64 20 72 65 72 75 6e 0a 09 09 20   ((and rerun... 
7a00: 20 28 6c 65 74 2a 20 28 28 72 65 72 75 6e 6c 73   (let* ((rerunls
7a10: 74 20 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69  t   (string-spli
7a20: 74 20 72 65 72 75 6e 20 22 2c 22 29 29 0a 09 09  t rerun ","))...
7a30: 09 20 28 6d 75 73 74 2d 72 65 72 75 6e 20 28 6d  . (must-rerun (m
7a40: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d  ember (test:get-
7a50: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20  status testdat) 
7a60: 72 65 72 75 6e 6c 73 74 29 29 29 0a 09 09 20 20  rerunlst)))...  
7a70: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33    (debug:print 3
7a80: 20 22 49 4e 46 4f 3a 20 2d 72 65 72 75 6e 20 6c   "INFO: -rerun l
7a90: 69 73 74 3a 20 22 20 72 65 72 75 6e 20 22 2c 20  ist: " rerun ", 
7aa0: 74 65 73 74 2d 73 74 61 74 75 73 3a 20 22 20 28  test-status: " (
7ab0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
7ac0: 74 65 73 74 64 61 74 29 22 2c 20 6d 75 73 74 2d  testdat)", must-
7ad0: 72 65 72 75 6e 3a 20 22 20 6d 75 73 74 2d 72 65  rerun: " must-re
7ae0: 72 75 6e 29 0a 09 09 20 20 20 20 6d 75 73 74 2d  run)...    must-
7af0: 72 65 72 75 6e 29 29 0a 09 20 20 20 20 20 28 64  rerun))..     (d
7b00: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 49 4e  ebug:print 2 "IN
7b10: 46 4f 3a 20 52 65 72 75 6e 20 66 6f 72 63 65 64  FO: Rerun forced
7b20: 20 66 6f 72 20 74 65 73 74 20 22 20 74 65 73 74   for test " test
7b30: 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70  -name "/" item-p
7b40: 61 74 68 29 0a 09 20 20 20 20 20 28 73 65 74 21  ath)..     (set!
7b50: 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20   runflag #t)).. 
7b60: 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67     ;; -keepgoing
7b70: 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75 6e 20 46  , do not rerun F
7b80: 41 49 4c 0a 09 20 20 20 20 28 28 61 6e 64 20 6b  AIL..    ((and k
7b90: 65 65 70 67 6f 69 6e 67 0a 09 09 20 20 28 6d 65  eepgoing...  (me
7ba0: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73  mber (test:get-s
7bb0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27  tatus testdat) '
7bc0: 28 22 46 41 49 4c 22 29 29 29 0a 09 20 20 20 20  ("FAIL")))..    
7bd0: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23   (set! runflag #
7be0: 66 29 29 0a 09 20 20 20 20 28 28 61 6e 64 20 28  f))..    ((and (
7bf0: 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 28  not rerun)...  (
7c00: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74  member (test:get
7c10: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
7c20: 20 27 28 22 46 41 49 4c 22 20 22 6e 2f 61 22 29   '("FAIL" "n/a")
7c30: 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72  ))..     (set! r
7c40: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20  unflag #t))..   
7c50: 20 28 65 6c 73 65 20 28 73 65 74 21 20 72 75 6e   (else (set! run
7c60: 66 6c 61 67 20 23 66 29 29 29 0a 09 20 20 20 28  flag #f)))..   (
7c70: 64 65 62 75 67 3a 70 72 69 6e 74 20 36 20 22 52  debug:print 6 "R
7c80: 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e 66 6c 61  UNNING => runfla
7c90: 67 3a 20 22 20 72 75 6e 66 6c 61 67 20 22 20 53  g: " runflag " S
7ca0: 54 41 54 45 3a 20 22 20 28 74 65 73 74 3a 67 65  TATE: " (test:ge
7cb0: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29  t-state testdat)
7cc0: 20 22 20 53 54 41 54 55 53 3a 20 22 20 28 74 65   " STATUS: " (te
7cd0: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
7ce0: 73 74 64 61 74 29 29 0a 09 20 20 20 28 69 66 20  stdat))..   (if 
7cf0: 28 6e 6f 74 20 72 75 6e 66 6c 61 67 29 0a 09 20  (not runflag).. 
7d00: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 70        (if (not p
7d10: 61 72 65 6e 74 2d 74 65 73 74 29 0a 09 09 20 20  arent-test)...  
7d20: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
7d30: 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 61 72 74  "NOTE: Not start
7d40: 69 6e 67 20 74 65 73 74 20 22 20 6e 65 77 2d 74  ing test " new-t
7d50: 65 73 74 2d 6e 61 6d 65 20 22 20 61 73 20 69 74  est-name " as it
7d60: 20 69 73 20 73 74 61 74 65 20 5c 22 22 20 28 74   is state \"" (t
7d70: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65  est:get-state te
7d80: 73 74 64 61 74 29 20 0a 09 09 09 09 22 5c 22 20  stdat) ....."\" 
7d90: 61 6e 64 20 73 74 61 74 75 73 20 5c 22 22 20 28  and status \"" (
7da0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
7db0: 74 65 73 74 64 61 74 29 20 22 5c 22 2c 20 75 73  testdat) "\", us
7dc0: 65 20 2d 72 65 72 75 6e 20 5c 22 22 20 28 74 65  e -rerun \"" (te
7dd0: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
7de0: 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 20 20  stdat).         
7df0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
7e00: 20 20 20 20 20 20 20 22 5c 22 20 6f 72 20 2d 66         "\" or -f
7e10: 6f 72 63 65 20 74 6f 20 6f 76 65 72 72 69 64 65  orce to override
7e20: 22 29 29 0a 09 20 20 20 20 20 20 20 3b 3b 20 4e  "))..       ;; N
7e30: 4f 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 72 20 62  OTE: No longer b
7e40: 65 20 63 68 65 63 6b 69 6e 67 20 70 72 65 72 65  e checking prere
7e50: 71 75 69 73 69 74 65 73 20 68 65 72 65 21 20 57  quisites here! W
7e60: 69 6c 6c 20 6e 65 76 65 72 20 67 65 74 20 68 65  ill never get he
7e70: 72 65 20 75 6e 6c 65 73 73 20 70 72 65 72 65 71  re unless prereq
7e80: 73 20 61 72 65 0a 09 20 20 20 20 20 20 20 3b 3b  s are..       ;;
7e90: 20 20 20 20 20 20 20 61 6c 72 65 61 64 79 20 6d         already m
7ea0: 65 74 2e 0a 09 20 20 20 20 20 20 20 28 69 66 20  et...       (if 
7eb0: 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d 74 65 73  (not (launch-tes
7ec0: 74 20 23 66 20 72 75 6e 2d 69 64 20 72 75 6e 6e  t #f run-id runn
7ed0: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65  ame test-conf ke
7ee0: 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d  yvallst test-nam
7ef0: 65 20 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d  e test-path item
7f00: 64 61 74 20 66 6c 61 67 73 29 29 0a 09 09 20 20  dat flags))...  
7f10: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28   (begin...     (
7f20: 70 72 69 6e 74 20 22 45 52 52 4f 52 3a 20 46 61  print "ERROR: Fa
7f30: 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74  iled to launch t
7f40: 68 65 20 74 65 73 74 2e 20 45 78 69 74 69 6e 67  he test. Exiting
7f50: 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73   as soon as poss
7f60: 69 62 6c 65 22 29 0a 09 09 20 20 20 20 20 28 73  ible")...     (s
7f70: 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73  et! *globalexits
7f80: 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09  tatus* 1) ;; ...
7f90: 20 20 20 20 20 28 70 72 6f 63 65 73 73 2d 73 69       (process-si
7fa0: 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d 70 72  gnal (current-pr
7fb0: 6f 63 65 73 73 2d 69 64 29 20 73 69 67 6e 61 6c  ocess-id) signal
7fc0: 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09 28 28 4b  /kill))))))..((K
7fd0: 49 4c 4c 45 44 29 20 0a 09 20 28 64 65 62 75 67  ILLED) .. (debug
7fe0: 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20  :print 1 "NOTE: 
7ff0: 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20  " new-test-name 
8000: 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e  " is already run
8010: 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 78 70 6c  ning or was expl
8020: 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73  ictly killed, us
8030: 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e  e -force to laun
8040: 63 68 20 69 74 2e 22 29 29 0a 09 28 28 4c 41 55  ch it."))..((LAU
8050: 4e 43 48 45 44 20 52 45 4d 4f 54 45 48 4f 53 54  NCHED REMOTEHOST
8060: 53 54 41 52 54 20 52 55 4e 4e 49 4e 47 29 20 20  START RUNNING)  
8070: 0a 09 20 28 69 66 20 28 3e 20 28 2d 20 28 63 75  .. (if (> (- (cu
8080: 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b  rrent-seconds)(+
8090: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 65 76   (db:test-get-ev
80a0: 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 61 74  ent_time testdat
80b0: 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 62  ).....       (db
80c0: 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75  :test-get-run_du
80d0: 72 61 74 69 6f 6e 20 74 65 73 74 64 61 74 29 29  ration testdat))
80e0: 29 0a 09 09 36 30 30 29 20 3b 3b 20 69 2e 65 2e  )...600) ;; i.e.
80f0: 20 6e 6f 20 75 70 64 61 74 65 20 66 6f 72 20 6d   no update for m
8100: 6f 72 65 20 74 68 61 6e 20 36 30 30 20 73 65 63  ore than 600 sec
8110: 6f 6e 64 73 0a 09 20 20 20 20 20 28 62 65 67 69  onds..     (begi
8120: 6e 0a 09 20 20 20 20 20 20 20 28 64 65 62 75 67  n..       (debug
8130: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e  :print 0 "WARNIN
8140: 47 3a 20 54 65 73 74 20 22 20 74 65 73 74 2d 6e  G: Test " test-n
8150: 61 6d 65 20 22 20 61 70 70 65 61 72 73 20 74 6f  ame " appears to
8160: 20 62 65 20 64 65 61 64 2e 20 46 6f 72 63 69 6e   be dead. Forcin
8170: 67 20 69 74 20 74 6f 20 73 74 61 74 65 20 49 4e  g it to state IN
8180: 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 73 74 61  COMPLETE and sta
8190: 74 75 73 20 53 54 55 43 4b 2f 44 45 41 44 22 29  tus STUCK/DEAD")
81a0: 0a 09 20 20 20 20 20 20 20 28 74 65 73 74 73 3a  ..       (tests:
81b0: 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 21  test-set-status!
81c0: 20 74 65 73 74 2d 69 64 20 22 49 4e 43 4f 4d 50   test-id "INCOMP
81d0: 4c 45 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41  LETE" "STUCK/DEA
81e0: 44 22 20 22 54 65 73 74 20 69 73 20 73 74 75 63  D" "Test is stuc
81f0: 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 0a  k or dead" #f)).
8200: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  .     (debug:pri
8210: 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 65  nt 2 "NOTE: " te
8220: 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72  st-name " is alr
8230: 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 29  eady running")))
8240: 0a 09 28 65 6c 73 65 20 20 20 20 20 20 20 28 64  ..(else       (d
8250: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
8260: 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c  ROR: Failed to l
8270: 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65 77  aunch test " new
8280: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e  -test-name ". Un
8290: 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74 65  recognised state
82a0: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
82b0: 74 65 20 74 65 73 74 64 61 74 29 29 29 29 29 29  te testdat))))))
82c0: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  )..;;===========
82d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
82e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
82f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8300: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45  ===========.;; E
8310: 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46 0a  ND OF NEW STUFF.
8320: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
8330: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8340: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8350: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8360: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e  ========..(defin
8370: 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20  e (get-dir-up-n 
8380: 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20  dir . params) . 
8390: 20 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 20   (let ((dparts  
83a0: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69  (string-split di
83b0: 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20  r "/"))..(count 
83c0: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72    (if (null? par
83d0: 61 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 61  ams) 1 (car para
83e0: 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63  ms)))).    (conc
83f0: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74   "/" (string-int
8400: 65 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 20  ersperse ..     
8410: 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28    (take dparts (
8420: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73  - (length dparts
8430: 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20  ) count))..     
8440: 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d    "/")))).;; Rem
8450: 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c  ove runs.;; fiel
8460: 64 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 69  ds are passing i
8470: 6e 20 74 68 72 6f 75 67 68 20 0a 3b 3b 20 61 63  n through .;; ac
8480: 74 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27 72 65 6d  tion:.;;    'rem
8490: 6f 76 65 2d 72 75 6e 73 0a 3b 3b 20 20 20 20 27  ove-runs.;;    '
84a0: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73  set-state-status
84b0: 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73 68 6f 75  .;;.;; NB// shou
84c0: 6c 64 20 70 61 73 73 20 69 6e 20 6b 65 79 73 3f  ld pass in keys?
84d0: 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  .;;.(define (run
84e0: 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 61 63 74  s:operate-on act
84f0: 69 6f 6e 20 72 75 6e 6e 61 6d 65 70 61 74 74 20  ion runnamepatt 
8500: 74 65 73 74 70 61 74 74 20 69 74 65 6d 70 61 74  testpatt itempat
8510: 74 20 23 21 6b 65 79 20 28 73 74 61 74 65 20 23  t #!key (state #
8520: 66 29 28 73 74 61 74 75 73 20 23 66 29 28 6e 65  f)(status #f)(ne
8530: 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 23  w-state-status #
8540: 66 29 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62  f)).  (let* ((db
8550: 20 20 20 20 20 20 20 20 20 20 20 23 66 29 0a 09             #f)..
8560: 20 28 6b 65 79 73 20 20 20 20 20 20 20 20 20 28   (keys         (
8570: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
8580: 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a  b:get-keys db)).
8590: 09 20 28 72 75 6e 64 61 74 20 20 20 20 20 20 20  . (rundat       
85a0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
85b0: 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79  runs:get-runs-by
85c0: 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75  -patt db keys ru
85d0: 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 28 68  nnamepatt)).. (h
85e0: 65 61 64 65 72 20 20 20 20 20 20 20 28 76 65 63  eader       (vec
85f0: 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30  tor-ref rundat 0
8600: 29 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 20  )).. (runs      
8610: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72     (vector-ref r
8620: 75 6e 64 61 74 20 31 29 29 0a 09 20 28 73 74 61  undat 1)).. (sta
8630: 74 65 73 20 20 20 20 20 20 20 28 69 66 20 73 74  tes       (if st
8640: 61 74 65 20 20 28 73 74 72 69 6e 67 2d 73 70 6c  ate  (string-spl
8650: 69 74 20 73 74 61 74 65 20 20 22 2c 22 29 20 27  it state  ",") '
8660: 28 29 29 29 0a 09 20 28 73 74 61 74 75 73 65 73  ())).. (statuses
8670: 20 20 20 20 20 28 69 66 20 73 74 61 74 75 73 20       (if status 
8680: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74  (string-split st
8690: 61 74 75 73 20 22 2c 22 29 20 27 28 29 29 29 0a  atus ",") '())).
86a0: 09 20 28 73 74 61 74 65 2d 73 74 61 74 75 73 20  . (state-status 
86b0: 28 69 66 20 28 73 74 72 69 6e 67 3f 20 6e 65 77  (if (string? new
86c0: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 28  -state-status) (
86d0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6e 65 77  string-split new
86e0: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 22 2c  -state-status ",
86f0: 22 29 20 27 28 23 66 20 23 66 29 29 29 29 0a 20  ") '(#f #f)))). 
8700: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
8710: 32 20 22 48 65 61 64 65 72 3a 20 22 20 68 65 61  2 "Header: " hea
8720: 64 65 72 20 22 20 61 63 74 69 6f 6e 3a 20 22 20  der " action: " 
8730: 61 63 74 69 6f 6e 20 22 20 6e 65 77 2d 73 74 61  action " new-sta
8740: 74 65 2d 73 74 61 74 75 73 3a 20 22 20 6e 65 77  te-status: " new
8750: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a 20  -state-status). 
8760: 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20     (for-each.   
8770: 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a    (lambda (run).
8780: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 75         (let ((ru
8790: 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 6e 74  nkey (string-int
87a0: 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c  ersperse (map (l
87b0: 61 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 09 09  ambda (k).......
87c0: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
87d0: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
87e0: 65 72 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b  er (vector-ref k
87f0: 20 30 29 29 29 20 6b 65 79 73 29 20 22 2f 22 29   0))) keys) "/")
8800: 29 0a 09 20 20 20 20 20 28 64 69 72 73 2d 74 6f  )..     (dirs-to
8810: 2d 72 65 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 61  -remove (make-ha
8820: 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 28 6c  sh-table))).. (l
8830: 65 74 2a 20 28 28 72 75 6e 2d 69 64 20 20 20 20  et* ((run-id    
8840: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
8850: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
8860: 65 72 20 22 69 64 22 29 29 0a 09 09 28 72 75 6e  er "id"))...(run
8870: 2d 73 74 61 74 65 20 28 64 62 3a 67 65 74 2d 76  -state (db:get-v
8880: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72  alue-by-header r
8890: 75 6e 20 68 65 61 64 65 72 20 22 73 74 61 74 65  un header "state
88a0: 22 29 29 0a 09 09 28 74 65 73 74 73 20 20 20 20  "))...(tests    
88b0: 20 28 69 66 20 28 6e 6f 74 20 28 65 71 75 61 6c   (if (not (equal
88c0: 3f 20 72 75 6e 2d 73 74 61 74 65 20 22 6c 6f 63  ? run-state "loc
88d0: 6b 65 64 22 29 29 0a 09 09 09 20 20 20 20 20 20  ked"))....      
88e0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
88f0: 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f   db:get-tests-fo
8900: 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74  r-run db (db:get
8910: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
8920: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22   run header "id"
8930: 29 0a 09 09 09 09 09 09 20 20 20 20 20 20 74 65  ).......      te
8940: 73 74 70 61 74 74 20 69 74 65 6d 70 61 74 74 20  stpatt itempatt 
8950: 73 74 61 74 65 73 20 73 74 61 74 75 73 65 73 0a  states statuses.
8960: 09 09 09 09 09 09 20 20 20 20 20 20 6e 6f 74 2d  ......      not-
8970: 69 6e 3a 20 20 23 66 0a 09 09 09 09 09 09 20 20  in:  #f.......  
8980: 20 20 20 20 73 6f 72 74 2d 62 79 3a 20 28 63 61      sort-by: (ca
8990: 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 09 09 09  se action.......
89a0: 09 09 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73  .. ((remove-runs
89b0: 29 20 27 72 75 6e 64 69 72 29 0a 09 09 09 09 09  ) 'rundir)......
89c0: 09 09 09 20 28 65 6c 73 65 20 20 20 20 20 20 20  ... (else       
89d0: 20 20 20 27 65 76 65 6e 74 5f 74 69 6d 65 29 29     'event_time))
89e0: 29 0a 09 09 09 20 20 20 20 20 20 20 27 28 29 29  )....       '())
89f0: 29 0a 09 09 28 6c 61 73 74 74 70 61 74 68 20 22  )...(lasttpath "
8a00: 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f  /does/not/exist/
8a10: 49 2f 68 6f 70 65 22 29 29 0a 09 20 20 20 28 64  I/hope"))..   (d
8a20: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e  ebug:print 4 "IN
8a30: 46 4f 3a 20 72 75 6e 73 3a 6f 70 65 72 61 74 65  FO: runs:operate
8a40: 2d 6f 6e 20 72 75 6e 3d 22 20 72 75 6e 20 22 2c  -on run=" run ",
8a50: 20 68 65 61 64 65 72 3d 22 20 68 65 61 64 65 72   header=" header
8a60: 29 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28  )..   (if (not (
8a70: 6e 75 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 20  null? tests)).. 
8a80: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20        (begin... 
8a90: 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 20  (case action... 
8aa0: 20 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29    ((remove-runs)
8ab0: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  ...    (debug:pr
8ac0: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20  int 1 "Removing 
8ad0: 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22  tests for run: "
8ae0: 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a   runkey " " (db:
8af0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
8b00: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
8b10: 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20  runname")))...  
8b20: 20 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61   ((set-state-sta
8b30: 74 75 73 29 0a 09 09 20 20 20 20 28 64 65 62 75  tus)...    (debu
8b40: 67 3a 70 72 69 6e 74 20 31 20 22 4d 6f 64 69 66  g:print 1 "Modif
8b50: 79 69 6e 67 20 73 74 61 74 65 20 61 6e 64 20 73  ying state and s
8b60: 74 61 75 73 20 66 6f 72 20 74 65 73 74 73 20 66  taus for tests f
8b70: 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79  or run: " runkey
8b80: 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c   " " (db:get-val
8b90: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
8ba0: 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65   header "runname
8bb0: 22 29 29 29 0a 09 09 20 20 20 28 28 70 72 69 6e  ")))...   ((prin
8bc0: 74 2d 72 75 6e 29 0a 09 09 20 20 20 20 28 64 65  t-run)...    (de
8bd0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 50 72 69  bug:print 1 "Pri
8be0: 6e 74 69 6e 67 20 69 6e 66 6f 20 66 6f 72 20 72  nting info for r
8bf0: 75 6e 20 22 20 72 75 6e 6b 65 79 20 22 2c 20 72  un " runkey ", r
8c00: 75 6e 3d 22 20 72 75 6e 20 22 2c 20 74 65 73 74  un=" run ", test
8c10: 73 3d 22 20 74 65 73 74 73 20 22 2c 20 68 65 61  s=" tests ", hea
8c20: 64 65 72 3d 22 20 68 65 61 64 65 72 29 0a 09 09  der=" header)...
8c30: 20 20 20 20 61 63 74 69 6f 6e 29 0a 09 09 20 20      action)...  
8c40: 20 28 65 6c 73 65 0a 09 09 20 20 20 20 28 70 72   (else...    (pr
8c50: 69 6e 74 20 22 49 4e 46 4f 3a 20 61 63 74 69 6f  int "INFO: actio
8c60: 6e 20 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65 64  n not recognised
8c70: 20 22 20 61 63 74 69 6f 6e 29 29 29 0a 09 09 20   " action)))... 
8c80: 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c  (for-each...  (l
8c90: 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 09 20  ambda (test)... 
8ca0: 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d     (let* ((item-
8cb0: 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65  path (db:test-ge
8cc0: 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74  t-item-path test
8cd0: 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e  ))....   (test-n
8ce0: 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ame (db:test-get
8cf0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29  -testname test))
8d00: 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20  ....   (run-dir 
8d10: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72    (db:test-get-r
8d20: 75 6e 64 69 72 20 74 65 73 74 29 29 0a 09 09 09  undir test))....
8d30: 20 20 20 28 74 65 73 74 2d 69 64 20 20 20 28 64     (test-id   (d
8d40: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
8d50: 73 74 29 29 29 0a 09 09 20 20 20 20 20 20 3b 3b  st)))...      ;;
8d60: 20 20 20 28 74 64 62 20 20 20 20 20 20 20 28 64     (tdb       (d
8d70: 62 3a 6f 70 65 6e 2d 74 65 73 74 2d 64 62 20 72  b:open-test-db r
8d80: 75 6e 2d 64 69 72 29 29 29 0a 09 09 20 20 20 20  un-dir)))...    
8d90: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31    (debug:print 1
8da0: 20 22 20 20 22 20 28 64 62 3a 74 65 73 74 2d 67   "  " (db:test-g
8db0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74  et-testname test
8dc0: 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a 74 65  ) " id: " (db:te
8dd0: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20  st-get-id test) 
8de0: 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20  " " item-path " 
8df0: 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e  action: " action
8e00: 29 0a 09 09 20 20 20 20 20 20 28 63 61 73 65 20  )...      (case 
8e10: 61 63 74 69 6f 6e 0a 09 09 09 28 28 72 65 6d 6f  action....((remo
8e20: 76 65 2d 72 75 6e 73 29 20 3b 3b 20 74 68 65 20  ve-runs) ;; the 
8e30: 74 64 62 20 69 73 20 66 6f 72 20 66 75 74 75 72  tdb is for futur
8e40: 65 20 70 6f 73 73 69 62 6c 65 2e 20 0a 09 09 09  e possible. ....
8e50: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
8e60: 20 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 2d   db:delete-test-
8e70: 72 65 63 6f 72 64 73 20 64 62 20 23 66 20 28 64  records db #f (d
8e80: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
8e90: 73 74 29 29 0a 09 09 09 20 28 64 65 62 75 67 3a  st)).... (debug:
8ea0: 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41  print 1 "INFO: A
8eb0: 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 72 65 6d  ttempting to rem
8ec0: 6f 76 65 20 64 69 72 20 22 20 72 75 6e 2d 64 69  ove dir " run-di
8ed0: 72 29 0a 09 09 09 20 28 69 66 20 28 61 6e 64 20  r).... (if (and 
8ee0: 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74  (> (string-lengt
8ef0: 68 20 72 75 6e 2d 64 69 72 29 20 35 29 0a 09 09  h run-dir) 5)...
8f00: 09 09 20 20 28 66 69 6c 65 2d 65 78 69 73 74 73  ..  (file-exists
8f10: 3f 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 62  ? run-dir)) ;; b
8f20: 61 64 20 68 65 75 72 69 73 74 69 63 20 62 75 74  ad heuristic but
8f30: 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 20   should prevent 
8f40: 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a  /tmp /home etc..
8f50: 09 09 09 20 20 20 20 20 28 6c 65 74 2a 20 28 28  ...     (let* ((
8f60: 72 65 61 6c 70 61 74 68 20 28 72 65 73 6f 6c 76  realpath (resolv
8f70: 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d 64  e-pathname run-d
8f80: 69 72 29 29 29 0a 09 09 09 20 20 20 20 20 20 20  ir)))....       
8f90: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
8fa0: 49 4e 46 4f 3a 20 52 65 61 6c 20 70 61 74 68 20  INFO: Real path 
8fb0: 6f 66 20 69 73 20 22 20 72 65 61 6c 70 61 74 68  of is " realpath
8fc0: 29 0a 09 09 09 20 20 20 20 20 20 20 28 69 66 20  )....       (if 
8fd0: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 65  (file-exists? re
8fe0: 61 6c 70 61 74 68 29 0a 09 09 09 09 20 20 20 28  alpath).....   (
8ff0: 69 66 20 28 3e 20 28 73 79 73 74 65 6d 20 28 63  if (> (system (c
9000: 6f 6e 63 20 22 72 6d 20 2d 72 66 20 22 20 72 65  onc "rm -rf " re
9010: 61 6c 70 61 74 68 29 29 20 30 29 0a 09 09 09 09  alpath)) 0).....
9020: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72         (debug:pr
9030: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68  int 0 "ERROR: Th
9040: 65 72 65 20 77 61 73 20 61 20 70 72 6f 62 6c 65  ere was a proble
9050: 6d 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 65 61  m removing " rea
9060: 6c 70 61 74 68 20 22 20 77 69 74 68 20 72 6d 20  lpath " with rm 
9070: 2d 66 22 29 29 0a 09 09 09 09 20 20 20 28 64 65  -f")).....   (de
9080: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52  bug:print 0 "WAR
9090: 4e 49 4e 47 3a 20 74 65 73 74 20 72 75 6e 20 64  NING: test run d
90a0: 69 72 20 22 20 72 65 61 6c 70 61 74 68 20 22 20  ir " realpath " 
90b0: 61 70 70 65 61 72 73 20 74 6f 20 6e 6f 74 20 65  appears to not e
90c0: 78 69 73 74 22 29 29 0a 09 09 09 20 20 20 20 20  xist"))....     
90d0: 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73    (if (file-exis
90e0: 74 73 3f 20 72 75 6e 2d 64 69 72 29 20 3b 3b 20  ts? run-dir) ;; 
90f0: 74 68 65 20 6c 69 6e 6b 0a 09 09 09 09 20 20 20  the link.....   
9100: 28 69 66 20 28 73 79 6d 62 6f 6c 69 63 2d 6c 69  (if (symbolic-li
9110: 6e 6b 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09  nk? run-dir)....
9120: 09 20 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d  .       (delete-
9130: 66 69 6c 65 20 72 75 6e 2d 64 69 72 29 0a 09 09  file run-dir)...
9140: 09 09 20 20 20 20 20 20 20 28 69 66 20 28 64 69  ..       (if (di
9150: 72 65 63 74 6f 72 79 3f 20 72 75 6e 2d 64 69 72  rectory? run-dir
9160: 29 0a 09 09 09 09 09 20 20 20 28 69 66 20 28 3e  )......   (if (>
9170: 20 28 64 69 72 65 63 74 6f 72 79 2d 66 6f 6c 64   (directory-fold
9180: 20 28 6c 61 6d 62 64 61 20 28 66 20 78 29 28 2b   (lambda (f x)(+
9190: 20 31 20 78 29 29 20 30 20 72 75 6e 2d 64 69 72   1 x)) 0 run-dir
91a0: 29 20 30 29 0a 09 09 09 09 09 20 20 20 20 20 20  ) 0)......      
91b0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
91c0: 22 57 41 52 4e 49 4e 47 3a 20 72 65 66 75 73 69  "WARNING: refusi
91d0: 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72  ng to remove " r
91e0: 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20 69  un-dir " as it i
91f0: 73 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09 09  s not empty")...
9200: 09 09 09 20 20 20 20 20 20 20 28 64 65 6c 65 74  ...       (delet
9210: 65 2d 64 69 72 65 63 74 6f 72 79 20 72 75 6e 2d  e-directory run-
9220: 64 69 72 29 29 20 3b 3b 20 69 74 20 73 68 6f 75  dir)) ;; it shou
9230: 6c 64 20 62 65 20 65 6d 70 74 79 20 62 79 20 68  ld be empty by h
9240: 65 72 65 20 42 55 47 20 42 55 47 2c 20 61 64 64  ere BUG BUG, add
9250: 20 65 72 72 6f 72 20 63 61 74 63 68 0a 09 09 09   error catch....
9260: 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ..   (debug:prin
9270: 74 20 30 20 22 45 52 52 4f 52 3a 20 72 65 66 75  t 0 "ERROR: refu
9280: 73 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22  sing to remove "
9290: 20 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74   run-dir " as it
92a0: 20 69 73 20 6e 65 69 74 68 65 72 20 61 20 73 79   is neither a sy
92b0: 6d 6c 69 6e 6b 20 6e 6f 72 20 61 20 64 69 72 65  mlink nor a dire
92c0: 63 74 6f 72 79 22 29 0a 09 09 09 09 09 20 20 20  ctory")......   
92d0: 29 29 29 29 0a 09 09 09 20 20 20 20 20 28 64 65  ))))....     (de
92e0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52  bug:print 0 "WAR
92f0: 4e 49 4e 47 3a 20 64 69 72 65 63 74 6f 72 79 20  NING: directory 
9300: 61 6c 72 65 61 64 79 20 72 65 6d 6f 76 65 64 20  already removed 
9310: 22 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09  " run-dir)))....
9320: 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74  ((set-state-stat
9330: 75 73 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70  us).... (debug:p
9340: 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20 6e 65  rint 2 "INFO: ne
9350: 77 20 73 74 61 74 65 20 22 20 28 63 61 72 20 73  w state " (car s
9360: 74 61 74 65 2d 73 74 61 74 75 73 29 20 22 2c 20  tate-status) ", 
9370: 6e 65 77 20 73 74 61 74 75 73 20 22 20 28 63 61  new status " (ca
9380: 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29  dr state-status)
9390: 29 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d  ).... (open-run-
93a0: 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 2d 73 65  close db:test-se
93b0: 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 2d 62  t-state-status-b
93c0: 79 2d 69 64 20 64 62 20 28 64 62 3a 74 65 73 74  y-id db (db:test
93d0: 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 28 63  -get-id test) (c
93e0: 61 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29  ar state-status)
93f0: 28 63 61 64 72 20 73 74 61 74 65 2d 73 74 61 74  (cadr state-stat
9400: 75 73 29 20 23 66 29 29 29 29 29 0a 09 09 20 20  us) #f)))))...  
9410: 74 65 73 74 73 29 29 29 0a 09 20 20 20 0a 09 20  tests)))..   .. 
9420: 20 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65 20    ;; remove the 
9430: 72 75 6e 20 69 66 20 7a 65 72 6f 20 74 65 73 74  run if zero test
9440: 73 20 72 65 6d 61 69 6e 0a 09 20 20 20 28 69 66  s remain..   (if
9450: 20 28 65 71 3f 20 61 63 74 69 6f 6e 20 27 72 65   (eq? action 're
9460: 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 20 20 20 20  move-runs)..    
9470: 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73     (let ((remtes
9480: 74 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  ts (open-run-clo
9490: 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d  se db:get-tests-
94a0: 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67  for-run db (db:g
94b0: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
94c0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69  er run header "i
94d0: 64 22 29 20 23 66 20 23 66 20 27 28 22 44 45 4c  d") #f #f '("DEL
94e0: 45 54 45 44 22 29 20 27 28 22 6e 2f 61 22 29 20  ETED") '("n/a") 
94f0: 6e 6f 74 2d 69 6e 3a 20 23 74 29 29 29 0a 09 09  not-in: #t)))...
9500: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 74   (if (null? remt
9510: 65 73 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65  ests) ;; no more
9520: 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67   tests remaining
9530: 0a 09 09 20 20 20 20 20 28 6c 65 74 2a 20 28 28  ...     (let* ((
9540: 64 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d  dparts  (string-
9550: 73 70 6c 69 74 20 6c 61 73 74 74 70 61 74 68 20  split lasttpath 
9560: 22 2f 22 29 29 0a 09 09 09 20 20 20 20 28 72 75  "/"))....    (ru
9570: 6e 70 61 74 68 20 28 63 6f 6e 63 20 22 2f 22 20  npath (conc "/" 
9580: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65  (string-interspe
9590: 72 73 65 20 0a 09 09 09 09 09 09 28 74 61 6b 65  rse .......(take
95a0: 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67   dparts (- (leng
95b0: 74 68 20 64 70 61 72 74 73 29 20 31 29 29 0a 09  th dparts) 1))..
95c0: 09 09 09 09 09 22 2f 22 29 29 29 29 0a 09 09 20  ....."/"))))... 
95d0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
95e0: 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72  nt 1 "Removing r
95f0: 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22  un: " runkey " "
9600: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62   (db:get-value-b
9610: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61  y-header run hea
9620: 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 20 22  der "runname") "
9630: 20 61 6e 64 20 72 65 6c 61 74 65 64 20 72 65 63   and related rec
9640: 6f 72 64 22 29 0a 09 09 20 20 20 20 20 20 20 28  ord")...       (
9650: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
9660: 62 3a 64 65 6c 65 74 65 2d 72 75 6e 20 64 62 20  b:delete-run db 
9670: 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 20 20 20  run-id)...      
9680: 20 3b 3b 20 54 68 69 73 20 69 73 20 61 20 70 72   ;; This is a pr
9690: 65 74 74 79 20 67 6f 6f 64 20 70 6c 61 63 65 20  etty good place 
96a0: 74 6f 20 70 75 72 67 65 20 6f 6c 64 20 44 45 4c  to purge old DEL
96b0: 45 54 45 44 20 74 65 73 74 73 0a 09 09 20 20 20  ETED tests...   
96c0: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
96d0: 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 74 65  ose db:delete-te
96e0: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72  sts-for-run db r
96f0: 75 6e 2d 69 64 29 0a 09 09 20 20 20 20 20 20 20  un-id)...       
9700: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
9710: 64 62 3a 64 65 6c 65 74 65 2d 6f 6c 64 2d 64 65  db:delete-old-de
9720: 6c 65 74 65 64 2d 74 65 73 74 2d 72 65 63 6f 72  leted-test-recor
9730: 64 73 20 64 62 29 0a 09 09 20 20 20 20 20 20 20  ds db)...       
9740: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
9750: 64 62 3a 73 65 74 2d 76 61 72 20 64 62 20 22 44  db:set-var db "D
9760: 45 4c 45 54 45 44 5f 54 45 53 54 53 22 20 28 63  ELETED_TESTS" (c
9770: 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 29  urrent-seconds))
9780: 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 6e 65 65  ...       ;; nee
9790: 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74 20  d to figure out 
97a0: 74 68 65 20 70 61 74 68 20 74 6f 20 74 68 65 20  the path to the 
97b0: 72 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d 6f  run dir and remo
97c0: 76 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a 09  ve it if empty..
97d0: 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 28 69  .       ;;    (i
97e0: 66 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 28  f (null? (glob (
97f0: 63 6f 6e 63 20 72 75 6e 70 61 74 68 20 22 2f 2a  conc runpath "/*
9800: 22 29 29 29 0a 09 09 20 20 20 20 20 20 20 3b 3b  ")))...       ;;
9810: 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09          (begin..
9820: 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28 64 65  .       ;; . (de
9830: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d  bug:print 1 "Rem
9840: 6f 76 69 6e 67 20 72 75 6e 20 64 69 72 20 22 20  oving run dir " 
9850: 72 75 6e 70 61 74 68 29 0a 09 09 20 20 20 20 20  runpath)...     
9860: 20 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 28    ;; . (system (
9870: 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 22  conc "rmdir -p "
9880: 20 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09 20   runpath))))... 
9890: 20 20 20 20 20 20 29 29 29 29 29 0a 09 20 29 29        ))))).. ))
98a0: 0a 20 20 20 20 20 72 75 6e 73 29 29 0a 20 20 23  .     runs)).  #
98b0: 74 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  t)..;;==========
98c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
98d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
98e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
98f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20  ============.;; 
9900: 52 6f 75 74 69 6e 65 73 20 66 6f 72 20 6d 61 6e  Routines for man
9910: 69 70 75 6c 61 74 69 6e 67 20 72 75 6e 73 0a 3b  ipulating runs.;
9920: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;===============
9930: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9940: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9950: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9960: 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63  =======..;; Sinc
9970: 65 20 6d 61 6e 79 20 63 61 6c 6c 73 20 74 6f 20  e many calls to 
9980: 61 20 72 75 6e 20 72 65 71 75 69 72 65 20 70 72  a run require pr
9990: 65 74 74 79 20 6d 75 63 68 20 74 68 65 20 73 61  etty much the sa
99a0: 6d 65 20 73 65 74 75 70 20 0a 3b 3b 20 74 68 69  me setup .;; thi
99b0: 73 20 77 72 61 70 70 65 72 20 69 73 20 75 73 65  s wrapper is use
99c0: 64 20 74 6f 20 72 65 64 75 63 65 20 74 68 65 20  d to reduce the 
99d0: 72 65 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 63  replication of c
99e0: 6f 64 65 0a 28 64 65 66 69 6e 65 20 28 67 65 6e  ode.(define (gen
99f0: 65 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c 20 73 77  eral-run-call sw
9a00: 69 74 63 68 6e 61 6d 65 20 61 63 74 69 6f 6e 2d  itchname action-
9a10: 64 65 73 63 20 70 72 6f 63 29 0a 20 20 28 6c 65  desc proc).  (le
9a20: 74 20 28 28 72 75 6e 6e 61 6d 65 20 28 61 72 67  t ((runname (arg
9a30: 73 3a 67 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e  s:get-arg ":runn
9a40: 61 6d 65 22 29 29 0a 09 28 74 61 72 67 65 74 20  ame"))..(target 
9a50: 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61   (if (args:get-a
9a60: 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09  rg "-target")...
9a70: 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61       (args:get-a
9a80: 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09  rg "-target")...
9a90: 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61       (args:get-a
9aa0: 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 29 29  rg "-reqtarg")))
9ab0: 0a 09 28 74 68 31 20 20 20 20 20 23 66 29 29 0a  ..(th1     #f)).
9ac0: 20 20 20 20 28 63 6f 6e 64 0a 20 20 20 20 20 28      (cond.     (
9ad0: 28 6e 6f 74 20 74 61 72 67 65 74 29 0a 20 20 20  (not target).   
9ae0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
9af0: 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e  0 "ERROR: Missin
9b00: 67 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d  g required param
9b10: 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 63  eter for " switc
9b20: 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73  hname ", you mus
9b30: 74 20 73 70 65 63 69 66 79 20 74 68 65 20 74 61  t specify the ta
9b40: 72 67 65 74 20 77 69 74 68 20 2d 74 61 72 67 65  rget with -targe
9b50: 74 22 29 0a 20 20 20 20 20 20 28 65 78 69 74 20  t").      (exit 
9b60: 33 29 29 0a 20 20 20 20 20 28 28 6e 6f 74 20 72  3)).     ((not r
9b70: 75 6e 6e 61 6d 65 29 0a 20 20 20 20 20 20 28 64  unname).      (d
9b80: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
9b90: 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 71  ROR: Missing req
9ba0: 75 69 72 65 64 20 70 61 72 61 6d 65 74 65 72 20  uired parameter 
9bb0: 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d 65  for " switchname
9bc0: 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 65   ", you must spe
9bd0: 63 69 66 79 20 74 68 65 20 72 75 6e 20 6e 61 6d  cify the run nam
9be0: 65 20 77 69 74 68 20 3a 72 75 6e 6e 61 6d 65 20  e with :runname 
9bf0: 72 75 6e 6e 61 6d 65 22 29 0a 20 20 20 20 20 20  runname").      
9c00: 28 65 78 69 74 20 33 29 29 0a 20 20 20 20 20 28  (exit 3)).     (
9c10: 65 6c 73 65 0a 20 20 20 20 20 20 28 6c 65 74 20  else.      (let 
9c20: 28 28 64 62 20 20 20 23 66 29 0a 09 20 20 20 20  ((db   #f)..    
9c30: 28 6b 65 79 73 20 23 66 29 29 0a 09 28 69 66 20  (keys #f))..(if 
9c40: 28 6e 6f 74 20 28 73 65 74 75 70 2d 66 6f 72 2d  (not (setup-for-
9c50: 72 75 6e 29 29 0a 09 20 20 20 20 28 62 65 67 69  run))..    (begi
9c60: 6e 20 0a 09 20 20 20 20 20 20 28 64 65 62 75 67  n ..      (debug
9c70: 3a 70 72 69 6e 74 20 30 20 22 46 61 69 6c 65 64  :print 0 "Failed
9c80: 20 74 6f 20 73 65 74 75 70 2c 20 65 78 69 74 69   to setup, exiti
9c90: 6e 67 22 29 0a 09 20 20 20 20 20 20 28 65 78 69  ng")..      (exi
9ca0: 74 20 31 29 29 29 0a 09 28 69 66 20 28 61 72 67  t 1)))..(if (arg
9cb0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 72 76  s:get-arg "-serv
9cc0: 65 72 22 29 0a 09 20 20 20 20 28 6f 70 65 6e 2d  er")..    (open-
9cd0: 72 75 6e 2d 63 6c 6f 73 65 20 73 65 72 76 65 72  run-close server
9ce0: 3a 73 74 61 72 74 20 64 62 20 28 61 72 67 73 3a  :start db (args:
9cf0: 67 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72  get-arg "-server
9d00: 22 29 29 0a 20 09 20 20 20 20 28 69 66 20 28 6e  ")). .    (if (n
9d10: 6f 74 20 28 6f 72 20 28 61 72 67 73 3a 67 65 74  ot (or (args:get
9d20: 2d 61 72 67 20 22 2d 72 75 6e 61 6c 6c 22 29 20  -arg "-runall") 
9d30: 20 20 20 20 3b 3b 20 72 75 6e 61 6c 6c 20 61 6e      ;; runall an
9d40: 64 20 72 75 6e 74 65 73 74 73 20 61 72 65 20 61  d runtests are a
9d50: 6c 6c 6f 77 65 64 20 74 6f 20 62 65 20 73 65 72  llowed to be ser
9d60: 76 65 72 73 0a 20 09 09 09 20 28 61 72 67 73 3a  vers. ... (args:
9d70: 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 74 65 73  get-arg "-runtes
9d80: 74 73 22 29 29 29 0a 09 09 28 73 65 72 76 65 72  ts")))...(server
9d90: 3a 63 6c 69 65 6e 74 2d 73 65 74 75 70 29 29 29  :client-setup)))
9da0: 0a 09 28 73 65 74 21 20 6b 65 79 73 20 28 6f 70  ..(set! keys (op
9db0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
9dc0: 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b  get-keys db))..;
9dd0: 3b 20 68 61 76 65 20 65 6e 6f 75 67 68 20 74 6f  ; have enough to
9de0: 20 70 72 6f 63 65 73 73 20 2d 74 61 72 67 65 74   process -target
9df0: 20 6f 72 20 2d 72 65 71 74 61 72 67 20 68 65 72   or -reqtarg her
9e00: 65 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 74  e..(if (args:get
9e10: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29  -arg "-reqtarg")
9e20: 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 72 75  ..    (let* ((ru
9e30: 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 20  nconfigf (conc  
9e40: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63  *toppath* "/runc
9e50: 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29  onfigs.config"))
9e60: 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55   ;; DO NOT EVALU
9e70: 41 54 45 20 41 4c 4c 20 0a 09 09 20 20 20 28 72  ATE ALL ...   (r
9e80: 75 6e 63 6f 6e 66 69 67 20 20 28 72 65 61 64 2d  unconfig  (read-
9e90: 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e 66 69 67  config runconfig
9ea0: 66 20 23 66 20 23 66 20 65 6e 76 69 72 6f 6e 2d  f #f #f environ-
9eb0: 70 61 74 74 3a 20 23 66 29 29 29 20 0a 09 20 20  patt: #f))) ..  
9ec0: 20 20 20 20 28 69 66 20 28 68 61 73 68 2d 74 61      (if (hash-ta
9ed0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
9ee0: 72 75 6e 63 6f 6e 66 69 67 20 28 61 72 67 73 3a  runconfig (args:
9ef0: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
9f00: 67 22 29 20 23 66 29 0a 09 09 20 20 28 6b 65 79  g") #f)...  (key
9f10: 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67  s:target-set-arg
9f20: 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74  s keys (args:get
9f30: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29  -arg "-reqtarg")
9f40: 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 0a   args:arg-hash).
9f50: 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20  ..  (begin...   
9f60: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
9f70: 22 45 52 52 4f 52 3a 20 5b 22 20 28 61 72 67 73  "ERROR: [" (args
9f80: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61  :get-arg "-reqta
9f90: 72 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e  rg") "] not foun
9fa0: 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67  d in " runconfig
9fb0: 66 29 0a 09 09 20 20 20 20 28 69 66 20 64 62 20  f)...    (if db 
9fc0: 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a  (sqlite3:finaliz
9fd0: 65 21 20 64 62 29 29 0a 09 09 20 20 20 20 28 65  e! db))...    (e
9fe0: 78 69 74 20 31 29 29 29 29 0a 09 20 20 20 20 28  xit 1))))..    (
9ff0: 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  if (args:get-arg
a000: 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 28 6b   "-target")...(k
a010: 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61  eys:target-set-a
a020: 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67  rgs keys (args:g
a030: 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22  et-arg "-target"
a040: 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 20   args:arg-hash) 
a050: 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 29 29  args:arg-hash)))
a060: 0a 09 28 69 66 20 28 6e 6f 74 20 28 63 61 72 20  ..(if (not (car 
a070: 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09  *configinfo*))..
a080: 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20      (begin..    
a090: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
a0a0: 20 22 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 74   "ERROR: Attempt
a0b0: 65 64 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64  ed to " action-d
a0c0: 65 73 63 20 22 20 62 75 74 20 72 75 6e 20 61 72  esc " but run ar
a0d0: 65 61 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e  ea config file n
a0e0: 6f 74 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 20  ot found")..    
a0f0: 20 20 28 65 78 69 74 20 31 29 29 0a 09 20 20 20    (exit 1))..   
a100: 20 3b 3b 20 45 78 74 72 61 63 74 20 6f 75 74 20   ;; Extract out 
a110: 73 74 75 66 66 20 6e 65 65 64 65 64 20 69 6e 20  stuff needed in 
a120: 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c  most or many cal
a130: 6c 73 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 20  ls..    ;; here 
a140: 74 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09  then call proc..
a150: 20 20 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e      (let* ((keyn
a160: 61 6d 65 73 20 20 20 28 6d 61 70 20 6b 65 79 3a  ames   (map key:
a170: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65  get-fieldname ke
a180: 79 73 29 29 0a 09 09 20 20 20 28 6b 65 79 76 61  ys))...   (keyva
a190: 6c 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c  llst  (keys->val
a1a0: 6c 69 73 74 20 6b 65 79 73 20 23 74 29 29 29 0a  list keys #t))).
a1b0: 09 20 20 20 20 20 20 28 70 72 6f 63 20 74 61 72  .      (proc tar
a1c0: 67 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73  get runname keys
a1d0: 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c   keynames keyval
a1e0: 6c 73 74 29 29 29 0a 09 28 69 66 20 74 68 31 20  lst)))..(if th1 
a1f0: 28 74 68 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68  (thread-join! th
a200: 31 29 29 0a 09 28 69 66 20 64 62 20 28 73 71 6c  1))..(if db (sql
a210: 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64  ite3:finalize! d
a220: 62 29 29 0a 09 28 73 65 74 21 20 2a 64 69 64 73  b))..(set! *dids
a230: 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29 29 29 29  omething* #t))))
a240: 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ))..;;==========
a250: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a260: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a270: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a280: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20  ============.;; 
a290: 4c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73  Lock/unlock runs
a2a0: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
a2b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a2c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a2d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a2e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69  =========..(defi
a2f0: 6e 65 20 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d  ne (runs:handle-
a300: 6c 6f 63 6b 69 6e 67 20 74 61 72 67 65 74 20 6b  locking target k
a310: 65 79 73 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b  eys runname lock
a320: 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 20 20   unlock user).  
a330: 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 20  (let* ((db      
a340: 20 23 66 29 0a 09 20 28 72 75 6e 64 61 74 20 20   #f).. (rundat  
a350: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
a360: 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62   runs:get-runs-b
a370: 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 72  y-patt db keys r
a380: 75 6e 6e 61 6d 65 29 29 0a 09 20 28 68 65 61 64  unname)).. (head
a390: 65 72 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66  er   (vector-ref
a3a0: 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72   rundat 0)).. (r
a3b0: 75 6e 73 20 20 20 20 20 28 76 65 63 74 6f 72 2d  uns     (vector-
a3c0: 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 29 0a  ref rundat 1))).
a3d0: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c      (for-each (l
a3e0: 61 6d 62 64 61 20 28 72 75 6e 29 0a 09 09 28 6c  ambda (run)...(l
a3f0: 65 74 20 28 28 72 75 6e 2d 69 64 20 28 64 62 3a  et ((run-id (db:
a400: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
a410: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
a420: 69 64 22 29 29 29 0a 09 09 20 20 28 69 66 20 28  id")))...  (if (
a430: 6f 72 20 6c 6f 63 6b 0a 09 09 09 20 20 28 61 6e  or lock....  (an
a440: 64 20 75 6e 6c 6f 63 6b 0a 09 09 09 20 20 20 20  d unlock....    
a450: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09 20 28     (begin..... (
a460: 70 72 69 6e 74 20 22 44 6f 20 79 6f 75 20 72 65  print "Do you re
a470: 61 6c 6c 79 20 77 69 73 68 20 74 6f 20 75 6e 6c  ally wish to unl
a480: 6f 63 6b 20 72 75 6e 20 22 20 72 75 6e 2d 69 64  ock run " run-id
a490: 20 22 3f 5c 6e 20 20 20 79 2f 6e 3a 20 22 29 0a   "?\n   y/n: ").
a4a0: 09 09 09 09 20 28 65 71 75 61 6c 3f 20 22 79 22  .... (equal? "y"
a4b0: 20 28 72 65 61 64 2d 6c 69 6e 65 29 29 29 29 29   (read-line)))))
a4c0: 0a 09 09 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  ...      (open-r
a4d0: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 6c 6f 63 6b  un-close db:lock
a4e0: 2f 75 6e 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 72  /unlock-run db r
a4f0: 75 6e 2d 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63  un-id lock unloc
a500: 6b 20 75 73 65 72 29 0a 09 09 20 20 20 20 20 20  k user)...      
a510: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
a520: 49 4e 46 4f 3a 20 53 6b 69 70 70 69 6e 67 20 6c  INFO: Skipping l
a530: 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20  ock/unlock on " 
a540: 72 75 6e 2d 69 64 29 29 29 29 0a 09 20 20 20 20  run-id))))..    
a550: 20 20 72 75 6e 73 29 29 29 0a 3b 3b 3d 3d 3d 3d    runs))).;;====
a560: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a570: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a590: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a5a0: 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e  ==.;; Rollup run
a5b0: 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  s.;;============
a5c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a5d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a5e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a5f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55  ==========..;; U
a600: 70 64 61 74 65 20 74 68 65 20 74 65 73 74 5f 6d  pdate the test_m
a610: 65 74 61 20 74 61 62 6c 65 20 66 6f 72 20 74 68  eta table for th
a620: 69 73 20 74 65 73 74 0a 28 64 65 66 69 6e 65 20  is test.(define 
a630: 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73  (runs:update-tes
a640: 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e  t_meta db test-n
a650: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20  ame test-conf). 
a660: 20 28 6c 65 74 20 28 28 63 75 72 72 72 65 63 6f   (let ((currreco
a670: 72 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  rd (open-run-clo
a680: 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 67  se db:testmeta-g
a690: 65 74 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73  et-record db tes
a6a0: 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 69  t-name))).    (i
a6b0: 66 20 28 6e 6f 74 20 63 75 72 72 72 65 63 6f 72  f (not currrecor
a6c0: 64 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73  d)..(begin..  (s
a6d0: 65 74 21 20 63 75 72 72 72 65 63 6f 72 64 20 28  et! currrecord (
a6e0: 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 23  make-vector 10 #
a6f0: 66 29 29 0a 09 20 20 28 6f 70 65 6e 2d 72 75 6e  f))..  (open-run
a700: 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d 65  -close db:testme
a710: 74 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 64 62  ta-add-record db
a720: 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20   test-name))).  
a730: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20    (for-each .   
a740: 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a    (lambda (key).
a750: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 69         (let* ((i
a760: 64 78 20 28 63 61 64 72 20 6b 65 79 29 29 0a 09  dx (cadr key))..
a770: 20 20 20 20 20 20 28 66 6c 64 20 28 63 61 72 20        (fld (car 
a780: 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 76   key))..      (v
a790: 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75  al (config-looku
a7a0: 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 73  p test-conf "tes
a7b0: 74 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 0a 09  t_meta" fld)))..
a7c0: 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e 74   ;; (debug:print
a7d0: 20 35 20 22 69 64 78 3a 20 22 20 69 64 78 20 22   5 "idx: " idx "
a7e0: 20 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 76 61   fld: " fld " va
a7f0: 6c 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 66 20  l: " val).. (if 
a800: 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 65  (and val (not (e
a810: 71 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65  qual? (vector-re
a820: 66 20 63 75 72 72 72 65 63 6f 72 64 20 69 64 78  f currrecord idx
a830: 29 20 76 61 6c 29 29 29 0a 09 20 20 20 20 20 28  ) val)))..     (
a840: 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 70  begin..       (p
a850: 72 69 6e 74 20 22 55 70 64 61 74 69 6e 67 20 22  rint "Updating "
a860: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 66   test-name " " f
a870: 6c 64 20 22 20 74 6f 20 22 20 76 61 6c 29 0a 09  ld " to " val)..
a880: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
a890: 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d 65  -close db:testme
a8a0: 74 61 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 20  ta-update-field 
a8b0: 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64  db test-name fld
a8c0: 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20 20 27   val))))).     '
a8d0: 28 28 22 61 75 74 68 6f 72 22 20 32 29 28 22 6f  (("author" 2)("o
a8e0: 77 6e 65 72 22 20 33 29 28 22 64 65 73 63 72 69  wner" 3)("descri
a8f0: 70 74 69 6f 6e 22 20 34 29 28 22 72 65 76 69 65  ption" 4)("revie
a900: 77 65 64 22 20 35 29 28 22 74 61 67 73 22 20 39  wed" 5)("tags" 9
a910: 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65  )))))..;; Update
a920: 20 74 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 61   test_meta for a
a930: 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 69 6e 65  ll tests.(define
a940: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c   (runs:update-al
a950: 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 29 0a  l-test_meta db).
a960: 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61    (let ((test-na
a970: 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67  mes (get-all-leg
a980: 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20  al-tests))).    
a990: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20  (for-each .     
a9a0: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61  (lambda (test-na
a9b0: 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a  me).       (let*
a9c0: 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 20 20   ((test-path    
a9d0: 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20  (conc *toppath* 
a9e0: 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e  "/tests/" test-n
a9f0: 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28 74 65  ame))..      (te
aa00: 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63  st-configf (conc
aa10: 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73   test-path "/tes
aa20: 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20  tconfig"))..    
aa30: 20 20 28 74 65 73 74 65 78 69 73 74 73 20 20 20    (testexists   
aa40: 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74  (and (file-exist
aa50: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29  s? test-configf)
aa60: 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73  (file-read-acces
aa70: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29  s? test-configf)
aa80: 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61  ))..      ;; rea
aa90: 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74  d configs with t
aaa0: 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66  ricks turned off
aab0: 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d   (i.e. no system
aac0: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63  )..      (test-c
aad0: 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 74 65  onf    (if teste
aae0: 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66  xists (read-conf
aaf0: 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20  ig test-configf 
ab00: 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68  #f #f)(make-hash
ab10: 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 3b 3b 20  -table)))).. ;; 
ab20: 75 73 65 20 74 68 65 20 6f 70 65 6e 2d 72 75 6e  use the open-run
ab30: 2d 63 6c 6f 73 65 20 69 6e 73 74 65 61 64 20 6f  -close instead o
ab40: 66 20 70 61 73 73 69 6e 67 20 69 6e 20 64 62 0a  f passing in db.
ab50: 09 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74  . (runs:update-t
ab60: 65 73 74 5f 6d 65 74 61 20 23 66 20 74 65 73 74  est_meta #f test
ab70: 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29  -name test-conf)
ab80: 29 29 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 6d  )).     test-nam
ab90: 65 73 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63  es)))..;; This c
aba0: 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 65  ould probably be
abb0: 20 72 65 66 61 63 74 6f 72 65 64 20 69 6e 74 6f   refactored into
abc0: 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75 65   one complex que
abd0: 72 79 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28  ry ....(define (
abe0: 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20  runs:rollup-run 
abf0: 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72  keys keyvallst r
ac00: 75 6e 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20  unname user) ;; 
ac10: 77 61 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20  was target, now 
ac20: 6b 65 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62  keyvallst.  (deb
ac30: 75 67 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73  ug:print 4 "runs
ac40: 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79  :rollup-run, key
ac50: 73 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76  s: " keys " keyv
ac60: 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c  allst: " keyvall
ac70: 73 74 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20  st " :runname " 
ac80: 72 75 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20  runname " user: 
ac90: 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20  " user).  (let* 
aca0: 28 28 64 62 20 20 20 20 20 20 20 20 20 20 20 20  ((db            
acb0: 20 20 23 66 29 20 3b 3b 20 28 6b 65 79 76 61 6c    #f) ;; (keyval
acc0: 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 79 73 3a  llst      (keys:
acd0: 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b  target->keyval k
ace0: 65 79 73 20 74 61 72 67 65 74 29 29 0a 09 20 28  eys target)).. (
acf0: 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 20  new-run-id      
ad00: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
ad10: 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75  runs:register-ru
ad20: 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c  n db keys keyval
ad30: 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77  lst runname "new
ad40: 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 0a 09  " "n/a" user))..
ad50: 20 28 70 72 65 76 2d 74 65 73 74 73 20 20 20 20   (prev-tests    
ad60: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
ad70: 65 20 74 65 73 74 3a 67 65 74 2d 6d 61 74 63 68  e test:get-match
ad80: 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d 74 65 73  ing-previous-tes
ad90: 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 62  t-run-records db
ada0: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20   new-run-id "%" 
adb0: 22 25 22 29 29 0a 09 20 28 63 75 72 72 2d 74 65  "%")).. (curr-te
adc0: 73 74 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  sts      (open-r
add0: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d  un-close db:get-
ade0: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62  tests-for-run db
adf0: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20   new-run-id "%" 
ae00: 22 25 22 20 27 28 29 20 27 28 29 29 29 0a 09 20  "%" '() '())).. 
ae10: 28 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68  (curr-tests-hash
ae20: 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c   (make-hash-tabl
ae30: 65 29 29 29 0a 20 20 20 20 28 6f 70 65 6e 2d 72  e))).    (open-r
ae40: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 75 70 64 61  un-close db:upda
ae50: 74 65 2d 72 75 6e 2d 65 76 65 6e 74 5f 74 69 6d  te-run-event_tim
ae60: 65 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 29  e db new-run-id)
ae70: 0a 20 20 20 20 3b 3b 20 69 6e 64 65 78 20 74 68  .    ;; index th
ae80: 65 20 61 6c 72 65 61 64 79 20 73 61 76 65 64 20  e already saved 
ae90: 74 65 73 74 73 20 62 79 20 74 65 73 74 6e 61 6d  tests by testnam
aea0: 65 20 61 6e 64 20 69 74 65 6d 64 61 74 20 69 6e  e and itemdat in
aeb0: 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68   curr-tests-hash
aec0: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20  .    (for-each. 
aed0: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73      (lambda (tes
aee0: 74 64 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65  tdat).       (le
aef0: 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28  t* ((testname  (
af00: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74  db:test-get-test
af10: 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09  name testdat))..
af20: 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68        (item-path
af30: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74   (db:test-get-it
af40: 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61 74 29  em-path testdat)
af50: 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e  )..      (full-n
af60: 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61  ame (conc testna
af70: 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68  me "/" item-path
af80: 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c  ))).. (hash-tabl
af90: 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73 74  e-set! curr-test
afa0: 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65  s-hash full-name
afb0: 20 74 65 73 74 64 61 74 29 29 29 0a 20 20 20 20   testdat))).    
afc0: 20 63 75 72 72 2d 74 65 73 74 73 29 0a 20 20 20   curr-tests).   
afd0: 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70   ;; NOPE: Non-op
afe0: 74 69 6d 61 6c 20 61 70 70 72 6f 61 63 68 2e 20  timal approach. 
aff0: 54 72 79 20 74 68 69 73 20 69 6e 73 74 65 61 64  Try this instead
b000: 2e 0a 20 20 20 20 3b 3b 20 20 20 31 2e 20 74 65  ..    ;;   1. te
b010: 73 74 73 20 61 72 65 20 72 65 63 65 69 76 65 64  sts are received
b020: 20 69 6e 20 61 20 6c 69 73 74 2c 20 6d 6f 73 74   in a list, most
b030: 20 72 65 63 65 6e 74 20 66 69 72 73 74 0a 20 20   recent first.  
b040: 20 20 3b 3b 20 20 20 32 2e 20 72 65 70 6c 61 63    ;;   2. replac
b050: 65 20 74 68 65 20 72 6f 6c 6c 75 70 20 74 65 73  e the rollup tes
b060: 74 20 77 69 74 68 20 74 68 65 20 6e 65 77 20 2a  t with the new *
b070: 61 6c 77 61 79 73 2a 0a 20 20 20 20 28 66 6f 72  always*.    (for
b080: 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d  -each .     (lam
b090: 62 64 61 20 28 74 65 73 74 64 61 74 29 0a 20 20  bda (testdat).  
b0a0: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73       (let* ((tes
b0b0: 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d  tname  (db:test-
b0c0: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73  get-testname tes
b0d0: 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 69  tdat))..      (i
b0e0: 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73  tem-path (db:tes
b0f0: 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20  t-get-item-path 
b100: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20  testdat))..     
b110: 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e   (full-name (con
b120: 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69  c testname "/" i
b130: 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 20  tem-path))..    
b140: 20 20 28 70 72 65 76 2d 74 65 73 74 2d 64 61 74    (prev-test-dat
b150: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
b160: 2f 64 65 66 61 75 6c 74 20 63 75 72 72 2d 74 65  /default curr-te
b170: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61  sts-hash full-na
b180: 6d 65 20 23 66 29 29 0a 09 20 20 20 20 20 20 28  me #f))..      (
b190: 74 65 73 74 2d 73 74 65 70 73 20 20 20 20 20 20  test-steps      
b1a0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
b1b0: 64 62 3a 67 65 74 2d 73 74 65 70 73 2d 66 6f 72  db:get-steps-for
b1c0: 2d 74 65 73 74 20 64 62 20 28 64 62 3a 74 65 73  -test db (db:tes
b1d0: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74  t-get-id testdat
b1e0: 29 29 29 0a 09 20 20 20 20 20 20 28 6e 65 77 2d  )))..      (new-
b1f0: 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 29  test-record #f))
b200: 0a 09 20 3b 3b 20 72 65 70 6c 61 63 65 20 74 68  .. ;; replace th
b210: 65 73 65 20 77 69 74 68 20 69 6e 73 65 72 74 20  ese with insert 
b220: 2e 2e 2e 20 73 65 6c 65 63 74 0a 09 20 28 61 70  ... select.. (ap
b230: 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63  ply sqlite3:exec
b240: 75 74 65 20 0a 09 09 64 62 20 0a 09 09 28 63 6f  ute ...db ...(co
b250: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45  nc "INSERT OR RE
b260: 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 73  PLACE INTO tests
b270: 20 28 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 6d   (run_id,testnam
b280: 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65  e,state,status,e
b290: 76 65 6e 74 5f 74 69 6d 65 2c 68 6f 73 74 2c 63  vent_time,host,c
b2a0: 70 75 6c 6f 61 64 2c 64 69 73 6b 66 72 65 65 2c  puload,diskfree,
b2b0: 75 6e 61 6d 65 2c 72 75 6e 64 69 72 2c 69 74 65  uname,rundir,ite
b2c0: 6d 5f 70 61 74 68 2c 72 75 6e 5f 64 75 72 61 74  m_path,run_durat
b2d0: 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63  ion,final_logf,c
b2e0: 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 20  omment) "...    
b2f0: 20 20 22 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f    "VALUES (?,?,?
b300: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
b310: 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e 65 77  ,?,?,?);")...new
b320: 2d 72 75 6e 2d 69 64 20 28 63 64 64 72 20 28 76  -run-id (cddr (v
b330: 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74 65 73 74  ector->list test
b340: 64 61 74 29 29 29 0a 09 20 28 73 65 74 21 20 6e  dat))).. (set! n
b350: 65 77 2d 74 65 73 74 64 61 74 20 28 63 61 72 20  ew-testdat (car 
b360: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
b370: 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72  db:get-tests-for
b380: 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d  -run db new-run-
b390: 69 64 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d  id testname item
b3a0: 2d 70 61 74 68 20 27 28 29 20 27 28 29 29 29 29  -path '() '())))
b3b0: 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73  .. (hash-table-s
b3c0: 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68  et! curr-tests-h
b3d0: 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65  ash full-name ne
b3e0: 77 2d 74 65 73 74 64 61 74 29 20 3b 3b 20 74 68  w-testdat) ;; th
b3f0: 69 73 20 63 6f 75 6c 64 20 62 65 20 63 6f 6e 66  is could be conf
b400: 75 73 69 6e 67 2c 20 77 68 69 63 68 20 72 65 63  using, which rec
b410: 6f 72 64 20 73 68 6f 75 6c 64 20 67 6f 20 69 6e  ord should go in
b420: 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 70 20 74 61  to the lookup ta
b430: 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 75  ble?.. ;; Now du
b440: 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 74  plicate the test
b450: 20 73 74 65 70 73 0a 09 20 28 64 65 62 75 67 3a   steps.. (debug:
b460: 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67  print 4 "Copying
b470: 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74   records in test
b480: 5f 73 74 65 70 73 20 66 72 6f 6d 20 74 65 73 74  _steps from test
b490: 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67  _id=" (db:test-g
b4a0: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 22  et-id testdat) "
b4b0: 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67   to " (db:test-g
b4c0: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61  et-id new-testda
b4d0: 74 29 29 0a 09 20 28 6f 70 65 6e 2d 72 75 6e 2d  t)).. (open-run-
b4e0: 63 6c 6f 73 65 20 0a 09 20 20 28 6c 61 6d 62 64  close ..  (lambd
b4f0: 61 20 28 29 0a 09 20 20 20 20 28 73 71 6c 69 74  a ()..    (sqlit
b500: 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 20  e3:execute ..   
b510: 20 20 64 62 20 0a 09 20 20 20 20 20 28 63 6f 6e    db ..     (con
b520: 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50  c "INSERT OR REP
b530: 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 73  LACE INTO test_s
b540: 74 65 70 73 20 28 74 65 73 74 5f 69 64 2c 73 74  teps (test_id,st
b550: 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61  epname,state,sta
b560: 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63  tus,event_time,c
b570: 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22  omment) "...   "
b580: 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73  SELECT " (db:tes
b590: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73  t-get-id new-tes
b5a0: 74 64 61 74 29 20 22 2c 73 74 65 70 6e 61 6d 65  tdat) ",stepname
b5b0: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76  ,state,status,ev
b5c0: 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74  ent_time,comment
b5d0: 20 46 52 4f 4d 20 74 65 73 74 5f 73 74 65 70 73   FROM test_steps
b5e0: 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d 3f   WHERE test_id=?
b5f0: 3b 22 29 0a 09 20 20 20 20 20 28 64 62 3a 74 65  ;")..     (db:te
b600: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61  st-get-id testda
b610: 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 6f 77 20  t))..    ;; Now 
b620: 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 65  duplicate the te
b630: 73 74 20 64 61 74 61 0a 09 20 20 20 20 28 64 65  st data..    (de
b640: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70  bug:print 4 "Cop
b650: 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20  ying records in 
b660: 74 65 73 74 5f 64 61 74 61 20 66 72 6f 6d 20 74  test_data from t
b670: 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73  est_id=" (db:tes
b680: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74  t-get-id testdat
b690: 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73  ) " to " (db:tes
b6a0: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73  t-get-id new-tes
b6b0: 74 64 61 74 29 29 0a 09 20 20 20 20 28 73 71 6c  tdat))..    (sql
b6c0: 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20  ite3:execute .. 
b6d0: 20 20 20 20 64 62 20 0a 09 20 20 20 20 20 28 63      db ..     (c
b6e0: 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52  onc "INSERT OR R
b6f0: 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74  EPLACE INTO test
b700: 5f 64 61 74 61 20 28 74 65 73 74 5f 69 64 2c 63  _data (test_id,c
b710: 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c 65  ategory,variable
b720: 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 2c  ,value,expected,
b730: 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e  tol,units,commen
b740: 74 29 20 22 0a 09 09 20 20 20 22 53 45 4c 45 43  t) "...   "SELEC
b750: 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  T " (db:test-get
b760: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29  -id new-testdat)
b770: 20 22 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69   ",category,vari
b780: 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63  able,value,expec
b790: 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f  ted,tol,units,co
b7a0: 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f  mment FROM test_
b7b0: 64 61 74 61 20 57 48 45 52 45 20 74 65 73 74 5f  data WHERE test_
b7c0: 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28 64  id=?;")..     (d
b7d0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
b7e0: 73 74 64 61 74 29 29 29 29 0a 09 20 29 29 0a 20  stdat)))).. )). 
b7f0: 20 20 20 20 70 72 65 76 2d 74 65 73 74 73 29 29      prev-tests))
b800: 29 0a 09 20 0a 20 20 20 20 20 0a                 ).. .     .