Megatest

Hex Artifact Content
Login

Artifact 22f36fb01a9f183aa1b72e6b3859524264190bd2:


0000: 0a 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 32 30  .;; Copyright 20
0010: 30 36 2d 32 30 31 31 2c 20 4d 61 74 74 68 65 77  06-2011, Matthew
0020: 20 57 65 6c 6c 61 6e 64 2e 0a 3b 3b 20 0a 3b 3b   Welland..;; .;;
0030: 20 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69    This program i
0040: 73 20 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65  s made available
0050: 20 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47   under the GNU G
0060: 50 4c 20 76 65 72 73 69 6f 6e 20 32 2e 30 20 6f  PL version 2.0 o
0070: 72 0a 3b 3b 20 20 67 72 65 61 74 65 72 2e 20 53  r.;;  greater. S
0080: 65 65 20 74 68 65 20 61 63 63 6f 6d 70 61 6e 79  ee the accompany
0090: 69 6e 67 20 66 69 6c 65 20 43 4f 50 59 49 4e 47  ing file COPYING
00a0: 20 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 3b 3b   for details..;;
00b0: 20 0a 3b 3b 20 20 54 68 69 73 20 70 72 6f 67 72   .;;  This progr
00c0: 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 65  am is distribute
00d0: 64 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41  d WITHOUT ANY WA
00e0: 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20  RRANTY; without 
00f0: 65 76 65 6e 20 74 68 65 0a 3b 3b 20 20 69 6d 70  even the.;;  imp
0100: 6c 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66  lied warranty of
0110: 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59   MERCHANTABILITY
0120: 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20   or FITNESS FOR 
0130: 41 20 50 41 52 54 49 43 55 4c 41 52 0a 3b 3b 20  A PARTICULAR.;; 
0140: 20 50 55 52 50 4f 53 45 2e 0a 0a 3b 3b 20 20 73   PURPOSE...;;  s
0150: 74 72 66 74 69 6d 65 28 27 25 6d 2f 25 64 2f 25  trftime('%m/%d/%
0160: 59 20 25 48 3a 25 4d 3a 25 53 27 2c 27 6e 6f 77  Y %H:%M:%S','now
0170: 27 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 29 0a 0a  ','localtime')..
0180: 28 75 73 65 20 73 71 6c 69 74 65 33 20 73 72 66  (use sqlite3 srf
0190: 69 2d 31 20 70 6f 73 69 78 20 72 65 67 65 78 20  i-1 posix regex 
01a0: 72 65 67 65 78 2d 63 61 73 65 20 73 72 66 69 2d  regex-case srfi-
01b0: 36 39 20 64 6f 74 2d 6c 6f 63 6b 69 6e 67 20 28  69 dot-locking (
01c0: 73 72 66 69 20 31 38 29 20 70 6f 73 69 78 2d 65  srfi 18) posix-e
01d0: 78 74 72 61 73 20 64 69 72 65 63 74 6f 72 79 2d  xtras directory-
01e0: 75 74 69 6c 73 29 0a 28 69 6d 70 6f 72 74 20 28  utils).(import (
01f0: 70 72 65 66 69 78 20 73 71 6c 69 74 65 33 20 73  prefix sqlite3 s
0200: 71 6c 69 74 65 33 3a 29 29 0a 0a 28 64 65 63 6c  qlite3:))..(decl
0210: 61 72 65 20 28 75 6e 69 74 20 72 75 6e 73 29 29  are (unit runs))
0220: 0a 28 64 65 63 6c 61 72 65 20 28 75 73 65 73 20  .(declare (uses 
0230: 64 62 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75  db)).(declare (u
0240: 73 65 73 20 63 6f 6d 6d 6f 6e 29 29 0a 28 64 65  ses common)).(de
0250: 63 6c 61 72 65 20 28 75 73 65 73 20 69 74 65 6d  clare (uses item
0260: 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75 73  s)).(declare (us
0270: 65 73 20 72 75 6e 63 6f 6e 66 69 67 29 29 0a 28  es runconfig)).(
0280: 64 65 63 6c 61 72 65 20 28 75 73 65 73 20 74 65  declare (uses te
0290: 73 74 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28  sts)).(declare (
02a0: 75 73 65 73 20 73 65 72 76 65 72 29 29 0a 0a 28  uses server))..(
02b0: 69 6e 63 6c 75 64 65 20 22 63 6f 6d 6d 6f 6e 5f  include "common_
02c0: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 69  records.scm").(i
02d0: 6e 63 6c 75 64 65 20 22 6b 65 79 5f 72 65 63 6f  nclude "key_reco
02e0: 72 64 73 2e 73 63 6d 22 29 0a 28 69 6e 63 6c 75  rds.scm").(inclu
02f0: 64 65 20 22 64 62 5f 72 65 63 6f 72 64 73 2e 73  de "db_records.s
0300: 63 6d 22 29 0a 28 69 6e 63 6c 75 64 65 20 22 72  cm").(include "r
0310: 75 6e 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29  un_records.scm")
0320: 0a 28 69 6e 63 6c 75 64 65 20 22 74 65 73 74 5f  .(include "test_
0330: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 0a 3b  records.scm")..;
0340: 3b 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d  ; runs:get-runs-
0350: 62 79 2d 70 61 74 74 0a 3b 3b 20 67 65 74 20 72  by-patt.;; get r
0360: 75 6e 73 20 62 79 20 6c 69 73 74 20 6f 66 20 63  uns by list of c
0370: 72 69 74 65 72 69 61 0a 3b 3b 20 72 65 67 69 73  riteria.;; regis
0380: 74 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77  ter a test run w
0390: 69 74 68 20 74 68 65 20 64 62 0a 3b 3b 0a 3b 3b  ith the db.;;.;;
03a0: 20 55 73 65 3a 20 28 64 62 2d 67 65 74 2d 76 61   Use: (db-get-va
03b0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28 64  lue-by-header (d
03c0: 62 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e  b:get-header run
03d0: 69 6e 66 6f 29 28 64 62 3a 67 65 74 2d 72 6f 77  info)(db:get-row
03e0: 20 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b 20 20 74   runinfo)).;;  t
03f0: 6f 20 65 78 74 72 61 63 74 20 69 6e 66 6f 20 66  o extract info f
0400: 72 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 72  rom the structur
0410: 65 20 72 65 74 75 72 6e 65 64 0a 3b 3b 0a 28 64  e returned.;;.(d
0420: 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d  efine (runs:get-
0430: 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20  runs-by-patt db 
0440: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74  keys runnamepatt
0450: 20 2e 20 70 61 72 61 6d 73 29 20 3b 3b 20 74 65   . params) ;; te
0460: 73 74 2d 6e 61 6d 65 29 0a 20 20 28 6c 65 74 2a  st-name).  (let*
0470: 20 28 28 6b 65 79 76 61 6c 6c 73 74 20 28 6b 65   ((keyvallst (ke
0480: 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73  ys->vallist keys
0490: 29 29 0a 09 20 28 74 6d 70 20 20 20 20 20 20 28  )).. (tmp      (
04a0: 72 75 6e 73 3a 67 65 74 2d 73 74 64 2d 72 75 6e  runs:get-std-run
04b0: 2d 66 69 65 6c 64 73 20 6b 65 79 73 20 27 28 22  -fields keys '("
04c0: 69 64 22 20 22 72 75 6e 6e 61 6d 65 22 20 22 73  id" "runname" "s
04d0: 74 61 74 65 22 20 22 73 74 61 74 75 73 22 20 22  tate" "status" "
04e0: 6f 77 6e 65 72 22 20 22 65 76 65 6e 74 5f 74 69  owner" "event_ti
04f0: 6d 65 22 29 29 29 0a 09 20 28 6b 65 79 73 74 72  me"))).. (keystr
0500: 20 20 20 28 63 61 72 20 74 6d 70 29 29 0a 09 20     (car tmp)).. 
0510: 28 68 65 61 64 65 72 20 20 20 28 63 61 64 72 20  (header   (cadr 
0520: 74 6d 70 29 29 0a 09 20 28 72 65 73 20 20 20 20  tmp)).. (res    
0530: 20 27 28 29 29 0a 09 20 28 6b 65 79 2d 70 61 74   '()).. (key-pat
0540: 74 20 22 22 29 29 0a 20 20 20 20 28 66 6f 72 2d  t "")).    (for-
0550: 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 6b 65  each (lambda (ke
0560: 79 76 61 6c 29 0a 09 09 28 6c 65 74 2a 20 28 28  yval)...(let* ((
0570: 6b 65 79 20 20 20 20 28 76 65 63 74 6f 72 2d 72  key    (vector-r
0580: 65 66 20 6b 65 79 76 61 6c 20 30 29 29 0a 09 09  ef keyval 0))...
0590: 20 20 20 20 20 20 20 28 66 75 6c 6b 65 79 20 28         (fulkey (
05a0: 63 6f 6e 63 20 22 3a 22 20 6b 65 79 29 29 0a 09  conc ":" key))..
05b0: 09 20 20 20 20 20 20 20 28 70 61 74 74 20 20 20  .       (patt   
05c0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 66 75  (args:get-arg fu
05d0: 6c 6b 65 79 29 29 29 0a 09 09 20 20 28 69 66 20  lkey)))...  (if 
05e0: 70 61 74 74 0a 09 09 20 20 20 20 20 20 28 73 65  patt...      (se
05f0: 74 21 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e  t! key-patt (con
0600: 63 20 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44  c key-patt " AND
0610: 20 22 20 6b 65 79 20 22 20 6c 69 6b 65 20 27 22   " key " like '"
0620: 20 70 61 74 74 20 22 27 22 29 29 0a 09 09 20 20   patt "'"))...  
0630: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 28 64      (begin....(d
0640: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
0650: 52 4f 52 3a 20 73 65 61 72 63 68 69 6e 67 20 66  ROR: searching f
0660: 6f 72 20 72 75 6e 73 20 77 69 74 68 20 6e 6f 20  or runs with no 
0670: 70 61 74 74 65 72 6e 20 73 65 74 20 66 6f 72 20  pattern set for 
0680: 22 20 66 75 6c 6b 65 79 29 0a 09 09 09 28 65 78  " fulkey)....(ex
0690: 69 74 20 36 29 29 29 29 29 0a 09 20 20 20 20 20  it 6)))))..     
06a0: 20 6b 65 79 73 29 0a 20 20 20 20 28 73 71 6c 69   keys).    (sqli
06b0: 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77  te3:for-each-row
06c0: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28   .     (lambda (
06d0: 61 20 2e 20 72 29 0a 20 20 20 20 20 20 20 28 73  a . r).       (s
06e0: 65 74 21 20 72 65 73 20 28 63 6f 6e 73 20 28 6c  et! res (cons (l
06f0: 69 73 74 2d 3e 76 65 63 74 6f 72 20 28 63 6f 6e  ist->vector (con
0700: 73 20 61 20 72 29 29 20 72 65 73 29 29 29 0a 20  s a r)) res))). 
0710: 20 20 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f      db .     (co
0720: 6e 63 20 22 53 45 4c 45 43 54 20 22 20 6b 65 79  nc "SELECT " key
0730: 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e 73 20  str " FROM runs 
0740: 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 20 6c 69  WHERE runname li
0750: 6b 65 20 3f 20 22 20 6b 65 79 2d 70 61 74 74 20  ke ? " key-patt 
0760: 22 3b 22 29 0a 20 20 20 20 20 72 75 6e 6e 61 6d  ";").     runnam
0770: 65 70 61 74 74 29 0a 20 20 20 20 28 76 65 63 74  epatt).    (vect
0780: 6f 72 20 68 65 61 64 65 72 20 72 65 73 29 29 29  or header res)))
0790: 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a  ..(define (runs:
07a0: 74 65 73 74 2d 67 65 74 2d 66 75 6c 6c 2d 70 61  test-get-full-pa
07b0: 74 68 20 74 65 73 74 29 0a 20 20 28 6c 65 74 2a  th test).  (let*
07c0: 20 28 28 74 65 73 74 6e 61 6d 65 20 28 64 62 3a   ((testname (db:
07d0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d  test-get-testnam
07e0: 65 20 20 20 74 65 73 74 29 29 0a 09 20 28 69 74  e   test)).. (it
07f0: 65 6d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d  empath (db:test-
0800: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65  get-item-path te
0810: 73 74 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20  st))).    (conc 
0820: 74 65 73 74 6e 61 6d 65 20 28 69 66 20 28 65 71  testname (if (eq
0830: 75 61 6c 3f 20 69 74 65 6d 70 61 74 68 20 22 22  ual? itempath ""
0840: 29 20 22 22 20 28 63 6f 6e 63 20 22 28 22 20 69  ) "" (conc "(" i
0850: 74 65 6d 70 61 74 68 20 22 29 22 29 29 29 29 29  tempath ")")))))
0860: 0a 0a 28 64 65 66 69 6e 65 20 28 73 65 74 2d 6d  ..(define (set-m
0870: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73  egatest-env-vars
0880: 20 64 62 20 72 75 6e 2d 69 64 29 0a 20 20 28 6c   db run-id).  (l
0890: 65 74 20 28 28 6b 65 79 73 20 28 72 64 62 3a 67  et ((keys (rdb:g
08a0: 65 74 2d 6b 65 79 73 20 64 62 29 29 29 0a 20 20  et-keys db))).  
08b0: 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d    (for-each (lam
08c0: 62 64 61 20 28 6b 65 79 29 0a 09 09 28 73 71 6c  bda (key)...(sql
08d0: 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f  ite3:for-each-ro
08e0: 77 0a 09 09 20 28 6c 61 6d 62 64 61 20 28 76 61  w... (lambda (va
08f0: 6c 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70  l)...   (debug:p
0900: 72 69 6e 74 20 32 20 22 73 65 74 65 6e 76 20 22  rint 2 "setenv "
0910: 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e   (key:get-fieldn
0920: 61 6d 65 20 6b 65 79 29 20 22 20 22 20 76 61 6c  ame key) " " val
0930: 29 0a 09 09 20 20 20 28 73 65 74 65 6e 76 20 28  )...   (setenv (
0940: 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d  key:get-fieldnam
0950: 65 20 6b 65 79 29 20 76 61 6c 29 29 0a 09 09 20  e key) val))... 
0960: 64 62 20 0a 09 09 20 28 63 6f 6e 63 20 22 53 45  db ... (conc "SE
0970: 4c 45 43 54 20 22 20 28 6b 65 79 3a 67 65 74 2d  LECT " (key:get-
0980: 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22  fieldname key) "
0990: 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45   FROM runs WHERE
09a0: 20 69 64 3d 3f 3b 22 29 0a 09 09 20 72 75 6e 2d   id=?;")... run-
09b0: 69 64 29 29 0a 09 20 20 20 20 20 20 6b 65 79 73  id))..      keys
09c0: 29 0a 20 20 20 20 28 61 6c 69 73 74 2d 3e 65 6e  ).    (alist->en
09d0: 76 2d 76 61 72 73 20 28 68 61 73 68 2d 74 61 62  v-vars (hash-tab
09e0: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a  le-ref/default *
09f0: 63 6f 6e 66 69 67 64 61 74 2a 20 22 65 6e 76 2d  configdat* "env-
0a00: 6f 76 65 72 72 69 64 65 22 20 27 28 29 29 29 0a  override" '())).
0a10: 20 20 20 20 3b 3b 20 4c 65 74 73 20 75 73 65 20      ;; Lets use 
0a20: 74 68 69 73 20 61 73 20 61 6e 20 6f 70 70 6f 72  this as an oppor
0a30: 74 75 6e 69 74 79 20 74 6f 20 70 75 74 20 4d 54  tunity to put MT
0a40: 5f 52 55 4e 4e 41 4d 45 20 69 6e 20 74 68 65 20  _RUNNAME in the 
0a50: 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20 20  environment.    
0a60: 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63  (sqlite3:for-eac
0a70: 68 2d 72 6f 77 0a 20 20 20 20 20 28 6c 61 6d 62  h-row.     (lamb
0a80: 64 61 20 28 72 75 6e 6e 61 6d 65 29 0a 20 20 20  da (runname).   
0a90: 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f      (setenv "MT_
0aa0: 52 55 4e 4e 41 4d 45 22 20 72 75 6e 6e 61 6d 65  RUNNAME" runname
0ab0: 29 29 0a 20 20 20 20 20 64 62 0a 20 20 20 20 20  )).     db.     
0ac0: 22 53 45 4c 45 43 54 20 72 75 6e 6e 61 6d 65 20  "SELECT runname 
0ad0: 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20  FROM runs WHERE 
0ae0: 69 64 3d 3f 3b 22 0a 20 20 20 20 20 72 75 6e 2d  id=?;".     run-
0af0: 69 64 29 0a 20 20 20 20 29 29 0a 0a 28 64 65 66  id).    ))..(def
0b00: 69 6e 65 20 28 73 65 74 2d 69 74 65 6d 2d 65 6e  ine (set-item-en
0b10: 76 2d 76 61 72 73 20 69 74 65 6d 64 61 74 29 0a  v-vars itemdat).
0b20: 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d    (for-each (lam
0b30: 62 64 61 20 28 69 74 65 6d 29 0a 09 20 20 20 20  bda (item)..    
0b40: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32    (debug:print 2
0b50: 20 22 73 65 74 65 6e 76 20 22 20 28 63 61 72 20   "setenv " (car 
0b60: 69 74 65 6d 29 20 22 20 22 20 28 63 61 64 72 20  item) " " (cadr 
0b70: 69 74 65 6d 29 29 0a 09 20 20 20 20 20 20 28 73  item))..      (s
0b80: 65 74 65 6e 76 20 28 63 61 72 20 69 74 65 6d 29  etenv (car item)
0b90: 20 28 63 61 64 72 20 69 74 65 6d 29 29 29 0a 09   (cadr item)))..
0ba0: 20 20 20 20 69 74 65 6d 64 61 74 29 29 0a 0a 28      itemdat))..(
0bb0: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 6e  define (runs:can
0bc0: 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20  -run-more-tests 
0bd0: 64 62 20 74 65 73 74 2d 72 65 63 6f 72 64 29 0a  db test-record).
0be0: 20 20 28 6c 65 74 2a 20 28 28 74 63 6f 6e 66 69    (let* ((tconfi
0bf0: 67 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  g               
0c00: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
0c10: 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69  ue-get-testconfi
0c20: 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a  g test-record)).
0c30: 09 20 28 6a 6f 62 67 72 6f 75 70 20 20 20 20 20  . (jobgroup     
0c40: 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 66             (conf
0c50: 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69  ig-lookup tconfi
0c60: 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22  g "requirements"
0c70: 20 22 6a 6f 62 67 72 6f 75 70 22 29 29 0a 09 20   "jobgroup")).. 
0c80: 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 20 20 20  (num-running    
0c90: 20 20 20 20 20 20 20 20 20 28 64 62 3a 67 65 74           (db:get
0ca0: 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75 6e  -count-tests-run
0cb0: 6e 69 6e 67 20 64 62 29 29 0a 09 20 28 6e 75 6d  ning db)).. (num
0cc0: 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67  -running-in-jobg
0cd0: 72 6f 75 70 20 28 64 62 3a 67 65 74 2d 63 6f 75  roup (db:get-cou
0ce0: 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67  nt-tests-running
0cf0: 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 64 62 20  -in-jobgroup db 
0d00: 6a 6f 62 67 72 6f 75 70 29 29 0a 09 20 28 6d 61  jobgroup)).. (ma
0d10: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
0d20: 73 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f  s     (config-lo
0d30: 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a  okup *configdat*
0d40: 20 22 73 65 74 75 70 22 20 20 20 20 20 22 6d 61   "setup"     "ma
0d50: 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62  x_concurrent_job
0d60: 73 22 29 29 0a 09 20 28 6a 6f 62 2d 67 72 6f 75  s")).. (job-grou
0d70: 70 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20 20  p-limit         
0d80: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a  (config-lookup *
0d90: 63 6f 6e 66 69 67 64 61 74 2a 20 22 6a 6f 62 67  configdat* "jobg
0da0: 72 6f 75 70 73 22 20 6a 6f 62 67 72 6f 75 70 29  roups" jobgroup)
0db0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  )).    (debug:pr
0dc0: 69 6e 74 20 32 20 22 6d 61 78 2d 63 6f 6e 63 75  int 2 "max-concu
0dd0: 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d 61  rrent-jobs: " ma
0de0: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
0df0: 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67  s ", num-running
0e00: 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29  : " num-running)
0e10: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65  .    (if (not (e
0e20: 71 3f 20 30 20 2a 67 6c 6f 62 61 6c 65 78 69 74  q? 0 *globalexit
0e30: 73 74 61 74 75 73 2a 29 29 0a 09 23 66 0a 09 28  status*))..#f..(
0e40: 6c 65 74 20 28 28 63 61 6e 2d 6e 6f 74 2d 72 75  let ((can-not-ru
0e50: 6e 2d 6d 6f 72 65 20 28 63 6f 6e 64 0a 09 09 09  n-more (cond....
0e60: 09 20 3b 3b 20 69 66 20 6d 61 78 2d 63 6f 6e 63  . ;; if max-conc
0e70: 75 72 72 65 6e 74 2d 6a 6f 62 73 20 69 73 20 73  urrent-jobs is s
0e80: 65 74 20 61 6e 64 20 74 68 65 20 6e 75 6d 62 65  et and the numbe
0e90: 72 20 72 75 6e 6e 69 6e 67 20 69 73 20 67 72 65  r running is gre
0ea0: 61 74 65 72 20 0a 09 09 09 09 20 3b 3b 20 74 68  ater ..... ;; th
0eb0: 61 6e 20 69 74 20 74 68 61 6e 20 63 61 6e 6e 6f  an it than canno
0ec0: 74 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 0a  t run more jobs.
0ed0: 09 09 09 09 20 28 28 61 6e 64 20 6d 61 78 2d 63  .... ((and max-c
0ee0: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 0a 09  oncurrent-jobs..
0ef0: 09 09 09 20 20 20 20 20 20 20 28 73 74 72 69 6e  ...       (strin
0f00: 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 63 6f  g->number max-co
0f10: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09  ncurrent-jobs)..
0f20: 09 09 09 20 20 20 20 20 20 20 28 3e 3d 20 6e 75  ...       (>= nu
0f30: 6d 2d 72 75 6e 6e 69 6e 67 20 28 73 74 72 69 6e  m-running (strin
0f40: 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 63 6f  g->number max-co
0f50: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 29 29  ncurrent-jobs)))
0f60: 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 72  .....  (debug:pr
0f70: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20  int 0 "WARNING: 
0f80: 4d 61 78 20 72 75 6e 6e 69 6e 67 20 6a 6f 62 73  Max running jobs
0f90: 20 65 78 63 65 65 64 65 64 2c 20 63 75 72 72 65   exceeded, curre
0fa0: 6e 74 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 6e  nt number runnin
0fb0: 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67  g: " num-running
0fc0: 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 22 2c   ......       ",
0fd0: 20 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f   max_concurrent_
0fe0: 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e 63  jobs: " max-conc
0ff0: 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 09 09  urrent-jobs)....
1000: 09 20 20 23 74 29 0a 09 09 09 09 20 3b 3b 20 69  .  #t)..... ;; i
1010: 66 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69  f job-group-limi
1020: 74 20 69 73 20 73 65 74 20 61 6e 64 20 6e 75 6d  t is set and num
1030: 62 65 72 20 6f 66 20 6a 6f 62 73 20 69 6e 20 74  ber of jobs in t
1040: 68 65 20 67 72 6f 75 70 20 69 73 20 67 72 65 61  he group is grea
1050: 74 65 72 0a 09 09 09 09 20 3b 3b 20 74 68 61 6e  ter..... ;; than
1060: 20 74 68 65 20 6c 69 6d 69 74 20 74 68 65 6e 20   the limit then 
1070: 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 20  cannot run more 
1080: 6a 6f 62 73 20 6f 66 20 74 68 69 73 20 6b 69 6e  jobs of this kin
1090: 64 0a 09 09 09 09 20 28 28 61 6e 64 20 6a 6f 62  d..... ((and job
10a0: 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 0a 09 09 09  -group-limit....
10b0: 09 20 20 20 20 20 20 20 28 3e 3d 20 6e 75 6d 2d  .       (>= num-
10c0: 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72  running-in-jobgr
10d0: 6f 75 70 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69  oup job-group-li
10e0: 6d 69 74 29 29 0a 09 09 09 09 20 20 28 64 65 62  mit)).....  (deb
10f0: 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52 4e  ug:print 1 "WARN
1100: 49 4e 47 3a 20 6e 75 6d 62 65 72 20 6f 66 20 6a  ING: number of j
1110: 6f 62 73 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e  obs " num-runnin
1120: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 0a 09  g-in-jobgroup ..
1130: 09 09 09 09 20 20 20 20 20 20 20 22 20 69 6e 20  ....       " in 
1140: 22 20 6a 6f 62 67 72 6f 75 70 20 22 20 65 78 63  " jobgroup " exc
1150: 65 65 64 65 64 2c 20 77 69 6c 6c 20 6e 6f 74 20  eeded, will not 
1160: 72 75 6e 20 22 20 28 74 65 73 74 73 3a 74 65 73  run " (tests:tes
1170: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e  tqueue-get-testn
1180: 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29  ame test-record)
1190: 29 0a 09 09 09 09 20 20 23 74 29 0a 09 09 09 09  ).....  #t).....
11a0: 20 28 65 6c 73 65 20 23 66 29 29 29 29 0a 09 20   (else #f)))).. 
11b0: 20 28 6e 6f 74 20 63 61 6e 2d 6e 6f 74 2d 72 75   (not can-not-ru
11c0: 6e 2d 6d 6f 72 65 29 29 29 29 29 0a 0a 3b 3b 3d  n-more)))))..;;=
11d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
11e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
11f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1200: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1210: 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65 77 20 6d 65 74  =====.;; New met
1220: 68 6f 64 6f 6c 6f 67 79 2e 20 54 68 65 73 65 20  hodology. These 
1230: 72 6f 75 74 69 6e 65 73 20 77 69 6c 6c 20 72 65  routines will re
1240: 70 6c 61 63 65 20 74 68 65 20 61 62 6f 76 65 20  place the above 
1250: 69 6e 20 74 69 6d 65 2e 20 46 6f 72 0a 3b 3b 20  in time. For.;; 
1260: 6e 6f 77 20 74 68 65 20 63 6f 64 65 20 69 73 20  now the code is 
1270: 64 75 70 6c 69 63 61 74 65 64 2e 20 54 68 69 73  duplicated. This
1280: 20 73 74 75 66 66 20 69 73 20 69 6e 69 74 69 61   stuff is initia
1290: 6c 6c 79 20 75 73 65 64 20 69 6e 20 74 68 65 20  lly used in the 
12a0: 6d 6f 6e 69 74 6f 72 0a 3b 3b 20 62 61 73 65 64  monitor.;; based
12b0: 20 63 6f 64 65 2e 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d   code..;;=======
12c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
12d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
12e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
12f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
1300: 0a 3b 3b 20 72 65 67 69 73 74 65 72 20 61 20 74  .;; register a t
1310: 65 73 74 20 72 75 6e 20 77 69 74 68 20 74 68 65  est run with the
1320: 20 64 62 0a 28 64 65 66 69 6e 65 20 28 72 75 6e   db.(define (run
1330: 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64  s:register-run d
1340: 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74  b keys keyvallst
1350: 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 65 20 73   runname state s
1360: 74 61 74 75 73 20 75 73 65 72 29 0a 20 20 28 64  tatus user).  (d
1370: 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 72 75  ebug:print 3 "ru
1380: 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 2c  ns:register-run,
1390: 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22 20   keys: " keys " 
13a0: 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79  keyvallst: " key
13b0: 76 61 6c 6c 73 74 20 22 20 72 75 6e 6e 61 6d 65  vallst " runname
13c0: 3a 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 73 74  : " runname " st
13d0: 61 74 65 3a 20 22 20 73 74 61 74 65 20 22 20 73  ate: " state " s
13e0: 74 61 74 75 73 3a 20 22 20 73 74 61 74 75 73 20  tatus: " status 
13f0: 22 20 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a  " user: " user).
1400: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 74 72    (let* ((keystr
1410: 20 20 20 20 28 6b 65 79 73 2d 3e 6b 65 79 73 74      (keys->keyst
1420: 72 20 6b 65 79 73 29 29 0a 09 20 28 63 6f 6d 6d  r keys)).. (comm
1430: 61 20 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65  a     (if (> (le
1440: 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 2c  ngth keys) 0) ",
1450: 22 20 22 22 29 29 0a 09 20 28 61 6e 64 73 74 72  " "")).. (andstr
1460: 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 6e 67      (if (> (leng
1470: 74 68 20 6b 65 79 73 29 20 30 29 20 22 20 41 4e  th keys) 0) " AN
1480: 44 20 22 20 22 22 29 29 0a 09 20 28 76 61 6c 73  D " "")).. (vals
1490: 6c 6f 74 73 20 20 28 6b 65 79 73 2d 3e 76 61 6c  lots  (keys->val
14a0: 73 6c 6f 74 73 20 6b 65 79 73 29 29 20 3b 3b 20  slots keys)) ;; 
14b0: 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 28 6b 65 79  ?,?,? ..... (key
14c0: 76 61 6c 73 20 20 20 28 6d 61 70 20 63 61 64 72  vals   (map cadr
14d0: 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20 28   keyvallst)).. (
14e0: 61 6c 6c 76 61 6c 73 20 20 20 28 61 70 70 65 6e  allvals   (appen
14f0: 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 20  d (list runname 
1500: 73 74 61 74 65 20 73 74 61 74 75 73 20 75 73 65  state status use
1510: 72 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 20 28  r) keyvals)).. (
1520: 71 72 79 76 61 6c 73 20 20 20 28 61 70 70 65 6e  qryvals   (appen
1530: 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 29  d (list runname)
1540: 20 6b 65 79 76 61 6c 73 29 29 0a 09 20 28 6b 65   keyvals)).. (ke
1550: 79 3d 3f 73 74 72 20 20 28 73 74 72 69 6e 67 2d  y=?str  (string-
1560: 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70  intersperse (map
1570: 20 28 6c 61 6d 62 64 61 20 28 6b 29 28 63 6f 6e   (lambda (k)(con
1580: 63 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64  c (key:get-field
1590: 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 29 29 20 6b  name k) "=?")) k
15a0: 65 79 73 29 20 22 20 41 4e 44 20 22 29 29 29 0a  eys) " AND "))).
15b0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
15c0: 20 33 20 22 6b 65 79 73 3a 20 22 20 6b 65 79 73   3 "keys: " keys
15d0: 20 22 20 61 6c 6c 76 61 6c 73 3a 20 22 20 61 6c   " allvals: " al
15e0: 6c 76 61 6c 73 20 22 20 6b 65 79 76 61 6c 73 3a  lvals " keyvals:
15f0: 20 22 20 6b 65 79 76 61 6c 73 29 0a 20 20 20 20   " keyvals).    
1600: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22  (debug:print 2 "
1610: 4e 4f 54 45 3a 20 75 73 69 6e 67 20 74 61 72 67  NOTE: using targ
1620: 65 74 20 22 20 28 73 74 72 69 6e 67 2d 69 6e 74  et " (string-int
1630: 65 72 73 70 65 72 73 65 20 6b 65 79 76 61 6c 73  ersperse keyvals
1640: 20 22 2f 22 29 20 22 20 66 6f 72 20 74 68 69 73   "/") " for this
1650: 20 72 75 6e 22 29 0a 20 20 20 20 28 69 66 20 28   run").    (if (
1660: 61 6e 64 20 72 75 6e 6e 61 6d 65 20 28 6e 75 6c  and runname (nul
1670: 6c 3f 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62  l? (filter (lamb
1680: 64 61 20 28 78 29 28 6e 6f 74 20 78 29 29 20 6b  da (x)(not x)) k
1690: 65 79 76 61 6c 73 29 29 29 20 3b 3b 20 74 68 65  eyvals))) ;; the
16a0: 72 65 20 6d 75 73 74 20 62 65 20 61 20 62 65 74  re must be a bet
16b0: 74 65 72 20 77 61 79 20 74 6f 20 22 61 70 70 6c  ter way to "appl
16c0: 79 20 61 6e 64 22 0a 09 28 6c 65 74 20 28 28 72  y and"..(let ((r
16d0: 65 73 20 23 66 29 29 0a 09 20 20 28 61 70 70 6c  es #f))..  (appl
16e0: 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74  y sqlite3:execut
16f0: 65 20 64 62 20 28 63 6f 6e 63 20 22 49 4e 53 45  e db (conc "INSE
1700: 52 54 20 4f 52 20 49 47 4e 4f 52 45 20 49 4e 54  RT OR IGNORE INT
1710: 4f 20 72 75 6e 73 20 28 72 75 6e 6e 61 6d 65 2c  O runs (runname,
1720: 73 74 61 74 65 2c 73 74 61 74 75 73 2c 6f 77 6e  state,status,own
1730: 65 72 2c 65 76 65 6e 74 5f 74 69 6d 65 22 20 63  er,event_time" c
1740: 6f 6d 6d 61 20 6b 65 79 73 74 72 20 22 29 20 56  omma keystr ") V
1750: 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 73  ALUES (?,?,?,?,s
1760: 74 72 66 74 69 6d 65 28 27 25 73 27 2c 27 6e 6f  trftime('%s','no
1770: 77 27 29 22 20 63 6f 6d 6d 61 20 76 61 6c 73 6c  w')" comma valsl
1780: 6f 74 73 20 22 29 3b 22 29 0a 09 09 20 61 6c 6c  ots ");")... all
1790: 76 61 6c 73 29 0a 09 20 20 28 61 70 70 6c 79 20  vals)..  (apply 
17a0: 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68  sqlite3:for-each
17b0: 2d 72 6f 77 20 0a 09 20 20 20 28 6c 61 6d 62 64  -row ..   (lambd
17c0: 61 20 28 69 64 29 0a 09 20 20 20 20 20 28 73 65  a (id)..     (se
17d0: 74 21 20 72 65 73 20 69 64 29 29 0a 09 20 20 20  t! res id))..   
17e0: 64 62 0a 09 20 20 20 28 6c 65 74 20 28 28 71 72  db..   (let ((qr
17f0: 79 20 28 63 6f 6e 63 20 22 53 45 4c 45 43 54 20  y (conc "SELECT 
1800: 69 64 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 45  id FROM runs WHE
1810: 52 45 20 28 72 75 6e 6e 61 6d 65 3d 3f 20 22 20  RE (runname=? " 
1820: 61 6e 64 73 74 72 20 6b 65 79 3d 3f 73 74 72 20  andstr key=?str 
1830: 22 29 3b 22 29 29 29 0a 09 20 20 20 20 20 3b 28  ");")))..     ;(
1840: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 71  debug:print 4 "q
1850: 72 79 3a 20 22 20 71 72 79 29 20 0a 09 20 20 20  ry: " qry) ..   
1860: 20 20 71 72 79 29 0a 09 20 20 20 71 72 79 76 61    qry)..   qryva
1870: 6c 73 29 0a 09 20 20 28 73 71 6c 69 74 65 33 3a  ls)..  (sqlite3:
1880: 65 78 65 63 75 74 65 20 64 62 20 22 55 50 44 41  execute db "UPDA
1890: 54 45 20 72 75 6e 73 20 53 45 54 20 73 74 61 74  TE runs SET stat
18a0: 65 3d 3f 2c 73 74 61 74 75 73 3d 3f 20 57 48 45  e=?,status=? WHE
18b0: 52 45 20 69 64 3d 3f 3b 22 20 73 74 61 74 65 20  RE id=?;" state 
18c0: 73 74 61 74 75 73 20 72 65 73 29 0a 09 20 20 72  status res)..  r
18d0: 65 73 29 20 0a 09 28 62 65 67 69 6e 0a 09 20 20  es) ..(begin..  
18e0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
18f0: 45 52 52 4f 52 3a 20 43 61 6c 6c 65 64 20 77 69  ERROR: Called wi
1900: 74 68 6f 75 74 20 61 6c 6c 20 6e 65 63 65 73 73  thout all necess
1910: 61 72 79 20 6b 65 79 73 22 29 0a 09 20 20 23 66  ary keys")..  #f
1920: 29 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 69 73  ))))..;; This is
1930: 20 61 20 64 75 70 6c 69 63 61 74 65 20 6f 66 20   a duplicate of 
1940: 72 75 6e 2d 74 65 73 74 73 20 28 77 68 69 63 68  run-tests (which
1950: 20 68 61 73 20 62 65 65 6e 20 64 65 70 72 65 63   has been deprec
1960: 61 74 65 64 29 2e 20 55 73 65 20 74 68 69 73 20  ated). Use this 
1970: 6f 6e 65 20 69 6e 73 74 65 61 64 20 6f 66 20 72  one instead of r
1980: 75 6e 20 74 65 73 74 73 2e 0a 3b 3b 20 6b 65 79  un tests..;; key
1990: 76 61 6c 73 0a 28 64 65 66 69 6e 65 20 28 72 75  vals.(define (ru
19a0: 6e 73 3a 72 75 6e 2d 74 65 73 74 73 20 64 62 20  ns:run-tests db 
19b0: 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 74  target runname t
19c0: 65 73 74 2d 70 61 74 74 73 20 75 73 65 72 20 66  est-patts user f
19d0: 6c 61 67 73 29 0a 20 20 28 6c 65 74 2a 20 28 28  lags).  (let* ((
19e0: 6b 65 79 73 20 20 20 20 20 20 20 20 28 72 64 62  keys        (rdb
19f0: 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09  :get-keys db))..
1a00: 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 28 6b   (keyvallst   (k
1a10: 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76  eys:target->keyv
1a20: 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29 29  al keys target))
1a30: 0a 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20 20  .. (run-id      
1a40: 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72  (runs:register-r
1a50: 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61  un db keys keyva
1a60: 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65  llst runname "ne
1a70: 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 20  w" "n/a" user)) 
1a80: 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29 29   ;;  test-name))
1a90: 29 0a 09 20 28 64 65 66 65 72 72 65 64 20 20 20  ).. (deferred   
1aa0: 20 27 28 29 29 20 3b 3b 20 64 65 6c 61 79 20 72   '()) ;; delay r
1ab0: 75 6e 6e 69 6e 67 20 74 68 65 73 65 20 73 69 6e  unning these sin
1ac0: 63 65 20 74 68 65 79 20 68 61 76 65 20 61 20 77  ce they have a w
1ad0: 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20 3b  aiton clause.. ;
1ae0: 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69 73 20 74  ; keepgoing is t
1af0: 68 65 20 64 65 66 61 63 74 6f 20 6d 6f 64 61 6c  he defacto modal
1b00: 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 61 64  ity now, will ad
1b10: 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61 20 62 69  d hit-n-run a bi
1b20: 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20 28 6b 65  t later.. ;; (ke
1b30: 65 70 67 6f 69 6e 67 20 20 20 28 68 61 73 68 2d  epgoing   (hash-
1b40: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
1b50: 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f  t flags "-keepgo
1b60: 69 6e 67 22 20 23 66 29 29 0a 09 20 28 74 65 73  ing" #f)).. (tes
1b70: 74 2d 6e 61 6d 65 73 20 20 27 28 29 29 0a 09 20  t-names  '()).. 
1b80: 28 72 75 6e 63 6f 6e 66 69 67 66 20 20 20 28 63  (runconfigf   (c
1b90: 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22  onc  *toppath* "
1ba0: 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66  /runconfigs.conf
1bb0: 69 67 22 29 29 0a 09 20 28 72 65 71 75 69 72 65  ig")).. (require
1bc0: 64 2d 74 65 73 74 73 20 27 28 29 29 0a 09 20 28  d-tests '()).. (
1bd0: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 28 6d 61  test-records (ma
1be0: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29  ke-hash-table)))
1bf0: 0a 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 61 74  ..    (set-megat
1c00: 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20  est-env-vars db 
1c10: 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65  run-id) ;; these
1c20: 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 62   may be needed b
1c30: 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20  y the launching 
1c40: 70 72 6f 63 65 73 73 0a 0a 20 20 20 20 28 69 66  process..    (if
1c50: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72   (file-exists? r
1c60: 75 6e 63 6f 6e 66 69 67 66 29 0a 09 28 73 65 74  unconfigf)..(set
1c70: 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74 73 20  up-env-defaults 
1c80: 64 62 20 72 75 6e 63 6f 6e 66 69 67 66 20 72 75  db runconfigf ru
1c90: 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d 73 65  n-id *already-se
1ca0: 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e 66  en-runconfig-inf
1cb0: 6f 2a 20 22 70 72 65 2d 6c 61 75 6e 63 68 2d 65  o* "pre-launch-e
1cc0: 6e 76 2d 76 61 72 73 22 29 0a 09 28 64 65 62 75  nv-vars")..(debu
1cd0: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49  g:print 0 "WARNI
1ce0: 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f 74 20 68  NG: You do not h
1cf0: 61 76 65 20 61 20 72 75 6e 20 63 6f 6e 66 69 67  ave a run config
1d00: 20 66 69 6c 65 3a 20 22 20 72 75 6e 63 6f 6e 66   file: " runconf
1d10: 69 67 66 29 29 0a 20 20 20 20 0a 20 20 20 20 3b  igf)).    .    ;
1d20: 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c 20 74 65  ; look up all te
1d30: 73 74 73 20 6d 61 74 63 68 69 6e 67 20 74 68 65  sts matching the
1d40: 20 63 6f 6d 6d 61 20 73 65 70 61 72 61 74 65 64   comma separated
1d50: 20 6c 69 73 74 20 6f 66 20 67 6c 6f 62 73 20 69   list of globs i
1d60: 6e 0a 20 20 20 20 3b 3b 20 74 65 73 74 2d 70 61  n.    ;; test-pa
1d70: 74 74 73 20 28 75 73 69 6e 67 20 25 20 61 73 20  tts (using % as 
1d80: 77 69 6c 64 63 61 72 64 29 0a 20 20 20 20 28 66  wildcard).    (f
1d90: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c  or-each .     (l
1da0: 61 6d 62 64 61 20 28 70 61 74 74 29 0a 20 20 20  ambda (patt).   
1db0: 20 20 20 20 28 6c 65 74 20 28 28 74 65 73 74 73      (let ((tests
1dc0: 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 2a 74 6f   (glob (conc *to
1dd0: 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22  ppath* "/tests/"
1de0: 20 28 73 74 72 69 6e 67 2d 74 72 61 6e 73 6c 61   (string-transla
1df0: 74 65 20 70 61 74 74 20 22 25 22 20 22 2a 22 29  te patt "%" "*")
1e00: 29 29 29 29 0a 09 20 28 73 65 74 21 20 74 65 73  )))).. (set! tes
1e10: 74 73 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62  ts (filter (lamb
1e20: 64 61 20 28 74 65 73 74 29 28 66 69 6c 65 2d 65  da (test)(file-e
1e30: 78 69 73 74 73 3f 20 28 63 6f 6e 63 20 74 65 73  xists? (conc tes
1e40: 74 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 29  t "/testconfig")
1e50: 29 29 20 74 65 73 74 73 29 29 0a 09 20 28 73 65  )) tests)).. (se
1e60: 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 61  t! test-names (a
1e70: 70 70 65 6e 64 20 74 65 73 74 2d 6e 61 6d 65 73  ppend test-names
1e80: 20 0a 09 09 09 09 20 20 28 6d 61 70 20 28 6c 61   .....  (map (la
1e90: 6d 62 64 61 20 28 74 65 73 74 70 29 0a 09 09 09  mbda (testp)....
1ea0: 09 09 20 28 6c 61 73 74 20 28 73 74 72 69 6e 67  .. (last (string
1eb0: 2d 73 70 6c 69 74 20 74 65 73 74 70 20 22 2f 22  -split testp "/"
1ec0: 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 20 74  ))).....       t
1ed0: 65 73 74 73 29 29 29 29 29 0a 20 20 20 20 20 28  ests))))).     (
1ee0: 69 66 20 74 65 73 74 2d 70 61 74 74 73 20 28 73  if test-patts (s
1ef0: 74 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 73 74  tring-split test
1f00: 2d 70 61 74 74 73 20 22 2c 22 29 28 6c 69 73 74  -patts ",")(list
1f10: 20 22 25 22 29 29 29 0a 0a 20 20 20 20 20 3b 3b   "%")))..     ;;
1f20: 20 6e 6f 77 20 72 65 6d 6f 76 65 20 64 75 70 6c   now remove dupl
1f30: 69 63 61 74 65 73 0a 20 20 20 20 28 73 65 74 21  icates.    (set!
1f40: 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 64 65 6c   test-names (del
1f50: 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 20 74  ete-duplicates t
1f60: 65 73 74 2d 6e 61 6d 65 73 29 29 0a 0a 20 20 20  est-names))..   
1f70: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
1f80: 22 49 4e 46 4f 3a 20 74 65 73 74 20 6e 61 6d 65  "INFO: test name
1f90: 73 20 22 20 74 65 73 74 2d 6e 61 6d 65 73 29 0a  s " test-names).
1fa0: 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65 20 66  .    ;; on the f
1fb0: 69 72 73 74 20 70 61 73 73 20 6f 72 20 63 61 6c  irst pass or cal
1fc0: 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 73 20 73  l to run-tests s
1fd0: 65 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f 54 5f  et FAILS to NOT_
1fe0: 53 54 41 52 54 45 44 20 69 66 0a 20 20 20 20 3b  STARTED if.    ;
1ff0: 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69 73 20  ; -keepgoing is 
2000: 73 70 65 63 69 66 69 65 64 0a 20 20 20 20 28 69  specified.    (i
2010: 66 20 28 65 71 3f 20 2a 70 61 73 73 6e 75 6d 2a  f (eq? *passnum*
2020: 20 30 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 3b   0)..(begin..  ;
2030: 3b 20 68 61 76 65 20 74 6f 20 64 65 6c 65 74 65  ; have to delete
2040: 20 74 65 73 74 20 72 65 63 6f 72 64 73 20 77 68   test records wh
2050: 65 72 65 20 4e 4f 54 5f 53 54 41 52 54 45 44 20  ere NOT_STARTED 
2060: 73 69 6e 63 65 20 74 68 65 79 20 63 61 6e 20 63  since they can c
2070: 61 75 73 65 20 2d 6b 65 65 70 67 6f 69 6e 67 20  ause -keepgoing 
2080: 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74 20 73 74  to ..  ;; get st
2090: 75 63 6b 20 64 75 65 20 74 6f 20 62 65 63 6f 6d  uck due to becom
20a0: 69 6e 67 20 69 6e 61 63 63 65 73 73 69 62 6c 65  ing inaccessible
20b0: 20 66 72 6f 6d 20 61 20 66 61 69 6c 65 64 20 74   from a failed t
20c0: 65 73 74 2e 20 49 2e 65 2e 20 69 66 20 74 65 73  est. I.e. if tes
20d0: 74 20 42 20 64 65 70 65 6e 64 73 20 0a 09 20 20  t B depends ..  
20e0: 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20 62 75 74  ;; on test A but
20f0: 20 74 65 73 74 20 42 20 72 65 61 63 68 65 64 20   test B reached 
2100: 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20 62 65 69  the point on bei
2110: 6e 67 20 72 65 67 69 73 74 65 72 65 64 20 61 73  ng registered as
2120: 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 61 6e 64   NOT_STARTED and
2130: 20 74 65 73 74 0a 09 20 20 3b 3b 20 41 20 66 61   test..  ;; A fa
2140: 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65 20 72 65  iled for some re
2150: 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 72 65 2d  ason then on re-
2160: 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65 65 70 67  run using -keepg
2170: 6f 69 6e 67 20 74 68 65 20 72 75 6e 20 63 61 6e  oing the run can
2180: 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65 74 65 2e   never complete.
2190: 0a 09 20 20 28 64 62 3a 64 65 6c 65 74 65 2d 74  ..  (db:delete-t
21a0: 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 20 64 62  ests-in-state db
21b0: 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 54 41   run-id "NOT_STA
21c0: 52 54 45 44 22 29 0a 09 20 20 28 72 64 62 3a 73  RTED")..  (rdb:s
21d0: 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65 2d 73  et-tests-state-s
21e0: 74 61 74 75 73 20 64 62 20 72 75 6e 2d 69 64 20  tatus db run-id 
21f0: 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 22 46  test-names #f "F
2200: 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54 45  AIL" "NOT_STARTE
2210: 44 22 20 22 46 41 49 4c 22 29 29 29 0a 0a 20 20  D" "FAIL")))..  
2220: 20 20 3b 3b 20 66 72 6f 6d 20 68 65 72 65 20 6f    ;; from here o
2230: 6e 20 6f 75 74 20 74 68 65 20 64 62 20 77 69 6c  n out the db wil
2240: 6c 20 62 65 20 6f 70 65 6e 65 64 20 61 6e 64 20  l be opened and 
2250: 63 6c 6f 73 65 64 20 6f 6e 20 65 76 65 72 79 20  closed on every 
2260: 63 61 6c 6c 20 72 75 6e 73 3a 72 75 6e 2d 74 65  call runs:run-te
2270: 73 74 73 2d 71 75 65 75 65 0a 20 20 20 20 28 73  sts-queue.    (s
2280: 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21  qlite3:finalize!
2290: 20 64 62 29 20 0a 20 20 20 20 3b 3b 20 6e 6f 77   db) .    ;; now
22a0: 20 61 64 64 20 6e 6f 6e 2d 64 69 72 65 63 74 6c   add non-directl
22b0: 79 20 72 65 66 65 72 65 6e 63 65 64 20 64 65 70  y referenced dep
22c0: 65 6e 64 65 6e 63 69 65 73 20 28 69 2e 65 2e 20  endencies (i.e. 
22d0: 77 61 69 74 6f 6e 29 0a 20 20 20 20 28 69 66 20  waiton).    (if 
22e0: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74  (not (null? test
22f0: 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65 74 20 6c  -names))..(let l
2300: 6f 6f 70 20 28 28 68 65 64 20 28 63 61 72 20 74  oop ((hed (car t
2310: 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20  est-names))...  
2320: 20 28 74 61 6c 20 28 63 64 72 20 74 65 73 74 2d   (tal (cdr test-
2330: 6e 61 6d 65 73 29 29 29 20 20 20 20 20 20 20 20  names)))        
2340: 20 3b 3b 20 27 72 65 74 75 72 6e 2d 70 72 6f 63   ;; 'return-proc
2350: 73 20 74 65 6c 6c 73 20 74 68 65 20 63 6f 6e 66  s tells the conf
2360: 69 67 20 72 65 61 64 65 72 20 74 6f 20 70 72 65  ig reader to pre
2370: 70 20 72 75 6e 6e 69 6e 67 20 73 79 73 74 65 6d  p running system
2380: 20 62 75 74 20 72 65 74 75 72 6e 20 61 20 70 72   but return a pr
2390: 6f 63 0a 09 20 20 28 6c 65 74 2a 20 28 28 63 6f  oc..  (let* ((co
23a0: 6e 66 69 67 20 20 28 74 65 73 74 73 3a 67 65 74  nfig  (tests:get
23b0: 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65 64 20  -testconfig hed 
23c0: 27 72 65 74 75 72 6e 2d 70 72 6f 63 73 29 29 0a  'return-procs)).
23d0: 09 09 20 28 77 61 69 74 6f 6e 73 20 28 69 66 20  .. (waitons (if 
23e0: 63 6f 6e 66 69 67 20 28 73 74 72 69 6e 67 2d 73  config (string-s
23f0: 70 6c 69 74 20 28 6c 65 74 20 28 28 77 20 28 63  plit (let ((w (c
2400: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e  onfig-lookup con
2410: 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74  fig "requirement
2420: 73 22 20 22 77 61 69 74 6f 6e 22 29 29 29 0a 09  s" "waiton")))..
2430: 09 09 09 09 09 20 20 20 20 20 28 69 66 20 77 20  .....     (if w 
2440: 77 20 22 22 29 29 29 0a 09 09 09 20 20 20 20 20  w "")))....     
2450: 20 28 62 65 67 69 6e 0a 09 09 09 09 28 64 65 62   (begin.....(deb
2460: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
2470: 52 3a 20 6e 6f 6e 2d 65 78 69 73 74 65 6e 74 20  R: non-existent 
2480: 72 65 71 75 69 72 65 64 20 74 65 73 74 20 5c 22  required test \"
2490: 22 20 68 65 64 20 22 5c 22 22 29 0a 20 20 20 20  " hed "\"").    
24a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
24b0: 20 20 20 20 20 20 20 20 20 20 20 20 28 73 71 6c              (sql
24c0: 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64  ite3:finalize! d
24d0: 62 29 0a 09 09 09 09 28 65 78 69 74 20 31 29 29  b).....(exit 1))
24e0: 29 29 29 0a 09 20 20 20 20 3b 3b 20 63 68 65 63  )))..    ;; chec
24f0: 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 77 61 69  k for hed in wai
2500: 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77 6f 75  tons => this wou
2510: 6c 64 20 62 65 20 63 69 72 63 75 6c 61 72 2c 20  ld be circular, 
2520: 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 20 69 73  remove it and is
2530: 73 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b 20 65  sue an..    ;; e
2540: 72 72 6f 72 0a 09 20 20 20 20 28 69 66 20 28 6d  rror..    (if (m
2550: 65 6d 62 65 72 20 68 65 64 20 77 61 69 74 6f 6e  ember hed waiton
2560: 73 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20  s)...(begin...  
2570: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
2580: 45 52 52 4f 52 3a 20 74 65 73 74 20 22 20 68 65  ERROR: test " he
2590: 64 20 22 20 68 61 73 20 6c 69 73 74 65 64 20 69  d " has listed i
25a0: 74 73 65 6c 66 20 61 73 20 61 20 77 61 69 74 6f  tself as a waito
25b0: 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72 65 63  n, please correc
25c0: 74 20 74 68 69 73 21 22 29 0a 09 09 20 20 28 73  t this!")...  (s
25d0: 65 74 21 20 77 61 69 74 6f 6e 73 20 28 66 69 6c  et! waitons (fil
25e0: 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28  ter (lambda (x)(
25f0: 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 68 65  not (equal? x he
2600: 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29 29 29  d))) waitons))))
2610: 0a 09 20 20 20 20 0a 09 20 20 20 20 3b 3b 20 28  ..    ..    ;; (
2620: 69 74 65 6d 73 20 20 20 28 69 74 65 6d 73 3a 67  items   (items:g
2630: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f  et-items-from-co
2640: 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 29 0a 09  nfig config)))..
2650: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61      (if (not (ha
2660: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
2670: 61 75 6c 74 20 74 65 73 74 2d 72 65 63 6f 72 64  ault test-record
2680: 73 20 68 65 64 20 23 66 29 29 0a 09 09 28 68 61  s hed #f))...(ha
2690: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65  sh-table-set! te
26a0: 73 74 2d 72 65 63 6f 72 64 73 0a 09 09 09 09 20  st-records..... 
26b0: 68 65 64 20 28 76 65 63 74 6f 72 20 68 65 64 20  hed (vector hed 
26c0: 20 20 20 20 3b 3b 20 30 0a 09 09 09 09 09 20 20      ;; 0......  
26d0: 20 20 20 63 6f 6e 66 69 67 20 20 3b 3b 20 31 0a     config  ;; 1.
26e0: 09 09 09 09 09 20 20 20 20 20 77 61 69 74 6f 6e  .....     waiton
26f0: 73 20 3b 3b 20 32 0a 09 09 09 09 09 20 20 20 20  s ;; 2......    
2700: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20   (config-lookup 
2710: 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d  config "requirem
2720: 65 6e 74 73 22 20 22 70 72 69 6f 72 69 74 79 22  ents" "priority"
2730: 29 20 20 20 20 20 3b 3b 20 70 72 69 6f 72 69 74  )     ;; priorit
2740: 79 20 33 0a 09 09 09 09 09 20 20 20 20 20 28 6c  y 3......     (l
2750: 65 74 20 28 28 69 74 65 6d 73 20 20 20 20 20 20  et ((items      
2760: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
2770: 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22  default config "
2780: 69 74 65 6d 73 22 20 23 66 29 29 20 3b 3b 20 69  items" #f)) ;; i
2790: 74 65 6d 73 20 34 0a 09 09 09 09 09 09 20 20 20  tems 4.......   
27a0: 28 69 74 65 6d 73 74 61 62 6c 65 20 28 68 61 73  (itemstable (has
27b0: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
27c0: 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 65 6d  ult config "item
27d0: 73 74 61 62 6c 65 22 20 23 66 29 29 29 20 0a 09  stable" #f))) ..
27e0: 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66  ....       ;; if
27f0: 20 65 69 74 68 65 72 20 69 74 65 6d 73 20 6f 72   either items or
2800: 20 69 74 65 6d 73 20 74 61 62 6c 65 20 69 73 20   items table is 
2810: 61 20 70 72 6f 63 20 72 65 74 75 72 6e 20 69 74  a proc return it
2820: 20 73 6f 20 74 65 73 74 20 72 75 6e 6e 69 6e 67   so test running
2830: 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20  ......       ;; 
2840: 70 72 6f 63 65 73 73 20 63 61 6e 20 6b 6e 6f 77  process can know
2850: 20 74 6f 20 63 61 6c 6c 20 69 74 65 6d 73 3a 67   to call items:g
2860: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f  et-items-from-co
2870: 6e 66 69 67 0a 09 09 09 09 09 20 20 20 20 20 20  nfig......      
2880: 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20 69 73   ;; if either is
2890: 20 61 20 6c 69 73 74 20 61 6e 64 20 6e 6f 6e 65   a list and none
28a0: 20 69 73 20 61 20 70 72 6f 63 20 67 6f 20 61 68   is a proc go ah
28b0: 65 61 64 20 61 6e 64 20 63 61 6c 6c 20 67 65 74  ead and call get
28c0: 2d 69 74 65 6d 73 0a 09 09 09 09 09 20 20 20 20  -items......    
28d0: 20 20 20 3b 3b 20 6f 74 68 65 72 77 69 73 65 20     ;; otherwise 
28e0: 72 65 74 75 72 6e 20 23 66 20 2d 20 74 68 69 73  return #f - this
28f0: 20 69 73 20 6e 6f 74 20 61 6e 20 69 74 65 72 61   is not an itera
2900: 74 65 64 20 74 65 73 74 0a 09 09 09 09 09 20 20  ted test......  
2910: 20 20 20 20 20 28 63 6f 6e 64 0a 09 09 09 09 09       (cond......
2920: 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74  .((procedure? it
2930: 65 6d 73 29 20 20 20 20 20 20 0a 09 09 09 09 09  ems)      ......
2940: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34  . (debug:print 4
2950: 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 69 73   "INFO: items is
2960: 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 69   a procedure, wi
2970: 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29 0a  ll calc later").
2980: 09 09 09 09 09 09 20 69 74 65 6d 73 29 20 20 20  ...... items)   
2990: 20 20 20 20 20 20 20 20 20 3b 3b 20 63 61 6c 63           ;; calc
29a0: 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28 70   later.......((p
29b0: 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 74  rocedure? itemst
29c0: 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28 64 65  able)....... (de
29d0: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46  bug:print 4 "INF
29e0: 4f 3a 20 69 74 65 6d 73 74 61 62 6c 65 20 69 73  O: itemstable is
29f0: 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 69   a procedure, wi
2a00: 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29 0a  ll calc later").
2a10: 09 09 09 09 09 09 20 69 74 65 6d 73 74 61 62 6c  ...... itemstabl
2a20: 65 29 20 20 20 20 20 20 20 3b 3b 20 63 61 6c 63  e)       ;; calc
2a30: 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28 66   later.......((f
2a40: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78  ilter (lambda (x
2a50: 29 0a 09 09 09 09 09 09 09 20 20 20 28 6c 65 74  )........   (let
2a60: 20 28 28 76 61 6c 20 28 63 61 72 20 78 29 29 29   ((val (car x)))
2a70: 0a 09 09 09 09 09 09 09 20 20 20 20 20 28 69 66  ........     (if
2a80: 20 28 70 72 6f 63 65 64 75 72 65 3f 20 76 61 6c   (procedure? val
2a90: 29 20 76 61 6c 20 23 66 29 29 29 0a 09 09 09 09  ) val #f))).....
2aa0: 09 09 09 20 28 61 70 70 65 6e 64 20 28 69 66 20  ... (append (if 
2ab0: 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74  (list? items) it
2ac0: 65 6d 73 20 27 28 29 29 0a 09 09 09 09 09 09 09  ems '())........
2ad0: 09 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65  . (if (list? ite
2ae0: 6d 73 74 61 62 6c 65 29 20 69 74 65 6d 73 74 61  mstable) itemsta
2af0: 62 6c 65 20 27 28 29 29 29 29 0a 09 09 09 09 09  ble '())))......
2b00: 09 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72  . 'have-procedur
2b10: 65 29 0a 09 09 09 09 09 09 28 28 6f 72 20 28 6c  e).......((or (l
2b20: 69 73 74 3f 20 69 74 65 6d 73 29 28 6c 69 73 74  ist? items)(list
2b30: 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 20 3b  ? itemstable)) ;
2b40: 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09 09 09  ; calc now......
2b50: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34  . (debug:print 4
2b60: 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 61 6e   "INFO: items an
2b70: 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61 72 65  d itemstable are
2b80: 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e 6f 77   lists, calc now
2b90: 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20 20 20  \n"........     
2ba0: 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22 20 69   "    items: " i
2bb0: 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61 62 6c  tems " itemstabl
2bc0: 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c 65 29  e: " itemstable)
2bd0: 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73 3a 67  ....... (items:g
2be0: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f  et-items-from-co
2bf0: 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a 09 09  nfig config))...
2c00: 09 09 09 09 28 65 6c 73 65 20 23 66 29 29 29 20  ....(else #f))) 
2c10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2c20: 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e 6f 74            ;; not
2c30: 20 69 74 65 72 61 74 65 64 0a 09 09 09 09 09 20   iterated...... 
2c40: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 69      #f      ;; i
2c50: 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09 09 20  temsdat 5...... 
2c60: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 73      #f      ;; s
2c70: 70 61 72 65 20 2d 20 75 73 65 64 20 66 6f 72 20  pare - used for 
2c80: 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 09 09 20  item-path...... 
2c90: 20 20 20 20 29 29 29 0a 09 20 20 20 20 28 66 6f      )))..    (fo
2ca0: 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20 28 6c  r-each ..     (l
2cb0: 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29 0a 09  ambda (waiton)..
2cc0: 20 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 20         (if (and 
2cd0: 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d  waiton (not (mem
2ce0: 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73 74 2d  ber waiton test-
2cf0: 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20 28 62  names)))...   (b
2d00: 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73 65 74  egin...     (set
2d10: 21 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73  ! required-tests
2d20: 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 72 65   (cons waiton re
2d30: 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09  quired-tests))..
2d40: 09 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74  .     (set! test
2d50: 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77 61 69  -names (cons wai
2d60: 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  ton test-names))
2d70: 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20 61 70  ))) ;; was an ap
2d80: 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f 6e 73  pend, now a cons
2d90: 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73 29 0a  ..     waitons).
2da0: 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74  .    (let ((remt
2db0: 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64 75 70  ests (delete-dup
2dc0: 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e 64 20  licates (append 
2dd0: 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 29 0a  waitons tal)))).
2de0: 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20  .      (if (not 
2df0: 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29  (null? remtests)
2e00: 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72  )...  (loop (car
2e10: 20 72 65 6d 74 65 73 74 73 29 28 63 64 72 20 72   remtests)(cdr r
2e20: 65 6d 74 65 73 74 73 29 29 29 29 29 29 29 0a 0a  emtests)))))))..
2e30: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75      (if (not (nu
2e40: 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 65 73  ll? required-tes
2e50: 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69  ts))..(debug:pri
2e60: 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 64 64 69  nt 1 "INFO: Addi
2e70: 6e 67 20 22 20 72 65 71 75 69 72 65 64 2d 74 65  ng " required-te
2e80: 73 74 73 20 22 20 74 6f 20 74 68 65 20 72 75 6e  sts " to the run
2e90: 20 71 75 65 75 65 22 29 29 0a 20 20 20 20 3b 3b   queue")).    ;;
2ea0: 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 72 65   NOTE: these are
2eb0: 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 73 74   all parent test
2ec0: 73 2c 20 69 74 65 6d 73 20 61 72 65 20 6e 6f 74  s, items are not
2ed0: 20 65 78 70 61 6e 64 65 64 20 79 65 74 2e 0a 20   expanded yet.. 
2ee0: 20 20 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73     (runs:run-tes
2ef0: 74 73 2d 71 75 65 75 65 20 72 75 6e 2d 69 64 20  ts-queue run-id 
2f00: 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63  runname test-rec
2f10: 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66  ords keyvallst f
2f20: 6c 61 67 73 29 0a 20 20 20 20 28 64 65 62 75 67  lags).    (debug
2f30: 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20  :print 4 "INFO: 
2f40: 41 6c 6c 20 64 6f 6e 65 20 62 79 20 68 65 72 65  All done by here
2f50: 22 29 29 29 0a 0a 3b 3b 20 74 65 73 74 2d 72 65  ")))..;; test-re
2f60: 63 6f 72 64 73 20 69 73 20 61 20 68 61 73 68 20  cords is a hash 
2f70: 74 61 62 6c 65 20 74 65 73 74 6e 61 6d 65 3a 69  table testname:i
2f80: 74 65 6d 5f 70 61 74 68 20 3d 3e 20 76 65 63 74  tem_path => vect
2f90: 6f 72 20 3c 20 74 65 73 74 6e 61 6d 65 20 74 65  or < testname te
2fa0: 73 74 63 6f 6e 66 69 67 20 77 61 69 74 6f 6e 73  stconfig waitons
2fb0: 20 70 72 69 6f 72 69 74 79 20 69 74 65 6d 73 2d   priority items-
2fc0: 69 6e 66 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66 69  info ... >.(defi
2fd0: 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73  ne (runs:run-tes
2fe0: 74 73 2d 71 75 65 75 65 20 72 75 6e 2d 69 64 20  ts-queue run-id 
2ff0: 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63  runname test-rec
3000: 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66  ords keyvallst f
3010: 6c 61 67 73 29 0a 20 20 20 20 3b 3b 20 41 74 20  lags).    ;; At 
3020: 74 68 69 73 20 70 6f 69 6e 74 20 74 68 65 20 6c  this point the l
3030: 69 73 74 20 6f 66 20 70 61 72 65 6e 74 20 74 65  ist of parent te
3040: 73 74 73 20 69 73 20 65 78 70 61 6e 64 65 64 20  sts is expanded 
3050: 0a 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f  .    ;; NB// Sho
3060: 75 6c 64 20 65 78 70 61 6e 64 20 69 74 65 6d 73  uld expand items
3070: 20 68 65 72 65 20 61 6e 64 20 74 68 65 6e 20 69   here and then i
3080: 6e 73 65 72 74 20 69 6e 74 6f 20 74 68 65 20 72  nsert into the r
3090: 75 6e 20 71 75 65 75 65 2e 0a 20 20 28 64 65 62  un queue..  (deb
30a0: 75 67 3a 70 72 69 6e 74 20 35 20 22 74 65 73 74  ug:print 5 "test
30b0: 2d 72 65 63 6f 72 64 73 3a 20 22 20 74 65 73 74  -records: " test
30c0: 2d 72 65 63 6f 72 64 73 20 22 2c 20 6b 65 79 76  -records ", keyv
30d0: 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c  allst: " keyvall
30e0: 73 74 20 22 20 66 6c 61 67 73 3a 20 22 20 28 68  st " flags: " (h
30f0: 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74  ash-table->alist
3100: 20 66 6c 61 67 73 29 29 0a 20 20 28 6c 65 74 20   flags)).  (let 
3110: 28 28 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61  ((sorted-test-na
3120: 6d 65 73 20 28 74 65 73 74 73 3a 73 6f 72 74 2d  mes (tests:sort-
3130: 62 79 2d 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d  by-priority-and-
3140: 77 61 69 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f  waiton test-reco
3150: 72 64 73 29 29 0a 09 28 69 74 65 6d 2d 70 61 74  rds))..(item-pat
3160: 74 73 20 20 20 20 20 20 20 20 28 68 61 73 68 2d  ts        (hash-
3170: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
3180: 74 20 66 6c 61 67 73 20 22 2d 69 74 65 6d 70 61  t flags "-itempa
3190: 74 74 22 20 23 66 29 29 29 0a 20 20 20 20 28 69  tt" #f))).    (i
31a0: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f  f (not (null? so
31b0: 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29  rted-test-names)
31c0: 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68  )..(let loop ((h
31d0: 65 64 20 20 20 20 20 20 20 20 20 28 63 61 72 20  ed         (car 
31e0: 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65  sorted-test-name
31f0: 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 20 20  s))...   (tal   
3200: 20 20 20 20 20 20 28 63 64 72 20 73 6f 72 74 65        (cdr sorte
3210: 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a  d-test-names))).
3220: 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70  .  (thread-sleep
3230: 21 20 30 2e 31 29 20 3b 3b 20 67 69 76 65 20 6f  ! 0.1) ;; give o
3240: 74 68 65 72 20 61 70 70 6c 69 63 61 74 69 6f 6e  ther application
3250: 73 20 73 6f 6d 65 20 74 69 6d 65 20 77 69 74 68  s some time with
3260: 20 74 68 65 20 64 62 0a 09 20 20 28 6c 65 74 2a   the db..  (let*
3270: 20 28 28 74 65 73 74 2d 72 65 63 6f 72 64 20 28   ((test-record (
3280: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 74  hash-table-ref t
3290: 65 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 29  est-records hed)
32a0: 29 0a 09 09 20 28 74 63 6f 6e 66 69 67 20 20 20  )... (tconfig   
32b0: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
32c0: 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69  ue-get-testconfi
32d0: 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a  g test-record)).
32e0: 09 09 20 28 74 65 73 74 6d 6f 64 65 20 20 20 20  .. (testmode    
32f0: 28 6c 65 74 20 28 28 6d 20 28 63 6f 6e 66 69 67  (let ((m (config
3300: 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20  -lookup tconfig 
3310: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22  "requirements" "
3320: 6d 6f 64 65 22 29 29 29 0a 09 09 09 09 28 69 66  mode"))).....(if
3330: 20 6d 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62   m (string->symb
3340: 6f 6c 20 6d 29 20 27 6e 6f 72 6d 61 6c 29 29 29  ol m) 'normal)))
3350: 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 20 20 20  ... (waitons    
3360: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
3370: 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20  e-get-waitons   
3380: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
3390: 09 20 28 70 72 69 6f 72 69 74 79 20 20 20 20 28  . (priority    (
33a0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
33b0: 67 65 74 2d 70 72 69 6f 72 69 74 79 20 20 20 74  get-priority   t
33c0: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20  est-record))... 
33d0: 28 69 74 65 6d 64 61 74 20 20 20 20 20 28 74 65  (itemdat     (te
33e0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
33f0: 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 73  t-itemdat    tes
3400: 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20 69 74  t-record)) ;; it
3410: 65 6d 64 61 74 20 63 61 6e 20 62 65 20 61 20 73  emdat can be a s
3420: 74 72 69 6e 67 2c 20 6c 69 73 74 20 6f 72 20 23  tring, list or #
3430: 66 0a 09 09 20 28 69 74 65 6d 73 20 20 20 20 20  f... (items     
3440: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
3450: 75 65 2d 67 65 74 2d 69 74 65 6d 73 20 20 20 20  ue-get-items    
3460: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a    test-record)).
3470: 09 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20  .. (item-path   
3480: 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68  (item-list->path
3490: 20 69 74 65 6d 64 61 74 29 29 0a 09 09 20 28 6e   itemdat))... (n
34a0: 65 77 74 61 6c 20 20 20 20 20 20 28 61 70 70 65  ewtal      (appe
34b0: 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64  nd tal (list hed
34c0: 29 29 29 0a 09 09 20 28 63 61 6c 63 2d 66 61 69  )))... (calc-fai
34d0: 6c 73 20 20 28 6c 61 6d 62 64 61 20 28 70 72 65  ls  (lambda (pre
34e0: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09  reqs-not-met)...
34f0: 09 09 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64  ..(filter (lambd
3500: 61 20 28 74 65 73 74 29 0a 09 09 09 09 09 20 20  a (test)......  
3510: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 39 20 22  (debug:print 9 "
3520: 74 65 73 74 3a 20 22 20 74 65 73 74 29 0a 09 09  test: " test)...
3530: 09 09 09 20 20 28 61 6e 64 20 28 76 65 63 74 6f  ...  (and (vecto
3540: 72 3f 20 74 65 73 74 29 20 3b 3b 20 6e 6f 74 20  r? test) ;; not 
3550: 28 73 74 72 69 6e 67 3f 20 74 65 73 74 29 29 0a  (string? test)).
3560: 09 09 09 09 09 20 20 20 20 20 20 20 28 65 71 75  .....       (equ
3570: 61 6c 3f 20 28 64 62 3a 74 65 73 74 2d 67 65 74  al? (db:test-get
3580: 2d 73 74 61 74 65 20 74 65 73 74 29 20 22 43 4f  -state test) "CO
3590: 4d 50 4c 45 54 45 44 22 29 0a 09 09 09 09 09 20  MPLETED")...... 
35a0: 20 20 20 20 20 20 28 6e 6f 74 20 28 6d 65 6d 62        (not (memb
35b0: 65 72 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  er (db:test-get-
35c0: 73 74 61 74 75 73 20 74 65 73 74 29 0a 09 09 09  status test)....
35d0: 09 09 09 09 20 20 20 20 27 28 22 50 41 53 53 22  ....    '("PASS"
35e0: 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 20   "WARN" "CHECK" 
35f0: 22 57 41 49 56 45 44 22 29 29 29 29 29 0a 09 09  "WAIVED")))))...
3600: 09 09 09 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  ...prereqs-not-m
3610: 65 74 29 29 29 0a 09 09 20 28 63 61 6c 63 2d 6e  et)))... (calc-n
3620: 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 28 6c 61  ot-completed (la
3630: 6d 62 64 61 20 28 70 72 65 72 65 71 73 2d 6e 6f  mbda (prereqs-no
3640: 74 2d 6d 65 74 29 0a 09 09 09 09 20 20 20 20 20  t-met).....     
3650: 20 20 28 66 69 6c 74 65 72 0a 09 09 09 09 09 28    (filter......(
3660: 6c 61 6d 62 64 61 20 28 74 29 0a 09 09 09 09 09  lambda (t)......
3670: 20 20 28 6f 72 20 28 6e 6f 74 20 28 76 65 63 74    (or (not (vect
3680: 6f 72 3f 20 74 29 29 0a 09 09 09 09 09 20 20 20  or? t))......   
3690: 20 20 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20     (not (equal? 
36a0: 22 43 4f 4d 50 4c 45 54 45 44 22 20 28 64 62 3a  "COMPLETED" (db:
36b0: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74  test-get-state t
36c0: 29 29 29 29 29 0a 09 09 09 09 09 70 72 65 72 65  )))))......prere
36d0: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09  qs-not-met)))...
36e0: 20 28 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20   (pretty-string 
36f0: 28 6c 61 6d 62 64 61 20 28 6c 73 74 29 0a 09 09  (lambda (lst)...
3700: 09 09 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61  ..  (map (lambda
3710: 20 28 74 29 0a 09 09 09 09 09 20 28 69 66 20 28   (t)...... (if (
3720: 6e 6f 74 20 28 76 65 63 74 6f 72 3f 20 74 29 29  not (vector? t))
3730: 0a 09 09 09 09 09 20 20 20 20 20 28 63 6f 6e 63  ......     (conc
3740: 20 74 29 0a 09 09 09 09 09 20 20 20 20 20 28 63   t)......     (c
3750: 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74  onc (db:test-get
3760: 2d 74 65 73 74 6e 61 6d 65 20 74 29 20 22 3a 22  -testname t) ":"
3770: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74   (db:test-get-st
3780: 61 74 65 20 74 29 20 22 2f 22 20 28 64 62 3a 74  ate t) "/" (db:t
3790: 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74  est-get-status t
37a0: 29 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 20  )))).....       
37b0: 6c 73 74 29 29 29 29 0a 09 20 20 20 20 28 64 65  lst))))..    (de
37c0: 62 75 67 3a 70 72 69 6e 74 20 36 0a 09 09 09 20  bug:print 6.... 
37d0: 22 69 74 65 6d 64 61 74 3a 20 20 20 20 20 22 20  "itemdat:     " 
37e0: 69 74 65 6d 64 61 74 0a 09 09 09 20 22 5c 6e 20  itemdat.... "\n 
37f0: 20 69 74 65 6d 73 3a 20 20 20 20 20 22 20 69 74   items:     " it
3800: 65 6d 73 0a 09 09 09 20 22 5c 6e 20 20 69 74 65  ems.... "\n  ite
3810: 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 6d 2d 70  m-path: " item-p
3820: 61 74 68 0a 09 09 09 20 22 5c 6e 20 20 77 61 69  ath.... "\n  wai
3830: 74 6f 6e 73 3a 20 20 20 22 20 77 61 69 74 6f 6e  tons:   " waiton
3840: 73 29 0a 0a 09 20 20 20 20 3b 3b 20 63 68 65 63  s)...    ;; chec
3850: 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 77 61 69  k for hed in wai
3860: 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77 6f 75  tons => this wou
3870: 6c 64 20 62 65 20 63 69 72 63 75 6c 61 72 2c 20  ld be circular, 
3880: 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 20 69 73  remove it and is
3890: 73 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b 20 65  sue an..    ;; e
38a0: 72 72 6f 72 0a 09 20 20 20 20 28 69 66 20 28 6d  rror..    (if (m
38b0: 65 6d 62 65 72 20 68 65 64 20 77 61 69 74 6f 6e  ember hed waiton
38c0: 73 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20  s)...(begin...  
38d0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
38e0: 45 52 52 4f 52 3a 20 74 65 73 74 20 22 20 68 65  ERROR: test " he
38f0: 64 20 22 20 68 61 73 20 6c 69 73 74 65 64 20 69  d " has listed i
3900: 74 73 65 6c 66 20 61 73 20 61 20 77 61 69 74 6f  tself as a waito
3910: 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72 65 63  n, please correc
3920: 74 20 74 68 69 73 21 22 29 0a 09 09 20 20 28 73  t this!")...  (s
3930: 65 74 21 20 77 61 69 74 6f 6e 20 28 66 69 6c 74  et! waiton (filt
3940: 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e  er (lambda (x)(n
3950: 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 68 65 64  ot (equal? x hed
3960: 29 29 29 20 77 61 69 74 6f 6e 73 29 29 29 29 0a  ))) waitons)))).
3970: 0a 09 20 20 20 20 28 63 6f 6e 64 0a 09 20 20 20  ..    (cond..   
3980: 20 20 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b    ((not items) ;
3990: 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 74 68 65  ; when false the
39a0: 20 74 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 62   test is ok to b
39b0: 65 20 68 61 6e 64 65 64 20 6f 66 66 20 74 6f 20  e handed off to 
39c0: 6c 61 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 20  launch (but not 
39d0: 62 65 66 6f 72 65 29 0a 09 20 20 20 20 20 20 28  before)..      (
39e0: 6c 65 74 2a 20 28 28 68 61 76 65 2d 72 65 73 6f  let* ((have-reso
39f0: 75 72 63 65 73 20 20 28 6f 70 65 6e 2d 72 75 6e  urces  (open-run
3a00: 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 63 61 6e 2d  -close runs:can-
3a10: 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 23  run-more-tests #
3a20: 66 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20  f test-record)) 
3a30: 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 74  ;; look at the t
3a40: 65 73 74 20 6a 6f 62 67 72 6f 75 70 20 61 6e 64  est jobgroup and
3a50: 20 74 6f 74 20 6a 6f 62 73 20 72 75 6e 6e 69 6e   tot jobs runnin
3a60: 67 0a 09 09 20 20 20 20 20 28 70 72 65 72 65 71  g...     (prereq
3a70: 73 2d 6e 6f 74 2d 6d 65 74 20 28 6f 70 65 6e 2d  s-not-met (open-
3a80: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
3a90: 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74  -prereqs-not-met
3aa0: 20 23 66 20 72 75 6e 2d 69 64 20 77 61 69 74 6f   #f run-id waito
3ab0: 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64  ns item-path mod
3ac0: 65 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a 09 09  e: testmode))...
3ad0: 20 20 20 20 20 28 66 61 69 6c 73 20 20 20 20 20       (fails     
3ae0: 20 20 20 20 20 20 28 63 61 6c 63 2d 66 61 69 6c        (calc-fail
3af0: 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  s prereqs-not-me
3b00: 74 29 29 0a 09 09 20 20 20 20 20 28 6e 6f 6e 2d  t))...     (non-
3b10: 63 6f 6d 70 6c 65 74 65 64 20 20 20 28 63 61 6c  completed   (cal
3b20: 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20  c-not-completed 
3b30: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
3b40: 29 29 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e  ))...(debug:prin
3b50: 74 20 38 20 22 49 4e 46 4f 3a 20 68 61 76 65 2d  t 8 "INFO: have-
3b60: 72 65 73 6f 75 72 63 65 73 3a 20 22 20 68 61 76  resources: " hav
3b70: 65 2d 72 65 73 6f 75 72 63 65 73 20 22 20 70 72  e-resources " pr
3b80: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22  ereqs-not-met: "
3b90: 20 0a 09 09 09 20 20 20 20 20 28 73 74 72 69 6e   ....     (strin
3ba0: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09  g-intersperse ..
3bb0: 09 09 20 20 20 20 20 20 28 6d 61 70 20 28 6c 61  ..      (map (la
3bc0: 6d 62 64 61 20 28 74 29 0a 09 09 09 09 20 20 20  mbda (t).....   
3bd0: 20 20 28 69 66 20 28 6e 6f 74 20 28 76 65 63 74    (if (not (vect
3be0: 6f 72 3f 20 74 29 29 0a 09 09 09 09 09 20 28 63  or? t))...... (c
3bf0: 6f 6e 63 20 22 20 57 41 52 4e 49 4e 47 3a 20 74  onc " WARNING: t
3c00: 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f 72   is not a vector
3c10: 3d 22 20 74 20 29 0a 09 09 09 09 09 20 28 63 6f  =" t )...... (co
3c20: 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  nc (db:test-get-
3c30: 73 74 61 74 65 20 74 29 20 22 2f 22 20 28 64 62  state t) "/" (db
3c40: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73  :test-get-status
3c50: 20 74 29 29 29 29 0a 09 09 09 09 20 20 20 70 72   t)))).....   pr
3c60: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 22  ereqs-not-met) "
3c70: 2c 20 22 29 20 22 20 66 61 69 6c 73 3a 20 22 20  , ") " fails: " 
3c80: 66 61 69 6c 73 29 0a 09 09 3b 3b 20 44 6f 6e 27  fails)...;; Don'
3c90: 74 20 6b 6e 6f 77 20 61 74 20 74 68 69 73 20 74  t know at this t
3ca0: 69 6d 65 20 69 66 20 74 68 65 20 74 65 73 74 20  ime if the test 
3cb0: 68 61 76 65 20 62 65 65 6e 20 6c 61 75 6e 63 68  have been launch
3cc0: 65 64 20 61 74 20 73 6f 6d 65 20 74 69 6d 65 20  ed at some time 
3cd0: 69 6e 20 74 68 65 20 70 61 73 74 0a 09 09 3b 3b  in the past...;;
3ce0: 20 69 2e 65 2e 20 69 73 20 74 68 69 73 20 61 20   i.e. is this a 
3cf0: 72 65 2d 6c 61 75 6e 63 68 3f 0a 09 09 28 63 6f  re-launch?...(co
3d00: 6e 64 0a 09 09 20 28 28 61 6e 64 20 68 61 76 65  nd... ((and have
3d10: 2d 72 65 73 6f 75 72 63 65 73 0a 09 09 20 20 20  -resources...   
3d20: 20 20 20 20 28 6f 72 20 28 6e 75 6c 6c 3f 20 70      (or (null? p
3d30: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a  rereqs-not-met).
3d40: 09 09 09 20 20 20 28 61 6e 64 20 28 65 71 3f 20  ...   (and (eq? 
3d50: 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76  testmode 'toplev
3d60: 65 6c 29 0a 09 09 09 09 28 6e 75 6c 6c 3f 20 6e  el).....(null? n
3d70: 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29 29 29  on-completed))))
3d80: 0a 09 09 20 20 3b 3b 20 6e 6f 20 6c 6f 6f 70 20  ...  ;; no loop 
3d90: 68 65 72 65 2c 20 6a 75 73 74 20 64 72 6f 70 20  here, just drop 
3da0: 74 68 6f 75 67 68 20 61 6e 64 20 75 73 65 20 74  though and use t
3db0: 68 65 20 6c 6f 6f 70 20 61 74 20 74 68 65 20 62  he loop at the b
3dc0: 6f 74 74 6f 6d 20 0a 09 09 20 20 28 69 66 20 28  ottom ...  (if (
3dd0: 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20  patt-list-match 
3de0: 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70  item-path item-p
3df0: 61 74 74 73 29 0a 09 09 20 20 20 20 20 20 28 72  atts)...      (r
3e00: 75 6e 3a 74 65 73 74 20 72 75 6e 2d 69 64 20 72  un:test run-id r
3e10: 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74  unname keyvallst
3e20: 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61   test-record fla
3e30: 67 73 20 23 66 29 0a 09 09 20 20 20 20 20 20 28  gs #f)...      (
3e40: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49  debug:print 1 "I
3e50: 4e 46 4f 3a 20 53 6b 69 70 70 69 6e 67 20 22 20  NFO: Skipping " 
3e60: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
3e70: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65  -get-testname te
3e80: 73 74 2d 72 65 63 6f 72 64 29 20 22 20 22 20 69  st-record) " " i
3e90: 74 65 6d 2d 70 61 74 68 20 22 20 61 73 20 69 74  tem-path " as it
3ea0: 20 64 6f 65 73 6e 27 74 20 6d 61 74 63 68 20 22   doesn't match "
3eb0: 20 69 74 65 6d 2d 70 61 74 74 73 29 29 0a 09 09   item-patts))...
3ec0: 20 20 3b 3b 20 65 6c 73 65 20 74 68 65 20 72 75    ;; else the ru
3ed0: 6e 20 69 73 20 73 74 75 63 6b 2c 20 74 65 6d 70  n is stuck, temp
3ee0: 6f 72 61 72 69 6c 79 20 6f 72 20 70 65 72 6d 61  orarily or perma
3ef0: 6e 65 6e 74 6c 79 0a 09 09 20 20 3b 3b 20 62 75  nently...  ;; bu
3f00: 74 20 73 68 6f 75 6c 64 20 63 68 65 63 6b 20 69  t should check i
3f10: 66 20 69 74 20 69 73 20 64 75 65 20 74 6f 20 6c  f it is due to l
3f20: 61 63 6b 20 6f 66 20 72 65 73 6f 75 72 63 65 73  ack of resources
3f30: 20 76 73 2e 20 70 72 65 72 65 71 75 69 73 69 74   vs. prerequisit
3f40: 65 73 0a 09 09 20 20 29 0a 09 09 20 28 28 6e 6f  es...  )... ((no
3f50: 74 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73  t have-resources
3f60: 29 20 3b 3b 20 73 69 6d 70 6c 79 20 74 72 79 20  ) ;; simply try 
3f70: 61 67 61 69 6e 20 61 66 74 65 72 20 77 61 69 74  again after wait
3f80: 69 6e 67 20 61 20 73 65 63 6f 6e 64 0a 09 09 20  ing a second... 
3f90: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
3fa0: 31 2e 30 29 0a 09 09 20 20 28 64 65 62 75 67 3a  1.0)...  (debug:
3fb0: 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 6e  print 1 "INFO: n
3fc0: 6f 20 72 65 73 6f 75 72 63 65 73 20 74 6f 20 72  o resources to r
3fd0: 75 6e 20 6e 65 77 20 74 65 73 74 73 2c 20 77 61  un new tests, wa
3fe0: 69 74 69 6e 67 20 2e 2e 2e 22 29 0a 09 09 20 20  iting ...")...  
3ff0: 3b 3b 20 63 6f 75 6c 64 20 68 61 76 65 20 64 6f  ;; could have do
4000: 6e 65 20 68 65 64 20 74 61 6c 20 68 65 72 65 20  ne hed tal here 
4010: 62 75 74 20 64 6f 69 6e 67 20 63 61 72 2f 63 64  but doing car/cd
4020: 72 20 6f 66 20 6e 65 77 74 61 6c 20 74 6f 20 72  r of newtal to r
4030: 6f 74 61 74 65 20 74 65 73 74 73 0a 09 09 20 20  otate tests...  
4040: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61  (loop (car newta
4050: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 29 29  l)(cdr newtal)))
4060: 0a 09 09 20 28 65 6c 73 65 20 3b 3b 20 6d 75 73  ... (else ;; mus
4070: 74 20 62 65 20 77 65 20 68 61 76 65 20 75 6e 6d  t be we have unm
4080: 65 74 20 70 72 65 72 65 71 75 69 73 69 74 65 73  et prerequisites
4090: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  ...    (debug:pr
40a0: 69 6e 74 20 34 20 22 46 41 49 4c 53 3a 20 22 20  int 4 "FAILS: " 
40b0: 66 61 69 6c 73 29 0a 09 09 20 20 20 20 3b 3b 20  fails)...    ;; 
40c0: 49 66 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f  If one or more o
40d0: 66 20 74 68 65 20 70 72 65 72 65 71 73 2d 6e 6f  f the prereqs-no
40e0: 74 2d 6d 65 74 20 61 72 65 20 46 41 49 4c 20 74  t-met are FAIL t
40f0: 68 65 6e 20 77 65 20 63 61 6e 20 69 73 73 75 65  hen we can issue
4100: 0a 09 09 20 20 20 20 3b 3b 20 61 20 6d 65 73 73  ...    ;; a mess
4110: 61 67 65 20 61 6e 64 20 64 72 6f 70 20 68 65 64  age and drop hed
4120: 20 66 72 6f 6d 20 74 68 65 20 69 74 65 6d 73 20   from the items 
4130: 74 6f 20 62 65 20 70 72 6f 63 65 73 73 65 64 2e  to be processed.
4140: 0a 09 09 20 20 20 20 28 69 66 20 28 6e 75 6c 6c  ...    (if (null
4150: 3f 20 66 61 69 6c 73 29 0a 09 09 09 28 62 65 67  ? fails)....(beg
4160: 69 6e 0a 09 09 09 20 20 3b 3b 20 63 6f 75 6c 64  in....  ;; could
4170: 6e 27 74 20 72 75 6e 2c 20 74 61 6b 65 20 61 20  n't run, take a 
4180: 62 72 65 61 74 68 65 72 0a 09 09 09 20 20 28 64  breather....  (d
4190: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e  ebug:print 4 "IN
41a0: 46 4f 3a 20 53 68 6f 75 6c 64 6e 27 74 20 72 65  FO: Shouldn't re
41b0: 61 6c 6c 79 20 67 65 74 20 68 65 72 65 2c 20 72  ally get here, r
41c0: 61 63 65 20 63 6f 6e 64 69 74 69 6f 6e 3f 20 55  ace condition? U
41d0: 6e 61 62 6c 65 20 74 6f 20 6c 61 75 6e 63 68 20  nable to launch 
41e0: 6d 6f 72 65 20 74 65 73 74 73 20 61 74 20 74 68  more tests at th
41f0: 69 73 20 6d 6f 6d 65 6e 74 2c 20 6b 69 6c 6c 69  is moment, killi
4200: 6e 67 20 74 69 6d 65 20 2e 2e 2e 22 29 0a 09 09  ng time ...")...
4210: 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70  .  (thread-sleep
4220: 21 20 30 2e 31 29 20 3b 3b 20 6c 6f 6e 67 20 73  ! 0.1) ;; long s
4230: 6c 65 65 70 20 68 65 72 65 20 2d 20 6e 6f 20 72  leep here - no r
4240: 65 73 6f 75 72 63 65 73 2c 20 6d 61 79 20 61 73  esources, may as
4250: 20 77 65 6c 6c 20 62 65 20 70 61 74 69 65 6e 74   well be patient
4260: 0a 09 09 09 20 20 3b 3b 20 77 65 20 6d 61 64 65  ....  ;; we made
4270: 20 6e 65 77 20 74 61 6c 20 62 79 20 73 74 69 63   new tal by stic
4280: 6b 69 6e 67 20 68 65 64 20 61 74 20 74 68 65 20  king hed at the 
4290: 62 61 63 6b 20 6f 66 20 74 68 65 20 6c 69 73 74  back of the list
42a0: 0a 09 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72  ....  (loop (car
42b0: 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77   newtal)(cdr new
42c0: 74 61 6c 29 29 29 0a 09 09 09 3b 3b 20 74 68 65  tal)))....;; the
42d0: 20 77 61 69 74 6f 6e 20 69 73 20 46 41 49 4c 20   waiton is FAIL 
42e0: 73 6f 20 6e 6f 20 70 6f 69 6e 74 20 69 6e 20 74  so no point in t
42f0: 72 79 69 6e 67 20 74 6f 20 72 75 6e 20 68 65 64  rying to run hed
4300: 20 65 76 65 72 20 61 67 61 69 6e 0a 09 09 09 28   ever again....(
4310: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74  if (not (null? t
4320: 61 6c 29 29 0a 09 09 09 20 20 20 20 28 62 65 67  al))....    (beg
4330: 69 6e 0a 09 09 09 20 20 20 20 20 20 28 64 65 62  in....      (deb
4340: 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52 4e  ug:print 1 "WARN
4350: 3a 20 44 72 6f 70 70 69 6e 67 20 74 65 73 74 20  : Dropping test 
4360: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74  " (db:test-get-t
4370: 65 73 74 6e 61 6d 65 20 68 65 64 29 20 22 2f 22  estname hed) "/"
4380: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74   (db:test-get-it
4390: 65 6d 2d 70 61 74 68 20 68 65 64 29 0a 09 09 09  em-path hed)....
43a0: 09 09 20 20 20 22 20 66 72 6f 6d 20 74 68 65 20  ..   " from the 
43b0: 6c 61 75 6e 63 68 20 6c 69 73 74 20 61 73 20 69  launch list as i
43c0: 74 20 68 61 73 20 70 72 65 72 65 71 75 69 73 74  t has prerequist
43d0: 65 73 20 74 68 61 74 20 61 72 65 20 46 41 49 4c  es that are FAIL
43e0: 22 29 0a 09 09 09 20 20 20 20 20 20 28 6c 6f 6f  ")....      (loo
43f0: 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20  p (car tal)(cdr 
4400: 74 61 6c 29 29 29 29 29 29 29 29 29 0a 09 20 20  tal)))))))))..  
4410: 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 63 61 73     ..     ;; cas
4420: 65 20 77 68 65 72 65 20 61 6e 20 69 74 65 6d 73  e where an items
4430: 20 63 61 6d 65 20 69 6e 20 61 73 20 61 20 6c 69   came in as a li
4440: 73 74 20 62 65 65 6e 20 70 72 6f 63 65 73 73 65  st been processe
4450: 64 0a 09 20 20 20 20 20 28 28 61 6e 64 20 28 6c  d..     ((and (l
4460: 69 73 74 3f 20 69 74 65 6d 73 29 20 20 20 20 20  ist? items)     
4470: 3b 3b 20 74 68 75 73 20 77 65 20 6b 6e 6f 77 20  ;; thus we know 
4480: 6f 75 72 20 69 74 65 6d 73 20 61 72 65 20 61 6c  our items are al
4490: 72 65 61 64 79 20 63 61 6c 63 75 6c 61 74 65 64  ready calculated
44a0: 0a 09 09 20 20 20 28 6e 6f 74 20 20 20 69 74 65  ...   (not   ite
44b0: 6d 64 61 74 29 29 20 3b 3b 20 61 6e 64 20 6e 6f  mdat)) ;; and no
44c0: 74 20 79 65 74 20 65 78 70 61 6e 64 65 64 20 69  t yet expanded i
44d0: 6e 74 6f 20 74 68 65 20 6c 69 73 74 20 6f 66 20  nto the list of 
44e0: 74 68 69 6e 67 73 20 74 6f 20 62 65 20 64 6f 6e  things to be don
44f0: 65 0a 09 20 20 20 20 20 20 28 69 66 20 28 61 6e  e..      (if (an
4500: 64 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79  d (>= *verbosity
4510: 2a 20 31 29 0a 09 09 20 20 20 20 20 20 20 28 3e  * 1)...       (>
4520: 20 28 6c 65 6e 67 74 68 20 69 74 65 6d 73 29 20   (length items) 
4530: 30 29 0a 09 09 20 20 20 20 20 20 20 28 3e 20 28  0)...       (> (
4540: 6c 65 6e 67 74 68 20 28 63 61 72 20 69 74 65 6d  length (car item
4550: 73 29 29 20 30 29 29 0a 09 09 20 20 28 70 70 20  s)) 0))...  (pp 
4560: 69 74 65 6d 73 29 29 0a 09 20 20 20 20 20 20 3b  items))..      ;
4570: 3b 20 28 69 66 20 28 3e 3d 20 2a 76 65 72 62 6f  ; (if (>= *verbo
4580: 73 69 74 79 2a 20 35 29 0a 09 20 20 20 20 20 20  sity* 5)..      
4590: 3b 3b 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20  ;;     (begin.. 
45a0: 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 28 70       ;;       (p
45b0: 72 69 6e 74 20 22 69 74 65 6d 73 3a 20 22 29 20  rint "items: ") 
45c0: 20 20 20 20 28 70 70 20 28 69 74 65 6d 2d 61 73      (pp (item-as
45d0: 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69  soc->item-list i
45e0: 74 65 6d 73 29 29 0a 09 20 20 20 20 20 20 3b 3b  tems))..      ;;
45f0: 20 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 69         (print "i
4600: 74 65 6d 73 74 61 62 6c 65 3a 20 22 29 28 70 70  temstable: ")(pp
4610: 20 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69 74   (item-table->it
4620: 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74 61 62  em-list itemstab
4630: 6c 65 29 29 29 29 0a 09 20 20 20 20 20 20 28 66  le))))..      (f
4640: 6f 72 2d 65 61 63 68 0a 09 20 20 20 20 20 20 20  or-each..       
4650: 28 6c 61 6d 62 64 61 20 28 6d 79 2d 69 74 65 6d  (lambda (my-item
4660: 64 61 74 29 0a 09 09 20 28 6c 65 74 2a 20 28 28  dat)... (let* ((
4670: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20  new-test-record 
4680: 28 6c 65 74 20 28 28 6e 65 77 72 65 63 20 28 6d  (let ((newrec (m
4690: 61 6b 65 2d 74 65 73 74 73 3a 74 65 73 74 71 75  ake-tests:testqu
46a0: 65 75 65 29 29 29 0a 09 09 09 09 09 20 20 20 28  eue)))......   (
46b0: 76 65 63 74 6f 72 2d 63 6f 70 79 21 20 74 65 73  vector-copy! tes
46c0: 74 2d 72 65 63 6f 72 64 20 6e 65 77 72 65 63 29  t-record newrec)
46d0: 0a 09 09 09 09 09 20 20 20 6e 65 77 72 65 63 29  ......   newrec)
46e0: 29 0a 09 09 09 28 6d 79 2d 69 74 65 6d 2d 70 61  )....(my-item-pa
46f0: 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70  th (item-list->p
4700: 61 74 68 20 6d 79 2d 69 74 65 6d 64 61 74 29 29  ath my-itemdat))
4710: 29 0a 09 09 20 20 20 28 69 66 20 28 70 61 74 74  )...   (if (patt
4720: 2d 6c 69 73 74 2d 6d 61 74 63 68 20 6d 79 2d 69  -list-match my-i
4730: 74 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70 61  tem-path item-pa
4740: 74 74 73 29 20 20 20 20 20 20 20 20 20 20 20 3b  tts)           ;
4750: 3b 20 79 65 73 2c 20 77 65 20 77 61 6e 74 20 74  ; yes, we want t
4760: 6f 20 70 72 6f 63 65 73 73 20 74 68 69 73 20 69  o process this i
4770: 74 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f 75 6c  tem, NOTE: Shoul
4780: 64 20 6e 6f 74 20 6e 65 65 64 20 74 68 69 73 20  d not need this 
4790: 63 68 65 63 6b 20 68 65 72 65 21 0a 09 09 20 20  check here!...  
47a0: 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 74       (let ((newt
47b0: 65 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20 68 65  estname (conc he
47c0: 64 20 22 2f 22 20 6d 79 2d 69 74 65 6d 2d 70 61  d "/" my-item-pa
47d0: 74 68 29 29 29 20 20 20 20 3b 3b 20 74 65 73 74  th)))    ;; test
47e0: 20 6e 61 6d 65 73 20 61 72 65 20 75 6e 69 71 75   names are uniqu
47f0: 65 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f 69 74  e on testname/it
4800: 65 6d 2d 70 61 74 68 0a 09 09 09 20 28 74 65 73  em-path.... (tes
4810: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74  ts:testqueue-set
4820: 2d 69 74 65 6d 73 21 20 20 20 20 20 6e 65 77 2d  -items!     new-
4830: 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 0a  test-record #f).
4840: 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 71  ... (tests:testq
4850: 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 61 74  ueue-set-itemdat
4860: 21 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 63  !   new-test-rec
4870: 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 29 0a  ord my-itemdat).
4880: 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 71  ... (tests:testq
4890: 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f 70 61  ueue-set-item_pa
48a0: 74 68 21 20 6e 65 77 2d 74 65 73 74 2d 72 65 63  th! new-test-rec
48b0: 6f 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68  ord my-item-path
48c0: 29 0a 09 09 09 20 28 68 61 73 68 2d 74 61 62 6c  ).... (hash-tabl
48d0: 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f  e-set! test-reco
48e0: 72 64 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20  rds newtestname 
48f0: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 29  new-test-record)
4900: 0a 09 09 09 20 28 73 65 74 21 20 74 61 6c 20 28  .... (set! tal (
4910: 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d 65  cons newtestname
4920: 20 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 73 69   tal)))))) ;; si
4930: 6e 63 65 20 74 68 65 73 65 20 61 72 65 20 69 74  nce these are it
4940: 65 6d 69 7a 65 64 20 63 72 65 61 74 65 20 6e 65  emized create ne
4950: 77 20 74 65 73 74 20 6e 61 6d 65 73 20 74 65 73  w test names tes
4960: 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a 09  tname/itempath..
4970: 20 20 20 20 20 20 20 69 74 65 6d 73 29 0a 09 20         items).. 
4980: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e       (if (not (n
4990: 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 28  ull? tal))...  (
49a0: 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63  loop (car tal)(c
49b0: 64 72 20 74 61 6c 29 29 29 29 0a 0a 09 20 20 20  dr tal))))...   
49c0: 20 20 3b 3b 20 69 66 20 69 74 65 6d 73 20 69 73    ;; if items is
49d0: 20 61 20 70 72 6f 63 20 74 68 65 6e 20 6e 65 65   a proc then nee
49e0: 64 20 74 6f 20 72 75 6e 20 69 74 65 6d 73 3a 67  d to run items:g
49f0: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f  et-items-from-co
4a00: 6e 66 69 67 2c 20 67 65 74 20 74 68 65 20 6c 69  nfig, get the li
4a10: 73 74 20 61 6e 64 20 6c 6f 6f 70 20 0a 09 20 20  st and loop ..  
4a20: 20 20 20 3b 3b 20 20 20 20 2d 20 62 75 74 20 6f     ;;    - but o
4a30: 6e 6c 79 20 64 6f 20 74 68 61 74 20 69 66 20 72  nly do that if r
4a40: 65 73 6f 75 72 63 65 73 20 65 78 69 73 74 20 74  esources exist t
4a50: 6f 20 6b 69 63 6b 20 6f 66 66 20 74 68 65 20 6a  o kick off the j
4a60: 6f 62 0a 09 20 20 20 20 20 28 28 6f 72 20 28 70  ob..     ((or (p
4a70: 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 29  rocedure? items)
4a80: 28 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76 65  (eq? items 'have
4a90: 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20 20  -procedure))..  
4aa0: 20 20 20 20 28 6c 65 74 20 28 28 63 61 6e 2d 72      (let ((can-r
4ab0: 75 6e 2d 6d 6f 72 65 20 20 20 20 28 6f 70 65 6e  un-more    (open
4ac0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a  -run-close runs:
4ad0: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73  can-run-more-tes
4ae0: 74 73 20 23 66 20 74 65 73 74 2d 72 65 63 6f 72  ts #f test-recor
4af0: 64 29 29 29 0a 09 09 28 69 66 20 63 61 6e 2d 72  d)))...(if can-r
4b00: 75 6e 2d 6d 6f 72 65 0a 09 09 20 20 20 20 28 6c  un-more...    (l
4b10: 65 74 2a 20 28 28 70 72 65 72 65 71 73 2d 6e 6f  et* ((prereqs-no
4b20: 74 2d 6d 65 74 20 28 6f 70 65 6e 2d 72 75 6e 2d  t-met (open-run-
4b30: 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 70 72 65  close db:get-pre
4b40: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 23 66 20  reqs-not-met #f 
4b50: 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69  run-id waitons i
4b60: 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74  tem-path mode: t
4b70: 65 73 74 6d 6f 64 65 29 29 0a 09 09 09 20 20 20  estmode))....   
4b80: 28 66 61 69 6c 73 20 20 20 20 20 20 20 20 20 20  (fails          
4b90: 20 28 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 65   (calc-fails pre
4ba0: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09  reqs-not-met))..
4bb0: 09 09 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65  ..   (non-comple
4bc0: 74 65 64 20 20 20 28 63 61 6c 63 2d 6e 6f 74 2d  ted   (calc-not-
4bd0: 63 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71  completed prereq
4be0: 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 20  s-not-met)))... 
4bf0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
4c00: 74 20 38 20 22 49 4e 46 4f 3a 20 63 61 6e 2d 72  t 8 "INFO: can-r
4c10: 75 6e 2d 6d 6f 72 65 3a 20 22 20 63 61 6e 2d 72  un-more: " can-r
4c20: 75 6e 2d 6d 6f 72 65 0a 09 09 09 09 20 20 20 22  un-more.....   "
4c30: 5c 6e 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  \n prereqs-not-m
4c40: 65 74 3a 20 22 20 28 70 72 65 74 74 79 2d 73 74  et: " (pretty-st
4c50: 72 69 6e 67 20 70 72 65 72 65 71 73 2d 6e 6f 74  ring prereqs-not
4c60: 2d 6d 65 74 29 0a 09 09 09 09 20 20 20 22 5c 6e  -met).....   "\n
4c70: 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 3a 20   non-completed: 
4c80: 20 20 22 20 28 70 72 65 74 74 79 2d 73 74 72 69    " (pretty-stri
4c90: 6e 67 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64  ng non-completed
4ca0: 29 20 0a 09 09 09 09 20 20 20 22 5c 6e 20 66 61  ) .....   "\n fa
4cb0: 69 6c 73 3a 20 20 20 20 20 20 20 20 20 20 20 22  ils:           "
4cc0: 20 28 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20   (pretty-string 
4cd0: 66 61 69 6c 73 29 0a 09 09 09 09 20 20 20 22 5c  fails).....   "\
4ce0: 6e 20 74 65 73 74 6d 6f 64 65 3a 20 20 20 20 20  n testmode:     
4cf0: 20 20 20 22 20 74 65 73 74 6d 6f 64 65 0a 09 09     " testmode...
4d00: 09 09 20 20 20 22 5c 6e 20 28 65 71 3f 20 74 65  ..   "\n (eq? te
4d10: 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c  stmode 'toplevel
4d20: 29 20 22 20 28 65 71 3f 20 74 65 73 74 6d 6f 64  ) " (eq? testmod
4d30: 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09  e 'toplevel)....
4d40: 09 20 20 20 22 5c 6e 20 28 6e 75 6c 6c 3f 20 6e  .   "\n (null? n
4d50: 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 20 20 20  on-completed)   
4d60: 20 22 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f   " (null? non-co
4d70: 6d 70 6c 65 74 65 64 29 29 0a 09 09 20 20 20 20  mpleted))...    
4d80: 20 20 28 63 6f 6e 64 20 0a 09 09 20 20 20 20 20    (cond ...     
4d90: 20 20 28 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72    ((or (null? pr
4da0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 3b  ereqs-not-met) ;
4db0: 3b 20 61 6c 6c 20 70 72 65 72 65 71 73 20 6d 65  ; all prereqs me
4dc0: 74 2c 20 66 69 72 65 20 6f 66 66 20 74 68 65 20  t, fire off the 
4dd0: 74 65 73 74 0a 09 09 09 20 20 20 20 3b 3b 20 6f  test....    ;; o
4de0: 72 2c 20 69 66 20 69 74 20 69 73 20 61 20 27 74  r, if it is a 't
4df0: 6f 70 6c 65 76 65 6c 20 74 65 73 74 20 61 6e 64  oplevel test and
4e00: 20 61 6c 6c 20 70 72 65 72 65 71 73 20 6e 6f 74   all prereqs not
4e10: 20 6d 65 74 20 61 72 65 20 43 4f 4d 50 4c 45 54   met are COMPLET
4e20: 45 44 20 74 68 65 6e 20 6c 61 75 6e 63 68 0a 09  ED then launch..
4e30: 09 09 20 20 20 20 28 61 6e 64 20 28 65 71 3f 20  ..    (and (eq? 
4e40: 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76  testmode 'toplev
4e50: 65 6c 29 0a 09 09 09 09 20 28 6e 75 6c 6c 3f 20  el)..... (null? 
4e60: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29 29  non-completed)))
4e70: 0a 09 09 09 28 6c 65 74 20 28 28 74 65 73 74 2d  ....(let ((test-
4e80: 6e 61 6d 65 20 28 74 65 73 74 73 3a 74 65 73 74  name (tests:test
4e90: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61  queue-get-testna
4ea0: 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29  me test-record))
4eb0: 29 0a 09 09 09 20 20 28 73 65 74 65 6e 76 20 22  )....  (setenv "
4ec0: 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65  MT_TEST_NAME" te
4ed0: 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 09 09 09  st-name) ;; ....
4ee0: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55    (setenv "MT_RU
4ef0: 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65  NNAME"   runname
4f00: 29 0a 09 09 09 20 20 28 6f 70 65 6e 2d 72 75 6e  )....  (open-run
4f10: 2d 63 6c 6f 73 65 20 73 65 74 2d 6d 65 67 61 74  -close set-megat
4f20: 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 23 66 20  est-env-vars #f 
4f30: 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65  run-id) ;; these
4f40: 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 62   may be needed b
4f50: 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20  y the launching 
4f60: 70 72 6f 63 65 73 73 0a 09 09 09 20 20 28 6c 65  process....  (le
4f70: 74 20 28 28 69 74 65 6d 73 2d 6c 69 73 74 20 28  t ((items-list (
4f80: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d  items:get-items-
4f90: 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 74 63 6f 6e  from-config tcon
4fa0: 66 69 67 29 29 29 0a 09 09 09 20 20 20 20 28 69  fig)))....    (i
4fb0: 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 2d 6c  f (list? items-l
4fc0: 69 73 74 29 0a 09 09 09 09 28 62 65 67 69 6e 0a  ist).....(begin.
4fd0: 09 09 09 09 20 20 28 74 65 73 74 73 3a 74 65 73  ....  (tests:tes
4fe0: 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 73  tqueue-set-items
4ff0: 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20 69 74  ! test-record it
5000: 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09 20 20  ems-list).....  
5010: 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 29 29 0a  (loop hed tal)).
5020: 09 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09 20  ....(begin..... 
5030: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
5040: 22 45 52 52 4f 52 3a 20 54 68 65 20 70 72 6f 63  "ERROR: The proc
5050: 20 66 72 6f 6d 20 72 65 61 64 69 6e 67 20 74 68   from reading th
5060: 65 20 73 65 74 75 70 20 64 69 64 20 6e 6f 74 20  e setup did not 
5070: 79 69 65 6c 64 20 61 20 6c 69 73 74 20 2d 20 70  yield a list - p
5080: 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 68 69  lease report thi
5090: 73 22 29 0a 09 09 09 09 20 20 28 65 78 69 74 20  s").....  (exit 
50a0: 31 29 29 29 29 29 29 0a 09 09 20 20 20 20 20 20  1))))))...      
50b0: 20 28 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a   ((null? fails).
50c0: 09 09 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65  ...(loop (car ne
50d0: 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c  wtal)(cdr newtal
50e0: 29 29 29 20 3b 3b 20 61 6e 20 69 73 73 75 65 20  ))) ;; an issue 
50f0: 77 69 74 68 20 70 72 65 72 65 71 73 20 6e 6f 74  with prereqs not
5100: 20 79 65 74 20 6d 65 74 3f 0a 09 09 20 20 20 20   yet met?...    
5110: 20 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 28 6e     ((and (not (n
5120: 75 6c 6c 3f 20 66 61 69 6c 73 29 29 28 65 71 3f  ull? fails))(eq?
5130: 20 74 65 73 74 6d 6f 64 65 20 27 6e 6f 72 6d 61   testmode 'norma
5140: 6c 29 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72  l))....(debug:pr
5150: 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 74 65 73  int 1 "INFO: tes
5160: 74 20 22 20 20 68 65 64 20 22 20 28 6d 6f 64 65  t "  hed " (mode
5170: 3d 22 20 74 65 73 74 6d 6f 64 65 20 22 29 20 68  =" testmode ") h
5180: 61 73 20 66 61 69 6c 65 64 20 70 72 65 72 65 71  as failed prereq
5190: 75 69 73 69 74 65 28 73 29 3b 20 22 0a 09 09 09  uisite(s); "....
51a0: 09 20 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e  .     (string-in
51b0: 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 28  tersperse (map (
51c0: 6c 61 6d 62 64 61 20 28 74 29 28 63 6f 6e 63 20  lambda (t)(conc 
51d0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73  (db:test-get-tes
51e0: 74 6e 61 6d 65 20 74 29 20 22 3a 22 20 28 64 62  tname t) ":" (db
51f0: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20  :test-get-state 
5200: 74 29 22 2f 22 28 64 62 3a 74 65 73 74 2d 67 65  t)"/"(db:test-ge
5210: 74 2d 73 74 61 74 75 73 20 74 29 29 29 20 66 61  t-status t))) fa
5220: 69 6c 73 29 20 22 2c 20 22 29 0a 09 09 09 09 20  ils) ", ")..... 
5230: 20 20 20 20 22 2c 20 72 65 6d 6f 76 69 6e 67 20      ", removing 
5240: 69 74 20 66 72 6f 6d 20 74 6f 2d 64 6f 20 6c 69  it from to-do li
5250: 73 74 22 29 0a 09 09 09 28 69 66 20 28 6e 6f 74  st")....(if (not
5260: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09   (null? tal))...
5270: 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20  .    (loop (car 
5280: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29  tal)(cdr tal))))
5290: 0a 09 09 20 20 20 20 20 20 20 28 65 6c 73 65 0a  ...       (else.
52a0: 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20  ...(debug:print 
52b0: 38 20 22 45 52 52 4f 52 3a 20 4e 6f 20 68 61 6e  8 "ERROR: No han
52c0: 64 6c 65 72 20 66 6f 72 20 74 68 69 73 20 63 6f  dler for this co
52d0: 6e 64 69 74 69 6f 6e 2e 22 29 0a 09 09 09 3b 3b  ndition.")....;;
52e0: 20 09 20 20 20 20 20 22 5c 6e 20 20 68 65 64 3a   .     "\n  hed:
52f0: 20 20 20 20 20 20 20 20 20 20 20 20 22 20 68 65              " he
5300: 64 20 0a 09 09 09 3b 3b 20 09 20 20 20 20 20 22  d ....;; .     "
5310: 5c 6e 20 66 61 69 6c 73 3a 20 20 20 20 20 20 20  \n fails:       
5320: 20 20 20 20 22 20 28 73 74 72 69 6e 67 2d 69 6e      " (string-in
5330: 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 64  tersperse (map d
5340: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e  b:test-get-testn
5350: 61 6d 65 20 66 61 69 6c 73 29 20 22 2c 22 29 0a  ame fails) ",").
5360: 09 09 09 3b 3b 20 09 20 20 20 20 20 22 5c 6e 20  ...;; .     "\n 
5370: 74 65 73 74 6d 6f 64 65 3a 20 20 20 20 20 20 20  testmode:       
5380: 20 22 20 74 65 73 74 6d 6f 64 65 0a 09 09 09 3b   " testmode....;
5390: 3b 20 09 20 20 20 20 20 22 5c 6e 20 70 72 65 72  ; .     "\n prer
53a0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 28  eqs-not-met: " (
53b0: 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 70 72  pretty-string pr
53c0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09  ereqs-not-met)..
53d0: 09 09 3b 3b 20 09 20 20 20 20 20 22 5c 6e 20 69  ..;; .     "\n i
53e0: 74 65 6d 73 3a 20 20 20 20 20 20 20 20 20 20 20  tems:           
53f0: 22 20 69 74 65 6d 73 29 0a 09 09 09 28 6c 6f 6f  " items)....(loo
5400: 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63  p (car newtal)(c
5410: 64 72 20 6e 65 77 74 61 6c 29 29 29 29 29 0a 09  dr newtal)))))..
5420: 09 20 20 20 20 3b 3b 20 69 66 20 63 61 6e 27 74  .    ;; if can't
5430: 20 72 75 6e 20 6d 6f 72 65 20 6a 75 73 74 20 6c   run more just l
5440: 6f 6f 70 20 77 69 74 68 20 6e 65 78 74 20 70 6f  oop with next po
5450: 73 73 69 62 6c 65 20 74 65 73 74 0a 09 09 20 20  ssible test...  
5460: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77    (loop (car new
5470: 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29  tal)(cdr newtal)
5480: 29 29 29 29 0a 09 20 20 20 20 20 0a 09 20 20 20  ))))..     ..   
5490: 20 20 3b 3b 20 74 68 69 73 20 63 61 73 65 20 73    ;; this case s
54a0: 68 6f 75 6c 64 20 6e 6f 74 20 68 61 70 70 65 6e  hould not happen
54b0: 2c 20 61 64 64 65 64 20 74 6f 20 68 65 6c 70 20  , added to help 
54c0: 63 61 74 63 68 20 61 6e 79 20 62 75 67 73 0a 09  catch any bugs..
54d0: 20 20 20 20 20 28 28 61 6e 64 20 28 6c 69 73 74       ((and (list
54e0: 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 64 61 74  ? items) itemdat
54f0: 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a  )..      (debug:
5500: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
5510: 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65 20  Should not have 
5520: 61 20 6c 69 73 74 20 6f 66 20 69 74 65 6d 73 20  a list of items 
5530: 69 6e 20 61 20 74 65 73 74 20 61 6e 64 20 74 68  in a test and th
5540: 65 20 69 74 65 6d 73 70 61 74 68 20 73 65 74 20  e itemspath set 
5550: 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20  - please report 
5560: 74 68 69 73 22 29 0a 09 20 20 20 20 20 20 28 65  this")..      (e
5570: 78 69 74 20 31 29 29 29 29 0a 09 20 20 0a 09 20  xit 1))))..  .. 
5580: 20 3b 3b 20 77 65 20 67 65 74 20 68 65 72 65 20   ;; we get here 
5590: 6f 6e 20 22 64 72 6f 70 20 74 68 72 6f 75 67 68  on "drop through
55a0: 22 20 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e 65 78  " - loop for nex
55b0: 74 20 74 65 73 74 20 69 6e 20 71 75 65 75 65 0a  t test in queue.
55c0: 09 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74 61  .  (if (null? ta
55d0: 6c 29 0a 09 20 20 20 20 20 20 28 62 65 67 69 6e  l)..      (begin
55e0: 0a 09 09 3b 3b 20 46 49 58 4d 45 21 21 21 21 20  ...;; FIXME!!!! 
55f0: 54 48 49 53 20 53 48 4f 55 4c 44 20 4e 4f 54 20  THIS SHOULD NOT 
5600: 52 45 51 55 49 52 45 20 41 4e 20 45 58 49 54 21  REQUIRE AN EXIT!
5610: 21 21 21 21 21 21 0a 09 09 28 64 65 62 75 67 3a  !!!!!!...(debug:
5620: 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41  print 1 "INFO: A
5630: 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e 63 68 65  ll tests launche
5640: 64 22 29 0a 09 09 28 74 68 72 65 61 64 2d 73 6c  d")...(thread-sl
5650: 65 65 70 21 20 30 2e 35 29 0a 09 09 3b 3b 20 46  eep! 0.5)...;; F
5660: 49 58 4d 45 21 20 54 68 69 73 20 68 61 72 73 68  IXME! This harsh
5670: 20 65 78 69 74 20 73 68 6f 75 6c 64 20 6e 6f 74   exit should not
5680: 20 62 65 20 6e 65 63 65 73 73 61 72 79 2e 2e 2e   be necessary...
5690: 2e 0a 09 09 28 69 66 20 28 6e 6f 74 20 2a 72 75  ....(if (not *ru
56a0: 6e 72 65 6d 6f 74 65 2a 29 28 65 78 69 74 29 29  nremote*)(exit))
56b0: 20 3b 3b 20 0a 09 09 23 66 29 20 3b 3b 20 72 65   ;; ...#f) ;; re
56c0: 74 75 72 6e 20 61 20 23 66 20 61 73 20 61 20 68  turn a #f as a h
56d0: 69 6e 74 20 74 68 61 74 20 77 65 20 61 72 65 20  int that we are 
56e0: 64 6f 6e 65 0a 09 20 20 20 20 20 20 3b 3b 20 48  done..      ;; H
56f0: 65 72 65 20 77 65 20 6e 65 65 64 20 74 6f 20 63  ere we need to c
5700: 68 65 63 6b 20 74 68 61 74 20 61 6c 6c 20 74 68  heck that all th
5710: 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e  e tests remainin
5720: 67 20 74 6f 20 62 65 20 72 75 6e 20 61 72 65 20  g to be run are 
5730: 65 6c 69 67 69 62 6c 65 20 74 6f 20 72 75 6e 0a  eligible to run.
5740: 09 20 20 20 20 20 20 3b 3b 20 61 6e 64 20 61 72  .      ;; and ar
5750: 65 20 6e 6f 74 20 62 6c 6f 63 6b 65 64 20 62 79  e not blocked by
5760: 20 66 61 69 6c 65 64 0a 09 20 20 20 20 20 20 28   failed..      (
5770: 6c 65 74 20 28 28 6e 65 77 6c 73 74 20 28 6f 70  let ((newlst (op
5780: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73  en-run-close tes
5790: 74 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d 72 75  ts:filter-non-ru
57a0: 6e 6e 61 62 6c 65 20 23 66 20 72 75 6e 2d 69 64  nnable #f run-id
57b0: 20 74 61 6c 20 74 65 73 74 2d 72 65 63 6f 72 64   tal test-record
57c0: 73 29 29 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 74  s))) ;; i.e. not
57d0: 20 46 41 49 4c 2c 20 57 41 49 56 45 44 2c 20 49   FAIL, WAIVED, I
57e0: 4e 43 4f 4d 50 4c 45 54 45 2c 20 50 41 53 53 2c  NCOMPLETE, PASS,
57f0: 20 4b 49 4c 4c 45 44 2c 0a 09 09 28 74 68 72 65   KILLED,...(thre
5800: 61 64 2d 73 6c 65 65 70 21 20 30 2e 31 29 0a 09  ad-sleep! 0.1)..
5810: 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f  .(if (not (null?
5820: 20 6e 65 77 6c 73 74 29 29 0a 09 09 20 20 20 20   newlst))...    
5830: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 6c 73  (loop (car newls
5840: 74 29 28 63 64 72 20 6e 65 77 6c 73 74 29 29 29  t)(cdr newlst)))
5850: 29 29 29 29 29 29 0a 0a 3b 3b 20 70 61 72 65 6e  ))))))..;; paren
5860: 74 2d 74 65 73 74 20 69 73 20 74 68 65 72 65 20  t-test is there 
5870: 61 73 20 61 20 70 6c 61 63 65 68 6f 6c 64 65 72  as a placeholder
5880: 20 66 6f 72 20 77 68 65 6e 20 70 61 72 65 6e 74   for when parent
5890: 2d 74 65 73 74 73 20 63 61 6e 20 62 65 20 72 75  -tests can be ru
58a0: 6e 20 61 73 20 61 20 73 65 74 75 70 20 73 74 65  n as a setup ste
58b0: 70 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 3a 74  p.(define (run:t
58c0: 65 73 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61  est run-id runna
58d0: 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73  me keyvallst tes
58e0: 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20 70  t-record flags p
58f0: 61 72 65 6e 74 2d 74 65 73 74 29 0a 20 20 3b 3b  arent-test).  ;;
5900: 20 41 6c 6c 20 74 68 65 73 65 20 76 61 72 73 20   All these vars 
5910: 6d 69 67 68 74 20 62 65 20 72 65 66 65 72 65 6e  might be referen
5920: 63 65 64 20 62 79 20 74 68 65 20 74 65 73 74 63  ced by the testc
5930: 6f 6e 66 69 67 20 66 69 6c 65 20 72 65 61 64 65  onfig file reade
5940: 72 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74  r.  (let* ((test
5950: 2d 6e 61 6d 65 20 20 20 20 28 74 65 73 74 73 3a  -name    (tests:
5960: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65  testqueue-get-te
5970: 73 74 6e 61 6d 65 20 20 20 74 65 73 74 2d 72 65  stname   test-re
5980: 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 77  cord)).. (test-w
5990: 61 69 74 6f 6e 73 20 28 74 65 73 74 73 3a 74 65  aitons (tests:te
59a0: 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74  stqueue-get-wait
59b0: 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f  ons    test-reco
59c0: 72 64 29 29 0a 09 20 28 74 65 73 74 2d 63 6f 6e  rd)).. (test-con
59d0: 66 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74  f    (tests:test
59e0: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f  queue-get-testco
59f0: 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64  nfig test-record
5a00: 29 29 0a 09 20 28 69 74 65 6d 64 61 74 20 20 20  )).. (itemdat   
5a10: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
5a20: 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20  eue-get-itemdat 
5a30: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29     test-record))
5a40: 0a 09 20 28 74 65 73 74 2d 70 61 74 68 20 20 20  .. (test-path   
5a50: 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a   (conc *toppath*
5a60: 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d   "/tests/" test-
5a70: 6e 61 6d 65 29 29 20 3b 3b 20 63 6f 75 6c 64 20  name)) ;; could 
5a80: 75 73 65 20 74 65 73 74 73 3a 67 65 74 2d 74 65  use tests:get-te
5a90: 73 74 63 6f 6e 66 69 67 20 68 65 72 65 20 2e 2e  stconfig here ..
5aa0: 2e 0a 09 20 28 66 6f 72 63 65 20 20 20 20 20 20  ... (force      
5ab0: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65    (hash-table-re
5ac0: 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20  f/default flags 
5ad0: 22 2d 66 6f 72 63 65 22 20 23 66 29 29 0a 09 20  "-force" #f)).. 
5ae0: 28 72 65 72 75 6e 20 20 20 20 20 20 20 20 28 68  (rerun        (h
5af0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
5b00: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 72 65  fault flags "-re
5b10: 72 75 6e 22 20 23 66 29 29 0a 09 20 28 6b 65 65  run" #f)).. (kee
5b20: 70 67 6f 69 6e 67 20 20 20 20 28 68 61 73 68 2d  pgoing    (hash-
5b30: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
5b40: 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f  t flags "-keepgo
5b50: 69 6e 67 22 20 23 66 29 29 0a 09 20 28 69 74 65  ing" #f)).. (ite
5b60: 6d 2d 70 61 74 68 20 20 20 20 20 22 22 29 0a 09  m-path     "")..
5b70: 20 28 64 62 20 20 20 20 20 20 20 20 20 20 20 23   (db           #
5b80: 66 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  f)).    (debug:p
5b90: 72 69 6e 74 20 35 0a 09 09 20 22 74 65 73 74 2d  rint 5... "test-
5ba0: 63 6f 6e 66 69 67 3a 20 22 20 28 68 61 73 68 2d  config: " (hash-
5bb0: 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73  table->alist tes
5bc0: 74 2d 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20 20  t-conf)... "\n  
5bd0: 20 69 74 65 6d 64 61 74 3a 20 22 20 69 74 65 6d   itemdat: " item
5be0: 64 61 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b 20  dat... ).    ;; 
5bf0: 73 65 74 74 69 6e 67 20 69 74 65 6d 64 61 74 20  setting itemdat 
5c00: 74 6f 20 61 20 6c 69 73 74 20 69 66 20 69 74 20  to a list if it 
5c10: 69 73 20 23 66 0a 20 20 20 20 28 69 66 20 28 6e  is #f.    (if (n
5c20: 6f 74 20 69 74 65 6d 64 61 74 29 28 73 65 74 21  ot itemdat)(set!
5c30: 20 69 74 65 6d 64 61 74 20 27 28 29 29 29 0a 20   itemdat '())). 
5c40: 20 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70 61     (set! item-pa
5c50: 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70  th (item-list->p
5c60: 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 20 20  ath itemdat)).  
5c70: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32    (debug:print 2
5c80: 20 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20   "Attempting to 
5c90: 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 74 65  launch test " te
5ca0: 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d  st-name "/" item
5cb0: 2d 70 61 74 68 29 0a 20 20 20 20 28 73 65 74 65  -path).    (sete
5cc0: 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45  nv "MT_TEST_NAME
5cd0: 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20  " test-name) ;; 
5ce0: 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54  .    (setenv "MT
5cf0: 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e  _RUNNAME"   runn
5d00: 61 6d 65 29 0a 20 20 20 20 28 6f 70 65 6e 2d 72  ame).    (open-r
5d10: 75 6e 2d 63 6c 6f 73 65 20 73 65 74 2d 6d 65 67  un-close set-meg
5d20: 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64  atest-env-vars d
5d30: 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65  b run-id) ;; the
5d40: 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64  se may be needed
5d50: 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e   by the launchin
5d60: 67 20 70 72 6f 63 65 73 73 0a 20 20 20 20 28 63  g process.    (c
5d70: 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20  hange-directory 
5d80: 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20 20 20  *toppath*)..    
5d90: 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65 72 65  ;; Here is where
5da0: 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74   the test_meta t
5db0: 61 62 6c 65 20 69 73 20 62 65 73 74 20 75 70 64  able is best upd
5dc0: 61 74 65 64 0a 20 20 20 20 3b 3b 20 59 65 73 2c  ated.    ;; Yes,
5dd0: 20 61 6e 6f 74 68 65 72 20 75 73 65 20 6f 66 20   another use of 
5de0: 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20 63 61 63  a global for cac
5df0: 68 69 6e 67 2e 20 4e 65 65 64 20 61 20 62 65 74  hing. Need a bet
5e00: 74 65 72 20 77 61 79 3f 0a 20 20 20 20 28 69 66  ter way?.    (if
5e10: 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c   (not (hash-tabl
5e20: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a 74  e-ref/default *t
5e30: 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64  est-meta-updated
5e40: 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 66 29 29  * test-name #f))
5e50: 0a 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a  .        (begin.
5e60: 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  .   (hash-table-
5e70: 73 65 74 21 20 2a 74 65 73 74 2d 6d 65 74 61 2d  set! *test-meta-
5e80: 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61  updated* test-na
5e90: 6d 65 20 23 74 29 0a 20 20 20 20 20 20 20 20 20  me #t).         
5ea0: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
5eb0: 65 20 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65  e runs:update-te
5ec0: 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d  st_meta db test-
5ed0: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29  name test-conf))
5ee0: 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 28 6c  ).    .    ;; (l
5ef0: 61 6d 62 64 61 20 28 69 74 65 6d 64 61 74 29 20  ambda (itemdat) 
5f00: 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 73 20 22  ;;; ((ripeness "
5f10: 6f 76 65 72 72 69 70 65 22 29 20 28 74 65 6d 70  overripe") (temp
5f20: 65 72 61 74 75 72 65 20 22 63 6f 6f 6c 22 29 20  erature "cool") 
5f30: 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d 65 72 22  (season "summer"
5f40: 29 29 0a 20 20 20 20 28 6c 65 74 2a 20 28 28 6e  )).    (let* ((n
5f50: 65 77 2d 74 65 73 74 2d 70 61 74 68 20 28 73 74  ew-test-path (st
5f60: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
5f70: 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 74 68   (cons test-path
5f80: 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d 64   (map cadr itemd
5f90: 61 74 29 29 20 22 2f 22 29 29 0a 09 20 20 20 28  at)) "/"))..   (
5fa0: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 28 69  new-test-name (i
5fb0: 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70  f (equal? item-p
5fc0: 61 74 68 20 22 22 29 20 74 65 73 74 2d 6e 61 6d  ath "") test-nam
5fd0: 65 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e 61 6d  e (conc test-nam
5fe0: 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29  e "/" item-path)
5ff0: 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65 64 20  )) ;; just need 
6000: 69 74 20 74 6f 20 62 65 20 75 6e 69 71 75 65 0a  it to be unique.
6010: 09 20 20 20 28 74 65 73 74 2d 69 64 20 20 20 20  .   (test-id    
6020: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
6030: 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69  se db:get-test-i
6040: 64 20 64 62 20 20 72 75 6e 2d 69 64 20 74 65 73  d db  run-id tes
6050: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68  t-name item-path
6060: 29 29 0a 09 20 20 20 28 74 65 73 74 64 61 74 20  ))..   (testdat 
6070: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
6080: 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73  close db:get-tes
6090: 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 64 62 20  t-info-by-id db 
60a0: 74 65 73 74 2d 69 64 29 29 29 0a 20 20 20 20 20  test-id))).     
60b0: 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74 64 61   (if (not testda
60c0: 74 29 0a 09 20 20 28 62 65 67 69 6e 0a 09 20 20  t)..  (begin..  
60d0: 20 20 3b 3b 20 65 6e 73 75 72 65 20 74 68 61 74    ;; ensure that
60e0: 20 74 68 65 20 70 61 74 68 20 65 78 69 73 74 73   the path exists
60f0: 20 62 65 66 6f 72 65 20 72 65 67 69 73 74 65 72   before register
6100: 69 6e 67 20 74 68 65 20 74 65 73 74 0a 09 20 20  ing the test..  
6110: 20 20 3b 3b 20 4e 4f 50 45 3a 20 43 61 6e 6e 6f    ;; NOPE: Canno
6120: 74 21 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 79 65  t! Don't know ye
6130: 74 20 77 68 69 63 68 20 64 69 73 6b 20 61 72 65  t which disk are
6140: 61 20 77 69 6c 6c 20 62 65 20 61 73 73 69 67 6e  a will be assign
6150: 65 64 2e 2e 2e 2e 0a 09 20 20 20 20 3b 3b 20 28  ed......    ;; (
6160: 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 6d 6b  system (conc "mk
6170: 64 69 72 20 2d 70 20 22 20 6e 65 77 2d 74 65 73  dir -p " new-tes
6180: 74 2d 70 61 74 68 29 29 0a 09 20 20 20 20 28 6f  t-path))..    (o
6190: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65  pen-run-close te
61a0: 73 74 73 3a 72 65 67 69 73 74 65 72 2d 74 65 73  sts:register-tes
61b0: 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74  t db run-id test
61c0: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29  -name item-path)
61d0: 0a 09 20 20 20 20 28 73 65 74 21 20 74 65 73 74  ..    (set! test
61e0: 2d 69 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c  -id (open-run-cl
61f0: 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d  ose db:get-test-
6200: 69 64 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73  id db run-id tes
6210: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68  t-name item-path
6220: 29 29 0a 09 20 20 20 20 28 73 65 74 21 20 74 65  ))..    (set! te
6230: 73 74 64 61 74 20 28 6f 70 65 6e 2d 72 75 6e 2d  stdat (open-run-
6240: 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73  close db:get-tes
6250: 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 64 62 20  t-info-by-id db 
6260: 74 65 73 74 2d 69 64 29 29 29 29 0a 20 20 20 20  test-id)))).    
6270: 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 64 20    (set! test-id 
6280: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
6290: 74 65 73 74 64 61 74 29 29 0a 20 20 20 20 20 20  testdat)).      
62a0: 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72  (change-director
62b0: 79 20 74 65 73 74 2d 70 61 74 68 29 0a 20 20 20  y test-path).   
62c0: 20 20 20 28 63 61 73 65 20 28 69 66 20 66 6f 72     (case (if for
62d0: 63 65 20 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d  ce ;; (args:get-
62e0: 61 72 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09  arg "-force")...
62f0: 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09 09 28  'NOT_STARTED...(
6300: 69 66 20 74 65 73 74 64 61 74 0a 09 09 20 20 20  if testdat...   
6310: 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c   (string->symbol
6320: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65   (test:get-state
6330: 20 74 65 73 74 64 61 74 29 29 0a 09 09 20 20 20   testdat))...   
6340: 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65   'failed-to-inse
6350: 72 74 29 29 0a 09 28 28 66 61 69 6c 65 64 2d 74  rt))..((failed-t
6360: 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28 64 65 62  o-insert).. (deb
6370: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
6380: 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 6e 73  R: Failed to ins
6390: 65 72 74 20 74 68 65 20 72 65 63 6f 72 64 20 69  ert the record i
63a0: 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a 09 28  nto the db"))..(
63b0: 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 43 4f 4d  (NOT_STARTED COM
63c0: 50 4c 45 54 45 44 29 0a 09 20 28 6c 65 74 20 28  PLETED).. (let (
63d0: 28 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20  (runflag #f)).. 
63e0: 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 3b 3b 20    (cond..    ;; 
63f0: 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 6d  -force, run no m
6400: 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 20 20  atter what..    
6410: 28 66 6f 72 63 65 20 28 73 65 74 21 20 72 75 6e  (force (set! run
6420: 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b  flag #t))..    ;
6430: 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20 72  ; NOT_STARTED, r
6440: 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61  un no matter wha
6450: 74 0a 09 20 20 20 20 28 28 65 71 75 61 6c 3f 20  t..    ((equal? 
6460: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
6470: 74 65 73 74 64 61 74 29 20 22 4e 4f 54 5f 53 54  testdat) "NOT_ST
6480: 41 52 54 45 44 22 29 28 73 65 74 21 20 72 75 6e  ARTED")(set! run
6490: 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b  flag #t))..    ;
64a0: 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e 64  ; not -rerun and
64b0: 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 43   PASS, WARN or C
64c0: 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a  HECK, do no run.
64d0: 09 20 20 20 20 28 28 61 6e 64 20 28 6f 72 20 28  .    ((and (or (
64e0: 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 20  not rerun)...   
64f0: 20 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 09     keepgoing)...
6500: 20 20 3b 3b 20 52 65 71 75 69 72 65 20 74 6f 20    ;; Require to 
6510: 66 6f 72 63 65 20 72 65 2d 72 75 6e 20 66 6f 72  force re-run for
6520: 20 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a 61   COMPLETED or *a
6530: 6e 79 74 68 69 6e 67 2a 20 2b 20 50 41 53 53 2c  nything* + PASS,
6540: 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09 09  WARN or CHECK...
6550: 20 20 28 6f 72 20 28 6d 65 6d 62 65 72 20 28 74    (or (member (t
6560: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74  est:get-status t
6570: 65 73 74 64 61 74 29 20 27 28 22 50 41 53 53 22  estdat) '("PASS"
6580: 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 29   "WARN" "CHECK")
6590: 29 0a 09 09 20 20 20 20 20 20 28 6d 65 6d 62 65  )...      (membe
65a0: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  r (test:get-stat
65b0: 65 20 20 74 65 73 74 64 61 74 29 20 27 28 22 43  e  testdat) '("C
65c0: 4f 4d 50 4c 45 54 45 44 22 29 29 29 29 20 0a 09  OMPLETED")))) ..
65d0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
65e0: 74 20 32 20 22 49 4e 46 4f 3a 20 72 75 6e 6e 69  t 2 "INFO: runni
65f0: 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e  ng test " test-n
6600: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
6610: 68 20 22 20 73 75 70 70 72 65 73 73 65 64 20 61  h " suppressed a
6620: 73 20 69 74 20 69 73 20 22 20 28 74 65 73 74 3a  s it is " (test:
6630: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61  get-state testda
6640: 74 29 20 22 20 61 6e 64 20 22 20 28 74 65 73 74  t) " and " (test
6650: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74  :get-status test
6660: 64 61 74 29 29 0a 09 20 20 20 20 20 28 73 65 74  dat))..     (set
6670: 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09  ! runflag #f))..
6680: 20 20 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e      ;; -rerun an
6690: 64 20 73 74 61 74 75 73 20 69 73 20 6f 6e 65 20  d status is one 
66a0: 6f 66 20 74 68 65 20 73 70 65 63 69 66 65 64 2c  of the specifed,
66b0: 20 72 75 6e 20 69 74 0a 09 20 20 20 20 28 28 61   run it..    ((a
66c0: 6e 64 20 72 65 72 75 6e 0a 09 09 20 20 28 6c 65  nd rerun...  (le
66d0: 74 2a 20 28 28 72 65 72 75 6e 6c 73 74 20 20 20  t* ((rerunlst   
66e0: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 72 65  (string-split re
66f0: 72 75 6e 20 22 2c 22 29 29 0a 09 09 09 20 28 6d  run ",")).... (m
6700: 75 73 74 2d 72 65 72 75 6e 20 28 6d 65 6d 62 65  ust-rerun (membe
6710: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  r (test:get-stat
6720: 75 73 20 74 65 73 74 64 61 74 29 20 72 65 72 75  us testdat) reru
6730: 6e 6c 73 74 29 29 29 0a 09 09 20 20 20 20 28 64  nlst)))...    (d
6740: 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 49 4e  ebug:print 3 "IN
6750: 46 4f 3a 20 2d 72 65 72 75 6e 20 6c 69 73 74 3a  FO: -rerun list:
6760: 20 22 20 72 65 72 75 6e 20 22 2c 20 74 65 73 74   " rerun ", test
6770: 2d 73 74 61 74 75 73 3a 20 22 20 28 74 65 73 74  -status: " (test
6780: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74  :get-status test
6790: 64 61 74 29 22 2c 20 6d 75 73 74 2d 72 65 72 75  dat)", must-reru
67a0: 6e 3a 20 22 20 6d 75 73 74 2d 72 65 72 75 6e 29  n: " must-rerun)
67b0: 0a 09 09 20 20 20 20 6d 75 73 74 2d 72 65 72 75  ...    must-reru
67c0: 6e 29 29 0a 09 20 20 20 20 20 28 64 65 62 75 67  n))..     (debug
67d0: 3a 70 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20  :print 2 "INFO: 
67e0: 52 65 72 75 6e 20 66 6f 72 63 65 64 20 66 6f 72  Rerun forced for
67f0: 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d   test " test-nam
6800: 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29  e "/" item-path)
6810: 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e  ..     (set! run
6820: 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b  flag #t))..    ;
6830: 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 64 6f  ; -keepgoing, do
6840: 20 6e 6f 74 20 72 65 72 75 6e 20 46 41 49 4c 0a   not rerun FAIL.
6850: 09 20 20 20 20 28 28 61 6e 64 20 6b 65 65 70 67  .    ((and keepg
6860: 6f 69 6e 67 0a 09 09 20 20 28 6d 65 6d 62 65 72  oing...  (member
6870: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75   (test:get-statu
6880: 73 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41  s testdat) '("FA
6890: 49 4c 22 29 29 29 0a 09 20 20 20 20 20 28 73 65  IL")))..     (se
68a0: 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a  t! runflag #f)).
68b0: 09 20 20 20 20 28 28 61 6e 64 20 28 6e 6f 74 20  .    ((and (not 
68c0: 72 65 72 75 6e 29 0a 09 09 20 20 28 6d 65 6d 62  rerun)...  (memb
68d0: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  er (test:get-sta
68e0: 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22  tus testdat) '("
68f0: 46 41 49 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09  FAIL" "n/a")))..
6900: 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c       (set! runfl
6910: 61 67 20 23 74 29 29 0a 09 20 20 20 20 28 65 6c  ag #t))..    (el
6920: 73 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67  se (set! runflag
6930: 20 23 66 29 29 29 0a 09 20 20 20 28 64 65 62 75   #f)))..   (debu
6940: 67 3a 70 72 69 6e 74 20 36 20 22 52 55 4e 4e 49  g:print 6 "RUNNI
6950: 4e 47 20 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22  NG => runflag: "
6960: 20 72 75 6e 66 6c 61 67 20 22 20 53 54 41 54 45   runflag " STATE
6970: 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74  : " (test:get-st
6980: 61 74 65 20 74 65 73 74 64 61 74 29 20 22 20 53  ate testdat) " S
6990: 54 41 54 55 53 3a 20 22 20 28 74 65 73 74 3a 67  TATUS: " (test:g
69a0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
69b0: 74 29 29 0a 09 20 20 20 28 69 66 20 28 6e 6f 74  t))..   (if (not
69c0: 20 72 75 6e 66 6c 61 67 29 0a 09 20 20 20 20 20   runflag)..     
69d0: 20 20 28 69 66 20 28 6e 6f 74 20 70 61 72 65 6e    (if (not paren
69e0: 74 2d 74 65 73 74 29 0a 09 09 20 20 20 28 64 65  t-test)...   (de
69f0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54  bug:print 1 "NOT
6a00: 45 3a 20 4e 6f 74 20 73 74 61 72 74 69 6e 67 20  E: Not starting 
6a10: 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d  test " new-test-
6a20: 6e 61 6d 65 20 22 20 61 73 20 69 74 20 69 73 20  name " as it is 
6a30: 73 74 61 74 65 20 5c 22 22 20 28 74 65 73 74 3a  state \"" (test:
6a40: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61  get-state testda
6a50: 74 29 20 0a 09 09 09 09 22 5c 22 20 61 6e 64 20  t) ....."\" and 
6a60: 73 74 61 74 75 73 20 5c 22 22 20 28 74 65 73 74  status \"" (test
6a70: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74  :get-status test
6a80: 64 61 74 29 20 22 5c 22 2c 20 75 73 65 20 2d 72  dat) "\", use -r
6a90: 65 72 75 6e 20 5c 22 22 20 28 74 65 73 74 3a 67  erun \"" (test:g
6aa0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
6ab0: 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20  t).             
6ac0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
6ad0: 20 20 20 22 5c 22 20 6f 72 20 2d 66 6f 72 63 65     "\" or -force
6ae0: 20 74 6f 20 6f 76 65 72 72 69 64 65 22 29 29 0a   to override")).
6af0: 09 20 20 20 20 20 20 20 3b 3b 20 4e 4f 54 45 3a  .       ;; NOTE:
6b00: 20 4e 6f 20 6c 6f 6e 67 65 72 20 62 65 20 63 68   No longer be ch
6b10: 65 63 6b 69 6e 67 20 70 72 65 72 65 71 75 69 73  ecking prerequis
6b20: 69 74 65 73 20 68 65 72 65 21 20 57 69 6c 6c 20  ites here! Will 
6b30: 6e 65 76 65 72 20 67 65 74 20 68 65 72 65 20 75  never get here u
6b40: 6e 6c 65 73 73 20 70 72 65 72 65 71 73 20 61 72  nless prereqs ar
6b50: 65 0a 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20  e..       ;;    
6b60: 20 20 20 61 6c 72 65 61 64 79 20 6d 65 74 2e 0a     already met..
6b70: 09 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74  .       (if (not
6b80: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
6b90: 20 6c 61 75 6e 63 68 2d 74 65 73 74 20 64 62 20   launch-test db 
6ba0: 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74  run-id runname t
6bb0: 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61 6c 6c  est-conf keyvall
6bc0: 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73  st test-name tes
6bd0: 74 2d 70 61 74 68 20 69 74 65 6d 64 61 74 20 66  t-path itemdat f
6be0: 6c 61 67 73 29 29 0a 09 09 20 20 20 28 62 65 67  lags))...   (beg
6bf0: 69 6e 0a 09 09 20 20 20 20 20 28 70 72 69 6e 74  in...     (print
6c00: 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20   "ERROR: Failed 
6c10: 74 6f 20 6c 61 75 6e 63 68 20 74 68 65 20 74 65  to launch the te
6c20: 73 74 2e 20 45 78 69 74 69 6e 67 20 61 73 20 73  st. Exiting as s
6c30: 6f 6f 6e 20 61 73 20 70 6f 73 73 69 62 6c 65 22  oon as possible"
6c40: 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 2a  )...     (set! *
6c50: 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73  globalexitstatus
6c60: 2a 20 31 29 20 3b 3b 20 0a 09 09 20 20 20 20 20  * 1) ;; ...     
6c70: 28 70 72 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20  (process-signal 
6c80: 28 63 75 72 72 65 6e 74 2d 70 72 6f 63 65 73 73  (current-process
6c90: 2d 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c  -id) signal/kill
6ca0: 29 29 29 29 29 29 0a 09 28 28 4b 49 4c 4c 45 44  ))))))..((KILLED
6cb0: 29 20 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e  ) .. (debug:prin
6cc0: 74 20 31 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77  t 1 "NOTE: " new
6cd0: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20  -test-name " is 
6ce0: 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 20  already running 
6cf0: 6f 72 20 77 61 73 20 65 78 70 6c 69 63 74 6c 79  or was explictly
6d00: 20 6b 69 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f   killed, use -fo
6d10: 72 63 65 20 74 6f 20 6c 61 75 6e 63 68 20 69 74  rce to launch it
6d20: 2e 22 29 29 0a 09 28 28 4c 41 55 4e 43 48 45 44  ."))..((LAUNCHED
6d30: 20 52 45 4d 4f 54 45 48 4f 53 54 53 54 41 52 54   REMOTEHOSTSTART
6d40: 20 52 55 4e 4e 49 4e 47 29 20 20 0a 09 20 28 69   RUNNING)  .. (i
6d50: 66 20 28 3e 20 28 2d 20 28 63 75 72 72 65 6e 74  f (> (- (current
6d60: 2d 73 65 63 6f 6e 64 73 29 28 2b 20 28 64 62 3a  -seconds)(+ (db:
6d70: 74 65 73 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74  test-get-event_t
6d80: 69 6d 65 20 74 65 73 74 64 61 74 29 0a 09 09 09  ime testdat)....
6d90: 09 20 20 20 20 20 20 20 28 64 62 3a 74 65 73 74  .       (db:test
6da0: 2d 67 65 74 2d 72 75 6e 5f 64 75 72 61 74 69 6f  -get-run_duratio
6db0: 6e 20 74 65 73 74 64 61 74 29 29 29 0a 09 09 36  n testdat)))...6
6dc0: 30 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75  00) ;; i.e. no u
6dd0: 70 64 61 74 65 20 66 6f 72 20 6d 6f 72 65 20 74  pdate for more t
6de0: 68 61 6e 20 36 30 30 20 73 65 63 6f 6e 64 73 0a  han 600 seconds.
6df0: 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20  .     (begin..  
6e00: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
6e10: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 54 65  t 0 "WARNING: Te
6e20: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22  st " test-name "
6e30: 20 61 70 70 65 61 72 73 20 74 6f 20 62 65 20 64   appears to be d
6e40: 65 61 64 2e 20 46 6f 72 63 69 6e 67 20 69 74 20  ead. Forcing it 
6e50: 74 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c  to state INCOMPL
6e60: 45 54 45 20 61 6e 64 20 73 74 61 74 75 73 20 53  ETE and status S
6e70: 54 55 43 4b 2f 44 45 41 44 22 29 0a 09 20 20 20  TUCK/DEAD")..   
6e80: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
6e90: 6f 73 65 20 74 65 73 74 2d 73 65 74 2d 73 74 61  ose test-set-sta
6ea0: 74 75 73 21 20 64 62 20 74 65 73 74 2d 69 64 20  tus! db test-id 
6eb0: 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22 53 54  "INCOMPLETE" "ST
6ec0: 55 43 4b 2f 44 45 41 44 22 20 22 54 65 73 74 20  UCK/DEAD" "Test 
6ed0: 69 73 20 73 74 75 63 6b 20 6f 72 20 64 65 61 64  is stuck or dead
6ee0: 22 20 23 66 29 29 0a 09 20 20 20 20 20 28 64 65  " #f))..     (de
6ef0: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54  bug:print 2 "NOT
6f00: 45 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22  E: " test-name "
6f10: 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e   is already runn
6f20: 69 6e 67 22 29 29 29 0a 09 28 65 6c 73 65 20 20  ing")))..(else  
6f30: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
6f40: 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c  t 0 "ERROR: Fail
6f50: 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73  ed to launch tes
6f60: 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d  t " new-test-nam
6f70: 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73 65  e ". Unrecognise
6f80: 64 20 73 74 61 74 65 20 22 20 28 74 65 73 74 3a  d state " (test:
6f90: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61  get-state testda
6fa0: 74 29 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d  t)))))))..;;====
6fb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6fc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6fd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6fe0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6ff0: 3d 3d 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e 45 57  ==.;; END OF NEW
7000: 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d   STUFF.;;=======
7010: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7020: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7030: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7040: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
7050: 0a 28 64 65 66 69 6e 65 20 28 67 65 74 2d 64 69  .(define (get-di
7060: 72 2d 75 70 2d 6e 20 64 69 72 20 2e 20 70 61 72  r-up-n dir . par
7070: 61 6d 73 29 20 0a 20 20 28 6c 65 74 20 28 28 64  ams) .  (let ((d
7080: 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73  parts  (string-s
7090: 70 6c 69 74 20 64 69 72 20 22 2f 22 29 29 0a 09  plit dir "/"))..
70a0: 28 63 6f 75 6e 74 20 20 20 28 69 66 20 28 6e 75  (count   (if (nu
70b0: 6c 6c 3f 20 70 61 72 61 6d 73 29 20 31 20 28 63  ll? params) 1 (c
70c0: 61 72 20 70 61 72 61 6d 73 29 29 29 29 0a 20 20  ar params)))).  
70d0: 20 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72    (conc "/" (str
70e0: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20  ing-intersperse 
70f0: 0a 09 20 20 20 20 20 20 20 28 74 61 6b 65 20 64  ..       (take d
7100: 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68  parts (- (length
7110: 20 64 70 61 72 74 73 29 20 63 6f 75 6e 74 29 29   dparts) count))
7120: 0a 09 20 20 20 20 20 20 20 22 2f 22 29 29 29 29  ..       "/"))))
7130: 0a 3b 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73 0a  .;; Remove runs.
7140: 3b 3b 20 66 69 65 6c 64 73 20 61 72 65 20 70 61  ;; fields are pa
7150: 73 73 69 6e 67 20 69 6e 20 74 68 72 6f 75 67 68  ssing in through
7160: 20 0a 3b 3b 20 61 63 74 69 6f 6e 3a 0a 3b 3b 20   .;; action:.;; 
7170: 20 20 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73 0a     'remove-runs.
7180: 3b 3b 20 20 20 20 27 73 65 74 2d 73 74 61 74 65  ;;    'set-state
7190: 2d 73 74 61 74 75 73 0a 3b 3b 0a 3b 3b 20 4e 42  -status.;;.;; NB
71a0: 2f 2f 20 73 68 6f 75 6c 64 20 70 61 73 73 20 69  // should pass i
71b0: 6e 20 6b 65 79 73 3f 0a 3b 3b 0a 28 64 65 66 69  n keys?.;;.(defi
71c0: 6e 65 20 28 72 75 6e 73 3a 6f 70 65 72 61 74 65  ne (runs:operate
71d0: 2d 6f 6e 20 64 62 20 61 63 74 69 6f 6e 20 72 75  -on db action ru
71e0: 6e 6e 61 6d 65 70 61 74 74 20 74 65 73 74 70 61  nnamepatt testpa
71f0: 74 74 20 69 74 65 6d 70 61 74 74 20 23 21 6b 65  tt itempatt #!ke
7200: 79 20 28 73 74 61 74 65 20 23 66 29 28 73 74 61  y (state #f)(sta
7210: 74 75 73 20 23 66 29 28 6e 65 77 2d 73 74 61 74  tus #f)(new-stat
7220: 65 2d 73 74 61 74 75 73 20 23 66 29 29 0a 20 20  e-status #f)).  
7230: 28 6c 65 74 2a 20 28 28 6b 65 79 73 20 20 20 20  (let* ((keys    
7240: 20 20 20 20 20 28 72 64 62 3a 67 65 74 2d 6b 65       (rdb:get-ke
7250: 79 73 20 64 62 29 29 0a 09 20 28 72 75 6e 64 61  ys db)).. (runda
7260: 74 20 20 20 20 20 20 20 28 72 75 6e 73 3a 67 65  t       (runs:ge
7270: 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64  t-runs-by-patt d
7280: 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61  b keys runnamepa
7290: 74 74 29 29 0a 09 20 28 68 65 61 64 65 72 20 20  tt)).. (header  
72a0: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66       (vector-ref
72b0: 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72   rundat 0)).. (r
72c0: 75 6e 73 20 20 20 20 20 20 20 20 20 28 76 65 63  uns         (vec
72d0: 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31  tor-ref rundat 1
72e0: 29 29 0a 09 20 28 73 74 61 74 65 73 20 20 20 20  )).. (states    
72f0: 20 20 20 28 69 66 20 73 74 61 74 65 20 20 28 73     (if state  (s
7300: 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 74  tring-split stat
7310: 65 20 20 22 2c 22 29 20 27 28 29 29 29 0a 09 20  e  ",") '())).. 
7320: 28 73 74 61 74 75 73 65 73 20 20 20 20 20 28 69  (statuses     (i
7330: 66 20 73 74 61 74 75 73 20 28 73 74 72 69 6e 67  f status (string
7340: 2d 73 70 6c 69 74 20 73 74 61 74 75 73 20 22 2c  -split status ",
7350: 22 29 20 27 28 29 29 29 0a 09 20 28 73 74 61 74  ") '())).. (stat
7360: 65 2d 73 74 61 74 75 73 20 28 69 66 20 28 73 74  e-status (if (st
7370: 72 69 6e 67 3f 20 6e 65 77 2d 73 74 61 74 65 2d  ring? new-state-
7380: 73 74 61 74 75 73 29 20 28 73 74 72 69 6e 67 2d  status) (string-
7390: 73 70 6c 69 74 20 6e 65 77 2d 73 74 61 74 65 2d  split new-state-
73a0: 73 74 61 74 75 73 20 22 2c 22 29 20 27 28 23 66  status ",") '(#f
73b0: 20 23 66 29 29 29 29 0a 20 20 20 20 28 64 65 62   #f)))).    (deb
73c0: 75 67 3a 70 72 69 6e 74 20 32 20 22 48 65 61 64  ug:print 2 "Head
73d0: 65 72 3a 20 22 20 68 65 61 64 65 72 20 22 20 61  er: " header " a
73e0: 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e 20  ction: " action 
73f0: 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74  " new-state-stat
7400: 75 73 3a 20 22 20 6e 65 77 2d 73 74 61 74 65 2d  us: " new-state-
7410: 73 74 61 74 75 73 29 0a 20 20 20 20 28 66 6f 72  status).    (for
7420: 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62  -each.     (lamb
7430: 64 61 20 28 72 75 6e 29 0a 20 20 20 20 20 20 20  da (run).       
7440: 28 6c 65 74 20 28 28 72 75 6e 6b 65 79 20 28 73  (let ((runkey (s
7450: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
7460: 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28  e (map (lambda (
7470: 6b 29 0a 09 09 09 09 09 09 28 64 62 3a 67 65 74  k).......(db:get
7480: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
7490: 20 72 75 6e 20 68 65 61 64 65 72 20 28 76 65 63   run header (vec
74a0: 74 6f 72 2d 72 65 66 20 6b 20 30 29 29 29 20 6b  tor-ref k 0))) k
74b0: 65 79 73 29 20 22 2f 22 29 29 0a 09 20 20 20 20  eys) "/"))..    
74c0: 20 28 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65   (dirs-to-remove
74d0: 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c   (make-hash-tabl
74e0: 65 29 29 29 0a 09 20 28 6c 65 74 2a 20 28 28 72  e))).. (let* ((r
74f0: 75 6e 2d 69 64 20 20 20 20 28 64 62 3a 67 65 74  un-id    (db:get
7500: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
7510: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22   run header "id"
7520: 29 29 0a 09 09 28 72 75 6e 2d 73 74 61 74 65 20  ))...(run-state 
7530: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
7540: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
7550: 65 72 20 22 73 74 61 74 65 22 29 29 0a 09 09 28  er "state"))...(
7560: 74 65 73 74 73 20 20 20 20 20 28 69 66 20 28 6e  tests     (if (n
7570: 6f 74 20 28 65 71 75 61 6c 3f 20 72 75 6e 2d 73  ot (equal? run-s
7580: 74 61 74 65 20 22 6c 6f 63 6b 65 64 22 29 29 0a  tate "locked")).
7590: 09 09 09 20 20 20 20 20 20 20 28 72 64 62 3a 67  ...       (rdb:g
75a0: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e  et-tests-for-run
75b0: 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75   db (db:get-valu
75c0: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20  e-by-header run 
75d0: 68 65 61 64 65 72 20 22 69 64 22 29 0a 09 09 09  header "id")....
75e0: 09 09 09 20 20 20 20 20 20 74 65 73 74 70 61 74  ...      testpat
75f0: 74 20 69 74 65 6d 70 61 74 74 20 73 74 61 74 65  t itempatt state
7600: 73 20 73 74 61 74 75 73 65 73 0a 09 09 09 09 09  s statuses......
7610: 09 20 20 20 20 20 20 6e 6f 74 2d 69 6e 3a 20 20  .      not-in:  
7620: 23 66 0a 09 09 09 09 09 09 20 20 20 20 20 20 73  #f.......      s
7630: 6f 72 74 2d 62 79 3a 20 28 63 61 73 65 20 61 63  ort-by: (case ac
7640: 74 69 6f 6e 0a 09 09 09 09 09 09 09 09 20 28 28  tion......... ((
7650: 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20 27 72 75  remove-runs) 'ru
7660: 6e 64 69 72 29 0a 09 09 09 09 09 09 09 09 20 28  ndir)......... (
7670: 65 6c 73 65 20 20 20 20 20 20 20 20 20 20 27 65  else          'e
7680: 76 65 6e 74 5f 74 69 6d 65 29 29 29 0a 09 09 09  vent_time)))....
7690: 20 20 20 20 20 20 20 27 28 29 29 29 0a 09 09 28         '()))...(
76a0: 6c 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65 73  lasttpath "/does
76b0: 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70  /not/exist/I/hop
76c0: 65 22 29 29 0a 0a 09 20 20 20 28 69 66 20 28 6e  e"))...   (if (n
76d0: 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29  ot (null? tests)
76e0: 29 0a 09 20 20 20 20 20 20 20 28 62 65 67 69 6e  )..       (begin
76f0: 0a 09 09 20 28 63 61 73 65 20 61 63 74 69 6f 6e  ... (case action
7700: 0a 09 09 20 20 20 28 28 72 65 6d 6f 76 65 2d 72  ...   ((remove-r
7710: 75 6e 73 29 0a 09 09 20 20 20 20 28 64 65 62 75  uns)...    (debu
7720: 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76  g:print 1 "Remov
7730: 69 6e 67 20 74 65 73 74 73 20 66 6f 72 20 72 75  ing tests for ru
7740: 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20  n: " runkey " " 
7750: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
7760: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
7770: 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a  er "runname"))).
7780: 09 09 20 20 20 28 28 73 65 74 2d 73 74 61 74 65  ..   ((set-state
7790: 2d 73 74 61 74 75 73 29 0a 09 09 20 20 20 20 28  -status)...    (
77a0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4d  debug:print 1 "M
77b0: 6f 64 69 66 79 69 6e 67 20 73 74 61 74 65 20 61  odifying state a
77c0: 6e 64 20 73 74 61 75 73 20 66 6f 72 20 74 65 73  nd staus for tes
77d0: 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75  ts for run: " ru
77e0: 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74  nkey " " (db:get
77f0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
7800: 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e   run header "run
7810: 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28 65  name")))...   (e
7820: 6c 73 65 0a 09 09 20 20 20 20 28 70 72 69 6e 74  lse...    (print
7830: 20 22 49 4e 46 4f 3a 20 61 63 74 69 6f 6e 20 6e   "INFO: action n
7840: 6f 74 20 72 65 63 6f 67 6e 69 73 65 64 20 22 20  ot recognised " 
7850: 61 63 74 69 6f 6e 29 29 29 0a 09 09 20 28 66 6f  action)))... (fo
7860: 72 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d 62  r-each...  (lamb
7870: 64 61 20 28 74 65 73 74 29 0a 09 09 20 20 20 20  da (test)...    
7880: 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 74  (let* ((item-pat
7890: 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  h (db:test-get-i
78a0: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 0a  tem-path test)).
78b0: 09 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d 65  ...   (test-name
78c0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
78d0: 73 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 09  stname test))...
78e0: 09 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20 28  .   (run-dir   (
78f0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64  db:test-get-rund
7900: 69 72 20 74 65 73 74 29 29 29 0a 09 09 20 20 20  ir test)))...   
7910: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
7920: 31 20 22 20 20 22 20 28 64 62 3a 74 65 73 74 2d  1 "  " (db:test-
7930: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73  get-testname tes
7940: 74 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a 74  t) " id: " (db:t
7950: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29  est-get-id test)
7960: 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22   " " item-path "
7970: 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f   action: " actio
7980: 6e 29 0a 09 09 20 20 20 20 20 20 28 63 61 73 65  n)...      (case
7990: 20 61 63 74 69 6f 6e 0a 09 09 09 28 28 72 65 6d   action....((rem
79a0: 6f 76 65 2d 72 75 6e 73 29 0a 09 09 09 20 28 72  ove-runs).... (r
79b0: 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 2d 72  db:delete-test-r
79c0: 65 63 6f 72 64 73 20 64 62 20 28 64 62 3a 74 65  ecords db (db:te
79d0: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29  st-get-id test))
79e0: 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e  .... (debug:prin
79f0: 74 20 31 20 22 49 4e 46 4f 3a 20 41 74 74 65 6d  t 1 "INFO: Attem
7a00: 70 74 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20  pting to remove 
7a10: 64 69 72 20 22 20 72 75 6e 2d 64 69 72 29 0a 09  dir " run-dir)..
7a20: 09 09 20 28 69 66 20 28 61 6e 64 20 28 3e 20 28  .. (if (and (> (
7a30: 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 72 75  string-length ru
7a40: 6e 2d 64 69 72 29 20 35 29 0a 09 09 09 09 20 20  n-dir) 5).....  
7a50: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75  (file-exists? ru
7a60: 6e 2d 64 69 72 29 29 20 3b 3b 20 62 61 64 20 68  n-dir)) ;; bad h
7a70: 65 75 72 69 73 74 69 63 20 62 75 74 20 73 68 6f  euristic but sho
7a80: 75 6c 64 20 70 72 65 76 65 6e 74 20 2f 74 6d 70  uld prevent /tmp
7a90: 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20   /home etc..... 
7aa0: 20 20 20 20 28 6c 65 74 2a 20 28 28 72 65 61 6c      (let* ((real
7ab0: 70 61 74 68 20 28 72 65 73 6f 6c 76 65 2d 70 61  path (resolve-pa
7ac0: 74 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72 29 29  thname run-dir))
7ad0: 29 0a 09 09 09 20 20 20 20 20 20 20 28 64 65 62  )....       (deb
7ae0: 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f  ug:print 1 "INFO
7af0: 3a 20 52 65 61 6c 20 70 61 74 68 20 6f 66 20 69  : Real path of i
7b00: 73 20 22 20 72 65 61 6c 70 61 74 68 29 0a 09 09  s " realpath)...
7b10: 09 20 20 20 20 20 20 20 28 69 66 20 28 66 69 6c  .       (if (fil
7b20: 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c 70 61  e-exists? realpa
7b30: 74 68 29 0a 09 09 09 09 20 20 20 28 69 66 20 28  th).....   (if (
7b40: 3e 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20  > (system (conc 
7b50: 22 72 6d 20 2d 72 66 20 22 20 72 65 61 6c 70 61  "rm -rf " realpa
7b60: 74 68 29 29 20 30 29 0a 09 09 09 09 20 20 20 20  th)) 0).....    
7b70: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
7b80: 30 20 22 45 52 52 4f 52 3a 20 54 68 65 72 65 20  0 "ERROR: There 
7b90: 77 61 73 20 61 20 70 72 6f 62 6c 65 6d 20 72 65  was a problem re
7ba0: 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c 70 61 74  moving " realpat
7bb0: 68 20 22 20 77 69 74 68 20 72 6d 20 2d 66 22 29  h " with rm -f")
7bc0: 29 0a 09 09 09 09 20 20 20 28 64 65 62 75 67 3a  ).....   (debug:
7bd0: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47  print 0 "WARNING
7be0: 3a 20 74 65 73 74 20 72 75 6e 20 64 69 72 20 22  : test run dir "
7bf0: 20 72 65 61 6c 70 61 74 68 20 22 20 61 70 70 65   realpath " appe
7c00: 61 72 73 20 74 6f 20 6e 6f 74 20 65 78 69 73 74  ars to not exist
7c10: 22 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 69  "))....       (i
7c20: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20  f (file-exists? 
7c30: 72 75 6e 2d 64 69 72 29 20 3b 3b 20 74 68 65 20  run-dir) ;; the 
7c40: 6c 69 6e 6b 0a 09 09 09 09 20 20 20 28 69 66 20  link.....   (if 
7c50: 28 73 79 6d 62 6f 6c 69 63 2d 6c 69 6e 6b 3f 20  (symbolic-link? 
7c60: 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 20 20 20  run-dir).....   
7c70: 20 20 20 20 28 64 65 6c 65 74 65 2d 66 69 6c 65      (delete-file
7c80: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 20 20   run-dir).....  
7c90: 20 20 20 20 20 28 69 66 20 28 64 69 72 65 63 74       (if (direct
7ca0: 6f 72 79 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09  ory? run-dir)...
7cb0: 09 09 09 20 20 20 28 69 66 20 28 3e 20 28 64 69  ...   (if (> (di
7cc0: 72 65 63 74 6f 72 79 2d 66 6f 6c 64 20 28 6c 61  rectory-fold (la
7cd0: 6d 62 64 61 20 28 66 20 78 29 28 2b 20 31 20 78  mbda (f x)(+ 1 x
7ce0: 29 29 20 30 20 72 75 6e 2d 64 69 72 29 20 30 29  )) 0 run-dir) 0)
7cf0: 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 64 65  ......       (de
7d00: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52  bug:print 0 "WAR
7d10: 4e 49 4e 47 3a 20 72 65 66 75 73 69 6e 67 20 74  NING: refusing t
7d20: 6f 20 72 65 6d 6f 76 65 20 22 20 72 75 6e 2d 64  o remove " run-d
7d30: 69 72 20 22 20 61 73 20 69 74 20 69 73 20 6e 6f  ir " as it is no
7d40: 74 20 65 6d 70 74 79 22 29 0a 09 09 09 09 09 20  t empty")...... 
7d50: 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d 64 69        (delete-di
7d60: 72 65 63 74 6f 72 79 20 72 75 6e 2d 64 69 72 29  rectory run-dir)
7d70: 29 20 3b 3b 20 69 74 20 73 68 6f 75 6c 64 20 62  ) ;; it should b
7d80: 65 20 65 6d 70 74 79 20 62 79 20 68 65 72 65 20  e empty by here 
7d90: 42 55 47 20 42 55 47 2c 20 61 64 64 20 65 72 72  BUG BUG, add err
7da0: 6f 72 20 63 61 74 63 68 0a 09 09 09 09 09 20 20  or catch......  
7db0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
7dc0: 22 45 52 52 4f 52 3a 20 72 65 66 75 73 69 6e 67  "ERROR: refusing
7dd0: 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72 75 6e   to remove " run
7de0: 2d 64 69 72 20 22 20 61 73 20 69 74 20 69 73 20  -dir " as it is 
7df0: 6e 65 69 74 68 65 72 20 61 20 73 79 6d 6c 69 6e  neither a symlin
7e00: 6b 20 6e 6f 72 20 61 20 64 69 72 65 63 74 6f 72  k nor a director
7e10: 79 22 29 0a 09 09 09 09 09 20 20 20 29 29 29 29  y")......   ))))
7e20: 0a 09 09 09 20 20 20 20 20 28 64 65 62 75 67 3a  ....     (debug:
7e30: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47  print 0 "WARNING
7e40: 3a 20 64 69 72 65 63 74 6f 72 79 20 61 6c 72 65  : directory alre
7e50: 61 64 79 20 72 65 6d 6f 76 65 64 20 22 20 72 75  ady removed " ru
7e60: 6e 2d 64 69 72 29 29 29 0a 09 09 09 28 28 73 65  n-dir)))....((se
7e70: 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a  t-state-status).
7e80: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ... (debug:print
7e90: 20 32 20 22 49 4e 46 4f 3a 20 6e 65 77 20 73 74   2 "INFO: new st
7ea0: 61 74 65 20 22 20 28 63 61 72 20 73 74 61 74 65  ate " (car state
7eb0: 2d 73 74 61 74 75 73 29 20 22 2c 20 6e 65 77 20  -status) ", new 
7ec0: 73 74 61 74 75 73 20 22 20 28 63 61 64 72 20 73  status " (cadr s
7ed0: 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a 09 09  tate-status))...
7ee0: 09 20 28 64 62 3a 74 65 73 74 2d 73 65 74 2d 73  . (db:test-set-s
7ef0: 74 61 74 65 2d 73 74 61 74 75 73 2d 62 79 2d 69  tate-status-by-i
7f00: 64 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65  d db (db:test-ge
7f10: 74 2d 69 64 20 74 65 73 74 29 20 28 63 61 72 20  t-id test) (car 
7f20: 73 74 61 74 65 2d 73 74 61 74 75 73 29 28 63 61  state-status)(ca
7f30: 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29  dr state-status)
7f40: 20 23 66 29 29 29 29 29 0a 09 09 20 20 74 65 73   #f)))))...  tes
7f50: 74 73 29 29 29 0a 09 20 20 20 0a 09 20 20 20 3b  ts)))..   ..   ;
7f60: 3b 20 72 65 6d 6f 76 65 20 74 68 65 20 72 75 6e  ; remove the run
7f70: 20 69 66 20 7a 65 72 6f 20 74 65 73 74 73 20 72   if zero tests r
7f80: 65 6d 61 69 6e 0a 09 20 20 20 28 69 66 20 28 65  emain..   (if (e
7f90: 71 3f 20 61 63 74 69 6f 6e 20 27 72 65 6d 6f 76  q? action 'remov
7fa0: 65 2d 72 75 6e 73 29 0a 09 20 20 20 20 20 20 20  e-runs)..       
7fb0: 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73 20  (let ((remtests 
7fc0: 28 72 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66  (rdb:get-tests-f
7fd0: 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65  or-run db (db:ge
7fe0: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65  t-value-by-heade
7ff0: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64  r run header "id
8000: 22 29 20 23 66 20 23 66 20 27 28 29 20 27 28 29  ") #f #f '() '()
8010: 29 29 29 0a 09 09 20 28 69 66 20 28 6e 75 6c 6c  )))... (if (null
8020: 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b 20 6e  ? remtests) ;; n
8030: 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72 65 6d  o more tests rem
8040: 61 69 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 6c  aining...     (l
8050: 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 28 73  et* ((dparts  (s
8060: 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73 74  tring-split last
8070: 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09 20  tpath "/")).... 
8080: 20 20 20 28 72 75 6e 70 61 74 68 20 28 63 6f 6e     (runpath (con
8090: 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e  c "/" (string-in
80a0: 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 09 09  tersperse ......
80b0: 09 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d  .(take dparts (-
80c0: 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29   (length dparts)
80d0: 20 31 29 29 0a 09 09 09 09 09 09 22 2f 22 29 29   1))......."/"))
80e0: 29 29 0a 09 09 20 20 20 20 20 20 20 28 64 65 62  ))...       (deb
80f0: 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f  ug:print 1 "Remo
8100: 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b  ving run: " runk
8110: 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76  ey " " (db:get-v
8120: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72  alue-by-header r
8130: 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61  un header "runna
8140: 6d 65 22 29 29 0a 09 09 20 20 20 20 20 20 20 28  me"))...       (
8150: 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e 20 64 62  db:delete-run db
8160: 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 20 20   run-id)...     
8170: 20 20 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 67    ;; need to fig
8180: 75 72 65 20 6f 75 74 20 74 68 65 20 70 61 74 68  ure out the path
8190: 20 74 6f 20 74 68 65 20 72 75 6e 20 64 69 72 20   to the run dir 
81a0: 61 6e 64 20 72 65 6d 6f 76 65 20 69 74 20 69 66  and remove it if
81b0: 20 65 6d 70 74 79 0a 09 09 20 20 20 20 20 20 20   empty...       
81c0: 3b 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f  ;;    (if (null?
81d0: 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e   (glob (conc run
81e0: 70 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 20  path "/*")))... 
81f0: 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20        ;;        
8200: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 20 20  (begin...       
8210: 3b 3b 20 09 20 28 64 65 62 75 67 3a 70 72 69 6e  ;; . (debug:prin
8220: 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75  t 1 "Removing ru
8230: 6e 20 64 69 72 20 22 20 72 75 6e 70 61 74 68 29  n dir " runpath)
8240: 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28  ...       ;; . (
8250: 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d  system (conc "rm
8260: 64 69 72 20 2d 70 20 22 20 72 75 6e 70 61 74 68  dir -p " runpath
8270: 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 29 29  ))))...       ))
8280: 29 29 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75  ))).. )).     ru
8290: 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d  ns)))..;;=======
82a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
82b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
82c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
82d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
82e0: 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f 72 20  ;; Routines for 
82f0: 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 72 75 6e  manipulating run
8300: 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  s.;;============
8310: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8320: 3d 3d 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 0a 0a 3b 3b 20 53  ==========..;; S
8350: 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73 20  ince many calls 
8360: 74 6f 20 61 20 72 75 6e 20 72 65 71 75 69 72 65  to a run require
8370: 20 70 72 65 74 74 79 20 6d 75 63 68 20 74 68 65   pretty much the
8380: 20 73 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b 20   same setup .;; 
8390: 74 68 69 73 20 77 72 61 70 70 65 72 20 69 73 20  this wrapper is 
83a0: 75 73 65 64 20 74 6f 20 72 65 64 75 63 65 20 74  used to reduce t
83b0: 68 65 20 72 65 70 6c 69 63 61 74 69 6f 6e 20 6f  he replication o
83c0: 66 20 63 6f 64 65 0a 28 64 65 66 69 6e 65 20 28  f code.(define (
83d0: 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c  general-run-call
83e0: 20 73 77 69 74 63 68 6e 61 6d 65 20 61 63 74 69   switchname acti
83f0: 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a 20 20  on-desc proc).  
8400: 28 6c 65 74 20 28 28 72 75 6e 6e 61 6d 65 20 28  (let ((runname (
8410: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72  args:get-arg ":r
8420: 75 6e 6e 61 6d 65 22 29 29 0a 09 28 74 61 72 67  unname"))..(targ
8430: 65 74 20 20 28 69 66 20 28 61 72 67 73 3a 67 65  et  (if (args:ge
8440: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29  t-arg "-target")
8450: 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 65  ...     (args:ge
8460: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29  t-arg "-target")
8470: 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 65  ...     (args:ge
8480: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22  t-arg "-reqtarg"
8490: 29 29 29 0a 09 28 74 68 31 20 20 20 20 20 23 66  )))..(th1     #f
84a0: 29 29 0a 20 20 20 20 28 63 6f 6e 64 0a 20 20 20  )).    (cond.   
84b0: 20 20 28 28 6e 6f 74 20 74 61 72 67 65 74 29 0a    ((not target).
84c0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
84d0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73  nt 0 "ERROR: Mis
84e0: 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61  sing required pa
84f0: 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77  rameter for " sw
8500: 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20  itchname ", you 
8510: 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65  must specify the
8520: 20 74 61 72 67 65 74 20 77 69 74 68 20 2d 74 61   target with -ta
8530: 72 67 65 74 22 29 0a 20 20 20 20 20 20 28 65 78  rget").      (ex
8540: 69 74 20 33 29 29 0a 20 20 20 20 20 28 28 6e 6f  it 3)).     ((no
8550: 74 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 20  t runname).     
8560: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
8570: 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20  "ERROR: Missing 
8580: 72 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 74  required paramet
8590: 65 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e  er for " switchn
85a0: 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20  ame ", you must 
85b0: 73 70 65 63 69 66 79 20 74 68 65 20 72 75 6e 20  specify the run 
85c0: 6e 61 6d 65 20 77 69 74 68 20 3a 72 75 6e 6e 61  name with :runna
85d0: 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a 20 20 20  me runname").   
85e0: 20 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 20     (exit 3)).   
85f0: 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 28 6c    (else.      (l
8600: 65 74 20 28 28 64 62 20 20 20 23 66 29 0a 09 20  et ((db   #f).. 
8610: 20 20 20 28 6b 65 79 73 20 23 66 29 29 0a 09 28     (keys #f))..(
8620: 69 66 20 28 6e 6f 74 20 28 73 65 74 75 70 2d 66  if (not (setup-f
8630: 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 20 28 62  or-run))..    (b
8640: 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64 65  egin ..      (de
8650: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 46 61 69  bug:print 0 "Fai
8660: 6c 65 64 20 74 6f 20 73 65 74 75 70 2c 20 65 78  led to setup, ex
8670: 69 74 69 6e 67 22 29 0a 09 20 20 20 20 20 20 28  iting")..      (
8680: 65 78 69 74 20 31 29 29 29 0a 09 28 73 65 74 21  exit 1)))..(set!
8690: 20 64 62 20 20 20 28 6f 70 65 6e 2d 64 62 29 29   db   (open-db))
86a0: 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d  ..(if (args:get-
86b0: 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 0a 09  arg "-server")..
86c0: 20 20 20 20 28 73 65 72 76 65 72 3a 73 74 61 72      (server:star
86d0: 74 20 64 62 20 28 61 72 67 73 3a 67 65 74 2d 61  t db (args:get-a
86e0: 72 67 20 22 2d 73 65 72 76 65 72 22 29 29 0a 09  rg "-server"))..
86f0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6f 72      (if (not (or
8700: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
8710: 2d 72 75 6e 61 6c 6c 22 29 0a 09 09 09 20 20 28  -runall")....  (
8720: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72  args:get-arg "-r
8730: 75 6e 74 65 73 74 73 22 29 29 29 0a 09 09 28 73  untests")))...(s
8740: 65 72 76 65 72 3a 63 6c 69 65 6e 74 2d 73 65 74  erver:client-set
8750: 75 70 20 64 62 29 29 29 0a 09 28 73 65 74 21 20  up db)))..(set! 
8760: 6b 65 79 73 20 28 72 64 62 3a 67 65 74 2d 6b 65  keys (rdb:get-ke
8770: 79 73 20 64 62 29 29 0a 09 3b 3b 20 68 61 76 65  ys db))..;; have
8780: 20 65 6e 6f 75 67 68 20 74 6f 20 70 72 6f 63 65   enough to proce
8790: 73 73 20 2d 74 61 72 67 65 74 20 6f 72 20 2d 72  ss -target or -r
87a0: 65 71 74 61 72 67 20 68 65 72 65 0a 09 28 69 66  eqtarg here..(if
87b0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
87c0: 2d 72 65 71 74 61 72 67 22 29 0a 09 20 20 20 20  -reqtarg")..    
87d0: 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f 6e 66 69  (let* ((runconfi
87e0: 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61  gf (conc  *toppa
87f0: 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73  th* "/runconfigs
8800: 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b 20 44 4f  .config")) ;; DO
8810: 20 4e 4f 54 20 45 56 41 4c 55 41 54 45 20 41 4c   NOT EVALUATE AL
8820: 4c 20 0a 09 09 20 20 20 28 72 75 6e 63 6f 6e 66  L ...   (runconf
8830: 69 67 20 20 28 72 65 61 64 2d 63 6f 6e 66 69 67  ig  (read-config
8840: 20 72 75 6e 63 6f 6e 66 69 67 66 20 23 66 20 23   runconfigf #f #
8850: 66 20 65 6e 76 69 72 6f 6e 2d 70 61 74 74 3a 20  f environ-patt: 
8860: 23 66 29 29 29 20 0a 09 20 20 20 20 20 20 28 69  #f))) ..      (i
8870: 66 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65  f (hash-table-re
8880: 66 2f 64 65 66 61 75 6c 74 20 72 75 6e 63 6f 6e  f/default runcon
8890: 66 69 67 20 28 61 72 67 73 3a 67 65 74 2d 61 72  fig (args:get-ar
88a0: 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 23 66  g "-reqtarg") #f
88b0: 29 0a 09 09 20 20 28 6b 65 79 73 3a 74 61 72 67  )...  (keys:targ
88c0: 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 73  et-set-args keys
88d0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
88e0: 2d 72 65 71 74 61 72 67 22 29 20 61 72 67 73 3a  -reqtarg") args:
88f0: 61 72 67 2d 68 61 73 68 29 0a 09 09 20 20 28 62  arg-hash)...  (b
8900: 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65 62 75  egin...    (debu
8910: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
8920: 3a 20 5b 22 20 28 61 72 67 73 3a 67 65 74 2d 61  : [" (args:get-a
8930: 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 22  rg "-reqtarg") "
8940: 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69 6e 20 22  ] not found in "
8950: 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 09 20   runconfigf)... 
8960: 20 20 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61     (sqlite3:fina
8970: 6c 69 7a 65 21 20 64 62 29 0a 09 09 20 20 20 20  lize! db)...    
8980: 28 65 78 69 74 20 31 29 29 29 29 0a 09 20 20 20  (exit 1))))..   
8990: 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61   (if (args:get-a
89a0: 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09  rg "-target")...
89b0: 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74  (keys:target-set
89c0: 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 73  -args keys (args
89d0: 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65  :get-arg "-targe
89e0: 74 22 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68  t" args:arg-hash
89f0: 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29  ) args:arg-hash)
8a00: 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 63 61  ))..(if (not (ca
8a10: 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29  r *configinfo*))
8a20: 0a 09 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20  ..    (begin..  
8a30: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
8a40: 20 30 20 22 45 52 52 4f 52 3a 20 41 74 74 65 6d   0 "ERROR: Attem
8a50: 70 74 65 64 20 74 6f 20 22 20 61 63 74 69 6f 6e  pted to " action
8a60: 2d 64 65 73 63 20 22 20 62 75 74 20 72 75 6e 20  -desc " but run 
8a70: 61 72 65 61 20 63 6f 6e 66 69 67 20 66 69 6c 65  area config file
8a80: 20 6e 6f 74 20 66 6f 75 6e 64 22 29 0a 09 20 20   not found")..  
8a90: 20 20 20 20 28 65 78 69 74 20 31 29 29 0a 09 20      (exit 1)).. 
8aa0: 20 20 20 3b 3b 20 45 78 74 72 61 63 74 20 6f 75     ;; Extract ou
8ab0: 74 20 73 74 75 66 66 20 6e 65 65 64 65 64 20 69  t stuff needed i
8ac0: 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63  n most or many c
8ad0: 61 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 68 65 72  alls..    ;; her
8ae0: 65 20 74 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63  e then call proc
8af0: 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 6b 65  ..    (let* ((ke
8b00: 79 6e 61 6d 65 73 20 20 20 28 6d 61 70 20 6b 65  ynames   (map ke
8b10: 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20  y:get-fieldname 
8b20: 6b 65 79 73 29 29 0a 09 09 20 20 20 28 6b 65 79  keys))...   (key
8b30: 76 61 6c 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76  vallst  (keys->v
8b40: 61 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 29 29  allist keys #t))
8b50: 29 0a 09 20 20 20 20 20 20 28 70 72 6f 63 20 64  )..      (proc d
8b60: 62 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65  b target runname
8b70: 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73 20 6b   keys keynames k
8b80: 65 79 76 61 6c 6c 73 74 29 29 29 0a 09 28 69 66  eyvallst)))..(if
8b90: 20 74 68 31 20 28 74 68 72 65 61 64 2d 6a 6f 69   th1 (thread-joi
8ba0: 6e 21 20 74 68 31 29 29 0a 09 28 73 71 6c 69 74  n! th1))..(sqlit
8bb0: 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29  e3:finalize! db)
8bc0: 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f 6d 65  ..(set! *didsome
8bd0: 74 68 69 6e 67 2a 20 23 74 29 29 29 29 29 29 0a  thing* #t)))))).
8be0: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
8bf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8c00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8c10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8c20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c 6f 63  =========.;; Loc
8c30: 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73 0a 3b 3b  k/unlock runs.;;
8c40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8c50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8c60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8c70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8c80: 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20  ======..(define 
8c90: 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d 6c 6f 63  (runs:handle-loc
8ca0: 6b 69 6e 67 20 64 62 20 74 61 72 67 65 74 20 6b  king db target k
8cb0: 65 79 73 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b  eys runname lock
8cc0: 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 20 20   unlock user).  
8cd0: 28 6c 65 74 2a 20 28 28 72 75 6e 64 61 74 20 20  (let* ((rundat  
8ce0: 20 28 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d   (runs:get-runs-
8cf0: 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20  by-patt db keys 
8d00: 72 75 6e 6e 61 6d 65 29 29 0a 09 20 28 68 65 61  runname)).. (hea
8d10: 64 65 72 20 20 20 28 76 65 63 74 6f 72 2d 72 65  der   (vector-re
8d20: 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28  f rundat 0)).. (
8d30: 72 75 6e 73 20 20 20 20 20 28 76 65 63 74 6f 72  runs     (vector
8d40: 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 29  -ref rundat 1)))
8d50: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28  .    (for-each (
8d60: 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 09 09 28  lambda (run)...(
8d70: 6c 65 74 20 28 28 72 75 6e 2d 69 64 20 28 64 62  let ((run-id (db
8d80: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65  :get-value-by-he
8d90: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20  ader run header 
8da0: 22 69 64 22 29 29 29 0a 09 09 20 20 28 69 66 20  "id")))...  (if 
8db0: 28 6f 72 20 6c 6f 63 6b 0a 09 09 09 20 20 28 61  (or lock....  (a
8dc0: 6e 64 20 75 6e 6c 6f 63 6b 0a 09 09 09 20 20 20  nd unlock....   
8dd0: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09 20      (begin..... 
8de0: 28 70 72 69 6e 74 20 22 44 6f 20 79 6f 75 20 72  (print "Do you r
8df0: 65 61 6c 6c 79 20 77 69 73 68 20 74 6f 20 75 6e  eally wish to un
8e00: 6c 6f 63 6b 20 72 75 6e 20 22 20 72 75 6e 2d 69  lock run " run-i
8e10: 64 20 22 3f 5c 6e 20 20 20 79 2f 6e 3a 20 22 29  d "?\n   y/n: ")
8e20: 0a 09 09 09 09 20 28 65 71 75 61 6c 3f 20 22 79  ..... (equal? "y
8e30: 22 20 28 72 65 61 64 2d 6c 69 6e 65 29 29 29 29  " (read-line))))
8e40: 29 0a 09 09 20 20 20 20 20 20 28 64 62 3a 6c 6f  )...      (db:lo
8e50: 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 75 6e 20 64 62  ck/unlock-run db
8e60: 20 72 75 6e 2d 69 64 20 6c 6f 63 6b 20 75 6e 6c   run-id lock unl
8e70: 6f 63 6b 20 75 73 65 72 29 0a 09 09 20 20 20 20  ock user)...    
8e80: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
8e90: 20 22 49 4e 46 4f 3a 20 53 6b 69 70 70 69 6e 67   "INFO: Skipping
8ea0: 20 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e 20   lock/unlock on 
8eb0: 22 20 72 75 6e 2d 69 64 29 29 29 29 0a 09 20 20  " run-id))))..  
8ec0: 20 20 20 20 72 75 6e 73 29 29 29 0a 3b 3b 3d 3d      runs))).;;==
8ed0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8ee0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8ef0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8f00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8f10: 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72  ====.;; Rollup r
8f20: 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  uns.;;==========
8f30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8f40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8f50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8f60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b  ============..;;
8f70: 20 55 70 64 61 74 65 20 74 68 65 20 74 65 73 74   Update the test
8f80: 5f 6d 65 74 61 20 74 61 62 6c 65 20 66 6f 72 20  _meta table for 
8f90: 74 68 69 73 20 74 65 73 74 0a 28 64 65 66 69 6e  this test.(defin
8fa0: 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74  e (runs:update-t
8fb0: 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74  est_meta db test
8fc0: 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29  -name test-conf)
8fd0: 0a 20 20 28 6c 65 74 20 28 28 63 75 72 72 72 65  .  (let ((currre
8fe0: 63 6f 72 64 20 28 64 62 3a 74 65 73 74 6d 65 74  cord (db:testmet
8ff0: 61 2d 67 65 74 2d 72 65 63 6f 72 64 20 64 62 20  a-get-record db 
9000: 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20  test-name))).   
9010: 20 28 69 66 20 28 6e 6f 74 20 63 75 72 72 72 65   (if (not currre
9020: 63 6f 72 64 29 0a 09 28 62 65 67 69 6e 0a 09 20  cord)..(begin.. 
9030: 20 28 73 65 74 21 20 63 75 72 72 72 65 63 6f 72   (set! currrecor
9040: 64 20 28 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31  d (make-vector 1
9050: 30 20 23 66 29 29 0a 09 20 20 28 64 62 3a 74 65  0 #f))..  (db:te
9060: 73 74 6d 65 74 61 2d 61 64 64 2d 72 65 63 6f 72  stmeta-add-recor
9070: 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29  d db test-name))
9080: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20  ).    (for-each 
9090: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6b  .     (lambda (k
90a0: 65 79 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a  ey).       (let*
90b0: 20 28 28 69 64 78 20 28 63 61 64 72 20 6b 65 79   ((idx (cadr key
90c0: 29 29 0a 09 20 20 20 20 20 20 28 66 6c 64 20 28  ))..      (fld (
90d0: 63 61 72 20 20 6b 65 79 29 29 0a 09 20 20 20 20  car  key))..    
90e0: 20 20 28 76 61 6c 20 28 63 6f 6e 66 69 67 2d 6c    (val (config-l
90f0: 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20  ookup test-conf 
9100: 22 74 65 73 74 5f 6d 65 74 61 22 20 66 6c 64 29  "test_meta" fld)
9110: 29 29 0a 09 20 3b 3b 20 28 64 65 62 75 67 3a 70  )).. ;; (debug:p
9120: 72 69 6e 74 20 35 20 22 69 64 78 3a 20 22 20 69  rint 5 "idx: " i
9130: 64 78 20 22 20 66 6c 64 3a 20 22 20 66 6c 64 20  dx " fld: " fld 
9140: 22 20 76 61 6c 3a 20 22 20 76 61 6c 29 0a 09 20  " val: " val).. 
9150: 28 69 66 20 28 61 6e 64 20 76 61 6c 20 28 6e 6f  (if (and val (no
9160: 74 20 28 65 71 75 61 6c 3f 20 28 76 65 63 74 6f  t (equal? (vecto
9170: 72 2d 72 65 66 20 63 75 72 72 72 65 63 6f 72 64  r-ref currrecord
9180: 20 69 64 78 29 20 76 61 6c 29 29 29 0a 09 20 20   idx) val)))..  
9190: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20     (begin..     
91a0: 20 20 28 70 72 69 6e 74 20 22 55 70 64 61 74 69    (print "Updati
91b0: 6e 67 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22  ng " test-name "
91c0: 20 22 20 66 6c 64 20 22 20 74 6f 20 22 20 76 61   " fld " to " va
91d0: 6c 29 0a 09 20 20 20 20 20 20 20 28 64 62 3a 74  l)..       (db:t
91e0: 65 73 74 6d 65 74 61 2d 75 70 64 61 74 65 2d 66  estmeta-update-f
91f0: 69 65 6c 64 20 64 62 20 74 65 73 74 2d 6e 61 6d  ield db test-nam
9200: 65 20 66 6c 64 20 76 61 6c 29 29 29 29 29 0a 20  e fld val))))). 
9210: 20 20 20 20 27 28 28 22 61 75 74 68 6f 72 22 20      '(("author" 
9220: 32 29 28 22 6f 77 6e 65 72 22 20 33 29 28 22 64  2)("owner" 3)("d
9230: 65 73 63 72 69 70 74 69 6f 6e 22 20 34 29 28 22  escription" 4)("
9240: 72 65 76 69 65 77 65 64 22 20 35 29 28 22 74 61  reviewed" 5)("ta
9250: 67 73 22 20 39 29 29 29 29 29 0a 0a 3b 3b 20 55  gs" 9)))))..;; U
9260: 70 64 61 74 65 20 74 65 73 74 5f 6d 65 74 61 20  pdate test_meta 
9270: 66 6f 72 20 61 6c 6c 20 74 65 73 74 73 0a 28 64  for all tests.(d
9280: 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61  efine (runs:upda
9290: 74 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 61  te-all-test_meta
92a0: 20 64 62 29 0a 20 20 28 6c 65 74 20 28 28 74 65   db).  (let ((te
92b0: 73 74 2d 6e 61 6d 65 73 20 28 67 65 74 2d 61 6c  st-names (get-al
92c0: 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73 29 29 29  l-legal-tests)))
92d0: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a  .    (for-each .
92e0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65       (lambda (te
92f0: 73 74 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20 20  st-name).       
9300: 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 70 61 74  (let* ((test-pat
9310: 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70  h    (conc *topp
9320: 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74  ath* "/tests/" t
9330: 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20 20 20 20  est-name))..    
9340: 20 20 28 74 65 73 74 2d 63 6f 6e 66 69 67 66 20    (test-configf 
9350: 28 63 6f 6e 63 20 74 65 73 74 2d 70 61 74 68 20  (conc test-path 
9360: 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29 0a  "/testconfig")).
9370: 09 20 20 20 20 20 20 28 74 65 73 74 65 78 69 73  .      (testexis
9380: 74 73 20 20 20 28 61 6e 64 20 28 66 69 6c 65 2d  ts   (and (file-
9390: 65 78 69 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e  exists? test-con
93a0: 66 69 67 66 29 28 66 69 6c 65 2d 72 65 61 64 2d  figf)(file-read-
93b0: 61 63 63 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e  access? test-con
93c0: 66 69 67 66 29 29 29 0a 09 20 20 20 20 20 20 3b  figf)))..      ;
93d0: 3b 20 72 65 61 64 20 63 6f 6e 66 69 67 73 20 77  ; read configs w
93e0: 69 74 68 20 74 72 69 63 6b 73 20 74 75 72 6e 65  ith tricks turne
93f0: 64 20 6f 66 66 20 28 69 2e 65 2e 20 6e 6f 20 73  d off (i.e. no s
9400: 79 73 74 65 6d 29 0a 09 20 20 20 20 20 20 28 74  ystem)..      (t
9410: 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 20  est-conf    (if 
9420: 74 65 73 74 65 78 69 73 74 73 20 28 72 65 61 64  testexists (read
9430: 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e  -config test-con
9440: 66 69 67 66 20 23 66 20 23 66 29 28 6d 61 6b 65  figf #f #f)(make
9450: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 29 0a  -hash-table)))).
9460: 09 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74  . (runs:update-t
9470: 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74  est_meta db test
9480: 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29  -name test-conf)
9490: 29 29 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 6d  )).     test-nam
94a0: 65 73 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63  es)))..;; This c
94b0: 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 65  ould probably be
94c0: 20 72 65 66 61 63 74 6f 72 65 64 20 69 6e 74 6f   refactored into
94d0: 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75 65   one complex que
94e0: 72 79 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28  ry ....(define (
94f0: 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20  runs:rollup-run 
9500: 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73  db keys keyvalls
9510: 74 20 72 75 6e 6e 61 6d 65 20 75 73 65 72 29 20  t runname user) 
9520: 3b 3b 20 77 61 73 20 74 61 72 67 65 74 2c 20 6e  ;; was target, n
9530: 6f 77 20 6b 65 79 76 61 6c 6c 73 74 0a 20 20 28  ow keyvallst.  (
9540: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 72  debug:print 4 "r
9550: 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20  uns:rollup-run, 
9560: 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22 20 6b  keys: " keys " k
9570: 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76  eyvallst: " keyv
9580: 61 6c 6c 73 74 20 22 20 3a 72 75 6e 6e 61 6d 65  allst " :runname
9590: 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 75 73 65   " runname " use
95a0: 72 3a 20 22 20 75 73 65 72 29 0a 20 20 28 6c 65  r: " user).  (le
95b0: 74 2a 20 28 3b 20 28 6b 65 79 76 61 6c 6c 6c 73  t* (; (keyvallls
95c0: 74 20 20 20 20 20 20 28 6b 65 79 73 3a 74 61 72  t      (keys:tar
95d0: 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73  get->keyval keys
95e0: 20 74 61 72 67 65 74 29 29 0a 09 20 28 6e 65 77   target)).. (new
95f0: 2d 72 75 6e 2d 69 64 20 20 20 20 20 20 28 72 75  -run-id      (ru
9600: 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20  ns:register-run 
9610: 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73  db keys keyvalls
9620: 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20  t runname "new" 
9630: 22 6e 2f 61 22 20 75 73 65 72 29 29 0a 09 20 28  "n/a" user)).. (
9640: 70 72 65 76 2d 74 65 73 74 73 20 20 20 20 20 20  prev-tests      
9650: 28 74 65 73 74 3a 67 65 74 2d 6d 61 74 63 68 69  (test:get-matchi
9660: 6e 67 2d 70 72 65 76 69 6f 75 73 2d 74 65 73 74  ng-previous-test
9670: 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 62 20  -run-records db 
9680: 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 22  new-run-id "%" "
9690: 25 22 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73  %")).. (curr-tes
96a0: 74 73 20 20 20 20 20 20 28 72 64 62 3a 67 65 74  ts      (rdb:get
96b0: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64  -tests-for-run d
96c0: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22  b new-run-id "%"
96d0: 20 22 25 22 20 27 28 29 20 27 28 29 29 29 0a 09   "%" '() '()))..
96e0: 20 28 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73   (curr-tests-has
96f0: 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62  h (make-hash-tab
9700: 6c 65 29 29 29 0a 20 20 20 20 28 64 62 3a 75 70  le))).    (db:up
9710: 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e 74 5f 74  date-run-event_t
9720: 69 6d 65 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69  ime db new-run-i
9730: 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64 65 78 20  d).    ;; index 
9740: 74 68 65 20 61 6c 72 65 61 64 79 20 73 61 76 65  the already save
9750: 64 20 74 65 73 74 73 20 62 79 20 74 65 73 74 6e  d tests by testn
9760: 61 6d 65 20 61 6e 64 20 69 74 65 6d 64 61 74 20  ame and itemdat 
9770: 69 6e 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61  in curr-tests-ha
9780: 73 68 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  sh.    (for-each
9790: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74  .     (lambda (t
97a0: 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28  estdat).       (
97b0: 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20  let* ((testname 
97c0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
97d0: 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29  stname testdat))
97e0: 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61  ..      (item-pa
97f0: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  th (db:test-get-
9800: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61  item-path testda
9810: 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c  t))..      (full
9820: 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74  -name (conc test
9830: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
9840: 74 68 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61  th))).. (hash-ta
9850: 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65  ble-set! curr-te
9860: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61  sts-hash full-na
9870: 6d 65 20 74 65 73 74 64 61 74 29 29 29 0a 20 20  me testdat))).  
9880: 20 20 20 63 75 72 72 2d 74 65 73 74 73 29 0a 20     curr-tests). 
9890: 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d     ;; NOPE: Non-
98a0: 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f 61 63 68  optimal approach
98b0: 2e 20 54 72 79 20 74 68 69 73 20 69 6e 73 74 65  . Try this inste
98c0: 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20 31 2e 20  ad..    ;;   1. 
98d0: 74 65 73 74 73 20 61 72 65 20 72 65 63 65 69 76  tests are receiv
98e0: 65 64 20 69 6e 20 61 20 6c 69 73 74 2c 20 6d 6f  ed in a list, mo
98f0: 73 74 20 72 65 63 65 6e 74 20 66 69 72 73 74 0a  st recent first.
9900: 20 20 20 20 3b 3b 20 20 20 32 2e 20 72 65 70 6c      ;;   2. repl
9910: 61 63 65 20 74 68 65 20 72 6f 6c 6c 75 70 20 74  ace the rollup t
9920: 65 73 74 20 77 69 74 68 20 74 68 65 20 6e 65 77  est with the new
9930: 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20 20 28 66   *always*.    (f
9940: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c  or-each .     (l
9950: 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a  ambda (testdat).
9960: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74         (let* ((t
9970: 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73  estname  (db:tes
9980: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  t-get-testname t
9990: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20  estdat))..      
99a0: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74  (item-path (db:t
99b0: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74  est-get-item-pat
99c0: 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  h testdat))..   
99d0: 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63     (full-name (c
99e0: 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22  onc testname "/"
99f0: 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20   item-path))..  
9a00: 20 20 20 20 28 70 72 65 76 2d 74 65 73 74 2d 64      (prev-test-d
9a10: 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72  at (hash-table-r
9a20: 65 66 2f 64 65 66 61 75 6c 74 20 63 75 72 72 2d  ef/default curr-
9a30: 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d  tests-hash full-
9a40: 6e 61 6d 65 20 23 66 29 29 0a 09 20 20 20 20 20  name #f))..     
9a50: 20 28 74 65 73 74 2d 73 74 65 70 73 20 20 20 20   (test-steps    
9a60: 20 20 28 64 62 3a 67 65 74 2d 73 74 65 70 73 2d    (db:get-steps-
9a70: 66 6f 72 2d 74 65 73 74 20 64 62 20 28 64 62 3a  for-test db (db:
9a80: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
9a90: 64 61 74 29 29 29 0a 09 20 20 20 20 20 20 28 6e  dat)))..      (n
9aa0: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23  ew-test-record #
9ab0: 66 29 29 0a 09 20 3b 3b 20 72 65 70 6c 61 63 65  f)).. ;; replace
9ac0: 20 74 68 65 73 65 20 77 69 74 68 20 69 6e 73 65   these with inse
9ad0: 72 74 20 2e 2e 2e 20 73 65 6c 65 63 74 0a 09 20  rt ... select.. 
9ae0: 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65  (apply sqlite3:e
9af0: 78 65 63 75 74 65 20 0a 09 09 64 62 20 0a 09 09  xecute ...db ...
9b00: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52  (conc "INSERT OR
9b10: 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65   REPLACE INTO te
9b20: 73 74 73 20 28 72 75 6e 5f 69 64 2c 74 65 73 74  sts (run_id,test
9b30: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75  name,state,statu
9b40: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 68 6f 73  s,event_time,hos
9b50: 74 2c 63 70 75 6c 6f 61 64 2c 64 69 73 6b 66 72  t,cpuload,diskfr
9b60: 65 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 69 72 2c  ee,uname,rundir,
9b70: 69 74 65 6d 5f 70 61 74 68 2c 72 75 6e 5f 64 75  item_path,run_du
9b80: 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67  ration,final_log
9b90: 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20  f,comment) "... 
9ba0: 20 20 20 20 20 22 56 41 4c 55 45 53 20 28 3f 2c       "VALUES (?,
9bb0: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c  ?,?,?,?,?,?,?,?,
9bc0: 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09  ?,?,?,?,?);")...
9bd0: 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 64 64 72  new-run-id (cddr
9be0: 20 28 76 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74   (vector->list t
9bf0: 65 73 74 64 61 74 29 29 29 0a 09 20 28 73 65 74  estdat))).. (set
9c00: 21 20 6e 65 77 2d 74 65 73 74 64 61 74 20 28 63  ! new-testdat (c
9c10: 61 72 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74  ar (rdb:get-test
9c20: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77  s-for-run db new
9c30: 2d 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65  -run-id testname
9c40: 20 69 74 65 6d 2d 70 61 74 68 20 27 28 29 20 27   item-path '() '
9c50: 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61  ()))).. (hash-ta
9c60: 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65  ble-set! curr-te
9c70: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61  sts-hash full-na
9c80: 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20  me new-testdat) 
9c90: 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65  ;; this could be
9ca0: 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 63   confusing, whic
9cb0: 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 20  h record should 
9cc0: 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b  go into the look
9cd0: 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e  up table?.. ;; N
9ce0: 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65  ow duplicate the
9cf0: 20 74 65 73 74 20 73 74 65 70 73 0a 09 20 28 64   test steps.. (d
9d00: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f  ebug:print 4 "Co
9d10: 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e  pying records in
9d20: 20 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f 6d   test_steps from
9d30: 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74   test_id=" (db:t
9d40: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
9d50: 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74  at) " to " (db:t
9d60: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74  est-get-id new-t
9d70: 65 73 74 64 61 74 29 29 0a 09 20 28 73 71 6c 69  estdat)).. (sqli
9d80: 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20  te3:execute ..  
9d90: 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e  db ..  (conc "IN
9da0: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20  SERT OR REPLACE 
9db0: 49 4e 54 4f 20 74 65 73 74 5f 73 74 65 70 73 20  INTO test_steps 
9dc0: 28 74 65 73 74 5f 69 64 2c 73 74 65 70 6e 61 6d  (test_id,stepnam
9dd0: 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65  e,state,status,e
9de0: 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e  vent_time,commen
9df0: 74 29 20 22 0a 09 09 22 53 45 4c 45 43 54 20 22  t) "..."SELECT "
9e00: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
9e10: 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c   new-testdat) ",
9e20: 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73  stepname,state,s
9e30: 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65  tatus,event_time
9e40: 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65  ,comment FROM te
9e50: 73 74 5f 73 74 65 70 73 20 57 48 45 52 45 20 74  st_steps WHERE t
9e60: 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 28  est_id=?;")..  (
9e70: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
9e80: 65 73 74 64 61 74 29 29 0a 09 20 3b 3b 20 4e 6f  estdat)).. ;; No
9e90: 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65 20  w duplicate the 
9ea0: 74 65 73 74 20 64 61 74 61 0a 09 20 28 64 65 62  test data.. (deb
9eb0: 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79  ug:print 4 "Copy
9ec0: 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74  ing records in t
9ed0: 65 73 74 5f 64 61 74 61 20 66 72 6f 6d 20 74 65  est_data from te
9ee0: 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74  st_id=" (db:test
9ef0: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29  -get-id testdat)
9f00: 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74   " to " (db:test
9f10: 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74  -get-id new-test
9f20: 64 61 74 29 29 0a 09 20 28 73 71 6c 69 74 65 33  dat)).. (sqlite3
9f30: 3a 65 78 65 63 75 74 65 20 0a 09 20 20 64 62 20  :execute ..  db 
9f40: 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52  ..  (conc "INSER
9f50: 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54  T OR REPLACE INT
9f60: 4f 20 74 65 73 74 5f 64 61 74 61 20 28 74 65 73  O test_data (tes
9f70: 74 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61  t_id,category,va
9f80: 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70  riable,value,exp
9f90: 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c  ected,tol,units,
9fa0: 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 22 53 45  comment) "..."SE
9fb0: 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d  LECT " (db:test-
9fc0: 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64  get-id new-testd
9fd0: 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79 2c 76  at) ",category,v
9fe0: 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78  ariable,value,ex
9ff0: 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73  pected,tol,units
a000: 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65  ,comment FROM te
a010: 73 74 5f 64 61 74 61 20 57 48 45 52 45 20 74 65  st_data WHERE te
a020: 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 28 64  st_id=?;")..  (d
a030: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
a040: 73 74 64 61 74 29 29 0a 09 20 29 29 0a 20 20 20  stdat)).. )).   
a050: 20 20 70 72 65 76 2d 74 65 73 74 73 29 29 29 0a    prev-tests))).
a060: 09 20 0a 20 20 20 20 20 0a                       . .     .