Megatest

Hex Artifact Content
Login

Artifact f9c80891515b7c47335444342af3a370d600bc1a:


0000: 0a 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 32 30  .;; Copyright 20
0010: 30 36 2d 32 30 31 32 2c 20 4d 61 74 74 68 65 77  06-2012, Matthew
0020: 20 57 65 6c 6c 61 6e 64 2e 0a 3b 3b 20 0a 3b 3b   Welland..;; .;;
0030: 20 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69    This program i
0040: 73 20 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65  s made available
0050: 20 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47   under the GNU G
0060: 50 4c 20 76 65 72 73 69 6f 6e 20 32 2e 30 20 6f  PL version 2.0 o
0070: 72 0a 3b 3b 20 20 67 72 65 61 74 65 72 2e 20 53  r.;;  greater. S
0080: 65 65 20 74 68 65 20 61 63 63 6f 6d 70 61 6e 79  ee the accompany
0090: 69 6e 67 20 66 69 6c 65 20 43 4f 50 59 49 4e 47  ing file COPYING
00a0: 20 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 3b 3b   for details..;;
00b0: 20 0a 3b 3b 20 20 54 68 69 73 20 70 72 6f 67 72   .;;  This progr
00c0: 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 65  am is distribute
00d0: 64 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41  d WITHOUT ANY WA
00e0: 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20  RRANTY; without 
00f0: 65 76 65 6e 20 74 68 65 0a 3b 3b 20 20 69 6d 70  even the.;;  imp
0100: 6c 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66  lied warranty of
0110: 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59   MERCHANTABILITY
0120: 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20   or FITNESS FOR 
0130: 41 20 50 41 52 54 49 43 55 4c 41 52 0a 3b 3b 20  A PARTICULAR.;; 
0140: 20 50 55 52 50 4f 53 45 2e 0a 0a 3b 3b 20 20 73   PURPOSE...;;  s
0150: 74 72 66 74 69 6d 65 28 27 25 6d 2f 25 64 2f 25  trftime('%m/%d/%
0160: 59 20 25 48 3a 25 4d 3a 25 53 27 2c 27 6e 6f 77  Y %H:%M:%S','now
0170: 27 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 29 0a 0a  ','localtime')..
0180: 28 75 73 65 20 73 71 6c 69 74 65 33 20 73 72 66  (use sqlite3 srf
0190: 69 2d 31 20 70 6f 73 69 78 20 72 65 67 65 78 20  i-1 posix regex 
01a0: 72 65 67 65 78 2d 63 61 73 65 20 73 72 66 69 2d  regex-case srfi-
01b0: 36 39 20 64 6f 74 2d 6c 6f 63 6b 69 6e 67 20 28  69 dot-locking (
01c0: 73 72 66 69 20 31 38 29 20 70 6f 73 69 78 2d 65  srfi 18) posix-e
01d0: 78 74 72 61 73 20 64 69 72 65 63 74 6f 72 79 2d  xtras directory-
01e0: 75 74 69 6c 73 29 0a 28 69 6d 70 6f 72 74 20 28  utils).(import (
01f0: 70 72 65 66 69 78 20 73 71 6c 69 74 65 33 20 73  prefix sqlite3 s
0200: 71 6c 69 74 65 33 3a 29 29 0a 0a 28 64 65 63 6c  qlite3:))..(decl
0210: 61 72 65 20 28 75 6e 69 74 20 72 75 6e 73 29 29  are (unit runs))
0220: 0a 28 64 65 63 6c 61 72 65 20 28 75 73 65 73 20  .(declare (uses 
0230: 64 62 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75  db)).(declare (u
0240: 73 65 73 20 63 6f 6d 6d 6f 6e 29 29 0a 28 64 65  ses common)).(de
0250: 63 6c 61 72 65 20 28 75 73 65 73 20 69 74 65 6d  clare (uses item
0260: 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75 73  s)).(declare (us
0270: 65 73 20 72 75 6e 63 6f 6e 66 69 67 29 29 0a 28  es runconfig)).(
0280: 64 65 63 6c 61 72 65 20 28 75 73 65 73 20 74 65  declare (uses te
0290: 73 74 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28  sts)).(declare (
02a0: 75 73 65 73 20 73 65 72 76 65 72 29 29 0a 0a 28  uses server))..(
02b0: 69 6e 63 6c 75 64 65 20 22 63 6f 6d 6d 6f 6e 5f  include "common_
02c0: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 69  records.scm").(i
02d0: 6e 63 6c 75 64 65 20 22 6b 65 79 5f 72 65 63 6f  nclude "key_reco
02e0: 72 64 73 2e 73 63 6d 22 29 0a 28 69 6e 63 6c 75  rds.scm").(inclu
02f0: 64 65 20 22 64 62 5f 72 65 63 6f 72 64 73 2e 73  de "db_records.s
0300: 63 6d 22 29 0a 28 69 6e 63 6c 75 64 65 20 22 72  cm").(include "r
0310: 75 6e 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29  un_records.scm")
0320: 0a 28 69 6e 63 6c 75 64 65 20 22 74 65 73 74 5f  .(include "test_
0330: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 0a 3b  records.scm")..;
0340: 3b 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d  ; runs:get-runs-
0350: 62 79 2d 70 61 74 74 0a 3b 3b 20 67 65 74 20 72  by-patt.;; get r
0360: 75 6e 73 20 62 79 20 6c 69 73 74 20 6f 66 20 63  uns by list of c
0370: 72 69 74 65 72 69 61 0a 3b 3b 20 72 65 67 69 73  riteria.;; regis
0380: 74 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77  ter a test run w
0390: 69 74 68 20 74 68 65 20 64 62 0a 3b 3b 0a 3b 3b  ith the db.;;.;;
03a0: 20 55 73 65 3a 20 28 64 62 2d 67 65 74 2d 76 61   Use: (db-get-va
03b0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28 64  lue-by-header (d
03c0: 62 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e  b:get-header run
03d0: 69 6e 66 6f 29 28 64 62 3a 67 65 74 2d 72 6f 77  info)(db:get-row
03e0: 20 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b 20 20 74   runinfo)).;;  t
03f0: 6f 20 65 78 74 72 61 63 74 20 69 6e 66 6f 20 66  o extract info f
0400: 72 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 72  rom the structur
0410: 65 20 72 65 74 75 72 6e 65 64 0a 3b 3b 0a 28 64  e returned.;;.(d
0420: 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d  efine (runs:get-
0430: 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20  runs-by-patt db 
0440: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74  keys runnamepatt
0450: 29 20 3b 3b 20 74 65 73 74 2d 6e 61 6d 65 29 0a  ) ;; test-name).
0460: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 76 61 6c    (let* ((keyval
0470: 6c 73 74 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69  lst (keys->valli
0480: 73 74 20 6b 65 79 73 29 29 0a 09 20 28 74 6d 70  st keys)).. (tmp
0490: 20 20 20 20 20 20 28 72 75 6e 73 3a 67 65 74 2d        (runs:get-
04a0: 73 74 64 2d 72 75 6e 2d 66 69 65 6c 64 73 20 6b  std-run-fields k
04b0: 65 79 73 20 27 28 22 69 64 22 20 22 72 75 6e 6e  eys '("id" "runn
04c0: 61 6d 65 22 20 22 73 74 61 74 65 22 20 22 73 74  ame" "state" "st
04d0: 61 74 75 73 22 20 22 6f 77 6e 65 72 22 20 22 65  atus" "owner" "e
04e0: 76 65 6e 74 5f 74 69 6d 65 22 29 29 29 0a 09 20  vent_time"))).. 
04f0: 28 6b 65 79 73 74 72 20 20 20 28 63 61 72 20 74  (keystr   (car t
0500: 6d 70 29 29 0a 09 20 28 68 65 61 64 65 72 20 20  mp)).. (header  
0510: 20 28 63 61 64 72 20 74 6d 70 29 29 0a 09 20 28   (cadr tmp)).. (
0520: 72 65 73 20 20 20 20 20 27 28 29 29 0a 09 20 28  res     '()).. (
0530: 6b 65 79 2d 70 61 74 74 20 22 22 29 0a 09 20 28  key-patt "").. (
0540: 72 75 6e 77 69 6c 64 74 79 70 65 20 28 69 66 20  runwildtype (if 
0550: 28 73 75 62 73 74 72 69 6e 67 2d 69 6e 64 65 78  (substring-index
0560: 20 22 25 22 20 72 75 6e 6e 61 6d 65 70 61 74 74   "%" runnamepatt
0570: 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f 62 22 29  ) "like" "glob")
0580: 29 0a 09 20 28 71 72 79 2d 73 74 72 20 20 23 66  ).. (qry-str  #f
0590: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  )).    (for-each
05a0: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 76 61 6c   (lambda (keyval
05b0: 29 0a 09 09 28 6c 65 74 2a 20 28 28 6b 65 79 20  )...(let* ((key 
05c0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b     (vector-ref k
05d0: 65 79 76 61 6c 20 30 29 29 0a 09 09 20 20 20 20  eyval 0))...    
05e0: 20 20 20 28 66 75 6c 6b 65 79 20 28 63 6f 6e 63     (fulkey (conc
05f0: 20 22 3a 22 20 6b 65 79 29 29 0a 09 09 20 20 20   ":" key))...   
0600: 20 20 20 20 28 70 61 74 74 20 20 20 28 61 72 67      (patt   (arg
0610: 73 3a 67 65 74 2d 61 72 67 20 66 75 6c 6b 65 79  s:get-arg fulkey
0620: 29 29 0a 09 09 20 20 20 20 20 20 20 28 77 69 6c  ))...       (wil
0630: 64 74 79 70 65 20 28 69 66 20 28 73 75 62 73 74  dtype (if (subst
0640: 72 69 6e 67 2d 69 6e 64 65 78 20 22 25 22 20 70  ring-index "%" p
0650: 61 74 74 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f  att) "like" "glo
0660: 62 22 29 29 29 0a 09 09 20 20 28 69 66 20 70 61  b")))...  (if pa
0670: 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 74 21  tt...      (set!
0680: 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e 63 20   key-patt (conc 
0690: 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 20 22  key-patt " AND "
06a0: 20 6b 65 79 20 22 20 22 20 77 69 6c 64 74 79 70   key " " wildtyp
06b0: 65 20 22 20 27 22 20 70 61 74 74 20 22 27 22 29  e " '" patt "'")
06c0: 29 0a 09 09 20 20 20 20 20 20 28 62 65 67 69 6e  )...      (begin
06d0: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ....(debug:print
06e0: 20 30 20 22 45 52 52 4f 52 3a 20 73 65 61 72 63   0 "ERROR: searc
06f0: 68 69 6e 67 20 66 6f 72 20 72 75 6e 73 20 77 69  hing for runs wi
0700: 74 68 20 6e 6f 20 70 61 74 74 65 72 6e 20 73 65  th no pattern se
0710: 74 20 66 6f 72 20 22 20 66 75 6c 6b 65 79 29 0a  t for " fulkey).
0720: 09 09 09 28 65 78 69 74 20 36 29 29 29 29 29 0a  ...(exit 6))))).
0730: 09 20 20 20 20 20 20 6b 65 79 73 29 0a 20 20 20  .      keys).   
0740: 20 28 73 65 74 21 20 71 72 79 2d 73 74 72 20 28   (set! qry-str (
0750: 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 20 6b  conc "SELECT " k
0760: 65 79 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e  eystr " FROM run
0770: 73 20 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 20  s WHERE runname 
0780: 22 20 72 75 6e 77 69 6c 64 74 79 70 65 20 22 20  " runwildtype " 
0790: 3f 20 22 20 6b 65 79 2d 70 61 74 74 20 22 3b 22  ? " key-patt ";"
07a0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  )).    (debug:pr
07b0: 69 6e 74 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 23 21 6b 65 79 20 28  testpatt #!key (
8510: 73 74 61 74 65 20 23 66 29 28 73 74 61 74 75 73  state #f)(status
8520: 20 23 66 29 28 6e 65 77 2d 73 74 61 74 65 2d 73   #f)(new-state-s
8530: 74 61 74 75 73 20 23 66 29 29 0a 20 20 28 6c 65  tatus #f)).  (le
8540: 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 20 20  t* ((db         
8550: 20 20 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20    #f).. (keys   
8560: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
8570: 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65 79  close db:get-key
8580: 73 20 64 62 29 29 0a 09 20 28 72 75 6e 64 61 74  s db)).. (rundat
8590: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
85a0: 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d  -close runs:get-
85b0: 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20  runs-by-patt db 
85c0: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74  keys runnamepatt
85d0: 29 29 0a 09 20 28 68 65 61 64 65 72 20 20 20 20  )).. (header    
85e0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72     (vector-ref r
85f0: 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e  undat 0)).. (run
8600: 73 20 20 20 20 20 20 20 20 20 28 76 65 63 74 6f  s         (vecto
8610: 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29 29  r-ref rundat 1))
8620: 0a 09 20 28 73 74 61 74 65 73 20 20 20 20 20 20  .. (states      
8630: 20 28 69 66 20 73 74 61 74 65 20 20 28 73 74 72   (if state  (str
8640: 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 65 20  ing-split state 
8650: 20 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73   ",") '())).. (s
8660: 74 61 74 75 73 65 73 20 20 20 20 20 28 69 66 20  tatuses     (if 
8670: 73 74 61 74 75 73 20 28 73 74 72 69 6e 67 2d 73  status (string-s
8680: 70 6c 69 74 20 73 74 61 74 75 73 20 22 2c 22 29  plit status ",")
8690: 20 27 28 29 29 29 0a 09 20 28 73 74 61 74 65 2d   '())).. (state-
86a0: 73 74 61 74 75 73 20 28 69 66 20 28 73 74 72 69  status (if (stri
86b0: 6e 67 3f 20 6e 65 77 2d 73 74 61 74 65 2d 73 74  ng? new-state-st
86c0: 61 74 75 73 29 20 28 73 74 72 69 6e 67 2d 73 70  atus) (string-sp
86d0: 6c 69 74 20 6e 65 77 2d 73 74 61 74 65 2d 73 74  lit new-state-st
86e0: 61 74 75 73 20 22 2c 22 29 20 27 28 23 66 20 23  atus ",") '(#f #
86f0: 66 29 29 29 29 0a 20 20 20 20 28 64 65 62 75 67  f)))).    (debug
8700: 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20  :print 4 "INFO: 
8710: 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20  runs:operate-on 
8720: 3d 3e 20 48 65 61 64 65 72 3a 20 22 20 68 65 61  => Header: " hea
8730: 64 65 72 20 22 20 61 63 74 69 6f 6e 3a 20 22 20  der " action: " 
8740: 61 63 74 69 6f 6e 20 22 20 6e 65 77 2d 73 74 61  action " new-sta
8750: 74 65 2d 73 74 61 74 75 73 3a 20 22 20 6e 65 77  te-status: " new
8760: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a 20  -state-status). 
8770: 20 20 20 28 69 66 20 28 3e 20 32 20 28 6c 65 6e     (if (> 2 (len
8780: 67 74 68 20 73 74 61 74 65 2d 73 74 61 74 75 73  gth state-status
8790: 29 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 64  ))..(begin..  (d
87a0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
87b0: 52 4f 52 3a 20 74 68 65 20 70 61 72 61 6d 65 74  ROR: the paramet
87c0: 65 72 20 74 6f 20 2d 73 65 74 2d 73 74 61 74 65  er to -set-state
87d0: 2d 73 74 61 74 75 73 20 69 73 20 61 20 63 6f 6d  -status is a com
87e0: 6d 61 20 64 65 6c 69 6d 69 74 65 64 20 73 74 72  ma delimited str
87f0: 69 6e 67 2e 20 45 2e 67 2e 20 43 4f 4d 50 4c 45  ing. E.g. COMPLE
8800: 54 45 44 2c 46 41 49 4c 22 29 0a 09 20 20 28 65  TED,FAIL")..  (e
8810: 78 69 74 29 29 29 0a 20 20 20 20 28 66 6f 72 2d  xit))).    (for-
8820: 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64  each.     (lambd
8830: 61 20 28 72 75 6e 29 0a 20 20 20 20 20 20 20 28  a (run).       (
8840: 6c 65 74 20 28 28 72 75 6e 6b 65 79 20 28 73 74  let ((runkey (st
8850: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
8860: 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b   (map (lambda (k
8870: 29 0a 09 09 09 09 09 09 28 64 62 3a 67 65 74 2d  ).......(db:get-
8880: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
8890: 72 75 6e 20 68 65 61 64 65 72 20 28 76 65 63 74  run header (vect
88a0: 6f 72 2d 72 65 66 20 6b 20 30 29 29 29 20 6b 65  or-ref k 0))) ke
88b0: 79 73 29 20 22 2f 22 29 29 0a 09 20 20 20 20 20  ys) "/"))..     
88c0: 28 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20  (dirs-to-remove 
88d0: 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65  (make-hash-table
88e0: 29 29 29 0a 09 20 28 6c 65 74 2a 20 28 28 72 75  ))).. (let* ((ru
88f0: 6e 2d 69 64 20 20 20 20 28 64 62 3a 67 65 74 2d  n-id    (db:get-
8900: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
8910: 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29  run header "id")
8920: 29 0a 09 09 28 72 75 6e 2d 73 74 61 74 65 20 28  )...(run-state (
8930: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d  db:get-value-by-
8940: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65  header run heade
8950: 72 20 22 73 74 61 74 65 22 29 29 0a 09 09 28 74  r "state"))...(t
8960: 65 73 74 73 20 20 20 20 20 28 69 66 20 28 6e 6f  ests     (if (no
8970: 74 20 28 65 71 75 61 6c 3f 20 72 75 6e 2d 73 74  t (equal? run-st
8980: 61 74 65 20 22 6c 6f 63 6b 65 64 22 29 29 0a 09  ate "locked"))..
8990: 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  ..       (open-r
89a0: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d  un-close db:get-
89b0: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62  tests-for-run db
89c0: 20 72 75 6e 2d 69 64 0a 09 09 09 09 09 09 20 20   run-id.......  
89d0: 20 20 20 20 74 65 73 74 70 61 74 74 20 73 74 61      testpatt sta
89e0: 74 65 73 20 73 74 61 74 75 73 65 73 0a 09 09 09  tes statuses....
89f0: 09 09 09 20 20 20 20 20 20 6e 6f 74 2d 69 6e 3a  ...      not-in:
8a00: 20 20 23 66 0a 09 09 09 09 09 09 20 20 20 20 20    #f.......     
8a10: 20 73 6f 72 74 2d 62 79 3a 20 28 63 61 73 65 20   sort-by: (case 
8a20: 61 63 74 69 6f 6e 0a 09 09 09 09 09 09 09 09 20  action......... 
8a30: 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20 27  ((remove-runs) '
8a40: 72 75 6e 64 69 72 29 0a 09 09 09 09 09 09 09 09  rundir).........
8a50: 20 28 65 6c 73 65 20 20 20 20 20 20 20 20 20 20   (else          
8a60: 27 65 76 65 6e 74 5f 74 69 6d 65 29 29 29 0a 09  'event_time)))..
8a70: 09 09 20 20 20 20 20 20 20 27 28 29 29 29 0a 09  ..       '()))..
8a80: 09 28 6c 61 73 74 74 70 61 74 68 20 22 2f 64 6f  .(lasttpath "/do
8a90: 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68  es/not/exist/I/h
8aa0: 6f 70 65 22 29 29 0a 09 20 20 20 28 64 65 62 75  ope"))..   (debu
8ab0: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a  g:print 4 "INFO:
8ac0: 20 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e   runs:operate-on
8ad0: 20 72 75 6e 3d 22 20 72 75 6e 20 22 2c 20 68 65   run=" run ", he
8ae0: 61 64 65 72 3d 22 20 68 65 61 64 65 72 29 0a 09  ader=" header)..
8af0: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c     (if (not (nul
8b00: 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 20 20 20  l? tests))..    
8b10: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 28 63 61     (begin... (ca
8b20: 73 65 20 61 63 74 69 6f 6e 0a 09 09 20 20 20 28  se action...   (
8b30: 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 09  (remove-runs)...
8b40: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
8b50: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 73   1 "Removing tes
8b60: 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75  ts for run: " ru
8b70: 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74  nkey " " (db:get
8b80: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
8b90: 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e   run header "run
8ba0: 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28 28  name")))...   ((
8bb0: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73  set-state-status
8bc0: 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70  )...    (debug:p
8bd0: 72 69 6e 74 20 31 20 22 4d 6f 64 69 66 79 69 6e  rint 1 "Modifyin
8be0: 67 20 73 74 61 74 65 20 61 6e 64 20 73 74 61 75  g state and stau
8bf0: 73 20 66 6f 72 20 74 65 73 74 73 20 66 6f 72 20  s for tests for 
8c00: 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20  run: " runkey " 
8c10: 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  " (db:get-value-
8c20: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
8c30: 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29  ader "runname"))
8c40: 29 0a 09 09 20 20 20 28 28 70 72 69 6e 74 2d 72  )...   ((print-r
8c50: 75 6e 29 0a 09 09 20 20 20 20 28 64 65 62 75 67  un)...    (debug
8c60: 3a 70 72 69 6e 74 20 31 20 22 50 72 69 6e 74 69  :print 1 "Printi
8c70: 6e 67 20 69 6e 66 6f 20 66 6f 72 20 72 75 6e 20  ng info for run 
8c80: 22 20 72 75 6e 6b 65 79 20 22 2c 20 72 75 6e 3d  " runkey ", run=
8c90: 22 20 72 75 6e 20 22 2c 20 74 65 73 74 73 3d 22  " run ", tests="
8ca0: 20 74 65 73 74 73 20 22 2c 20 68 65 61 64 65 72   tests ", header
8cb0: 3d 22 20 68 65 61 64 65 72 29 0a 09 09 20 20 20  =" header)...   
8cc0: 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 20 28 65   action)...   (e
8cd0: 6c 73 65 0a 09 09 20 20 20 20 28 70 72 69 6e 74  lse...    (print
8ce0: 20 22 49 4e 46 4f 3a 20 61 63 74 69 6f 6e 20 6e   "INFO: action n
8cf0: 6f 74 20 72 65 63 6f 67 6e 69 73 65 64 20 22 20  ot recognised " 
8d00: 61 63 74 69 6f 6e 29 29 29 0a 09 09 20 28 66 6f  action)))... (fo
8d10: 72 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d 62  r-each...  (lamb
8d20: 64 61 20 28 74 65 73 74 29 0a 09 09 20 20 20 20  da (test)...    
8d30: 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 74  (let* ((item-pat
8d40: 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  h (db:test-get-i
8d50: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 0a  tem-path test)).
8d60: 09 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d 65  ...   (test-name
8d70: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
8d80: 73 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 09  stname test))...
8d90: 09 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20 28  .   (run-dir   (
8da0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64  db:test-get-rund
8db0: 69 72 20 74 65 73 74 29 29 20 20 20 20 3b 3b 20  ir test))    ;; 
8dc0: 72 75 6e 20 64 69 72 20 69 73 20 66 72 6f 6d 20  run dir is from 
8dd0: 74 68 65 20 6c 69 6e 6b 20 74 72 65 65 0a 09 09  the link tree...
8de0: 09 20 20 20 28 72 65 61 6c 2d 64 69 72 20 20 28  .   (real-dir  (
8df0: 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f  if (file-exists?
8e00: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 09 20   run-dir)...... 
8e10: 20 28 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e 61   (resolve-pathna
8e20: 6d 65 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09  me run-dir).....
8e30: 09 20 20 23 66 29 29 0a 09 09 09 20 20 20 28 74  .  #f))....   (t
8e40: 65 73 74 2d 69 64 20 20 20 28 64 62 3a 74 65 73  est-id   (db:tes
8e50: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29 29  t-get-id test)))
8e60: 0a 09 09 20 20 20 20 20 20 3b 3b 20 20 20 28 74  ...      ;;   (t
8e70: 64 62 20 20 20 20 20 20 20 28 64 62 3a 6f 70 65  db       (db:ope
8e80: 6e 2d 74 65 73 74 2d 64 62 20 72 75 6e 2d 64 69  n-test-db run-di
8e90: 72 29 29 29 0a 09 09 20 20 20 20 20 20 28 64 65  r)))...      (de
8ea0: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46  bug:print 4 "INF
8eb0: 4f 3a 20 74 65 73 74 3d 22 20 74 65 73 74 29 20  O: test=" test) 
8ec0: 3b 3b 20 20 20 22 20 28 64 62 3a 74 65 73 74 2d  ;;   " (db:test-
8ed0: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73  get-testname tes
8ee0: 74 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a 74  t) " id: " (db:t
8ef0: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29  est-get-id test)
8f00: 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22   " " item-path "
8f10: 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f   action: " actio
8f20: 6e 29 0a 09 09 20 20 20 20 20 20 28 63 61 73 65  n)...      (case
8f30: 20 61 63 74 69 6f 6e 0a 09 09 09 28 28 72 65 6d   action....((rem
8f40: 6f 76 65 2d 72 75 6e 73 29 20 3b 3b 20 74 68 65  ove-runs) ;; the
8f50: 20 74 64 62 20 69 73 20 66 6f 72 20 66 75 74 75   tdb is for futu
8f60: 72 65 20 70 6f 73 73 69 62 6c 65 2e 20 0a 09 09  re possible. ...
8f70: 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73  . (open-run-clos
8f80: 65 20 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74  e db:delete-test
8f90: 2d 72 65 63 6f 72 64 73 20 64 62 20 23 66 20 28  -records db #f (
8fa0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
8fb0: 65 73 74 29 29 0a 09 09 09 20 28 64 65 62 75 67  est)).... (debug
8fc0: 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20  :print 1 "INFO: 
8fd0: 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 72 65  Attempting to re
8fe0: 6d 6f 76 65 20 64 69 72 20 22 20 72 65 61 6c 2d  move dir " real-
8ff0: 64 69 72 20 22 20 61 6e 64 20 6c 69 6e 6b 20 22  dir " and link "
9000: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 28 69   run-dir).... (i
9010: 66 20 28 61 6e 64 20 72 65 61 6c 2d 64 69 72 20  f (and real-dir 
9020: 0a 09 09 09 09 20 20 28 3e 20 28 73 74 72 69 6e  .....  (> (strin
9030: 67 2d 6c 65 6e 67 74 68 20 72 65 61 6c 2d 64 69  g-length real-di
9040: 72 29 20 35 29 0a 09 09 09 09 20 20 28 66 69 6c  r) 5).....  (fil
9050: 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c 2d 64  e-exists? real-d
9060: 69 72 29 29 20 3b 3b 20 62 61 64 20 68 65 75 72  ir)) ;; bad heur
9070: 69 73 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64  istic but should
9080: 20 70 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68   prevent /tmp /h
9090: 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20 20 20 20  ome etc.....    
90a0: 20 28 62 65 67 69 6e 20 3b 3b 20 6c 65 74 2a 20   (begin ;; let* 
90b0: 28 28 72 65 61 6c 70 61 74 68 20 28 72 65 73 6f  ((realpath (reso
90c0: 6c 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e  lve-pathname run
90d0: 2d 64 69 72 29 29 29 0a 09 09 09 20 20 20 20 20  -dir)))....     
90e0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31    (debug:print 1
90f0: 20 22 49 4e 46 4f 3a 20 52 65 63 75 72 73 69 76   "INFO: Recursiv
9100: 65 6c 79 20 72 65 6d 6f 76 69 6e 67 20 22 20 72  ely removing " r
9110: 65 61 6c 2d 64 69 72 29 0a 09 09 09 20 20 20 20  eal-dir)....    
9120: 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69     (if (file-exi
9130: 73 74 73 3f 20 72 65 61 6c 2d 64 69 72 29 0a 09  sts? real-dir)..
9140: 09 09 09 20 20 20 28 69 66 20 28 3e 20 28 73 79  ...   (if (> (sy
9150: 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d  stem (conc "rm -
9160: 72 66 20 22 20 72 65 61 6c 2d 64 69 72 29 29 20  rf " real-dir)) 
9170: 30 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64  0).....       (d
9180: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
9190: 52 4f 52 3a 20 54 68 65 72 65 20 77 61 73 20 61  ROR: There was a
91a0: 20 70 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 69 6e   problem removin
91b0: 67 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20 77  g " real-dir " w
91c0: 69 74 68 20 72 6d 20 2d 66 22 29 29 0a 09 09 09  ith rm -f"))....
91d0: 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  .   (debug:print
91e0: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 74 65 73   0 "WARNING: tes
91f0: 74 20 72 75 6e 20 64 69 72 20 22 20 72 65 61 6c  t run dir " real
9200: 2d 64 69 72 20 22 20 61 70 70 65 61 72 73 20 74  -dir " appears t
9210: 6f 20 6e 6f 74 20 65 78 69 73 74 22 29 29 29 0a  o not exist"))).
9220: 09 09 09 20 20 20 20 20 28 64 65 62 75 67 3a 70  ...     (debug:p
9230: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a  rint 0 "WARNING:
9240: 20 64 69 72 65 63 74 6f 72 79 20 22 20 72 65 61   directory " rea
9250: 6c 2d 64 69 72 20 22 20 64 6f 65 73 20 6e 6f 74  l-dir " does not
9260: 20 65 78 69 73 74 22 29 29 0a 09 09 09 20 28 69   exist")).... (i
9270: 66 20 28 73 79 6d 62 6f 6c 69 63 2d 6c 69 6e 6b  f (symbolic-link
9280: 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 20  ? run-dir)....  
9290: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20     (begin....   
92a0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
92b0: 20 31 20 22 49 4e 46 4f 3a 20 52 65 6d 6f 76 69   1 "INFO: Removi
92c0: 6e 67 20 73 79 6d 6c 69 6e 6b 20 22 20 72 75 6e  ng symlink " run
92d0: 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20 20 20  -dir)....       
92e0: 28 64 65 6c 65 74 65 2d 66 69 6c 65 20 72 75 6e  (delete-file run
92f0: 2d 64 69 72 29 29 0a 09 09 09 20 20 20 20 20 28  -dir))....     (
9300: 69 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20 72  if (directory? r
9310: 75 6e 2d 64 69 72 29 0a 09 09 09 09 20 28 69 66  un-dir)..... (if
9320: 20 28 3e 20 28 64 69 72 65 63 74 6f 72 79 2d 66   (> (directory-f
9330: 6f 6c 64 20 28 6c 61 6d 62 64 61 20 28 66 20 78  old (lambda (f x
9340: 29 28 2b 20 31 20 78 29 29 20 30 20 72 75 6e 2d  )(+ 1 x)) 0 run-
9350: 64 69 72 29 20 30 29 0a 09 09 09 09 20 20 20 20  dir) 0).....    
9360: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
9370: 22 57 41 52 4e 49 4e 47 3a 20 72 65 66 75 73 69  "WARNING: refusi
9380: 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72  ng to remove " r
9390: 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20 69  un-dir " as it i
93a0: 73 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09 09  s not empty")...
93b0: 09 09 20 20 20 20 20 28 64 65 6c 65 74 65 2d 64  ..     (delete-d
93c0: 69 72 65 63 74 6f 72 79 20 72 75 6e 2d 64 69 72  irectory run-dir
93d0: 29 29 20 3b 3b 20 69 74 20 73 68 6f 75 6c 64 20  )) ;; it should 
93e0: 62 65 20 65 6d 70 74 79 20 62 79 20 68 65 72 65  be empty by here
93f0: 20 42 55 47 20 42 55 47 2c 20 61 64 64 20 65 72   BUG BUG, add er
9400: 72 6f 72 20 63 61 74 63 68 0a 09 09 09 09 20 28  ror catch..... (
9410: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
9420: 52 52 4f 52 3a 20 72 65 66 75 73 69 6e 67 20 74  RROR: refusing t
9430: 6f 20 72 65 6d 6f 76 65 20 22 20 72 75 6e 2d 64  o remove " run-d
9440: 69 72 20 22 20 61 73 20 69 74 20 65 69 74 68 65  ir " as it eithe
9450: 72 20 64 6f 65 73 6e 27 74 20 65 78 69 73 74 20  r doesn't exist 
9460: 6f 72 20 69 73 20 6e 6f 74 20 61 20 73 79 6d 6c  or is not a syml
9470: 69 6e 6b 20 6f 72 20 64 69 72 65 63 74 6f 72 79  ink or directory
9480: 22 29 0a 09 09 09 09 20 29 29 29 0a 09 09 09 28  ")..... )))....(
9490: 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75  (set-state-statu
94a0: 73 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72  s).... (debug:pr
94b0: 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20 6e 65 77  int 2 "INFO: new
94c0: 20 73 74 61 74 65 20 22 20 28 63 61 72 20 73 74   state " (car st
94d0: 61 74 65 2d 73 74 61 74 75 73 29 20 22 2c 20 6e  ate-status) ", n
94e0: 65 77 20 73 74 61 74 75 73 20 22 20 28 63 61 64  ew status " (cad
94f0: 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 29  r state-status))
9500: 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  .... (open-run-c
9510: 6c 6f 73 65 20 64 62 3a 74 65 73 74 2d 73 65 74  lose db:test-set
9520: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 2d 62 79  -state-status-by
9530: 2d 69 64 20 64 62 20 28 64 62 3a 74 65 73 74 2d  -id db (db:test-
9540: 67 65 74 2d 69 64 20 74 65 73 74 29 20 28 63 61  get-id test) (ca
9550: 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 28  r state-status)(
9560: 63 61 64 72 20 73 74 61 74 65 2d 73 74 61 74 75  cadr state-statu
9570: 73 29 20 23 66 29 29 29 29 29 0a 09 09 20 20 28  s) #f)))))...  (
9580: 73 6f 72 74 20 74 65 73 74 73 20 28 6c 61 6d 62  sort tests (lamb
9590: 64 61 20 28 61 20 62 29 28 6c 65 74 20 28 28 64  da (a b)(let ((d
95a0: 69 72 61 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ira (db:test-get
95b0: 2d 72 75 6e 64 69 72 20 61 29 29 0a 09 09 09 09  -rundir a)).....
95c0: 09 09 20 28 64 69 72 62 20 28 64 62 3a 74 65 73  .. (dirb (db:tes
95d0: 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 62 29 29  t-get-rundir b))
95e0: 29 0a 09 09 09 09 09 20 20 20 20 20 28 69 66 20  )......     (if 
95f0: 28 61 6e 64 20 28 73 74 72 69 6e 67 3f 20 64 69  (and (string? di
9600: 72 61 29 28 73 74 72 69 6e 67 3f 20 64 69 72 62  ra)(string? dirb
9610: 29 29 0a 09 09 09 09 09 09 20 28 3e 20 28 73 74  ))....... (> (st
9620: 72 69 6e 67 2d 6c 65 6e 67 74 68 20 64 69 72 61  ring-length dira
9630: 29 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20  )(string-length 
9640: 64 69 72 62 29 29 0a 09 09 09 09 09 09 20 23 66  dirb))....... #f
9650: 29 29 29 29 29 29 29 0a 09 20 20 20 3b 3b 20 72  )))))))..   ;; r
9660: 65 6d 6f 76 65 20 74 68 65 20 72 75 6e 20 69 66  emove the run if
9670: 20 7a 65 72 6f 20 74 65 73 74 73 20 72 65 6d 61   zero tests rema
9680: 69 6e 0a 09 20 20 20 28 69 66 20 28 65 71 3f 20  in..   (if (eq? 
9690: 61 63 74 69 6f 6e 20 27 72 65 6d 6f 76 65 2d 72  action 'remove-r
96a0: 75 6e 73 29 0a 09 20 20 20 20 20 20 20 28 6c 65  uns)..       (le
96b0: 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 6f 70  t ((remtests (op
96c0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
96d0: 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75  get-tests-for-ru
96e0: 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c  n db (db:get-val
96f0: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
9700: 20 68 65 61 64 65 72 20 22 69 64 22 29 20 23 66   header "id") #f
9710: 20 27 28 22 44 45 4c 45 54 45 44 22 29 20 27 28   '("DELETED") '(
9720: 22 6e 2f 61 22 29 20 6e 6f 74 2d 69 6e 3a 20 23  "n/a") not-in: #
9730: 74 29 29 29 0a 09 09 20 28 69 66 20 28 6e 75 6c  t)))... (if (nul
9740: 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b 20  l? remtests) ;; 
9750: 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72 65  no more tests re
9760: 6d 61 69 6e 69 6e 67 0a 09 09 20 20 20 20 20 28  maining...     (
9770: 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 28  let* ((dparts  (
9780: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73  string-split las
9790: 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09  ttpath "/"))....
97a0: 20 20 20 20 28 72 75 6e 70 61 74 68 20 28 63 6f      (runpath (co
97b0: 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69  nc "/" (string-i
97c0: 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 09  ntersperse .....
97d0: 09 09 28 74 61 6b 65 20 64 70 61 72 74 73 20 28  ..(take dparts (
97e0: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73  - (length dparts
97f0: 29 20 31 29 29 0a 09 09 09 09 09 09 22 2f 22 29  ) 1))......."/")
9800: 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 64 65  )))...       (de
9810: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d  bug:print 1 "Rem
9820: 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e  oving run: " run
9830: 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d  key " " (db:get-
9840: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
9850: 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e  run header "runn
9860: 61 6d 65 22 29 20 22 20 61 6e 64 20 72 65 6c 61  ame") " and rela
9870: 74 65 64 20 72 65 63 6f 72 64 22 29 0a 09 09 20  ted record")... 
9880: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
9890: 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d  close db:delete-
98a0: 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09  run db run-id)..
98b0: 09 20 20 20 20 20 20 20 3b 3b 20 54 68 69 73 20  .       ;; This 
98c0: 69 73 20 61 20 70 72 65 74 74 79 20 67 6f 6f 64  is a pretty good
98d0: 20 70 6c 61 63 65 20 74 6f 20 70 75 72 67 65 20   place to purge 
98e0: 6f 6c 64 20 44 45 4c 45 54 45 44 20 74 65 73 74  old DELETED test
98f0: 73 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e  s...       (open
9900: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65  -run-close db:de
9910: 6c 65 74 65 2d 74 65 73 74 73 2d 66 6f 72 2d 72  lete-tests-for-r
9920: 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09  un db run-id)...
9930: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
9940: 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65  -close db:delete
9950: 2d 6f 6c 64 2d 64 65 6c 65 74 65 64 2d 74 65 73  -old-deleted-tes
9960: 74 2d 72 65 63 6f 72 64 73 20 64 62 29 0a 09 09  t-records db)...
9970: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
9980: 2d 63 6c 6f 73 65 20 64 62 3a 73 65 74 2d 76 61  -close db:set-va
9990: 72 20 64 62 20 22 44 45 4c 45 54 45 44 5f 54 45  r db "DELETED_TE
99a0: 53 54 53 22 20 28 63 75 72 72 65 6e 74 2d 73 65  STS" (current-se
99b0: 63 6f 6e 64 73 29 29 0a 09 09 20 20 20 20 20 20  conds))...      
99c0: 20 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 75   ;; need to figu
99d0: 72 65 20 6f 75 74 20 74 68 65 20 70 61 74 68 20  re out the path 
99e0: 74 6f 20 74 68 65 20 72 75 6e 20 64 69 72 20 61  to the run dir a
99f0: 6e 64 20 72 65 6d 6f 76 65 20 69 74 20 69 66 20  nd remove it if 
9a00: 65 6d 70 74 79 0a 09 09 20 20 20 20 20 20 20 3b  empty...       ;
9a10: 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20  ;    (if (null? 
9a20: 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70  (glob (conc runp
9a30: 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 20 20  ath "/*")))...  
9a40: 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28       ;;        (
9a50: 62 65 67 69 6e 0a 09 09 20 20 20 20 20 20 20 3b  begin...       ;
9a60: 3b 20 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ; . (debug:print
9a70: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e   1 "Removing run
9a80: 20 64 69 72 20 22 20 72 75 6e 70 61 74 68 29 0a   dir " runpath).
9a90: 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28 73  ..       ;; . (s
9aa0: 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64  ystem (conc "rmd
9ab0: 69 72 20 2d 70 20 22 20 72 75 6e 70 61 74 68 29  ir -p " runpath)
9ac0: 29 29 29 0a 09 09 20 20 20 20 20 20 20 29 29 29  )))...       )))
9ad0: 29 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75 6e  )).. )).     run
9ae0: 73 29 29 0a 20 20 23 74 29 0a 0a 3b 3b 3d 3d 3d  s)).  #t)..;;===
9af0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9b00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9b10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9b20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9b30: 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20  ===.;; Routines 
9b40: 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67  for manipulating
9b50: 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d   runs.;;========
9b60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9b70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9b80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9b90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a  ==============..
9ba0: 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61  ;; Since many ca
9bb0: 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71  lls to a run req
9bc0: 75 69 72 65 20 70 72 65 74 74 79 20 6d 75 63 68  uire pretty much
9bd0: 20 74 68 65 20 73 61 6d 65 20 73 65 74 75 70 20   the same setup 
9be0: 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 70 65 72  .;; this wrapper
9bf0: 20 69 73 20 75 73 65 64 20 74 6f 20 72 65 64 75   is used to redu
9c00: 63 65 20 74 68 65 20 72 65 70 6c 69 63 61 74 69  ce the replicati
9c10: 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69  on of code.(defi
9c20: 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d  ne (general-run-
9c30: 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20  call switchname 
9c40: 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63  action-desc proc
9c50: 29 0a 20 20 28 6c 65 74 20 28 28 72 75 6e 6e 61  ).  (let ((runna
9c60: 6d 65 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  me (args:get-arg
9c70: 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28   ":runname"))..(
9c80: 74 61 72 67 65 74 20 20 28 69 66 20 28 61 72 67  target  (if (arg
9c90: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67  s:get-arg "-targ
9ca0: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67  et")...     (arg
9cb0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67  s:get-arg "-targ
9cc0: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67  et")...     (arg
9cd0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74  s:get-arg "-reqt
9ce0: 61 72 67 22 29 29 29 0a 09 28 74 68 31 20 20 20  arg")))..(th1   
9cf0: 20 20 23 66 29 29 0a 20 20 20 20 28 63 6f 6e 64    #f)).    (cond
9d00: 0a 20 20 20 20 20 28 28 6e 6f 74 20 74 61 72 67  .     ((not targ
9d10: 65 74 29 0a 20 20 20 20 20 20 28 64 65 62 75 67  et).      (debug
9d20: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
9d30: 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65   Missing require
9d40: 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20  d parameter for 
9d50: 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20  " switchname ", 
9d60: 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79  you must specify
9d70: 20 74 68 65 20 74 61 72 67 65 74 20 77 69 74 68   the target with
9d80: 20 2d 74 61 72 67 65 74 22 29 0a 20 20 20 20 20   -target").     
9d90: 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 20 20   (exit 3)).     
9da0: 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20  ((not runname). 
9db0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
9dc0: 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73  t 0 "ERROR: Miss
9dd0: 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 72  ing required par
9de0: 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 69  ameter for " swi
9df0: 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d  tchname ", you m
9e00: 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65 20  ust specify the 
9e10: 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72  run name with :r
9e20: 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29  unname runname")
9e30: 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29  .      (exit 3))
9e40: 0a 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20  .     (else.    
9e50: 20 20 28 6c 65 74 20 28 28 64 62 20 20 20 23 66    (let ((db   #f
9e60: 29 0a 09 20 20 20 20 28 6b 65 79 73 20 23 66 29  )..    (keys #f)
9e70: 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 65 74  )..(if (not (set
9e80: 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20  up-for-run))..  
9e90: 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 20 20    (begin ..     
9ea0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
9eb0: 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74 75 70  "Failed to setup
9ec0: 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20 20 20  , exiting")..   
9ed0: 20 20 20 28 65 78 69 74 20 31 29 29 29 0a 09 28     (exit 1)))..(
9ee0: 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  if (args:get-arg
9ef0: 20 22 2d 73 65 72 76 65 72 22 29 0a 09 20 20 20   "-server")..   
9f00: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
9f10: 20 73 65 72 76 65 72 3a 73 74 61 72 74 20 64 62   server:start db
9f20: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
9f30: 2d 73 65 72 76 65 72 22 29 29 0a 20 09 20 20 20  -server")). .   
9f40: 20 28 69 66 20 28 6e 6f 74 20 28 6f 72 20 28 61   (if (not (or (a
9f50: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75  rgs:get-arg "-ru
9f60: 6e 61 6c 6c 22 29 20 20 20 20 20 3b 3b 20 72 75  nall")     ;; ru
9f70: 6e 61 6c 6c 20 61 6e 64 20 72 75 6e 74 65 73 74  nall and runtest
9f80: 73 20 61 72 65 20 61 6c 6c 6f 77 65 64 20 74 6f  s are allowed to
9f90: 20 62 65 20 73 65 72 76 65 72 73 0a 20 09 09 09   be servers. ...
9fa0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
9fb0: 2d 72 75 6e 74 65 73 74 73 22 29 29 29 0a 09 09  -runtests")))...
9fc0: 28 73 65 72 76 65 72 3a 63 6c 69 65 6e 74 2d 73  (server:client-s
9fd0: 65 74 75 70 29 29 29 0a 09 28 73 65 74 21 20 6b  etup)))..(set! k
9fe0: 65 79 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c  eys (open-run-cl
9ff0: 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20  ose db:get-keys 
a000: 64 62 29 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e  db))..;; have en
a010: 6f 75 67 68 20 74 6f 20 70 72 6f 63 65 73 73 20  ough to process 
a020: 2d 74 61 72 67 65 74 20 6f 72 20 2d 72 65 71 74  -target or -reqt
a030: 61 72 67 20 68 65 72 65 0a 09 28 69 66 20 28 61  arg here..(if (a
a040: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65  rgs:get-arg "-re
a050: 71 74 61 72 67 22 29 0a 09 20 20 20 20 28 6c 65  qtarg")..    (le
a060: 74 2a 20 28 28 72 75 6e 63 6f 6e 66 69 67 66 20  t* ((runconfigf 
a070: 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a  (conc  *toppath*
a080: 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f   "/runconfigs.co
a090: 6e 66 69 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f  nfig")) ;; DO NO
a0a0: 54 20 45 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a  T EVALUATE ALL .
a0b0: 09 09 20 20 20 28 72 75 6e 63 6f 6e 66 69 67 20  ..   (runconfig 
a0c0: 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 72 75   (read-config ru
a0d0: 6e 63 6f 6e 66 69 67 66 20 23 66 20 23 66 20 65  nconfigf #f #f e
a0e0: 6e 76 69 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29  nviron-patt: #f)
a0f0: 29 29 20 0a 09 20 20 20 20 20 20 28 69 66 20 28  )) ..      (if (
a100: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
a110: 65 66 61 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67  efault runconfig
a120: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
a130: 2d 72 65 71 74 61 72 67 22 29 20 23 66 29 0a 09  -reqtarg") #f)..
a140: 09 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d  .  (keys:target-
a150: 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61  set-args keys (a
a160: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65  rgs:get-arg "-re
a170: 71 74 61 72 67 22 29 20 61 72 67 73 3a 61 72 67  qtarg") args:arg
a180: 2d 68 61 73 68 29 0a 09 09 20 20 28 62 65 67 69  -hash)...  (begi
a190: 6e 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70  n...    (debug:p
a1a0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 5b  rint 0 "ERROR: [
a1b0: 22 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  " (args:get-arg 
a1c0: 22 2d 72 65 71 74 61 72 67 22 29 20 22 5d 20 6e  "-reqtarg") "] n
a1d0: 6f 74 20 66 6f 75 6e 64 20 69 6e 20 22 20 72 75  ot found in " ru
a1e0: 6e 63 6f 6e 66 69 67 66 29 0a 09 09 20 20 20 20  nconfigf)...    
a1f0: 28 69 66 20 64 62 20 28 73 71 6c 69 74 65 33 3a  (if db (sqlite3:
a200: 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 29 0a 09  finalize! db))..
a210: 09 20 20 20 20 28 65 78 69 74 20 31 29 29 29 29  .    (exit 1))))
a220: 0a 09 20 20 20 20 28 69 66 20 28 61 72 67 73 3a  ..    (if (args:
a230: 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74  get-arg "-target
a240: 22 29 0a 09 09 28 6b 65 79 73 3a 74 61 72 67 65  ")...(keys:targe
a250: 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20  t-set-args keys 
a260: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
a270: 74 61 72 67 65 74 22 20 61 72 67 73 3a 61 72 67  target" args:arg
a280: 2d 68 61 73 68 29 20 61 72 67 73 3a 61 72 67 2d  -hash) args:arg-
a290: 68 61 73 68 29 29 29 0a 09 28 69 66 20 28 6e 6f  hash)))..(if (no
a2a0: 74 20 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e  t (car *configin
a2b0: 66 6f 2a 29 29 0a 09 20 20 20 20 28 62 65 67 69  fo*))..    (begi
a2c0: 6e 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a  n..      (debug:
a2d0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
a2e0: 41 74 74 65 6d 70 74 65 64 20 74 6f 20 22 20 61  Attempted to " a
a2f0: 63 74 69 6f 6e 2d 64 65 73 63 20 22 20 62 75 74  ction-desc " but
a300: 20 72 75 6e 20 61 72 65 61 20 63 6f 6e 66 69 67   run area config
a310: 20 66 69 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 22   file not found"
a320: 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31  )..      (exit 1
a330: 29 29 0a 09 20 20 20 20 3b 3b 20 45 78 74 72 61  ))..    ;; Extra
a340: 63 74 20 6f 75 74 20 73 74 75 66 66 20 6e 65 65  ct out stuff nee
a350: 64 65 64 20 69 6e 20 6d 6f 73 74 20 6f 72 20 6d  ded in most or m
a360: 61 6e 79 20 63 61 6c 6c 73 0a 09 20 20 20 20 3b  any calls..    ;
a370: 3b 20 68 65 72 65 20 74 68 65 6e 20 63 61 6c 6c  ; here then call
a380: 20 70 72 6f 63 0a 09 20 20 20 20 28 6c 65 74 2a   proc..    (let*
a390: 20 28 28 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d   ((keynames   (m
a3a0: 61 70 20 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64  ap key:get-field
a3b0: 6e 61 6d 65 20 6b 65 79 73 29 29 0a 09 09 20 20  name keys))...  
a3c0: 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 28 6b 65   (keyvallst  (ke
a3d0: 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73  ys->vallist keys
a3e0: 20 23 74 29 29 29 0a 09 20 20 20 20 20 20 28 70   #t)))..      (p
a3f0: 72 6f 63 20 74 61 72 67 65 74 20 72 75 6e 6e 61  roc target runna
a400: 6d 65 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73  me keys keynames
a410: 20 6b 65 79 76 61 6c 6c 73 74 29 29 29 0a 09 28   keyvallst)))..(
a420: 69 66 20 74 68 31 20 28 74 68 72 65 61 64 2d 6a  if th1 (thread-j
a430: 6f 69 6e 21 20 74 68 31 29 29 0a 09 28 69 66 20  oin! th1))..(if 
a440: 64 62 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61  db (sqlite3:fina
a450: 6c 69 7a 65 21 20 64 62 29 29 0a 09 28 73 65 74  lize! db))..(set
a460: 21 20 2a 64 69 64 73 6f 6d 65 74 68 69 6e 67 2a  ! *didsomething*
a470: 20 23 74 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d   #t))))))..;;===
a480: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a490: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a4a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a4b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a4c0: 3d 3d 3d 0a 3b 3b 20 4c 6f 63 6b 2f 75 6e 6c 6f  ===.;; Lock/unlo
a4d0: 63 6b 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d  ck runs.;;======
a4e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a4f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a500: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a510: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a520: 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a  ..(define (runs:
a530: 68 61 6e 64 6c 65 2d 6c 6f 63 6b 69 6e 67 20 74  handle-locking t
a540: 61 72 67 65 74 20 6b 65 79 73 20 72 75 6e 6e 61  arget keys runna
a550: 6d 65 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75  me lock unlock u
a560: 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 64  ser).  (let* ((d
a570: 62 20 20 20 20 20 20 20 23 66 29 0a 09 20 28 72  b       #f).. (r
a580: 75 6e 64 61 74 20 20 20 28 6f 70 65 6e 2d 72 75  undat   (open-ru
a590: 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74  n-close runs:get
a5a0: 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62  -runs-by-patt db
a5b0: 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 29 29 0a   keys runname)).
a5c0: 09 20 28 68 65 61 64 65 72 20 20 20 28 76 65 63  . (header   (vec
a5d0: 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30  tor-ref rundat 0
a5e0: 29 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 28  )).. (runs     (
a5f0: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61  vector-ref runda
a600: 74 20 31 29 29 29 0a 20 20 20 20 28 66 6f 72 2d  t 1))).    (for-
a610: 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 72 75  each (lambda (ru
a620: 6e 29 0a 09 09 28 6c 65 74 20 28 28 72 75 6e 2d  n)...(let ((run-
a630: 69 64 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65  id (db:get-value
a640: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
a650: 65 61 64 65 72 20 22 69 64 22 29 29 29 0a 09 09  eader "id")))...
a660: 20 20 28 69 66 20 28 6f 72 20 6c 6f 63 6b 0a 09    (if (or lock..
a670: 09 09 20 20 28 61 6e 64 20 75 6e 6c 6f 63 6b 0a  ..  (and unlock.
a680: 09 09 09 20 20 20 20 20 20 20 28 62 65 67 69 6e  ...       (begin
a690: 0a 09 09 09 09 20 28 70 72 69 6e 74 20 22 44 6f  ..... (print "Do
a6a0: 20 79 6f 75 20 72 65 61 6c 6c 79 20 77 69 73 68   you really wish
a6b0: 20 74 6f 20 75 6e 6c 6f 63 6b 20 72 75 6e 20 22   to unlock run "
a6c0: 20 72 75 6e 2d 69 64 20 22 3f 5c 6e 20 20 20 79   run-id "?\n   y
a6d0: 2f 6e 3a 20 22 29 0a 09 09 09 09 20 28 65 71 75  /n: ")..... (equ
a6e0: 61 6c 3f 20 22 79 22 20 28 72 65 61 64 2d 6c 69  al? "y" (read-li
a6f0: 6e 65 29 29 29 29 29 0a 09 09 20 20 20 20 20 20  ne)))))...      
a700: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
a710: 64 62 3a 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 2d 72  db:lock/unlock-r
a720: 75 6e 20 64 62 20 72 75 6e 2d 69 64 20 6c 6f 63  un db run-id loc
a730: 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 09  k unlock user)..
a740: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
a750: 69 6e 74 20 30 20 22 49 4e 46 4f 3a 20 53 6b 69  int 0 "INFO: Ski
a760: 70 70 69 6e 67 20 6c 6f 63 6b 2f 75 6e 6c 6f 63  pping lock/unloc
a770: 6b 20 6f 6e 20 22 20 72 75 6e 2d 69 64 29 29 29  k on " run-id)))
a780: 29 0a 09 20 20 20 20 20 20 72 75 6e 73 29 29 29  )..      runs)))
a790: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
a7a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a7b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a7c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a7d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c  =========.;; Rol
a7e0: 6c 75 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d  lup runs.;;=====
a7f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a800: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a810: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a820: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a830: 3d 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 68 65  =..;; Update the
a840: 20 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65   test_meta table
a850: 20 66 6f 72 20 74 68 69 73 20 74 65 73 74 0a 28   for this test.(
a860: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64  define (runs:upd
a870: 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62  ate-test_meta db
a880: 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d   test-name test-
a890: 63 6f 6e 66 29 0a 20 20 28 6c 65 74 20 28 28 63  conf).  (let ((c
a8a0: 75 72 72 72 65 63 6f 72 64 20 28 6f 70 65 6e 2d  urrrecord (open-
a8b0: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73  run-close db:tes
a8c0: 74 6d 65 74 61 2d 67 65 74 2d 72 65 63 6f 72 64  tmeta-get-record
a8d0: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29   db test-name)))
a8e0: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 63 75  .    (if (not cu
a8f0: 72 72 72 65 63 6f 72 64 29 0a 09 28 62 65 67 69  rrrecord)..(begi
a900: 6e 0a 09 20 20 28 73 65 74 21 20 63 75 72 72 72  n..  (set! currr
a910: 65 63 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63 74  ecord (make-vect
a920: 6f 72 20 31 30 20 23 66 29 29 0a 09 20 20 28 6f  or 10 #f))..  (o
a930: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
a940: 3a 74 65 73 74 6d 65 74 61 2d 61 64 64 2d 72 65  :testmeta-add-re
a950: 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d  cord db test-nam
a960: 65 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61  e))).    (for-ea
a970: 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61  ch .     (lambda
a980: 20 28 6b 65 79 29 0a 20 20 20 20 20 20 20 28 6c   (key).       (l
a990: 65 74 2a 20 28 28 69 64 78 20 28 63 61 64 72 20  et* ((idx (cadr 
a9a0: 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 66 6c  key))..      (fl
a9b0: 64 20 28 63 61 72 20 20 6b 65 79 29 29 0a 09 20  d (car  key)).. 
a9c0: 20 20 20 20 20 28 76 61 6c 20 28 63 6f 6e 66 69       (val (confi
a9d0: 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f  g-lookup test-co
a9e0: 6e 66 20 22 74 65 73 74 5f 6d 65 74 61 22 20 66  nf "test_meta" f
a9f0: 6c 64 29 29 29 0a 09 20 3b 3b 20 28 64 65 62 75  ld))).. ;; (debu
aa00: 67 3a 70 72 69 6e 74 20 35 20 22 69 64 78 3a 20  g:print 5 "idx: 
aa10: 22 20 69 64 78 20 22 20 66 6c 64 3a 20 22 20 66  " idx " fld: " f
aa20: 6c 64 20 22 20 76 61 6c 3a 20 22 20 76 61 6c 29  ld " val: " val)
aa30: 0a 09 20 28 69 66 20 28 61 6e 64 20 76 61 6c 20  .. (if (and val 
aa40: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 76 65  (not (equal? (ve
aa50: 63 74 6f 72 2d 72 65 66 20 63 75 72 72 72 65 63  ctor-ref currrec
aa60: 6f 72 64 20 69 64 78 29 20 76 61 6c 29 29 29 0a  ord idx) val))).
aa70: 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20  .     (begin..  
aa80: 20 20 20 20 20 28 70 72 69 6e 74 20 22 55 70 64       (print "Upd
aa90: 61 74 69 6e 67 20 22 20 74 65 73 74 2d 6e 61 6d  ating " test-nam
aaa0: 65 20 22 20 22 20 66 6c 64 20 22 20 74 6f 20 22  e " " fld " to "
aab0: 20 76 61 6c 29 0a 09 20 20 20 20 20 20 20 28 6f   val)..       (o
aac0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
aad0: 3a 74 65 73 74 6d 65 74 61 2d 75 70 64 61 74 65  :testmeta-update
aae0: 2d 66 69 65 6c 64 20 64 62 20 74 65 73 74 2d 6e  -field db test-n
aaf0: 61 6d 65 20 66 6c 64 20 76 61 6c 29 29 29 29 29  ame fld val)))))
ab00: 0a 20 20 20 20 20 27 28 28 22 61 75 74 68 6f 72  .     '(("author
ab10: 22 20 32 29 28 22 6f 77 6e 65 72 22 20 33 29 28  " 2)("owner" 3)(
ab20: 22 64 65 73 63 72 69 70 74 69 6f 6e 22 20 34 29  "description" 4)
ab30: 28 22 72 65 76 69 65 77 65 64 22 20 35 29 28 22  ("reviewed" 5)("
ab40: 74 61 67 73 22 20 39 29 29 29 29 29 0a 0a 3b 3b  tags" 9)))))..;;
ab50: 20 55 70 64 61 74 65 20 74 65 73 74 5f 6d 65 74   Update test_met
ab60: 61 20 66 6f 72 20 61 6c 6c 20 74 65 73 74 73 0a  a for all tests.
ab70: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70  (define (runs:up
ab80: 64 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65  date-all-test_me
ab90: 74 61 20 64 62 29 0a 20 20 28 6c 65 74 20 28 28  ta db).  (let ((
aba0: 74 65 73 74 2d 6e 61 6d 65 73 20 28 67 65 74 2d  test-names (get-
abb0: 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73 29  all-legal-tests)
abc0: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  )).    (for-each
abd0: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28   .     (lambda (
abe0: 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20 20 20  test-name).     
abf0: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 70    (let* ((test-p
ac00: 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f  ath    (conc *to
ac10: 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22  ppath* "/tests/"
ac20: 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20 20   test-name))..  
ac30: 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 69 67      (test-config
ac40: 66 20 28 63 6f 6e 63 20 74 65 73 74 2d 70 61 74  f (conc test-pat
ac50: 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 29  h "/testconfig")
ac60: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 65 78  )..      (testex
ac70: 69 73 74 73 20 20 20 28 61 6e 64 20 28 66 69 6c  ists   (and (fil
ac80: 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74 2d 63  e-exists? test-c
ac90: 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 65 61  onfigf)(file-rea
aca0: 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74 2d 63  d-access? test-c
acb0: 6f 6e 66 69 67 66 29 29 29 0a 09 20 20 20 20 20  onfigf)))..     
acc0: 20 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69 67 73   ;; read configs
acd0: 20 77 69 74 68 20 74 72 69 63 6b 73 20 74 75 72   with tricks tur
ace0: 6e 65 64 20 6f 66 66 20 28 69 2e 65 2e 20 6e 6f  ned off (i.e. no
acf0: 20 73 79 73 74 65 6d 29 0a 09 20 20 20 20 20 20   system)..      
ad00: 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 69  (test-conf    (i
ad10: 66 20 74 65 73 74 65 78 69 73 74 73 20 28 72 65  f testexists (re
ad20: 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d 63  ad-config test-c
ad30: 6f 6e 66 69 67 66 20 23 66 20 23 66 29 28 6d 61  onfigf #f #f)(ma
ad40: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29  ke-hash-table)))
ad50: 29 0a 09 20 3b 3b 20 75 73 65 20 74 68 65 20 6f  ).. ;; use the o
ad60: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 69 6e  pen-run-close in
ad70: 73 74 65 61 64 20 6f 66 20 70 61 73 73 69 6e 67  stead of passing
ad80: 20 69 6e 20 64 62 0a 09 20 28 72 75 6e 73 3a 75   in db.. (runs:u
ad90: 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20  pdate-test_meta 
ada0: 23 66 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73  #f test-name tes
adb0: 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 20 74  t-conf))).     t
adc0: 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b  est-names)))..;;
add0: 20 54 68 69 73 20 63 6f 75 6c 64 20 70 72 6f 62   This could prob
ade0: 61 62 6c 79 20 62 65 20 72 65 66 61 63 74 6f 72  ably be refactor
adf0: 65 64 20 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70  ed into one comp
ae00: 6c 65 78 20 71 75 65 72 79 20 2e 2e 2e 0a 28 64  lex query ....(d
ae10: 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 6f 6c 6c  efine (runs:roll
ae20: 75 70 2d 72 75 6e 20 6b 65 79 73 20 6b 65 79 76  up-run keys keyv
ae30: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75 73  allst runname us
ae40: 65 72 29 20 3b 3b 20 77 61 73 20 74 61 72 67 65  er) ;; was targe
ae50: 74 2c 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74  t, now keyvallst
ae60: 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
ae70: 34 20 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72  4 "runs:rollup-r
ae80: 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73  un, keys: " keys
ae90: 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20   " keyvallst: " 
aea0: 6b 65 79 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e  keyvallst " :run
aeb0: 6e 61 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20 22  name " runname "
aec0: 20 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20   user: " user). 
aed0: 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20   (let* ((db     
aee0: 20 20 20 20 20 20 20 20 20 23 66 29 20 3b 3b 20           #f) ;; 
aef0: 28 6b 65 79 76 61 6c 6c 6c 73 74 20 20 20 20 20  (keyvalllst     
af00: 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b   (keys:target->k
af10: 65 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65  eyval keys targe
af20: 74 29 29 0a 09 20 28 6e 65 77 2d 72 75 6e 2d 69  t)).. (new-run-i
af30: 64 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e  d      (open-run
af40: 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 72 65 67 69  -close runs:regi
af50: 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73  ster-run db keys
af60: 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61   keyvallst runna
af70: 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75  me "new" "n/a" u
af80: 73 65 72 29 29 0a 09 20 28 70 72 65 76 2d 74 65  ser)).. (prev-te
af90: 73 74 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  sts      (open-r
afa0: 75 6e 2d 63 6c 6f 73 65 20 74 65 73 74 3a 67 65  un-close test:ge
afb0: 74 2d 6d 61 74 63 68 69 6e 67 2d 70 72 65 76 69  t-matching-previ
afc0: 6f 75 73 2d 74 65 73 74 2d 72 75 6e 2d 72 65 63  ous-test-run-rec
afd0: 6f 72 64 73 20 64 62 20 6e 65 77 2d 72 75 6e 2d  ords db new-run-
afe0: 69 64 20 22 25 22 20 22 25 22 29 29 0a 09 20 28  id "%" "%")).. (
aff0: 63 75 72 72 2d 74 65 73 74 73 20 20 20 20 20 20  curr-tests      
b000: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
b010: 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72  db:get-tests-for
b020: 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d  -run db new-run-
b030: 69 64 20 22 25 2f 25 22 20 27 28 29 20 27 28 29  id "%/%" '() '()
b040: 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73  )).. (curr-tests
b050: 2d 68 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68  -hash (make-hash
b060: 2d 74 61 62 6c 65 29 29 29 0a 20 20 20 20 28 6f  -table))).    (o
b070: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
b080: 3a 75 70 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e  :update-run-even
b090: 74 5f 74 69 6d 65 20 64 62 20 6e 65 77 2d 72 75  t_time db new-ru
b0a0: 6e 2d 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64  n-id).    ;; ind
b0b0: 65 78 20 74 68 65 20 61 6c 72 65 61 64 79 20 73  ex the already s
b0c0: 61 76 65 64 20 74 65 73 74 73 20 62 79 20 74 65  aved tests by te
b0d0: 73 74 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d 64  stname and itemd
b0e0: 61 74 20 69 6e 20 63 75 72 72 2d 74 65 73 74 73  at in curr-tests
b0f0: 2d 68 61 73 68 0a 20 20 20 20 28 66 6f 72 2d 65  -hash.    (for-e
b100: 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61  ach.     (lambda
b110: 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 20   (testdat).     
b120: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61    (let* ((testna
b130: 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74  me  (db:test-get
b140: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61  -testname testda
b150: 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d  t))..      (item
b160: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67  -path (db:test-g
b170: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73  et-item-path tes
b180: 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 66  tdat))..      (f
b190: 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74  ull-name (conc t
b1a0: 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d  estname "/" item
b1b0: 2d 70 61 74 68 29 29 29 0a 09 20 28 68 61 73 68  -path))).. (hash
b1c0: 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72  -table-set! curr
b1d0: 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c  -tests-hash full
b1e0: 2d 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 29  -name testdat)))
b1f0: 0a 20 20 20 20 20 63 75 72 72 2d 74 65 73 74 73  .     curr-tests
b200: 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e  ).    ;; NOPE: N
b210: 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f  on-optimal appro
b220: 61 63 68 2e 20 54 72 79 20 74 68 69 73 20 69 6e  ach. Try this in
b230: 73 74 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20  stead..    ;;   
b240: 31 2e 20 74 65 73 74 73 20 61 72 65 20 72 65 63  1. tests are rec
b250: 65 69 76 65 64 20 69 6e 20 61 20 6c 69 73 74 2c  eived in a list,
b260: 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 66 69 72   most recent fir
b270: 73 74 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 72  st.    ;;   2. r
b280: 65 70 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c 75  eplace the rollu
b290: 70 20 74 65 73 74 20 77 69 74 68 20 74 68 65 20  p test with the 
b2a0: 6e 65 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20  new *always*.   
b2b0: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20   (for-each .    
b2c0: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61   (lambda (testda
b2d0: 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20  t).       (let* 
b2e0: 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a  ((testname  (db:
b2f0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d  test-get-testnam
b300: 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  e testdat))..   
b310: 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64     (item-path (d
b320: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d  b:test-get-item-
b330: 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a 09  path testdat))..
b340: 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65        (full-name
b350: 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20   (conc testname 
b360: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a  "/" item-path)).
b370: 09 20 20 20 20 20 20 28 70 72 65 76 2d 74 65 73  .      (prev-tes
b380: 74 2d 64 61 74 20 28 68 61 73 68 2d 74 61 62 6c  t-dat (hash-tabl
b390: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 75  e-ref/default cu
b3a0: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75  rr-tests-hash fu
b3b0: 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 20  ll-name #f))..  
b3c0: 20 20 20 20 28 74 65 73 74 2d 73 74 65 70 73 20      (test-steps 
b3d0: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
b3e0: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 73 74 65 70  lose db:get-step
b3f0: 73 2d 66 6f 72 2d 74 65 73 74 20 64 62 20 28 64  s-for-test db (d
b400: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
b410: 73 74 64 61 74 29 29 29 0a 09 20 20 20 20 20 20  stdat)))..      
b420: 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64  (new-test-record
b430: 20 23 66 29 29 0a 09 20 3b 3b 20 72 65 70 6c 61   #f)).. ;; repla
b440: 63 65 20 74 68 65 73 65 20 77 69 74 68 20 69 6e  ce these with in
b450: 73 65 72 74 20 2e 2e 2e 20 73 65 6c 65 63 74 0a  sert ... select.
b460: 09 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33  . (apply sqlite3
b470: 3a 65 78 65 63 75 74 65 20 0a 09 09 64 62 20 0a  :execute ...db .
b480: 09 09 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20  ..(conc "INSERT 
b490: 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20  OR REPLACE INTO 
b4a0: 74 65 73 74 73 20 28 72 75 6e 5f 69 64 2c 74 65  tests (run_id,te
b4b0: 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61  stname,state,sta
b4c0: 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 68  tus,event_time,h
b4d0: 6f 73 74 2c 63 70 75 6c 6f 61 64 2c 64 69 73 6b  ost,cpuload,disk
b4e0: 66 72 65 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 69  free,uname,rundi
b4f0: 72 2c 69 74 65 6d 5f 70 61 74 68 2c 72 75 6e 5f  r,item_path,run_
b500: 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c  duration,final_l
b510: 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09  ogf,comment) "..
b520: 09 20 20 20 20 20 20 22 56 41 4c 55 45 53 20 28  .      "VALUES (
b530: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c  ?,?,?,?,?,?,?,?,
b540: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a  ?,?,?,?,?,?);").
b550: 09 09 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 64  ..new-run-id (cd
b560: 64 72 20 28 76 65 63 74 6f 72 2d 3e 6c 69 73 74  dr (vector->list
b570: 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 28 73   testdat))).. (s
b580: 65 74 21 20 6e 65 77 2d 74 65 73 74 64 61 74 20  et! new-testdat 
b590: 28 63 61 72 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  (car (open-run-c
b5a0: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74  lose db:get-test
b5b0: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77  s-for-run db new
b5c0: 2d 72 75 6e 2d 69 64 20 28 63 6f 6e 63 20 74 65  -run-id (conc te
b5d0: 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d  stname "/" item-
b5e0: 70 61 74 68 29 20 27 28 29 20 27 28 29 29 29 29  path) '() '())))
b5f0: 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73  .. (hash-table-s
b600: 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68  et! curr-tests-h
b610: 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65  ash full-name ne
b620: 77 2d 74 65 73 74 64 61 74 29 20 3b 3b 20 74 68  w-testdat) ;; th
b630: 69 73 20 63 6f 75 6c 64 20 62 65 20 63 6f 6e 66  is could be conf
b640: 75 73 69 6e 67 2c 20 77 68 69 63 68 20 72 65 63  using, which rec
b650: 6f 72 64 20 73 68 6f 75 6c 64 20 67 6f 20 69 6e  ord should go in
b660: 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 70 20 74 61  to the lookup ta
b670: 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 75  ble?.. ;; Now du
b680: 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 74  plicate the test
b690: 20 73 74 65 70 73 0a 09 20 28 64 65 62 75 67 3a   steps.. (debug:
b6a0: 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67  print 4 "Copying
b6b0: 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74   records in test
b6c0: 5f 73 74 65 70 73 20 66 72 6f 6d 20 74 65 73 74  _steps from test
b6d0: 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67  _id=" (db:test-g
b6e0: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 22  et-id testdat) "
b6f0: 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67   to " (db:test-g
b700: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61  et-id new-testda
b710: 74 29 29 0a 09 20 28 6f 70 65 6e 2d 72 75 6e 2d  t)).. (open-run-
b720: 63 6c 6f 73 65 20 0a 09 20 20 28 6c 61 6d 62 64  close ..  (lambd
b730: 61 20 28 29 0a 09 20 20 20 20 28 73 71 6c 69 74  a ()..    (sqlit
b740: 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 20  e3:execute ..   
b750: 20 20 64 62 20 0a 09 20 20 20 20 20 28 63 6f 6e    db ..     (con
b760: 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50  c "INSERT OR REP
b770: 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 73  LACE INTO test_s
b780: 74 65 70 73 20 28 74 65 73 74 5f 69 64 2c 73 74  teps (test_id,st
b790: 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61  epname,state,sta
b7a0: 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63  tus,event_time,c
b7b0: 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22  omment) "...   "
b7c0: 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73  SELECT " (db:tes
b7d0: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73  t-get-id new-tes
b7e0: 74 64 61 74 29 20 22 2c 73 74 65 70 6e 61 6d 65  tdat) ",stepname
b7f0: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76  ,state,status,ev
b800: 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74  ent_time,comment
b810: 20 46 52 4f 4d 20 74 65 73 74 5f 73 74 65 70 73   FROM test_steps
b820: 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d 3f   WHERE test_id=?
b830: 3b 22 29 0a 09 20 20 20 20 20 28 64 62 3a 74 65  ;")..     (db:te
b840: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61  st-get-id testda
b850: 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 6f 77 20  t))..    ;; Now 
b860: 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 65  duplicate the te
b870: 73 74 20 64 61 74 61 0a 09 20 20 20 20 28 64 65  st data..    (de
b880: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70  bug:print 4 "Cop
b890: 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20  ying records in 
b8a0: 74 65 73 74 5f 64 61 74 61 20 66 72 6f 6d 20 74  test_data from t
b8b0: 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73  est_id=" (db:tes
b8c0: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74  t-get-id testdat
b8d0: 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73  ) " to " (db:tes
b8e0: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73  t-get-id new-tes
b8f0: 74 64 61 74 29 29 0a 09 20 20 20 20 28 73 71 6c  tdat))..    (sql
b900: 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20  ite3:execute .. 
b910: 20 20 20 20 64 62 20 0a 09 20 20 20 20 20 28 63      db ..     (c
b920: 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52  onc "INSERT OR R
b930: 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74  EPLACE INTO test
b940: 5f 64 61 74 61 20 28 74 65 73 74 5f 69 64 2c 63  _data (test_id,c
b950: 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c 65  ategory,variable
b960: 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 2c  ,value,expected,
b970: 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e  tol,units,commen
b980: 74 29 20 22 0a 09 09 20 20 20 22 53 45 4c 45 43  t) "...   "SELEC
b990: 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  T " (db:test-get
b9a0: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29  -id new-testdat)
b9b0: 20 22 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69   ",category,vari
b9c0: 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63  able,value,expec
b9d0: 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f  ted,tol,units,co
b9e0: 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f  mment FROM test_
b9f0: 64 61 74 61 20 57 48 45 52 45 20 74 65 73 74 5f  data WHERE test_
ba00: 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28 64  id=?;")..     (d
ba10: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
ba20: 73 74 64 61 74 29 29 29 29 0a 09 20 29 29 0a 20  stdat)))).. )). 
ba30: 20 20 20 20 70 72 65 76 2d 74 65 73 74 73 29 29      prev-tests))
ba40: 29 0a 09 20 0a 20 20 20 20 20 0a                 ).. .     .