Megatest

Hex Artifact Content
Login

Artifact d1cf09ce49f1ea3825b57ff1b42835728ba0bfb7:


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 6e 6f 77 20 61 64 64 20 6e 6f 6e    ;; now add non
2230: 2d 64 69 72 65 63 74 6c 79 20 72 65 66 65 72 65  -directly refere
2240: 6e 63 65 64 20 64 65 70 65 6e 64 65 6e 63 69 65  nced dependencie
2250: 73 20 28 69 2e 65 2e 20 77 61 69 74 6f 6e 29 0a  s (i.e. waiton).
2260: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75      (if (not (nu
2270: 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  ll? test-names))
2280: 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65  ..(let loop ((he
2290: 64 20 28 63 61 72 20 74 65 73 74 2d 6e 61 6d 65  d (car test-name
22a0: 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 28 63  s))...   (tal (c
22b0: 64 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29  dr test-names)))
22c0: 20 20 20 20 20 20 20 20 20 3b 3b 20 27 72 65 74           ;; 'ret
22d0: 75 72 6e 2d 70 72 6f 63 73 20 74 65 6c 6c 73 20  urn-procs tells 
22e0: 74 68 65 20 63 6f 6e 66 69 67 20 72 65 61 64 65  the config reade
22f0: 72 20 74 6f 20 70 72 65 70 20 72 75 6e 6e 69 6e  r to prep runnin
2300: 67 20 73 79 73 74 65 6d 20 62 75 74 20 72 65 74  g system but ret
2310: 75 72 6e 20 61 20 70 72 6f 63 0a 09 20 20 28 6c  urn a proc..  (l
2320: 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20 28 74  et* ((config  (t
2330: 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e  ests:get-testcon
2340: 66 69 67 20 68 65 64 20 27 72 65 74 75 72 6e 2d  fig hed 'return-
2350: 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61 69 74  procs))... (wait
2360: 6f 6e 73 20 28 69 66 20 63 6f 6e 66 69 67 20 28  ons (if config (
2370: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 6c 65  string-split (le
2380: 74 20 28 28 77 20 28 63 6f 6e 66 69 67 2d 6c 6f  t ((w (config-lo
2390: 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 65 71  okup config "req
23a0: 75 69 72 65 6d 65 6e 74 73 22 20 22 77 61 69 74  uirements" "wait
23b0: 6f 6e 22 29 29 29 0a 09 09 09 09 09 09 20 20 20  on"))).......   
23c0: 20 20 28 69 66 20 77 20 77 20 22 22 29 29 29 0a    (if w w ""))).
23d0: 09 09 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a  ...      (begin.
23e0: 09 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ....(debug:print
23f0: 20 30 20 22 45 52 52 4f 52 3a 20 6e 6f 6e 2d 65   0 "ERROR: non-e
2400: 78 69 73 74 65 6e 74 20 72 65 71 75 69 72 65 64  xistent required
2410: 20 74 65 73 74 20 5c 22 22 20 68 65 64 20 22 5c   test \"" hed "\
2420: 22 22 29 0a 20 20 20 20 20 20 20 20 20 20 20 20  "").            
2430: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2440: 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 69 6e      (sqlite3:fin
2450: 61 6c 69 7a 65 21 20 64 62 29 0a 09 09 09 09 28  alize! db).....(
2460: 65 78 69 74 20 31 29 29 29 29 29 0a 09 20 20 20  exit 1)))))..   
2470: 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65   ;; check for he
2480: 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20  d in waitons => 
2490: 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69  this would be ci
24a0: 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69  rcular, remove i
24b0: 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09  t and issue an..
24c0: 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20      ;; error..  
24d0: 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20 68 65    (if (member he
24e0: 64 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62 65  d waitons)...(be
24f0: 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70  gin...  (debug:p
2500: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74  rint 0 "ERROR: t
2510: 65 73 74 20 22 20 68 65 64 20 22 20 68 61 73 20  est " hed " has 
2520: 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20 61 73  listed itself as
2530: 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61 73   a waiton, pleas
2540: 65 20 63 6f 72 72 65 63 74 20 74 68 69 73 21 22  e correct this!"
2550: 29 0a 09 09 20 20 28 73 65 74 21 20 77 61 69 74  )...  (set! wait
2560: 6f 6e 73 20 28 66 69 6c 74 65 72 20 28 6c 61 6d  ons (filter (lam
2570: 62 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71 75  bda (x)(not (equ
2580: 61 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61 69  al? x hed))) wai
2590: 74 6f 6e 73 29 29 29 29 0a 09 20 20 20 20 0a 09  tons))))..    ..
25a0: 20 20 20 20 3b 3b 20 28 69 74 65 6d 73 20 20 20      ;; (items   
25b0: 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73  (items:get-items
25c0: 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e  -from-config con
25d0: 66 69 67 29 29 29 0a 09 20 20 20 20 28 69 66 20  fig)))..    (if 
25e0: 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65  (not (hash-table
25f0: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73  -ref/default tes
2600: 74 2d 72 65 63 6f 72 64 73 20 68 65 64 20 23 66  t-records hed #f
2610: 29 29 0a 09 09 28 68 61 73 68 2d 74 61 62 6c 65  ))...(hash-table
2620: 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f 72  -set! test-recor
2630: 64 73 0a 09 09 09 09 20 68 65 64 20 28 76 65 63  ds..... hed (vec
2640: 74 6f 72 20 68 65 64 20 20 20 20 20 3b 3b 20 30  tor hed     ;; 0
2650: 0a 09 09 09 09 09 20 20 20 20 20 63 6f 6e 66 69  ......     confi
2660: 67 20 20 3b 3b 20 31 0a 09 09 09 09 09 20 20 20  g  ;; 1......   
2670: 20 20 77 61 69 74 6f 6e 73 20 3b 3b 20 32 0a 09    waitons ;; 2..
2680: 09 09 09 09 20 20 20 20 20 28 63 6f 6e 66 69 67  ....     (config
2690: 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22  -lookup config "
26a0: 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 70  requirements" "p
26b0: 72 69 6f 72 69 74 79 22 29 20 20 20 20 20 3b 3b  riority")     ;;
26c0: 20 70 72 69 6f 72 69 74 79 20 33 0a 09 09 09 09   priority 3.....
26d0: 09 20 20 20 20 20 28 6c 65 74 20 28 28 69 74 65  .     (let ((ite
26e0: 6d 73 20 20 20 20 20 20 28 68 61 73 68 2d 74 61  ms      (hash-ta
26f0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
2700: 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 22 20 23  config "items" #
2710: 66 29 29 20 3b 3b 20 69 74 65 6d 73 20 34 0a 09  f)) ;; items 4..
2720: 09 09 09 09 09 20 20 20 28 69 74 65 6d 73 74 61  .....   (itemsta
2730: 62 6c 65 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  ble (hash-table-
2740: 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66  ref/default conf
2750: 69 67 20 22 69 74 65 6d 73 74 61 62 6c 65 22 20  ig "itemstable" 
2760: 23 66 29 29 29 20 0a 09 09 09 09 09 20 20 20 20  #f))) ......    
2770: 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20     ;; if either 
2780: 69 74 65 6d 73 20 6f 72 20 69 74 65 6d 73 20 74  items or items t
2790: 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63 20 72  able is a proc r
27a0: 65 74 75 72 6e 20 69 74 20 73 6f 20 74 65 73 74  eturn it so test
27b0: 20 72 75 6e 6e 69 6e 67 0a 09 09 09 09 09 20 20   running......  
27c0: 20 20 20 20 20 3b 3b 20 70 72 6f 63 65 73 73 20       ;; process 
27d0: 63 61 6e 20 6b 6e 6f 77 20 74 6f 20 63 61 6c 6c  can know to call
27e0: 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73   items:get-items
27f0: 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09 09 09  -from-config....
2800: 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20 65  ..       ;; if e
2810: 69 74 68 65 72 20 69 73 20 61 20 6c 69 73 74 20  ither is a list 
2820: 61 6e 64 20 6e 6f 6e 65 20 69 73 20 61 20 70 72  and none is a pr
2830: 6f 63 20 67 6f 20 61 68 65 61 64 20 61 6e 64 20  oc go ahead and 
2840: 63 61 6c 6c 20 67 65 74 2d 69 74 65 6d 73 0a 09  call get-items..
2850: 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 6f 74  ....       ;; ot
2860: 68 65 72 77 69 73 65 20 72 65 74 75 72 6e 20 23  herwise return #
2870: 66 20 2d 20 74 68 69 73 20 69 73 20 6e 6f 74 20  f - this is not 
2880: 61 6e 20 69 74 65 72 61 74 65 64 20 74 65 73 74  an iterated test
2890: 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 63 6f  ......       (co
28a0: 6e 64 0a 09 09 09 09 09 09 28 28 70 72 6f 63 65  nd.......((proce
28b0: 64 75 72 65 3f 20 69 74 65 6d 73 29 20 20 20 20  dure? items)    
28c0: 20 20 0a 09 09 09 09 09 09 20 28 64 65 62 75 67    ....... (debug
28d0: 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20  :print 4 "INFO: 
28e0: 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63 65  items is a proce
28f0: 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20  dure, will calc 
2900: 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 20 69  later")....... i
2910: 74 65 6d 73 29 20 20 20 20 20 20 20 20 20 20 20  tems)           
2920: 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a 09   ;; calc later..
2930: 09 09 09 09 09 28 28 70 72 6f 63 65 64 75 72 65  .....((procedure
2940: 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 09  ? itemstable)...
2950: 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e  .... (debug:prin
2960: 74 20 34 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73  t 4 "INFO: items
2970: 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63 65  table is a proce
2980: 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20  dure, will calc 
2990: 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 20 69  later")....... i
29a0: 74 65 6d 73 74 61 62 6c 65 29 20 20 20 20 20 20  temstable)      
29b0: 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a 09   ;; calc later..
29c0: 09 09 09 09 09 28 28 66 69 6c 74 65 72 20 28 6c  .....((filter (l
29d0: 61 6d 62 64 61 20 28 78 29 0a 09 09 09 09 09 09  ambda (x).......
29e0: 09 20 20 20 28 6c 65 74 20 28 28 76 61 6c 20 28  .   (let ((val (
29f0: 63 61 72 20 78 29 29 29 0a 09 09 09 09 09 09 09  car x)))........
2a00: 20 20 20 20 20 28 69 66 20 28 70 72 6f 63 65 64       (if (proced
2a10: 75 72 65 3f 20 76 61 6c 29 20 76 61 6c 20 23 66  ure? val) val #f
2a20: 29 29 29 0a 09 09 09 09 09 09 09 20 28 61 70 70  )))........ (app
2a30: 65 6e 64 20 28 69 66 20 28 6c 69 73 74 3f 20 69  end (if (list? i
2a40: 74 65 6d 73 29 20 69 74 65 6d 73 20 27 28 29 29  tems) items '())
2a50: 0a 09 09 09 09 09 09 09 09 20 28 69 66 20 28 6c  ......... (if (l
2a60: 69 73 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29  ist? itemstable)
2a70: 20 69 74 65 6d 73 74 61 62 6c 65 20 27 28 29 29   itemstable '())
2a80: 29 29 0a 09 09 09 09 09 09 20 27 68 61 76 65 2d  ))....... 'have-
2a90: 70 72 6f 63 65 64 75 72 65 29 0a 09 09 09 09 09  procedure)......
2aa0: 09 28 28 6f 72 20 28 6c 69 73 74 3f 20 69 74 65  .((or (list? ite
2ab0: 6d 73 29 28 6c 69 73 74 3f 20 69 74 65 6d 73 74  ms)(list? itemst
2ac0: 61 62 6c 65 29 29 20 3b 3b 20 63 61 6c 63 20 6e  able)) ;; calc n
2ad0: 6f 77 0a 09 09 09 09 09 09 20 28 64 65 62 75 67  ow....... (debug
2ae0: 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20  :print 4 "INFO: 
2af0: 69 74 65 6d 73 20 61 6e 64 20 69 74 65 6d 73 74  items and itemst
2b00: 61 62 6c 65 20 61 72 65 20 6c 69 73 74 73 2c 20  able are lists, 
2b10: 63 61 6c 63 20 6e 6f 77 5c 6e 22 0a 09 09 09 09  calc now\n".....
2b20: 09 09 09 20 20 20 20 20 20 22 20 20 20 20 69 74  ...      "    it
2b30: 65 6d 73 3a 20 22 20 69 74 65 6d 73 20 22 20 69  ems: " items " i
2b40: 74 65 6d 73 74 61 62 6c 65 3a 20 22 20 69 74 65  temstable: " ite
2b50: 6d 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09 20  mstable)....... 
2b60: 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73  (items:get-items
2b70: 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e  -from-config con
2b80: 66 69 67 29 29 0a 09 09 09 09 09 09 28 65 6c 73  fig)).......(els
2b90: 65 20 23 66 29 29 29 20 20 20 20 20 20 20 20 20  e #f)))         
2ba0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2bb0: 20 20 3b 3b 20 6e 6f 74 20 69 74 65 72 61 74 65    ;; not iterate
2bc0: 64 0a 09 09 09 09 09 20 20 20 20 20 23 66 20 20  d......     #f  
2bd0: 20 20 20 20 3b 3b 20 69 74 65 6d 73 64 61 74 20      ;; itemsdat 
2be0: 35 0a 09 09 09 09 09 20 20 20 20 20 23 66 20 20  5......     #f  
2bf0: 20 20 20 20 3b 3b 20 73 70 61 72 65 20 2d 20 75      ;; spare - u
2c00: 73 65 64 20 66 6f 72 20 69 74 65 6d 2d 70 61 74  sed for item-pat
2c10: 68 0a 09 09 09 09 09 20 20 20 20 20 29 29 29 0a  h......     ))).
2c20: 09 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a  .    (for-each .
2c30: 09 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 77  .     (lambda (w
2c40: 61 69 74 6f 6e 29 0a 09 20 20 20 20 20 20 20 28  aiton)..       (
2c50: 69 66 20 28 61 6e 64 20 77 61 69 74 6f 6e 20 28  if (and waiton (
2c60: 6e 6f 74 20 28 6d 65 6d 62 65 72 20 77 61 69 74  not (member wait
2c70: 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29  on test-names)))
2c80: 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20  ...   (begin... 
2c90: 20 20 20 20 28 73 65 74 21 20 72 65 71 75 69 72      (set! requir
2ca0: 65 64 2d 74 65 73 74 73 20 28 63 6f 6e 73 20 77  ed-tests (cons w
2cb0: 61 69 74 6f 6e 20 72 65 71 75 69 72 65 64 2d 74  aiton required-t
2cc0: 65 73 74 73 29 29 0a 09 09 20 20 20 20 20 28 73  ests))...     (s
2cd0: 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28  et! test-names (
2ce0: 63 6f 6e 73 20 77 61 69 74 6f 6e 20 74 65 73 74  cons waiton test
2cf0: 2d 6e 61 6d 65 73 29 29 29 29 29 20 3b 3b 20 77  -names))))) ;; w
2d00: 61 73 20 61 6e 20 61 70 70 65 6e 64 2c 20 6e 6f  as an append, no
2d10: 77 20 61 20 63 6f 6e 73 0a 09 20 20 20 20 20 77  w a cons..     w
2d20: 61 69 74 6f 6e 73 29 0a 09 20 20 20 20 28 6c 65  aitons)..    (le
2d30: 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 64 65  t ((remtests (de
2d40: 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 20  lete-duplicates 
2d50: 28 61 70 70 65 6e 64 20 77 61 69 74 6f 6e 73 20  (append waitons 
2d60: 74 61 6c 29 29 29 29 0a 09 20 20 20 20 20 20 28  tal))))..      (
2d70: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72  if (not (null? r
2d80: 65 6d 74 65 73 74 73 29 29 0a 09 09 20 20 28 6c  emtests))...  (l
2d90: 6f 6f 70 20 28 63 61 72 20 72 65 6d 74 65 73 74  oop (car remtest
2da0: 73 29 28 63 64 72 20 72 65 6d 74 65 73 74 73 29  s)(cdr remtests)
2db0: 29 29 29 29 29 29 0a 0a 20 20 20 20 28 69 66 20  ))))))..    (if 
2dc0: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 71 75  (not (null? requ
2dd0: 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09 28 64  ired-tests))..(d
2de0: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e  ebug:print 1 "IN
2df0: 46 4f 3a 20 41 64 64 69 6e 67 20 22 20 72 65 71  FO: Adding " req
2e00: 75 69 72 65 64 2d 74 65 73 74 73 20 22 20 74 6f  uired-tests " to
2e10: 20 74 68 65 20 72 75 6e 20 71 75 65 75 65 22 29   the run queue")
2e20: 29 0a 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 74  ).    ;; NOTE: t
2e30: 68 65 73 65 20 61 72 65 20 61 6c 6c 20 70 61 72  hese are all par
2e40: 65 6e 74 20 74 65 73 74 73 2c 20 69 74 65 6d 73  ent tests, items
2e50: 20 61 72 65 20 6e 6f 74 20 65 78 70 61 6e 64 65   are not expande
2e60: 64 20 79 65 74 2e 0a 20 20 20 20 28 72 75 6e 73  d yet..    (runs
2e70: 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75 65  :run-tests-queue
2e80: 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61   db run-id runna
2e90: 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20  me test-records 
2ea0: 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 29  keyvallst flags)
2eb0: 0a 20 20 20 20 28 69 66 20 2a 72 70 63 3a 6c 69  .    (if *rpc:li
2ec0: 73 74 65 6e 65 72 2a 20 28 73 65 72 76 65 72 3a  stener* (server:
2ed0: 6b 65 65 70 2d 72 75 6e 6e 69 6e 67 20 64 62 29  keep-running db)
2ee0: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ).    (debug:pri
2ef0: 6e 74 20 34 20 22 49 4e 46 4f 3a 20 41 6c 6c 20  nt 4 "INFO: All 
2f00: 64 6f 6e 65 20 62 79 20 68 65 72 65 22 29 29 29  done by here")))
2f10: 0a 0a 3b 3b 20 74 65 73 74 2d 72 65 63 6f 72 64  ..;; test-record
2f20: 73 20 69 73 20 61 20 68 61 73 68 20 74 61 62 6c  s is a hash tabl
2f30: 65 20 74 65 73 74 6e 61 6d 65 3a 69 74 65 6d 5f  e testname:item_
2f40: 70 61 74 68 20 3d 3e 20 76 65 63 74 6f 72 20 3c  path => vector <
2f50: 20 74 65 73 74 6e 61 6d 65 20 74 65 73 74 63 6f   testname testco
2f60: 6e 66 69 67 20 77 61 69 74 6f 6e 73 20 70 72 69  nfig waitons pri
2f70: 6f 72 69 74 79 20 69 74 65 6d 73 2d 69 6e 66 6f  ority items-info
2f80: 20 2e 2e 2e 20 3e 0a 28 64 65 66 69 6e 65 20 28   ... >.(define (
2f90: 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71  runs:run-tests-q
2fa0: 75 65 75 65 20 64 62 20 72 75 6e 2d 69 64 20 72  ueue db run-id r
2fb0: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f  unname test-reco
2fc0: 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c  rds keyvallst fl
2fd0: 61 67 73 29 0a 20 20 20 20 3b 3b 20 41 74 20 74  ags).    ;; At t
2fe0: 68 69 73 20 70 6f 69 6e 74 20 74 68 65 20 6c 69  his point the li
2ff0: 73 74 20 6f 66 20 70 61 72 65 6e 74 20 74 65 73  st of parent tes
3000: 74 73 20 69 73 20 65 78 70 61 6e 64 65 64 20 0a  ts is expanded .
3010: 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75      ;; NB// Shou
3020: 6c 64 20 65 78 70 61 6e 64 20 69 74 65 6d 73 20  ld expand items 
3030: 68 65 72 65 20 61 6e 64 20 74 68 65 6e 20 69 6e  here and then in
3040: 73 65 72 74 20 69 6e 74 6f 20 74 68 65 20 72 75  sert into the ru
3050: 6e 20 71 75 65 75 65 2e 0a 20 20 28 64 65 62 75  n queue..  (debu
3060: 67 3a 70 72 69 6e 74 20 35 20 22 74 65 73 74 2d  g:print 5 "test-
3070: 72 65 63 6f 72 64 73 3a 20 22 20 74 65 73 74 2d  records: " test-
3080: 72 65 63 6f 72 64 73 20 22 2c 20 6b 65 79 76 61  records ", keyva
3090: 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73  llst: " keyvalls
30a0: 74 20 22 20 66 6c 61 67 73 3a 20 22 20 28 68 61  t " flags: " (ha
30b0: 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20  sh-table->alist 
30c0: 66 6c 61 67 73 29 29 0a 20 20 28 6c 65 74 20 28  flags)).  (let (
30d0: 28 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d  (sorted-test-nam
30e0: 65 73 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62  es (tests:sort-b
30f0: 79 2d 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77  y-priority-and-w
3100: 61 69 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72  aiton test-recor
3110: 64 73 29 29 0a 09 28 69 74 65 6d 2d 70 61 74 74  ds))..(item-patt
3120: 73 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74  s        (hash-t
3130: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
3140: 20 66 6c 61 67 73 20 22 2d 69 74 65 6d 70 61 74   flags "-itempat
3150: 74 22 20 23 66 29 29 29 0a 20 20 20 20 28 69 66  t" #f))).    (if
3160: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f 72   (not (null? sor
3170: 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29  ted-test-names))
3180: 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65  ..(let loop ((he
3190: 64 20 20 20 20 20 20 20 20 20 28 63 61 72 20 73  d         (car s
31a0: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73  orted-test-names
31b0: 29 29 0a 09 09 20 20 20 28 74 61 6c 20 20 20 20  ))...   (tal    
31c0: 20 20 20 20 20 28 63 64 72 20 73 6f 72 74 65 64       (cdr sorted
31d0: 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09  -test-names)))..
31e0: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
31f0: 20 30 2e 31 29 20 3b 3b 20 67 69 76 65 20 6f 74   0.1) ;; give ot
3200: 68 65 72 20 61 70 70 6c 69 63 61 74 69 6f 6e 73  her applications
3210: 20 73 6f 6d 65 20 74 69 6d 65 20 77 69 74 68 20   some time with 
3220: 74 68 65 20 64 62 0a 09 20 20 28 6c 65 74 2a 20  the db..  (let* 
3230: 28 28 74 65 73 74 2d 72 65 63 6f 72 64 20 28 68  ((test-record (h
3240: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 74 65  ash-table-ref te
3250: 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 29 29  st-records hed))
3260: 0a 09 09 20 28 74 63 6f 6e 66 69 67 20 20 20 20  ... (tconfig    
3270: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
3280: 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67  e-get-testconfig
3290: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
32a0: 09 20 28 74 65 73 74 6d 6f 64 65 20 20 20 20 28  . (testmode    (
32b0: 6c 65 74 20 28 28 6d 20 28 63 6f 6e 66 69 67 2d  let ((m (config-
32c0: 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20 22  lookup tconfig "
32d0: 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 6d  requirements" "m
32e0: 6f 64 65 22 29 29 29 0a 09 09 09 09 28 69 66 20  ode"))).....(if 
32f0: 6d 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f  m (string->symbo
3300: 6c 20 6d 29 20 27 6e 6f 72 6d 61 6c 29 29 29 0a  l m) 'normal))).
3310: 09 09 20 28 77 61 69 74 6f 6e 73 20 20 20 20 20  .. (waitons     
3320: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
3330: 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 20  -get-waitons    
3340: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09  test-record))...
3350: 20 28 70 72 69 6f 72 69 74 79 20 20 20 20 28 74   (priority    (t
3360: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
3370: 65 74 2d 70 72 69 6f 72 69 74 79 20 20 20 74 65  et-priority   te
3380: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28  st-record))... (
3390: 69 74 65 6d 64 61 74 20 20 20 20 20 28 74 65 73  itemdat     (tes
33a0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
33b0: 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 74  -itemdat    test
33c0: 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20 69 74 65  -record)) ;; ite
33d0: 6d 64 61 74 20 63 61 6e 20 62 65 20 61 20 73 74  mdat can be a st
33e0: 72 69 6e 67 2c 20 6c 69 73 74 20 6f 72 20 23 66  ring, list or #f
33f0: 0a 09 09 20 28 69 74 65 6d 73 20 20 20 20 20 20  ... (items      
3400: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
3410: 65 2d 67 65 74 2d 69 74 65 6d 73 20 20 20 20 20  e-get-items     
3420: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
3430: 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 28  . (item-path   (
3440: 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20  item-list->path 
3450: 69 74 65 6d 64 61 74 29 29 0a 09 09 20 28 6e 65  itemdat))... (ne
3460: 77 74 61 6c 20 20 20 20 20 20 28 61 70 70 65 6e  wtal      (appen
3470: 64 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64 29  d tal (list hed)
3480: 29 29 0a 09 09 20 28 63 61 6c 63 2d 66 61 69 6c  ))... (calc-fail
3490: 73 20 20 28 6c 61 6d 62 64 61 20 28 70 72 65 72  s  (lambda (prer
34a0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09  eqs-not-met)....
34b0: 09 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61  .(filter (lambda
34c0: 20 28 74 65 73 74 29 0a 09 09 09 09 09 20 20 28   (test)......  (
34d0: 64 65 62 75 67 3a 70 72 69 6e 74 20 39 20 22 74  debug:print 9 "t
34e0: 65 73 74 3a 20 22 20 74 65 73 74 29 0a 09 09 09  est: " test)....
34f0: 09 09 20 20 28 61 6e 64 20 28 76 65 63 74 6f 72  ..  (and (vector
3500: 3f 20 74 65 73 74 29 20 3b 3b 20 6e 6f 74 20 28  ? test) ;; not (
3510: 73 74 72 69 6e 67 3f 20 74 65 73 74 29 29 0a 09  string? test))..
3520: 09 09 09 09 20 20 20 20 20 20 20 28 65 71 75 61  ....       (equa
3530: 6c 3f 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  l? (db:test-get-
3540: 73 74 61 74 65 20 74 65 73 74 29 20 22 43 4f 4d  state test) "COM
3550: 50 4c 45 54 45 44 22 29 0a 09 09 09 09 09 20 20  PLETED")......  
3560: 20 20 20 20 20 28 6e 6f 74 20 28 6d 65 6d 62 65       (not (membe
3570: 72 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  r (db:test-get-s
3580: 74 61 74 75 73 20 74 65 73 74 29 0a 09 09 09 09  tatus test).....
3590: 09 09 09 20 20 20 20 27 28 22 50 41 53 53 22 20  ...    '("PASS" 
35a0: 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 20 22  "WARN" "CHECK" "
35b0: 57 41 49 56 45 44 22 29 29 29 29 29 0a 09 09 09  WAIVED")))))....
35c0: 09 09 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  ..prereqs-not-me
35d0: 74 29 29 29 0a 09 09 20 28 63 61 6c 63 2d 6e 6f  t)))... (calc-no
35e0: 74 2d 63 6f 6d 70 6c 65 74 65 64 20 28 6c 61 6d  t-completed (lam
35f0: 62 64 61 20 28 70 72 65 72 65 71 73 2d 6e 6f 74  bda (prereqs-not
3600: 2d 6d 65 74 29 0a 09 09 09 09 20 20 20 20 20 20  -met).....      
3610: 20 28 66 69 6c 74 65 72 0a 09 09 09 09 09 28 6c   (filter......(l
3620: 61 6d 62 64 61 20 28 74 29 0a 09 09 09 09 09 20  ambda (t)...... 
3630: 20 28 6f 72 20 28 6e 6f 74 20 28 76 65 63 74 6f   (or (not (vecto
3640: 72 3f 20 74 29 29 0a 09 09 09 09 09 20 20 20 20  r? t))......    
3650: 20 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 22    (not (equal? "
3660: 43 4f 4d 50 4c 45 54 45 44 22 20 28 64 62 3a 74  COMPLETED" (db:t
3670: 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29  est-get-state t)
3680: 29 29 29 29 0a 09 09 09 09 09 70 72 65 72 65 71  ))))......prereq
3690: 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 20  s-not-met)))... 
36a0: 28 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 28  (pretty-string (
36b0: 6c 61 6d 62 64 61 20 28 6c 73 74 29 0a 09 09 09  lambda (lst)....
36c0: 09 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20  .  (map (lambda 
36d0: 28 74 29 0a 09 09 09 09 09 20 28 69 66 20 28 6e  (t)...... (if (n
36e0: 6f 74 20 28 76 65 63 74 6f 72 3f 20 74 29 29 0a  ot (vector? t)).
36f0: 09 09 09 09 09 20 20 20 20 20 28 63 6f 6e 63 20  .....     (conc 
3700: 74 29 0a 09 09 09 09 09 20 20 20 20 20 28 63 6f  t)......     (co
3710: 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  nc (db:test-get-
3720: 74 65 73 74 6e 61 6d 65 20 74 29 20 22 3a 22 20  testname t) ":" 
3730: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61  (db:test-get-sta
3740: 74 65 20 74 29 20 22 2f 22 20 28 64 62 3a 74 65  te t) "/" (db:te
3750: 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 29  st-get-status t)
3760: 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 20 6c  ))).....       l
3770: 73 74 29 29 29 29 0a 09 20 20 20 20 28 64 65 62  st))))..    (deb
3780: 75 67 3a 70 72 69 6e 74 20 36 0a 09 09 09 20 22  ug:print 6.... "
3790: 69 74 65 6d 64 61 74 3a 20 20 20 20 20 22 20 69  itemdat:     " i
37a0: 74 65 6d 64 61 74 0a 09 09 09 20 22 5c 6e 20 20  temdat.... "\n  
37b0: 69 74 65 6d 73 3a 20 20 20 20 20 22 20 69 74 65  items:     " ite
37c0: 6d 73 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d  ms.... "\n  item
37d0: 2d 70 61 74 68 3a 20 22 20 69 74 65 6d 2d 70 61  -path: " item-pa
37e0: 74 68 0a 09 09 09 20 22 5c 6e 20 20 77 61 69 74  th.... "\n  wait
37f0: 6f 6e 73 3a 20 20 20 22 20 77 61 69 74 6f 6e 73  ons:   " waitons
3800: 29 0a 0a 09 20 20 20 20 3b 3b 20 63 68 65 63 6b  )...    ;; check
3810: 20 66 6f 72 20 68 65 64 20 69 6e 20 77 61 69 74   for hed in wait
3820: 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77 6f 75 6c  ons => this woul
3830: 64 20 62 65 20 63 69 72 63 75 6c 61 72 2c 20 72  d be circular, r
3840: 65 6d 6f 76 65 20 69 74 20 61 6e 64 20 69 73 73  emove it and iss
3850: 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b 20 65 72  ue an..    ;; er
3860: 72 6f 72 0a 09 20 20 20 20 28 69 66 20 28 6d 65  ror..    (if (me
3870: 6d 62 65 72 20 68 65 64 20 77 61 69 74 6f 6e 73  mber hed waitons
3880: 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20 28  )...(begin...  (
3890: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
38a0: 52 52 4f 52 3a 20 74 65 73 74 20 22 20 68 65 64  RROR: test " hed
38b0: 20 22 20 68 61 73 20 6c 69 73 74 65 64 20 69 74   " has listed it
38c0: 73 65 6c 66 20 61 73 20 61 20 77 61 69 74 6f 6e  self as a waiton
38d0: 2c 20 70 6c 65 61 73 65 20 63 6f 72 72 65 63 74  , please correct
38e0: 20 74 68 69 73 21 22 29 0a 09 09 20 20 28 73 65   this!")...  (se
38f0: 74 21 20 77 61 69 74 6f 6e 20 28 66 69 6c 74 65  t! waiton (filte
3900: 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f  r (lambda (x)(no
3910: 74 20 28 65 71 75 61 6c 3f 20 78 20 68 65 64 29  t (equal? x hed)
3920: 29 29 20 77 61 69 74 6f 6e 73 29 29 29 29 0a 0a  )) waitons))))..
3930: 09 20 20 20 20 28 63 6f 6e 64 0a 09 20 20 20 20  .    (cond..    
3940: 20 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b 3b   ((not items) ;;
3950: 20 77 68 65 6e 20 66 61 6c 73 65 20 74 68 65 20   when false the 
3960: 74 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 62 65  test is ok to be
3970: 20 68 61 6e 64 65 64 20 6f 66 66 20 74 6f 20 6c   handed off to l
3980: 61 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 20 62  aunch (but not b
3990: 65 66 6f 72 65 29 0a 09 20 20 20 20 20 20 28 6c  efore)..      (l
39a0: 65 74 2a 20 28 28 68 61 76 65 2d 72 65 73 6f 75  et* ((have-resou
39b0: 72 63 65 73 20 20 28 72 75 6e 73 3a 63 61 6e 2d  rces  (runs:can-
39c0: 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64  run-more-tests d
39d0: 62 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20  b test-record)) 
39e0: 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 74  ;; look at the t
39f0: 65 73 74 20 6a 6f 62 67 72 6f 75 70 20 61 6e 64  est jobgroup and
3a00: 20 74 6f 74 20 6a 6f 62 73 20 72 75 6e 6e 69 6e   tot jobs runnin
3a10: 67 0a 09 09 20 20 20 20 20 28 70 72 65 72 65 71  g...     (prereq
3a20: 73 2d 6e 6f 74 2d 6d 65 74 20 28 64 62 3a 67 65  s-not-met (db:ge
3a30: 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  t-prereqs-not-me
3a40: 74 20 64 62 20 72 75 6e 2d 69 64 20 77 61 69 74  t db run-id wait
3a50: 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f  ons item-path mo
3a60: 64 65 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a 09  de: testmode))..
3a70: 09 20 20 20 20 20 28 66 61 69 6c 73 20 20 20 20  .     (fails    
3a80: 20 20 20 20 20 20 20 28 63 61 6c 63 2d 66 61 69         (calc-fai
3a90: 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  ls prereqs-not-m
3aa0: 65 74 29 29 0a 09 09 20 20 20 20 20 28 6e 6f 6e  et))...     (non
3ab0: 2d 63 6f 6d 70 6c 65 74 65 64 20 20 20 28 63 61  -completed   (ca
3ac0: 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64  lc-not-completed
3ad0: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
3ae0: 29 29 29 0a 09 09 28 64 65 62 75 67 3a 70 72 69  )))...(debug:pri
3af0: 6e 74 20 38 20 22 49 4e 46 4f 3a 20 68 61 76 65  nt 8 "INFO: have
3b00: 2d 72 65 73 6f 75 72 63 65 73 3a 20 22 20 68 61  -resources: " ha
3b10: 76 65 2d 72 65 73 6f 75 72 63 65 73 20 22 20 70  ve-resources " p
3b20: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20  rereqs-not-met: 
3b30: 22 20 0a 09 09 09 20 20 20 20 20 28 73 74 72 69  " ....     (stri
3b40: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a  ng-intersperse .
3b50: 09 09 09 20 20 20 20 20 20 28 6d 61 70 20 28 6c  ...      (map (l
3b60: 61 6d 62 64 61 20 28 74 29 0a 09 09 09 09 20 20  ambda (t).....  
3b70: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 76 65 63     (if (not (vec
3b80: 74 6f 72 3f 20 74 29 29 0a 09 09 09 09 09 20 28  tor? t))...... (
3b90: 63 6f 6e 63 20 22 20 57 41 52 4e 49 4e 47 3a 20  conc " WARNING: 
3ba0: 74 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f  t is not a vecto
3bb0: 72 3d 22 20 74 20 29 0a 09 09 09 09 09 20 28 63  r=" t )...... (c
3bc0: 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74  onc (db:test-get
3bd0: 2d 73 74 61 74 65 20 74 29 20 22 2f 22 20 28 64  -state t) "/" (d
3be0: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75  b:test-get-statu
3bf0: 73 20 74 29 29 29 29 0a 09 09 09 09 20 20 20 70  s t)))).....   p
3c00: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20  rereqs-not-met) 
3c10: 22 2c 20 22 29 20 22 20 66 61 69 6c 73 3a 20 22  ", ") " fails: "
3c20: 20 66 61 69 6c 73 29 0a 09 09 3b 3b 20 44 6f 6e   fails)...;; Don
3c30: 27 74 20 6b 6e 6f 77 20 61 74 20 74 68 69 73 20  't know at this 
3c40: 74 69 6d 65 20 69 66 20 74 68 65 20 74 65 73 74  time if the test
3c50: 20 68 61 76 65 20 62 65 65 6e 20 6c 61 75 6e 63   have been launc
3c60: 68 65 64 20 61 74 20 73 6f 6d 65 20 74 69 6d 65  hed at some time
3c70: 20 69 6e 20 74 68 65 20 70 61 73 74 0a 09 09 3b   in the past...;
3c80: 3b 20 69 2e 65 2e 20 69 73 20 74 68 69 73 20 61  ; i.e. is this a
3c90: 20 72 65 2d 6c 61 75 6e 63 68 3f 0a 09 09 28 63   re-launch?...(c
3ca0: 6f 6e 64 0a 09 09 20 28 28 61 6e 64 20 68 61 76  ond... ((and hav
3cb0: 65 2d 72 65 73 6f 75 72 63 65 73 0a 09 09 20 20  e-resources...  
3cc0: 20 20 20 20 20 28 6f 72 20 28 6e 75 6c 6c 3f 20       (or (null? 
3cd0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
3ce0: 0a 09 09 09 20 20 20 28 61 6e 64 20 28 65 71 3f  ....   (and (eq?
3cf0: 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65   testmode 'tople
3d00: 76 65 6c 29 0a 09 09 09 09 28 6e 75 6c 6c 3f 20  vel).....(null? 
3d10: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29 29  non-completed)))
3d20: 29 0a 09 09 20 20 3b 3b 20 6e 6f 20 6c 6f 6f 70  )...  ;; no loop
3d30: 20 68 65 72 65 2c 20 6a 75 73 74 20 64 72 6f 70   here, just drop
3d40: 20 74 68 6f 75 67 68 20 61 6e 64 20 75 73 65 20   though and use 
3d50: 74 68 65 20 6c 6f 6f 70 20 61 74 20 74 68 65 20  the loop at the 
3d60: 62 6f 74 74 6f 6d 20 0a 09 09 20 20 28 69 66 20  bottom ...  (if 
3d70: 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68  (patt-list-match
3d80: 20 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d   item-path item-
3d90: 70 61 74 74 73 29 0a 09 09 20 20 20 20 20 20 28  patts)...      (
3da0: 72 75 6e 3a 74 65 73 74 20 64 62 20 72 75 6e 2d  run:test db run-
3db0: 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61  id runname keyva
3dc0: 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64  llst test-record
3dd0: 20 66 6c 61 67 73 20 23 66 29 0a 09 09 20 20 20   flags #f)...   
3de0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
3df0: 31 20 22 49 4e 46 4f 3a 20 53 6b 69 70 70 69 6e  1 "INFO: Skippin
3e00: 67 20 22 20 28 74 65 73 74 73 3a 74 65 73 74 71  g " (tests:testq
3e10: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d  ueue-get-testnam
3e20: 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20 22  e test-record) "
3e30: 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 61   " item-path " a
3e40: 73 20 69 74 20 64 6f 65 73 6e 27 74 20 6d 61 74  s it doesn't mat
3e50: 63 68 20 22 20 69 74 65 6d 2d 70 61 74 74 73 29  ch " item-patts)
3e60: 29 0a 09 09 20 20 3b 3b 20 65 6c 73 65 20 74 68  )...  ;; else th
3e70: 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b 2c 20  e run is stuck, 
3e80: 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20 70  temporarily or p
3e90: 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 20 20 3b  ermanently...  ;
3ea0: 3b 20 62 75 74 20 73 68 6f 75 6c 64 20 63 68 65  ; but should che
3eb0: 63 6b 20 69 66 20 69 74 20 69 73 20 64 75 65 20  ck if it is due 
3ec0: 74 6f 20 6c 61 63 6b 20 6f 66 20 72 65 73 6f 75  to lack of resou
3ed0: 72 63 65 73 20 76 73 2e 20 70 72 65 72 65 71 75  rces vs. prerequ
3ee0: 69 73 69 74 65 73 0a 09 09 20 20 29 0a 09 09 20  isites...  )... 
3ef0: 28 28 6e 6f 74 20 68 61 76 65 2d 72 65 73 6f 75  ((not have-resou
3f00: 72 63 65 73 29 20 3b 3b 20 73 69 6d 70 6c 79 20  rces) ;; simply 
3f10: 74 72 79 20 61 67 61 69 6e 20 61 66 74 65 72 20  try again after 
3f20: 77 61 69 74 69 6e 67 20 61 20 73 65 63 6f 6e 64  waiting a second
3f30: 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65  ...  (thread-sle
3f40: 65 70 21 20 31 2e 30 29 0a 09 09 20 20 28 64 65  ep! 1.0)...  (de
3f50: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46  bug:print 1 "INF
3f60: 4f 3a 20 6e 6f 20 72 65 73 6f 75 72 63 65 73 20  O: no resources 
3f70: 74 6f 20 72 75 6e 20 6e 65 77 20 74 65 73 74 73  to run new tests
3f80: 2c 20 77 61 69 74 69 6e 67 20 2e 2e 2e 22 29 0a  , waiting ...").
3f90: 09 09 20 20 3b 3b 20 63 6f 75 6c 64 20 68 61 76  ..  ;; could hav
3fa0: 65 20 64 6f 6e 65 20 68 65 64 20 74 61 6c 20 68  e done hed tal h
3fb0: 65 72 65 20 62 75 74 20 64 6f 69 6e 67 20 63 61  ere but doing ca
3fc0: 72 2f 63 64 72 20 6f 66 20 6e 65 77 74 61 6c 20  r/cdr of newtal 
3fd0: 74 6f 20 72 6f 74 61 74 65 20 74 65 73 74 73 0a  to rotate tests.
3fe0: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e  ..  (loop (car n
3ff0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
4000: 6c 29 29 29 0a 09 09 20 28 65 6c 73 65 20 3b 3b  l)))... (else ;;
4010: 20 6d 75 73 74 20 62 65 20 77 65 20 68 61 76 65   must be we have
4020: 20 75 6e 6d 65 74 20 70 72 65 72 65 71 75 69 73   unmet prerequis
4030: 69 74 65 73 0a 09 09 20 20 20 20 28 64 65 62 75  ites...    (debu
4040: 67 3a 70 72 69 6e 74 20 34 20 22 46 41 49 4c 53  g:print 4 "FAILS
4050: 3a 20 22 20 66 61 69 6c 73 29 0a 09 09 20 20 20  : " fails)...   
4060: 20 3b 3b 20 49 66 20 6f 6e 65 20 6f 72 20 6d 6f   ;; If one or mo
4070: 72 65 20 6f 66 20 74 68 65 20 70 72 65 72 65 71  re of the prereq
4080: 73 2d 6e 6f 74 2d 6d 65 74 20 61 72 65 20 46 41  s-not-met are FA
4090: 49 4c 20 74 68 65 6e 20 77 65 20 63 61 6e 20 69  IL then we can i
40a0: 73 73 75 65 0a 09 09 20 20 20 20 3b 3b 20 61 20  ssue...    ;; a 
40b0: 6d 65 73 73 61 67 65 20 61 6e 64 20 64 72 6f 70  message and drop
40c0: 20 68 65 64 20 66 72 6f 6d 20 74 68 65 20 69 74   hed from the it
40d0: 65 6d 73 20 74 6f 20 62 65 20 70 72 6f 63 65 73  ems to be proces
40e0: 73 65 64 2e 0a 09 09 20 20 20 20 28 69 66 20 28  sed....    (if (
40f0: 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 09 09  null? fails)....
4100: 28 62 65 67 69 6e 0a 09 09 09 20 20 3b 3b 20 63  (begin....  ;; c
4110: 6f 75 6c 64 6e 27 74 20 72 75 6e 2c 20 74 61 6b  ouldn't run, tak
4120: 65 20 61 20 62 72 65 61 74 68 65 72 0a 09 09 09  e a breather....
4130: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34    (debug:print 4
4140: 20 22 49 4e 46 4f 3a 20 53 68 6f 75 6c 64 6e 27   "INFO: Shouldn'
4150: 74 20 72 65 61 6c 6c 79 20 67 65 74 20 68 65 72  t really get her
4160: 65 2c 20 72 61 63 65 20 63 6f 6e 64 69 74 69 6f  e, race conditio
4170: 6e 3f 20 55 6e 61 62 6c 65 20 74 6f 20 6c 61 75  n? Unable to lau
4180: 6e 63 68 20 6d 6f 72 65 20 74 65 73 74 73 20 61  nch more tests a
4190: 74 20 74 68 69 73 20 6d 6f 6d 65 6e 74 2c 20 6b  t this moment, k
41a0: 69 6c 6c 69 6e 67 20 74 69 6d 65 20 2e 2e 2e 22  illing time ..."
41b0: 29 0a 09 09 09 20 20 28 74 68 72 65 61 64 2d 73  )....  (thread-s
41c0: 6c 65 65 70 21 20 30 2e 31 29 20 3b 3b 20 6c 6f  leep! 0.1) ;; lo
41d0: 6e 67 20 73 6c 65 65 70 20 68 65 72 65 20 2d 20  ng sleep here - 
41e0: 6e 6f 20 72 65 73 6f 75 72 63 65 73 2c 20 6d 61  no resources, ma
41f0: 79 20 61 73 20 77 65 6c 6c 20 62 65 20 70 61 74  y as well be pat
4200: 69 65 6e 74 0a 09 09 09 20 20 3b 3b 20 77 65 20  ient....  ;; we 
4210: 6d 61 64 65 20 6e 65 77 20 74 61 6c 20 62 79 20  made new tal by 
4220: 73 74 69 63 6b 69 6e 67 20 68 65 64 20 61 74 20  sticking hed at 
4230: 74 68 65 20 62 61 63 6b 20 6f 66 20 74 68 65 20  the back of the 
4240: 6c 69 73 74 0a 09 09 09 20 20 28 6c 6f 6f 70 20  list....  (loop 
4250: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
4260: 20 6e 65 77 74 61 6c 29 29 29 0a 09 09 09 3b 3b   newtal)))....;;
4270: 20 74 68 65 20 77 61 69 74 6f 6e 20 69 73 20 46   the waiton is F
4280: 41 49 4c 20 73 6f 20 6e 6f 20 70 6f 69 6e 74 20  AIL so no point 
4290: 69 6e 20 74 72 79 69 6e 67 20 74 6f 20 72 75 6e  in trying to run
42a0: 20 68 65 64 20 65 76 65 72 20 61 67 61 69 6e 0a   hed ever again.
42b0: 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c  ...(if (not (nul
42c0: 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20  l? tal))....    
42d0: 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20  (begin....      
42e0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
42f0: 57 41 52 4e 3a 20 44 72 6f 70 70 69 6e 67 20 74  WARN: Dropping t
4300: 65 73 74 20 22 20 28 64 62 3a 74 65 73 74 2d 67  est " (db:test-g
4310: 65 74 2d 74 65 73 74 6e 61 6d 65 20 68 65 64 29  et-testname hed)
4320: 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65   "/" (db:test-ge
4330: 74 2d 69 74 65 6d 2d 70 61 74 68 20 68 65 64 29  t-item-path hed)
4340: 0a 09 09 09 09 09 20 20 20 22 20 66 72 6f 6d 20  ......   " from 
4350: 74 68 65 20 6c 61 75 6e 63 68 20 6c 69 73 74 20  the launch list 
4360: 61 73 20 69 74 20 68 61 73 20 70 72 65 72 65 71  as it has prereq
4370: 75 69 73 74 65 73 20 74 68 61 74 20 61 72 65 20  uistes that are 
4380: 46 41 49 4c 22 29 0a 09 09 09 20 20 20 20 20 20  FAIL")....      
4390: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28  (loop (car tal)(
43a0: 63 64 72 20 74 61 6c 29 29 29 29 29 29 29 29 29  cdr tal)))))))))
43b0: 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20 3b 3b  ..     ..     ;;
43c0: 20 63 61 73 65 20 77 68 65 72 65 20 61 6e 20 69   case where an i
43d0: 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 73 20  tems came in as 
43e0: 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72 6f 63  a list been proc
43f0: 65 73 73 65 64 0a 09 20 20 20 20 20 28 28 61 6e  essed..     ((an
4400: 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20  d (list? items) 
4410: 20 20 20 20 3b 3b 20 74 68 75 73 20 77 65 20 6b      ;; thus we k
4420: 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 20 61 72  now our items ar
4430: 65 20 61 6c 72 65 61 64 79 20 63 61 6c 63 75 6c  e already calcul
4440: 61 74 65 64 0a 09 09 20 20 20 28 6e 6f 74 20 20  ated...   (not  
4450: 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 61 6e   itemdat)) ;; an
4460: 64 20 6e 6f 74 20 79 65 74 20 65 78 70 61 6e 64  d not yet expand
4470: 65 64 20 69 6e 74 6f 20 74 68 65 20 6c 69 73 74  ed into the list
4480: 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 62 65   of things to be
4490: 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 28 69 66   done..      (if
44a0: 20 28 61 6e 64 20 28 3e 3d 20 2a 76 65 72 62 6f   (and (>= *verbo
44b0: 73 69 74 79 2a 20 31 29 0a 09 09 20 20 20 20 20  sity* 1)...     
44c0: 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 74 65    (> (length ite
44d0: 6d 73 29 20 30 29 0a 09 09 20 20 20 20 20 20 20  ms) 0)...       
44e0: 28 3e 20 28 6c 65 6e 67 74 68 20 28 63 61 72 20  (> (length (car 
44f0: 69 74 65 6d 73 29 29 20 30 29 29 0a 09 09 20 20  items)) 0))...  
4500: 28 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20 20  (pp items))..   
4510: 20 20 20 3b 3b 20 28 69 66 20 28 3e 3d 20 2a 76     ;; (if (>= *v
4520: 65 72 62 6f 73 69 74 79 2a 20 35 29 0a 09 20 20  erbosity* 5)..  
4530: 20 20 20 20 3b 3b 20 20 20 20 20 28 62 65 67 69      ;;     (begi
4540: 6e 0a 09 20 20 20 20 20 20 3b 3b 20 20 20 20 20  n..      ;;     
4550: 20 20 28 70 72 69 6e 74 20 22 69 74 65 6d 73 3a    (print "items:
4560: 20 22 29 20 20 20 20 20 28 70 70 20 28 69 74 65   ")     (pp (ite
4570: 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69  m-assoc->item-li
4580: 73 74 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20  st items))..    
4590: 20 20 3b 3b 20 20 20 20 20 20 20 28 70 72 69 6e    ;;       (prin
45a0: 74 20 22 69 74 65 6d 73 74 61 62 6c 65 3a 20 22  t "itemstable: "
45b0: 29 28 70 70 20 28 69 74 65 6d 2d 74 61 62 6c 65  )(pp (item-table
45c0: 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d  ->item-list item
45d0: 73 74 61 62 6c 65 29 29 29 29 0a 09 20 20 20 20  stable))))..    
45e0: 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20 20    (for-each..   
45f0: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d      (lambda (my-
4600: 69 74 65 6d 64 61 74 29 0a 09 09 20 28 6c 65 74  itemdat)... (let
4610: 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 63  * ((new-test-rec
4620: 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72 65  ord (let ((newre
4630: 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65  c (make-tests:te
4640: 73 74 71 75 65 75 65 29 29 29 0a 09 09 09 09 09  stqueue)))......
4650: 20 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 79 21     (vector-copy!
4660: 20 74 65 73 74 2d 72 65 63 6f 72 64 20 6e 65 77   test-record new
4670: 72 65 63 29 0a 09 09 09 09 09 20 20 20 6e 65 77  rec)......   new
4680: 72 65 63 29 29 0a 09 09 09 28 6d 79 2d 69 74 65  rec))....(my-ite
4690: 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73  m-path (item-lis
46a0: 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d 64  t->path my-itemd
46b0: 61 74 29 29 29 0a 09 09 20 20 20 28 69 66 20 28  at)))...   (if (
46c0: 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20  patt-list-match 
46d0: 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 69 74 65  my-item-path ite
46e0: 6d 2d 70 61 74 74 73 29 20 20 20 20 20 20 20 20  m-patts)        
46f0: 20 20 20 3b 3b 20 79 65 73 2c 20 77 65 20 77 61     ;; yes, we wa
4700: 6e 74 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68  nt to process th
4710: 69 73 20 69 74 65 6d 2c 20 4e 4f 54 45 3a 20 53  is item, NOTE: S
4720: 68 6f 75 6c 64 20 6e 6f 74 20 6e 65 65 64 20 74  hould not need t
4730: 68 69 73 20 63 68 65 63 6b 20 68 65 72 65 21 0a  his check here!.
4740: 09 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 28  ..       (let ((
4750: 6e 65 77 74 65 73 74 6e 61 6d 65 20 28 63 6f 6e  newtestname (con
4760: 63 20 68 65 64 20 22 2f 22 20 6d 79 2d 69 74 65  c hed "/" my-ite
4770: 6d 2d 70 61 74 68 29 29 29 20 20 20 20 3b 3b 20  m-path)))    ;; 
4780: 74 65 73 74 20 6e 61 6d 65 73 20 61 72 65 20 75  test names are u
4790: 6e 69 71 75 65 20 6f 6e 20 74 65 73 74 6e 61 6d  nique on testnam
47a0: 65 2f 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 20  e/item-path.... 
47b0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
47c0: 2d 73 65 74 2d 69 74 65 6d 73 21 20 20 20 20 20  -set-items!     
47d0: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20  new-test-record 
47e0: 23 66 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74  #f).... (tests:t
47f0: 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65  estqueue-set-ite
4800: 6d 64 61 74 21 20 20 20 6e 65 77 2d 74 65 73 74  mdat!   new-test
4810: 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 64  -record my-itemd
4820: 61 74 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74  at).... (tests:t
4830: 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65  estqueue-set-ite
4840: 6d 5f 70 61 74 68 21 20 6e 65 77 2d 74 65 73 74  m_path! new-test
4850: 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 2d  -record my-item-
4860: 70 61 74 68 29 0a 09 09 09 20 28 68 61 73 68 2d  path).... (hash-
4870: 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d  table-set! test-
4880: 72 65 63 6f 72 64 73 20 6e 65 77 74 65 73 74 6e  records newtestn
4890: 61 6d 65 20 6e 65 77 2d 74 65 73 74 2d 72 65 63  ame new-test-rec
48a0: 6f 72 64 29 0a 09 09 09 20 28 73 65 74 21 20 74  ord).... (set! t
48b0: 61 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65 73 74  al (cons newtest
48c0: 6e 61 6d 65 20 74 61 6c 29 29 29 29 29 29 20 3b  name tal)))))) ;
48d0: 3b 20 73 69 6e 63 65 20 74 68 65 73 65 20 61 72  ; since these ar
48e0: 65 20 69 74 65 6d 69 7a 65 64 20 63 72 65 61 74  e itemized creat
48f0: 65 20 6e 65 77 20 74 65 73 74 20 6e 61 6d 65 73  e new test names
4900: 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61   testname/itempa
4910: 74 68 0a 09 20 20 20 20 20 20 20 69 74 65 6d 73  th..       items
4920: 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f  )..      (if (no
4930: 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09  t (null? tal))..
4940: 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61  .  (loop (car ta
4950: 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29 0a 0a  l)(cdr tal))))..
4960: 09 20 20 20 20 20 3b 3b 20 69 66 20 69 74 65 6d  .     ;; if item
4970: 73 20 69 73 20 61 20 70 72 6f 63 20 74 68 65 6e  s is a proc then
4980: 20 6e 65 65 64 20 74 6f 20 72 75 6e 20 69 74 65   need to run ite
4990: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f  ms:get-items-fro
49a0: 6d 2d 63 6f 6e 66 69 67 2c 20 67 65 74 20 74 68  m-config, get th
49b0: 65 20 6c 69 73 74 20 61 6e 64 20 6c 6f 6f 70 20  e list and loop 
49c0: 0a 09 20 20 20 20 20 3b 3b 20 20 20 20 2d 20 62  ..     ;;    - b
49d0: 75 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20  ut only do that 
49e0: 69 66 20 72 65 73 6f 75 72 63 65 73 20 65 78 69  if resources exi
49f0: 73 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74  st to kick off t
4a00: 68 65 20 6a 6f 62 0a 09 20 20 20 20 20 28 28 6f  he job..     ((o
4a10: 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74  r (procedure? it
4a20: 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20 27  ems)(eq? items '
4a30: 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 29  have-procedure))
4a40: 0a 09 20 20 20 20 20 20 28 6c 65 74 20 28 28 63  ..      (let ((c
4a50: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 20 20 20 28  an-run-more    (
4a60: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72  runs:can-run-mor
4a70: 65 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 2d  e-tests db test-
4a80: 72 65 63 6f 72 64 29 29 29 0a 09 09 28 69 66 20  record)))...(if 
4a90: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09 20  can-run-more... 
4aa0: 20 20 20 28 6c 65 74 2a 20 28 28 70 72 65 72 65     (let* ((prere
4ab0: 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 64 62 3a 67  qs-not-met (db:g
4ac0: 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  et-prereqs-not-m
4ad0: 65 74 20 64 62 20 72 75 6e 2d 69 64 20 77 61 69  et db run-id wai
4ae0: 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d  tons item-path m
4af0: 6f 64 65 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a  ode: testmode)).
4b00: 09 09 09 20 20 20 28 66 61 69 6c 73 20 20 20 20  ...   (fails    
4b10: 20 20 20 20 20 20 20 28 63 61 6c 63 2d 66 61 69         (calc-fai
4b20: 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  ls prereqs-not-m
4b30: 65 74 29 29 0a 09 09 09 20 20 20 28 6e 6f 6e 2d  et))....   (non-
4b40: 63 6f 6d 70 6c 65 74 65 64 20 20 20 28 63 61 6c  completed   (cal
4b50: 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20  c-not-completed 
4b60: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
4b70: 29 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75  ))...      (debu
4b80: 67 3a 70 72 69 6e 74 20 38 20 22 49 4e 46 4f 3a  g:print 8 "INFO:
4b90: 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20 22   can-run-more: "
4ba0: 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09   can-run-more...
4bb0: 09 09 20 20 20 22 5c 6e 20 70 72 65 72 65 71 73  ..   "\n prereqs
4bc0: 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 28 70 72 65  -not-met: " (pre
4bd0: 74 74 79 2d 73 74 72 69 6e 67 20 70 72 65 72 65  tty-string prere
4be0: 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 09  qs-not-met).....
4bf0: 20 20 20 22 5c 6e 20 6e 6f 6e 2d 63 6f 6d 70 6c     "\n non-compl
4c00: 65 74 65 64 3a 20 20 20 22 20 28 70 72 65 74 74  eted:   " (prett
4c10: 79 2d 73 74 72 69 6e 67 20 6e 6f 6e 2d 63 6f 6d  y-string non-com
4c20: 70 6c 65 74 65 64 29 20 0a 09 09 09 09 20 20 20  pleted) .....   
4c30: 22 5c 6e 20 66 61 69 6c 73 3a 20 20 20 20 20 20  "\n fails:      
4c40: 20 20 20 20 20 22 20 28 70 72 65 74 74 79 2d 73       " (pretty-s
4c50: 74 72 69 6e 67 20 66 61 69 6c 73 29 0a 09 09 09  tring fails)....
4c60: 09 20 20 20 22 5c 6e 20 74 65 73 74 6d 6f 64 65  .   "\n testmode
4c70: 3a 20 20 20 20 20 20 20 20 22 20 74 65 73 74 6d  :        " testm
4c80: 6f 64 65 0a 09 09 09 09 20 20 20 22 5c 6e 20 28  ode.....   "\n (
4c90: 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f  eq? testmode 'to
4ca0: 70 6c 65 76 65 6c 29 20 22 20 28 65 71 3f 20 74  plevel) " (eq? t
4cb0: 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65  estmode 'topleve
4cc0: 6c 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 6e  l).....   "\n (n
4cd0: 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74  ull? non-complet
4ce0: 65 64 29 20 20 20 20 22 20 28 6e 75 6c 6c 3f 20  ed)    " (null? 
4cf0: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29 0a  non-completed)).
4d00: 09 09 20 20 20 20 20 20 28 63 6f 6e 64 20 0a 09  ..      (cond ..
4d10: 09 20 20 20 20 20 20 20 28 28 6f 72 20 28 6e 75  .       ((or (nu
4d20: 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ll? prereqs-not-
4d30: 6d 65 74 29 20 3b 3b 20 61 6c 6c 20 70 72 65 72  met) ;; all prer
4d40: 65 71 73 20 6d 65 74 2c 20 66 69 72 65 20 6f 66  eqs met, fire of
4d50: 66 20 74 68 65 20 74 65 73 74 0a 09 09 09 20 20  f the test....  
4d60: 20 20 3b 3b 20 6f 72 2c 20 69 66 20 69 74 20 69    ;; or, if it i
4d70: 73 20 61 20 27 74 6f 70 6c 65 76 65 6c 20 74 65  s a 'toplevel te
4d80: 73 74 20 61 6e 64 20 61 6c 6c 20 70 72 65 72 65  st and all prere
4d90: 71 73 20 6e 6f 74 20 6d 65 74 20 61 72 65 20 43  qs not met are C
4da0: 4f 4d 50 4c 45 54 45 44 20 74 68 65 6e 20 6c 61  OMPLETED then la
4db0: 75 6e 63 68 0a 09 09 09 20 20 20 20 28 61 6e 64  unch....    (and
4dc0: 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27   (eq? testmode '
4dd0: 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 20 28  toplevel)..... (
4de0: 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65  null? non-comple
4df0: 74 65 64 29 29 29 0a 09 09 09 28 6c 65 74 20 28  ted)))....(let (
4e00: 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 65 73 74  (test-name (test
4e10: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d  s:testqueue-get-
4e20: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65  testname test-re
4e30: 63 6f 72 64 29 29 29 0a 09 09 09 20 20 28 73 65  cord)))....  (se
4e40: 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41  tenv "MT_TEST_NA
4e50: 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b  ME" test-name) ;
4e60: 3b 20 0a 09 09 09 20 20 28 73 65 74 65 6e 76 20  ; ....  (setenv 
4e70: 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72  "MT_RUNNAME"   r
4e80: 75 6e 6e 61 6d 65 29 0a 09 09 09 20 20 28 73 65  unname)....  (se
4e90: 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76  t-megatest-env-v
4ea0: 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 20 3b  ars db run-id) ;
4eb0: 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e  ; these may be n
4ec0: 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75  eeded by the lau
4ed0: 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 09  nching process..
4ee0: 09 09 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73  ..  (let ((items
4ef0: 2d 6c 69 73 74 20 28 69 74 65 6d 73 3a 67 65 74  -list (items:get
4f00: 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66  -items-from-conf
4f10: 69 67 20 74 63 6f 6e 66 69 67 29 29 29 0a 09 09  ig tconfig)))...
4f20: 09 20 20 20 20 28 69 66 20 28 6c 69 73 74 3f 20  .    (if (list? 
4f30: 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09  items-list).....
4f40: 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 74 65  (begin.....  (te
4f50: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65  sts:testqueue-se
4f60: 74 2d 69 74 65 6d 73 21 20 74 65 73 74 2d 72 65  t-items! test-re
4f70: 63 6f 72 64 20 69 74 65 6d 73 2d 6c 69 73 74 29  cord items-list)
4f80: 0a 09 09 09 09 20 20 28 6c 6f 6f 70 20 68 65 64  .....  (loop hed
4f90: 20 74 61 6c 29 29 0a 09 09 09 09 28 62 65 67 69   tal)).....(begi
4fa0: 6e 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70  n.....  (debug:p
4fb0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 54  rint 0 "ERROR: T
4fc0: 68 65 20 70 72 6f 63 20 66 72 6f 6d 20 72 65 61  he proc from rea
4fd0: 64 69 6e 67 20 74 68 65 20 73 65 74 75 70 20 64  ding the setup d
4fe0: 69 64 20 6e 6f 74 20 79 69 65 6c 64 20 61 20 6c  id not yield a l
4ff0: 69 73 74 20 2d 20 70 6c 65 61 73 65 20 72 65 70  ist - please rep
5000: 6f 72 74 20 74 68 69 73 22 29 0a 09 09 09 09 20  ort this")..... 
5010: 20 28 65 78 69 74 20 31 29 29 29 29 29 29 0a 09   (exit 1))))))..
5020: 09 20 20 20 20 20 20 20 28 28 6e 75 6c 6c 3f 20  .       ((null? 
5030: 66 61 69 6c 73 29 0a 09 09 09 28 6c 6f 6f 70 20  fails)....(loop 
5040: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
5050: 20 6e 65 77 74 61 6c 29 29 29 20 3b 3b 20 61 6e   newtal))) ;; an
5060: 20 69 73 73 75 65 20 77 69 74 68 20 70 72 65 72   issue with prer
5070: 65 71 73 20 6e 6f 74 20 79 65 74 20 6d 65 74 3f  eqs not yet met?
5080: 0a 09 09 20 20 20 20 20 20 20 28 28 61 6e 64 20  ...       ((and 
5090: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 66 61 69 6c  (not (null? fail
50a0: 73 29 29 28 65 71 3f 20 74 65 73 74 6d 6f 64 65  s))(eq? testmode
50b0: 20 27 6e 6f 72 6d 61 6c 29 29 0a 09 09 09 28 64   'normal))....(d
50c0: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e  ebug:print 1 "IN
50d0: 46 4f 3a 20 74 65 73 74 20 22 20 20 68 65 64 20  FO: test "  hed 
50e0: 22 20 28 6d 6f 64 65 3d 22 20 74 65 73 74 6d 6f  " (mode=" testmo
50f0: 64 65 20 22 29 20 68 61 73 20 66 61 69 6c 65 64  de ") has failed
5100: 20 70 72 65 72 65 71 75 69 73 69 74 65 28 73 29   prerequisite(s)
5110: 3b 20 22 0a 09 09 09 09 20 20 20 20 20 28 73 74  ; ".....     (st
5120: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
5130: 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 74   (map (lambda (t
5140: 29 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d  )(conc (db:test-
5150: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 29 20  get-testname t) 
5160: 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ":" (db:test-get
5170: 2d 73 74 61 74 65 20 74 29 22 2f 22 28 64 62 3a  -state t)"/"(db:
5180: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20  test-get-status 
5190: 74 29 29 29 20 66 61 69 6c 73 29 20 22 2c 20 22  t))) fails) ", "
51a0: 29 0a 09 09 09 09 20 20 20 20 20 22 2c 20 72 65  ).....     ", re
51b0: 6d 6f 76 69 6e 67 20 69 74 20 66 72 6f 6d 20 74  moving it from t
51c0: 6f 2d 64 6f 20 6c 69 73 74 22 29 0a 09 09 09 28  o-do list")....(
51d0: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74  if (not (null? t
51e0: 61 6c 29 29 0a 09 09 09 20 20 20 20 28 6c 6f 6f  al))....    (loo
51f0: 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20  p (car tal)(cdr 
5200: 74 61 6c 29 29 29 29 0a 09 09 20 20 20 20 20 20  tal))))...      
5210: 20 28 65 6c 73 65 0a 09 09 09 28 64 65 62 75 67   (else....(debug
5220: 3a 70 72 69 6e 74 20 38 20 22 45 52 52 4f 52 3a  :print 8 "ERROR:
5230: 20 4e 6f 20 68 61 6e 64 6c 65 72 20 66 6f 72 20   No handler for 
5240: 74 68 69 73 20 63 6f 6e 64 69 74 69 6f 6e 2e 22  this condition."
5250: 29 0a 09 09 09 3b 3b 20 09 20 20 20 20 20 22 5c  )....;; .     "\
5260: 6e 20 20 68 65 64 3a 20 20 20 20 20 20 20 20 20  n  hed:         
5270: 20 20 20 22 20 68 65 64 20 0a 09 09 09 3b 3b 20     " hed ....;; 
5280: 09 20 20 20 20 20 22 5c 6e 20 66 61 69 6c 73 3a  .     "\n fails:
5290: 20 20 20 20 20 20 20 20 20 20 20 22 20 28 73 74             " (st
52a0: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
52b0: 20 28 6d 61 70 20 64 62 3a 74 65 73 74 2d 67 65   (map db:test-ge
52c0: 74 2d 74 65 73 74 6e 61 6d 65 20 66 61 69 6c 73  t-testname fails
52d0: 29 20 22 2c 22 29 0a 09 09 09 3b 3b 20 09 20 20  ) ",")....;; .  
52e0: 20 20 20 22 5c 6e 20 74 65 73 74 6d 6f 64 65 3a     "\n testmode:
52f0: 20 20 20 20 20 20 20 20 22 20 74 65 73 74 6d 6f          " testmo
5300: 64 65 0a 09 09 09 3b 3b 20 09 20 20 20 20 20 22  de....;; .     "
5310: 5c 6e 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  \n prereqs-not-m
5320: 65 74 3a 20 22 20 28 70 72 65 74 74 79 2d 73 74  et: " (pretty-st
5330: 72 69 6e 67 20 70 72 65 72 65 71 73 2d 6e 6f 74  ring prereqs-not
5340: 2d 6d 65 74 29 0a 09 09 09 3b 3b 20 09 20 20 20  -met)....;; .   
5350: 20 20 22 5c 6e 20 69 74 65 6d 73 3a 20 20 20 20    "\n items:    
5360: 20 20 20 20 20 20 20 22 20 69 74 65 6d 73 29 0a         " items).
5370: 09 09 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65  ...(loop (car ne
5380: 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c  wtal)(cdr newtal
5390: 29 29 29 29 29 0a 09 09 20 20 20 20 3b 3b 20 69  )))))...    ;; i
53a0: 66 20 63 61 6e 27 74 20 72 75 6e 20 6d 6f 72 65  f can't run more
53b0: 20 6a 75 73 74 20 6c 6f 6f 70 20 77 69 74 68 20   just loop with 
53c0: 6e 65 78 74 20 70 6f 73 73 69 62 6c 65 20 74 65  next possible te
53d0: 73 74 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 28  st...    (loop (
53e0: 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20  car newtal)(cdr 
53f0: 6e 65 77 74 61 6c 29 29 29 29 29 0a 09 20 20 20  newtal)))))..   
5400: 20 20 0a 09 20 20 20 20 20 3b 3b 20 74 68 69 73    ..     ;; this
5410: 20 63 61 73 65 20 73 68 6f 75 6c 64 20 6e 6f 74   case should not
5420: 20 68 61 70 70 65 6e 2c 20 61 64 64 65 64 20 74   happen, added t
5430: 6f 20 68 65 6c 70 20 63 61 74 63 68 20 61 6e 79  o help catch any
5440: 20 62 75 67 73 0a 09 20 20 20 20 20 28 28 61 6e   bugs..     ((an
5450: 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20  d (list? items) 
5460: 69 74 65 6d 64 61 74 29 0a 09 20 20 20 20 20 20  itemdat)..      
5470: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
5480: 45 52 52 4f 52 3a 20 53 68 6f 75 6c 64 20 6e 6f  ERROR: Should no
5490: 74 20 68 61 76 65 20 61 20 6c 69 73 74 20 6f 66  t have a list of
54a0: 20 69 74 65 6d 73 20 69 6e 20 61 20 74 65 73 74   items in a test
54b0: 20 61 6e 64 20 74 68 65 20 69 74 65 6d 73 70 61   and the itemspa
54c0: 74 68 20 73 65 74 20 2d 20 70 6c 65 61 73 65 20  th set - please 
54d0: 72 65 70 6f 72 74 20 74 68 69 73 22 29 0a 09 20  report this").. 
54e0: 20 20 20 20 20 28 65 78 69 74 20 31 29 29 29 29       (exit 1))))
54f0: 0a 09 20 20 0a 09 20 20 3b 3b 20 77 65 20 67 65  ..  ..  ;; we ge
5500: 74 20 68 65 72 65 20 6f 6e 20 22 64 72 6f 70 20  t here on "drop 
5510: 74 68 72 6f 75 67 68 22 20 2d 20 6c 6f 6f 70 20  through" - loop 
5520: 66 6f 72 20 6e 65 78 74 20 74 65 73 74 20 69 6e  for next test in
5530: 20 71 75 65 75 65 0a 09 20 20 28 69 66 20 28 6e   queue..  (if (n
5540: 75 6c 6c 3f 20 74 61 6c 29 0a 09 20 20 20 20 20  ull? tal)..     
5550: 20 28 62 65 67 69 6e 0a 09 09 3b 3b 20 46 49 58   (begin...;; FIX
5560: 4d 45 21 21 21 21 20 54 48 49 53 20 53 48 4f 55  ME!!!! THIS SHOU
5570: 4c 44 20 4e 4f 54 20 52 45 51 55 49 52 45 20 41  LD NOT REQUIRE A
5580: 4e 20 45 58 49 54 21 21 21 21 21 21 21 0a 09 09  N EXIT!!!!!!!...
5590: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
55a0: 49 4e 46 4f 3a 20 41 6c 6c 20 74 65 73 74 73 20  INFO: All tests 
55b0: 6c 61 75 6e 63 68 65 64 22 29 0a 09 09 28 74 68  launched")...(th
55c0: 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 35 29  read-sleep! 0.5)
55d0: 0a 09 09 3b 3b 20 46 49 58 4d 45 21 20 54 68 69  ...;; FIXME! Thi
55e0: 73 20 68 61 72 73 68 20 65 78 69 74 20 73 68 6f  s harsh exit sho
55f0: 75 6c 64 20 6e 6f 74 20 62 65 20 6e 65 63 65 73  uld not be neces
5600: 73 61 72 79 2e 2e 2e 2e 0a 09 09 28 69 66 20 28  sary.......(if (
5610: 6e 6f 74 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 29  not *runremote*)
5620: 28 65 78 69 74 29 29 20 3b 3b 20 0a 09 09 23 66  (exit)) ;; ...#f
5630: 29 20 3b 3b 20 72 65 74 75 72 6e 20 61 20 23 66  ) ;; return a #f
5640: 20 61 73 20 61 20 68 69 6e 74 20 74 68 61 74 20   as a hint that 
5650: 77 65 20 61 72 65 20 64 6f 6e 65 0a 09 20 20 20  we are done..   
5660: 20 20 20 3b 3b 20 48 65 72 65 20 77 65 20 6e 65     ;; Here we ne
5670: 65 64 20 74 6f 20 63 68 65 63 6b 20 74 68 61 74  ed to check that
5680: 20 61 6c 6c 20 74 68 65 20 74 65 73 74 73 20 72   all the tests r
5690: 65 6d 61 69 6e 69 6e 67 20 74 6f 20 62 65 20 72  emaining to be r
56a0: 75 6e 20 61 72 65 20 65 6c 69 67 69 62 6c 65 20  un are eligible 
56b0: 74 6f 20 72 75 6e 0a 09 20 20 20 20 20 20 3b 3b  to run..      ;;
56c0: 20 61 6e 64 20 61 72 65 20 6e 6f 74 20 62 6c 6f   and are not blo
56d0: 63 6b 65 64 20 62 79 20 66 61 69 6c 65 64 0a 09  cked by failed..
56e0: 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77        (let ((new
56f0: 6c 73 74 20 28 74 65 73 74 73 3a 66 69 6c 74 65  lst (tests:filte
5700: 72 2d 6e 6f 6e 2d 72 75 6e 6e 61 62 6c 65 20 64  r-non-runnable d
5710: 62 20 72 75 6e 2d 69 64 20 74 61 6c 20 74 65 73  b run-id tal tes
5720: 74 2d 72 65 63 6f 72 64 73 29 29 29 20 3b 3b 20  t-records))) ;; 
5730: 69 2e 65 2e 20 6e 6f 74 20 46 41 49 4c 2c 20 57  i.e. not FAIL, W
5740: 41 49 56 45 44 2c 20 49 4e 43 4f 4d 50 4c 45 54  AIVED, INCOMPLET
5750: 45 2c 20 50 41 53 53 2c 20 4b 49 4c 4c 45 44 2c  E, PASS, KILLED,
5760: 0a 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65 70  ...(thread-sleep
5770: 21 20 30 2e 31 29 0a 09 09 28 69 66 20 28 6e 6f  ! 0.1)...(if (no
5780: 74 20 28 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74 29  t (null? newlst)
5790: 29 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63  )...    (loop (c
57a0: 61 72 20 6e 65 77 6c 73 74 29 28 63 64 72 20 6e  ar newlst)(cdr n
57b0: 65 77 6c 73 74 29 29 29 29 29 29 29 29 29 0a 0a  ewlst)))))))))..
57c0: 3b 3b 20 70 61 72 65 6e 74 2d 74 65 73 74 20 69  ;; parent-test i
57d0: 73 20 74 68 65 72 65 20 61 73 20 61 20 70 6c 61  s there as a pla
57e0: 63 65 68 6f 6c 64 65 72 20 66 6f 72 20 77 68 65  ceholder for whe
57f0: 6e 20 70 61 72 65 6e 74 2d 74 65 73 74 73 20 63  n parent-tests c
5800: 61 6e 20 62 65 20 72 75 6e 20 61 73 20 61 20 73  an be run as a s
5810: 65 74 75 70 20 73 74 65 70 0a 28 64 65 66 69 6e  etup step.(defin
5820: 65 20 28 72 75 6e 3a 74 65 73 74 20 64 62 20 72  e (run:test db r
5830: 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65  un-id runname ke
5840: 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63  yvallst test-rec
5850: 6f 72 64 20 66 6c 61 67 73 20 70 61 72 65 6e 74  ord flags parent
5860: 2d 74 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c 20  -test).  ;; All 
5870: 74 68 65 73 65 20 76 61 72 73 20 6d 69 67 68 74  these vars might
5880: 20 62 65 20 72 65 66 65 72 65 6e 63 65 64 20 62   be referenced b
5890: 79 20 74 68 65 20 74 65 73 74 63 6f 6e 66 69 67  y the testconfig
58a0: 20 66 69 6c 65 20 72 65 61 64 65 72 0a 20 20 28   file reader.  (
58b0: 6c 65 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d 65  let* ((test-name
58c0: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
58d0: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d  ueue-get-testnam
58e0: 65 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29  e   test-record)
58f0: 29 0a 09 20 28 74 65 73 74 2d 77 61 69 74 6f 6e  ).. (test-waiton
5900: 73 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65  s (tests:testque
5910: 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20  ue-get-waitons  
5920: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a    test-record)).
5930: 09 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20  . (test-conf    
5940: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
5950: 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20  -get-testconfig 
5960: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20  test-record)).. 
5970: 28 69 74 65 6d 64 61 74 20 20 20 20 20 20 28 74  (itemdat      (t
5980: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
5990: 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65  et-itemdat    te
59a0: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74  st-record)).. (t
59b0: 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e  est-path    (con
59c0: 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65  c *toppath* "/te
59d0: 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29  sts/" test-name)
59e0: 29 20 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20 74  ) ;; could use t
59f0: 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e  ests:get-testcon
5a00: 66 69 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28  fig here ..... (
5a10: 66 6f 72 63 65 20 20 20 20 20 20 20 20 28 68 61  force        (ha
5a20: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
5a30: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f 72  ault flags "-for
5a40: 63 65 22 20 23 66 29 29 0a 09 20 28 72 65 72 75  ce" #f)).. (reru
5a50: 6e 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74  n        (hash-t
5a60: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
5a70: 20 66 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 20   flags "-rerun" 
5a80: 23 66 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 6e  #f)).. (keepgoin
5a90: 67 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65  g    (hash-table
5aa0: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61  -ref/default fla
5ab0: 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20  gs "-keepgoing" 
5ac0: 23 66 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74  #f)).. (item-pat
5ad0: 68 20 20 20 20 20 22 22 29 29 0a 20 20 20 20 28  h     "")).    (
5ae0: 64 65 62 75 67 3a 70 72 69 6e 74 20 35 0a 09 09  debug:print 5...
5af0: 20 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20 22   "test-config: "
5b00: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c   (hash-table->al
5b10: 69 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a 09  ist test-conf)..
5b20: 09 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 74 3a  . "\n   itemdat:
5b30: 20 22 20 69 74 65 6d 64 61 74 0a 09 09 20 29 0a   " itemdat... ).
5b40: 20 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 20 69      ;; setting i
5b50: 74 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 73 74  temdat to a list
5b60: 20 69 66 20 69 74 20 69 73 20 23 66 0a 20 20 20   if it is #f.   
5b70: 20 28 69 66 20 28 6e 6f 74 20 69 74 65 6d 64 61   (if (not itemda
5b80: 74 29 28 73 65 74 21 20 69 74 65 6d 64 61 74 20  t)(set! itemdat 
5b90: 27 28 29 29 29 0a 20 20 20 20 28 73 65 74 21 20  '())).    (set! 
5ba0: 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d  item-path (item-
5bb0: 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64  list->path itemd
5bc0: 61 74 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a  at)).    (debug:
5bd0: 70 72 69 6e 74 20 32 20 22 41 74 74 65 6d 70 74  print 2 "Attempt
5be0: 69 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 74 65  ing to launch te
5bf0: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22  st " test-name "
5c00: 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 20 20  /" item-path).  
5c10: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45    (setenv "MT_TE
5c20: 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61  ST_NAME" test-na
5c30: 6d 65 29 20 3b 3b 20 0a 20 20 20 20 28 73 65 74  me) ;; .    (set
5c40: 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22  env "MT_RUNNAME"
5c50: 20 20 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20     runname).    
5c60: 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e  (set-megatest-en
5c70: 76 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64  v-vars db run-id
5c80: 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62  ) ;; these may b
5c90: 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20  e needed by the 
5ca0: 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73  launching proces
5cb0: 73 0a 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69  s.    (change-di
5cc0: 72 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 68  rectory *toppath
5cd0: 2a 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65 20  *)..    ;; Here 
5ce0: 69 73 20 77 68 65 72 65 20 74 68 65 20 74 65 73  is where the tes
5cf0: 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73 20  t_meta table is 
5d00: 62 65 73 74 20 75 70 64 61 74 65 64 0a 20 20 20  best updated.   
5d10: 20 3b 3b 20 59 65 73 2c 20 61 6e 6f 74 68 65 72   ;; Yes, another
5d20: 20 75 73 65 20 6f 66 20 61 20 67 6c 6f 62 61 6c   use of a global
5d30: 20 66 6f 72 20 63 61 63 68 69 6e 67 2e 20 4e 65   for caching. Ne
5d40: 65 64 20 61 20 62 65 74 74 65 72 20 77 61 79 3f  ed a better way?
5d50: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68  .    (if (not (h
5d60: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
5d70: 66 61 75 6c 74 20 2a 74 65 73 74 2d 6d 65 74 61  fault *test-meta
5d80: 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e  -updated* test-n
5d90: 61 6d 65 20 23 66 29 29 0a 20 20 20 20 20 20 20  ame #f)).       
5da0: 20 28 62 65 67 69 6e 0a 09 20 20 20 28 68 61 73   (begin..   (has
5db0: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a 74 65  h-table-set! *te
5dc0: 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a  st-meta-updated*
5dd0: 20 74 65 73 74 2d 6e 61 6d 65 20 23 74 29 0a 20   test-name #t). 
5de0: 20 20 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a            (runs:
5df0: 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61  update-test_meta
5e00: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65   db test-name te
5e10: 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 0a  st-conf))).    .
5e20: 20 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28      ;; (lambda (
5e30: 69 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72  itemdat) ;;; ((r
5e40: 69 70 65 6e 65 73 73 20 22 6f 76 65 72 72 69 70  ipeness "overrip
5e50: 65 22 29 20 28 74 65 6d 70 65 72 61 74 75 72 65  e") (temperature
5e60: 20 22 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e   "cool") (season
5e70: 20 22 73 75 6d 6d 65 72 22 29 29 0a 20 20 20 20   "summer")).    
5e80: 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74  (let* ((new-test
5e90: 2d 70 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e  -path (string-in
5ea0: 74 65 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20  tersperse (cons 
5eb0: 74 65 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63  test-path (map c
5ec0: 61 64 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f  adr itemdat)) "/
5ed0: 22 29 29 0a 09 20 20 20 28 6e 65 77 2d 74 65 73  "))..   (new-tes
5ee0: 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61  t-name (if (equa
5ef0: 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29  l? item-path "")
5f00: 20 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63   test-name (conc
5f10: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69   test-name "/" i
5f20: 74 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a  tem-path))) ;; j
5f30: 75 73 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62  ust need it to b
5f40: 65 20 75 6e 69 71 75 65 0a 09 20 20 20 28 74 65  e unique..   (te
5f50: 73 74 2d 69 64 20 20 20 20 20 20 20 28 64 62 3a  st-id       (db:
5f60: 67 65 74 2d 74 65 73 74 2d 69 64 20 64 62 20 20  get-test-id db  
5f70: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65  run-id test-name
5f80: 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20   item-path))..  
5f90: 20 28 74 65 73 74 64 61 74 20 20 20 20 20 20 20   (testdat       
5fa0: 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66  (db:get-test-inf
5fb0: 6f 2d 62 79 2d 69 64 20 64 62 20 74 65 73 74 2d  o-by-id db test-
5fc0: 69 64 29 29 29 0a 20 20 20 20 20 20 28 69 66 20  id))).      (if 
5fd0: 28 6e 6f 74 20 74 65 73 74 64 61 74 29 0a 09 20  (not testdat).. 
5fe0: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b 20   (begin..    ;; 
5ff0: 65 6e 73 75 72 65 20 74 68 61 74 20 74 68 65 20  ensure that the 
6000: 70 61 74 68 20 65 78 69 73 74 73 20 62 65 66 6f  path exists befo
6010: 72 65 20 72 65 67 69 73 74 65 72 69 6e 67 20 74  re registering t
6020: 68 65 20 74 65 73 74 0a 09 20 20 20 20 3b 3b 20  he test..    ;; 
6030: 4e 4f 50 45 3a 20 43 61 6e 6e 6f 74 21 20 44 6f  NOPE: Cannot! Do
6040: 6e 27 74 20 6b 6e 6f 77 20 79 65 74 20 77 68 69  n't know yet whi
6050: 63 68 20 64 69 73 6b 20 61 72 65 61 20 77 69 6c  ch disk area wil
6060: 6c 20 62 65 20 61 73 73 69 67 6e 65 64 2e 2e 2e  l be assigned...
6070: 2e 0a 09 20 20 20 20 3b 3b 20 28 73 79 73 74 65  ...    ;; (syste
6080: 6d 20 28 63 6f 6e 63 20 22 6d 6b 64 69 72 20 2d  m (conc "mkdir -
6090: 70 20 22 20 6e 65 77 2d 74 65 73 74 2d 70 61 74  p " new-test-pat
60a0: 68 29 29 0a 09 20 20 20 20 28 74 65 73 74 73 3a  h))..    (tests:
60b0: 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 64 62  register-test db
60c0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d   run-id test-nam
60d0: 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20  e item-path)..  
60e0: 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 64 20    (set! test-id 
60f0: 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 20  (db:get-test-id 
6100: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e  db run-id test-n
6110: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 0a  ame item-path)).
6120: 09 20 20 20 20 28 73 65 74 21 20 74 65 73 74 64  .    (set! testd
6130: 61 74 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d  at (db:get-test-
6140: 69 6e 66 6f 2d 62 79 2d 69 64 20 64 62 20 74 65  info-by-id db te
6150: 73 74 2d 69 64 29 29 29 29 0a 20 20 20 20 20 20  st-id)))).      
6160: 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 28 64  (set! test-id (d
6170: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
6180: 73 74 64 61 74 29 29 0a 20 20 20 20 20 20 28 63  stdat)).      (c
6190: 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20  hange-directory 
61a0: 74 65 73 74 2d 70 61 74 68 29 0a 20 20 20 20 20  test-path).     
61b0: 20 28 63 61 73 65 20 28 69 66 20 66 6f 72 63 65   (case (if force
61c0: 20 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d 61 72   ;; (args:get-ar
61d0: 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 27 4e  g "-force")...'N
61e0: 4f 54 5f 53 54 41 52 54 45 44 0a 09 09 28 69 66  OT_STARTED...(if
61f0: 20 74 65 73 74 64 61 74 0a 09 09 20 20 20 20 28   testdat...    (
6200: 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28  string->symbol (
6210: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74  test:get-state t
6220: 65 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 27  estdat))...    '
6230: 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74  failed-to-insert
6240: 29 29 0a 09 28 28 66 61 69 6c 65 64 2d 74 6f 2d  ))..((failed-to-
6250: 69 6e 73 65 72 74 29 0a 09 20 28 64 65 62 75 67  insert).. (debug
6260: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
6270: 20 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 65 72   Failed to inser
6280: 74 20 74 68 65 20 72 65 63 6f 72 64 20 69 6e 74  t the record int
6290: 6f 20 74 68 65 20 64 62 22 29 29 0a 09 28 28 4e  o the db"))..((N
62a0: 4f 54 5f 53 54 41 52 54 45 44 20 43 4f 4d 50 4c  OT_STARTED COMPL
62b0: 45 54 45 44 29 0a 09 20 28 6c 65 74 20 28 28 72  ETED).. (let ((r
62c0: 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20  unflag #f))..   
62d0: 28 63 6f 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66  (cond..    ;; -f
62e0: 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74  orce, run no mat
62f0: 74 65 72 20 77 68 61 74 0a 09 20 20 20 20 28 66  ter what..    (f
6300: 6f 72 63 65 20 28 73 65 74 21 20 72 75 6e 66 6c  orce (set! runfl
6310: 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20  ag #t))..    ;; 
6320: 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20 72 75 6e  NOT_STARTED, run
6330: 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a   no matter what.
6340: 09 20 20 20 20 28 28 65 71 75 61 6c 3f 20 28 74  .    ((equal? (t
6350: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65  est:get-state te
6360: 73 74 64 61 74 29 20 22 4e 4f 54 5f 53 54 41 52  stdat) "NOT_STAR
6370: 54 45 44 22 29 28 73 65 74 21 20 72 75 6e 66 6c  TED")(set! runfl
6380: 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20  ag #t))..    ;; 
6390: 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e 64 20 50  not -rerun and P
63a0: 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 43 48 45  ASS, WARN or CHE
63b0: 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a 09 20  CK, do no run.. 
63c0: 20 20 20 28 28 61 6e 64 20 28 6f 72 20 28 6e 6f     ((and (or (no
63d0: 74 20 72 65 72 75 6e 29 0a 09 09 20 20 20 20 20  t rerun)...     
63e0: 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 09 20 20   keepgoing)...  
63f0: 3b 3b 20 52 65 71 75 69 72 65 20 74 6f 20 66 6f  ;; Require to fo
6400: 72 63 65 20 72 65 2d 72 75 6e 20 66 6f 72 20 43  rce re-run for C
6410: 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a 61 6e 79  OMPLETED or *any
6420: 74 68 69 6e 67 2a 20 2b 20 50 41 53 53 2c 57 41  thing* + PASS,WA
6430: 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09 09 20 20  RN or CHECK...  
6440: 28 6f 72 20 28 6d 65 6d 62 65 72 20 28 74 65 73  (or (member (tes
6450: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
6460: 74 64 61 74 29 20 27 28 22 50 41 53 53 22 20 22  tdat) '("PASS" "
6470: 57 41 52 4e 22 20 22 43 48 45 43 4b 22 29 29 0a  WARN" "CHECK")).
6480: 09 09 20 20 20 20 20 20 28 6d 65 6d 62 65 72 20  ..      (member 
6490: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
64a0: 20 74 65 73 74 64 61 74 29 20 27 28 22 43 4f 4d   testdat) '("COM
64b0: 50 4c 45 54 45 44 22 29 29 29 29 20 0a 09 20 20  PLETED")))) ..  
64c0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
64d0: 32 20 22 49 4e 46 4f 3a 20 72 75 6e 6e 69 6e 67  2 "INFO: running
64e0: 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d   test " test-nam
64f0: 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 20  e "/" item-path 
6500: 22 20 73 75 70 70 72 65 73 73 65 64 20 61 73 20  " suppressed as 
6510: 69 74 20 69 73 20 22 20 28 74 65 73 74 3a 67 65  it is " (test:ge
6520: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29  t-state testdat)
6530: 20 22 20 61 6e 64 20 22 20 28 74 65 73 74 3a 67   " and " (test:g
6540: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
6550: 74 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20  t))..     (set! 
6560: 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20  runflag #f))..  
6570: 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64 20    ;; -rerun and 
6580: 73 74 61 74 75 73 20 69 73 20 6f 6e 65 20 6f 66  status is one of
6590: 20 74 68 65 20 73 70 65 63 69 66 65 64 2c 20 72   the specifed, r
65a0: 75 6e 20 69 74 0a 09 20 20 20 20 28 28 61 6e 64  un it..    ((and
65b0: 20 72 65 72 75 6e 0a 09 09 20 20 28 6c 65 74 2a   rerun...  (let*
65c0: 20 28 28 72 65 72 75 6e 6c 73 74 20 20 20 28 73   ((rerunlst   (s
65d0: 74 72 69 6e 67 2d 73 70 6c 69 74 20 72 65 72 75  tring-split reru
65e0: 6e 20 22 2c 22 29 29 0a 09 09 09 20 28 6d 75 73  n ",")).... (mus
65f0: 74 2d 72 65 72 75 6e 20 28 6d 65 6d 62 65 72 20  t-rerun (member 
6600: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
6610: 20 74 65 73 74 64 61 74 29 20 72 65 72 75 6e 6c   testdat) rerunl
6620: 73 74 29 29 29 0a 09 09 20 20 20 20 28 64 65 62  st)))...    (deb
6630: 75 67 3a 70 72 69 6e 74 20 33 20 22 49 4e 46 4f  ug:print 3 "INFO
6640: 3a 20 2d 72 65 72 75 6e 20 6c 69 73 74 3a 20 22  : -rerun list: "
6650: 20 72 65 72 75 6e 20 22 2c 20 74 65 73 74 2d 73   rerun ", test-s
6660: 74 61 74 75 73 3a 20 22 20 28 74 65 73 74 3a 67  tatus: " (test:g
6670: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
6680: 74 29 22 2c 20 6d 75 73 74 2d 72 65 72 75 6e 3a  t)", must-rerun:
6690: 20 22 20 6d 75 73 74 2d 72 65 72 75 6e 29 0a 09   " must-rerun)..
66a0: 09 20 20 20 20 6d 75 73 74 2d 72 65 72 75 6e 29  .    must-rerun)
66b0: 29 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70  )..     (debug:p
66c0: 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20 52 65  rint 2 "INFO: Re
66d0: 72 75 6e 20 66 6f 72 63 65 64 20 66 6f 72 20 74  run forced for t
66e0: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  est " test-name 
66f0: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09  "/" item-path)..
6700: 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c       (set! runfl
6710: 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20  ag #t))..    ;; 
6720: 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20 6e  -keepgoing, do n
6730: 6f 74 20 72 65 72 75 6e 20 46 41 49 4c 0a 09 20  ot rerun FAIL.. 
6740: 20 20 20 28 28 61 6e 64 20 6b 65 65 70 67 6f 69     ((and keepgoi
6750: 6e 67 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28  ng...  (member (
6760: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
6770: 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c  testdat) '("FAIL
6780: 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 74 21  ")))..     (set!
6790: 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20   runflag #f)).. 
67a0: 20 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 72 65     ((and (not re
67b0: 72 75 6e 29 0a 09 09 20 20 28 6d 65 6d 62 65 72  run)...  (member
67c0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75   (test:get-statu
67d0: 73 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41  s testdat) '("FA
67e0: 49 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09 20 20  IL" "n/a")))..  
67f0: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67     (set! runflag
6800: 20 23 74 29 29 0a 09 20 20 20 20 28 65 6c 73 65   #t))..    (else
6810: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23   (set! runflag #
6820: 66 29 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a  f)))..   (debug:
6830: 70 72 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47  print 6 "RUNNING
6840: 20 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72   => runflag: " r
6850: 75 6e 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20  unflag " STATE: 
6860: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
6870: 65 20 74 65 73 74 64 61 74 29 20 22 20 53 54 41  e testdat) " STA
6880: 54 55 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74  TUS: " (test:get
6890: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
68a0: 29 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 72  )..   (if (not r
68b0: 75 6e 66 6c 61 67 29 0a 09 20 20 20 20 20 20 20  unflag)..       
68c0: 28 69 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d  (if (not parent-
68d0: 74 65 73 74 29 0a 09 09 20 20 20 28 64 65 62 75  test)...   (debu
68e0: 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a  g:print 1 "NOTE:
68f0: 20 4e 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65   Not starting te
6900: 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61  st " new-test-na
6910: 6d 65 20 22 20 61 73 20 69 74 20 69 73 20 73 74  me " as it is st
6920: 61 74 65 20 5c 22 22 20 28 74 65 73 74 3a 67 65  ate \"" (test:ge
6930: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29  t-state testdat)
6940: 20 0a 09 09 09 09 22 5c 22 20 61 6e 64 20 73 74   ....."\" and st
6950: 61 74 75 73 20 5c 22 22 20 28 74 65 73 74 3a 67  atus \"" (test:g
6960: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
6970: 74 29 20 22 5c 22 2c 20 75 73 65 20 2d 72 65 72  t) "\", use -rer
6980: 75 6e 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74  un \"" (test:get
6990: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
69a0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .               
69b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
69c0: 20 22 5c 22 20 6f 72 20 2d 66 6f 72 63 65 20 74   "\" or -force t
69d0: 6f 20 6f 76 65 72 72 69 64 65 22 29 29 0a 09 20  o override")).. 
69e0: 20 20 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e        ;; NOTE: N
69f0: 6f 20 6c 6f 6e 67 65 72 20 62 65 20 63 68 65 63  o longer be chec
6a00: 6b 69 6e 67 20 70 72 65 72 65 71 75 69 73 69 74  king prerequisit
6a10: 65 73 20 68 65 72 65 21 20 57 69 6c 6c 20 6e 65  es here! Will ne
6a20: 76 65 72 20 67 65 74 20 68 65 72 65 20 75 6e 6c  ver get here unl
6a30: 65 73 73 20 70 72 65 72 65 71 73 20 61 72 65 0a  ess prereqs are.
6a40: 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20  .       ;;      
6a50: 20 61 6c 72 65 61 64 79 20 6d 65 74 2e 0a 09 20   already met... 
6a60: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28        (if (not (
6a70: 6c 61 75 6e 63 68 2d 74 65 73 74 20 64 62 20 72  launch-test db r
6a80: 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65  un-id runname te
6a90: 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73  st-conf keyvalls
6aa0: 74 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74  t test-name test
6ab0: 2d 70 61 74 68 20 69 74 65 6d 64 61 74 20 66 6c  -path itemdat fl
6ac0: 61 67 73 29 29 0a 09 09 20 20 20 28 62 65 67 69  ags))...   (begi
6ad0: 6e 0a 09 09 20 20 20 20 20 28 70 72 69 6e 74 20  n...     (print 
6ae0: 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74  "ERROR: Failed t
6af0: 6f 20 6c 61 75 6e 63 68 20 74 68 65 20 74 65 73  o launch the tes
6b00: 74 2e 20 45 78 69 74 69 6e 67 20 61 73 20 73 6f  t. Exiting as so
6b10: 6f 6e 20 61 73 20 70 6f 73 73 69 62 6c 65 22 29  on as possible")
6b20: 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 2a 67  ...     (set! *g
6b30: 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a  lobalexitstatus*
6b40: 20 31 29 20 3b 3b 20 0a 09 09 20 20 20 20 20 28   1) ;; ...     (
6b50: 70 72 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20 28  process-signal (
6b60: 63 75 72 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d  current-process-
6b70: 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29  id) signal/kill)
6b80: 29 29 29 29 29 0a 09 28 28 4b 49 4c 4c 45 44 29  )))))..((KILLED)
6b90: 20 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74   .. (debug:print
6ba0: 20 31 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77 2d   1 "NOTE: " new-
6bb0: 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61  test-name " is a
6bc0: 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 20 6f  lready running o
6bd0: 72 20 77 61 73 20 65 78 70 6c 69 63 74 6c 79 20  r was explictly 
6be0: 6b 69 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f 72  killed, use -for
6bf0: 63 65 20 74 6f 20 6c 61 75 6e 63 68 20 69 74 2e  ce to launch it.
6c00: 22 29 29 0a 09 28 28 4c 41 55 4e 43 48 45 44 20  "))..((LAUNCHED 
6c10: 52 45 4d 4f 54 45 48 4f 53 54 53 54 41 52 54 20  REMOTEHOSTSTART 
6c20: 52 55 4e 4e 49 4e 47 29 20 20 0a 09 20 28 69 66  RUNNING)  .. (if
6c30: 20 28 3e 20 28 2d 20 28 63 75 72 72 65 6e 74 2d   (> (- (current-
6c40: 73 65 63 6f 6e 64 73 29 28 2b 20 28 64 62 3a 74  seconds)(+ (db:t
6c50: 65 73 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69  est-get-event_ti
6c60: 6d 65 20 74 65 73 74 64 61 74 29 0a 09 09 09 09  me testdat).....
6c70: 20 20 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d         (db:test-
6c80: 67 65 74 2d 72 75 6e 5f 64 75 72 61 74 69 6f 6e  get-run_duration
6c90: 20 74 65 73 74 64 61 74 29 29 29 0a 09 09 36 30   testdat)))...60
6ca0: 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70  0) ;; i.e. no up
6cb0: 64 61 74 65 20 66 6f 72 20 6d 6f 72 65 20 74 68  date for more th
6cc0: 61 6e 20 36 30 30 20 73 65 63 6f 6e 64 73 0a 09  an 600 seconds..
6cd0: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20       (begin..   
6ce0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
6cf0: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 54 65 73   0 "WARNING: Tes
6d00: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20  t " test-name " 
6d10: 61 70 70 65 61 72 73 20 74 6f 20 62 65 20 64 65  appears to be de
6d20: 61 64 2e 20 46 6f 72 63 69 6e 67 20 69 74 20 74  ad. Forcing it t
6d30: 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45  o state INCOMPLE
6d40: 54 45 20 61 6e 64 20 73 74 61 74 75 73 20 53 54  TE and status ST
6d50: 55 43 4b 2f 44 45 41 44 22 29 0a 09 20 20 20 20  UCK/DEAD")..    
6d60: 20 20 20 28 74 65 73 74 2d 73 65 74 2d 73 74 61     (test-set-sta
6d70: 74 75 73 21 20 64 62 20 74 65 73 74 2d 69 64 20  tus! db test-id 
6d80: 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22 53 54  "INCOMPLETE" "ST
6d90: 55 43 4b 2f 44 45 41 44 22 20 22 54 65 73 74 20  UCK/DEAD" "Test 
6da0: 69 73 20 73 74 75 63 6b 20 6f 72 20 64 65 61 64  is stuck or dead
6db0: 22 20 23 66 29 29 0a 09 20 20 20 20 20 28 64 65  " #f))..     (de
6dc0: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54  bug:print 2 "NOT
6dd0: 45 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22  E: " test-name "
6de0: 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e   is already runn
6df0: 69 6e 67 22 29 29 29 0a 09 28 65 6c 73 65 20 20  ing")))..(else  
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 45 52 52 4f 52 3a 20 46 61 69 6c  t 0 "ERROR: Fail
6e20: 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73  ed to launch tes
6e30: 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d  t " new-test-nam
6e40: 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73 65  e ". Unrecognise
6e50: 64 20 73 74 61 74 65 20 22 20 28 74 65 73 74 3a  d state " (test:
6e60: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61  get-state testda
6e70: 74 29 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d  t)))))))..;;====
6e80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6e90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6ea0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6eb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6ec0: 3d 3d 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e 45 57  ==.;; END OF NEW
6ed0: 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d   STUFF.;;=======
6ee0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6ef0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6f00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6f10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
6f20: 0a 28 64 65 66 69 6e 65 20 28 67 65 74 2d 64 69  .(define (get-di
6f30: 72 2d 75 70 2d 6e 20 64 69 72 20 2e 20 70 61 72  r-up-n dir . par
6f40: 61 6d 73 29 20 0a 20 20 28 6c 65 74 20 28 28 64  ams) .  (let ((d
6f50: 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73  parts  (string-s
6f60: 70 6c 69 74 20 64 69 72 20 22 2f 22 29 29 0a 09  plit dir "/"))..
6f70: 28 63 6f 75 6e 74 20 20 20 28 69 66 20 28 6e 75  (count   (if (nu
6f80: 6c 6c 3f 20 70 61 72 61 6d 73 29 20 31 20 28 63  ll? params) 1 (c
6f90: 61 72 20 70 61 72 61 6d 73 29 29 29 29 0a 20 20  ar params)))).  
6fa0: 20 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72    (conc "/" (str
6fb0: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20  ing-intersperse 
6fc0: 0a 09 20 20 20 20 20 20 20 28 74 61 6b 65 20 64  ..       (take d
6fd0: 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68  parts (- (length
6fe0: 20 64 70 61 72 74 73 29 20 63 6f 75 6e 74 29 29   dparts) count))
6ff0: 0a 09 20 20 20 20 20 20 20 22 2f 22 29 29 29 29  ..       "/"))))
7000: 0a 3b 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73 0a  .;; Remove runs.
7010: 3b 3b 20 66 69 65 6c 64 73 20 61 72 65 20 70 61  ;; fields are pa
7020: 73 73 69 6e 67 20 69 6e 20 74 68 72 6f 75 67 68  ssing in through
7030: 20 0a 3b 3b 20 61 63 74 69 6f 6e 3a 0a 3b 3b 20   .;; action:.;; 
7040: 20 20 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73 0a     'remove-runs.
7050: 3b 3b 20 20 20 20 27 73 65 74 2d 73 74 61 74 65  ;;    'set-state
7060: 2d 73 74 61 74 75 73 0a 3b 3b 0a 3b 3b 20 4e 42  -status.;;.;; NB
7070: 2f 2f 20 73 68 6f 75 6c 64 20 70 61 73 73 20 69  // should pass i
7080: 6e 20 6b 65 79 73 3f 0a 3b 3b 0a 28 64 65 66 69  n keys?.;;.(defi
7090: 6e 65 20 28 72 75 6e 73 3a 6f 70 65 72 61 74 65  ne (runs:operate
70a0: 2d 6f 6e 20 64 62 20 61 63 74 69 6f 6e 20 72 75  -on db action ru
70b0: 6e 6e 61 6d 65 70 61 74 74 20 74 65 73 74 70 61  nnamepatt testpa
70c0: 74 74 20 69 74 65 6d 70 61 74 74 20 23 21 6b 65  tt itempatt #!ke
70d0: 79 20 28 73 74 61 74 65 20 23 66 29 28 73 74 61  y (state #f)(sta
70e0: 74 75 73 20 23 66 29 28 6e 65 77 2d 73 74 61 74  tus #f)(new-stat
70f0: 65 2d 73 74 61 74 75 73 20 23 66 29 29 0a 20 20  e-status #f)).  
7100: 28 6c 65 74 2a 20 28 28 6b 65 79 73 20 20 20 20  (let* ((keys    
7110: 20 20 20 20 20 28 72 64 62 3a 67 65 74 2d 6b 65       (rdb:get-ke
7120: 79 73 20 64 62 29 29 0a 09 20 28 72 75 6e 64 61  ys db)).. (runda
7130: 74 20 20 20 20 20 20 20 28 72 75 6e 73 3a 67 65  t       (runs:ge
7140: 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64  t-runs-by-patt d
7150: 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61  b keys runnamepa
7160: 74 74 29 29 0a 09 20 28 68 65 61 64 65 72 20 20  tt)).. (header  
7170: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66       (vector-ref
7180: 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72   rundat 0)).. (r
7190: 75 6e 73 20 20 20 20 20 20 20 20 20 28 76 65 63  uns         (vec
71a0: 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31  tor-ref rundat 1
71b0: 29 29 0a 09 20 28 73 74 61 74 65 73 20 20 20 20  )).. (states    
71c0: 20 20 20 28 69 66 20 73 74 61 74 65 20 20 28 73     (if state  (s
71d0: 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 74  tring-split stat
71e0: 65 20 20 22 2c 22 29 20 27 28 29 29 29 0a 09 20  e  ",") '())).. 
71f0: 28 73 74 61 74 75 73 65 73 20 20 20 20 20 28 69  (statuses     (i
7200: 66 20 73 74 61 74 75 73 20 28 73 74 72 69 6e 67  f status (string
7210: 2d 73 70 6c 69 74 20 73 74 61 74 75 73 20 22 2c  -split status ",
7220: 22 29 20 27 28 29 29 29 0a 09 20 28 73 74 61 74  ") '())).. (stat
7230: 65 2d 73 74 61 74 75 73 20 28 69 66 20 28 73 74  e-status (if (st
7240: 72 69 6e 67 3f 20 6e 65 77 2d 73 74 61 74 65 2d  ring? new-state-
7250: 73 74 61 74 75 73 29 20 28 73 74 72 69 6e 67 2d  status) (string-
7260: 73 70 6c 69 74 20 6e 65 77 2d 73 74 61 74 65 2d  split new-state-
7270: 73 74 61 74 75 73 20 22 2c 22 29 20 27 28 23 66  status ",") '(#f
7280: 20 23 66 29 29 29 29 0a 20 20 20 20 28 64 65 62   #f)))).    (deb
7290: 75 67 3a 70 72 69 6e 74 20 32 20 22 48 65 61 64  ug:print 2 "Head
72a0: 65 72 3a 20 22 20 68 65 61 64 65 72 20 22 20 61  er: " header " a
72b0: 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e 20  ction: " action 
72c0: 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74  " new-state-stat
72d0: 75 73 3a 20 22 20 6e 65 77 2d 73 74 61 74 65 2d  us: " new-state-
72e0: 73 74 61 74 75 73 29 0a 20 20 20 20 28 66 6f 72  status).    (for
72f0: 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62  -each.     (lamb
7300: 64 61 20 28 72 75 6e 29 0a 20 20 20 20 20 20 20  da (run).       
7310: 28 6c 65 74 20 28 28 72 75 6e 6b 65 79 20 28 73  (let ((runkey (s
7320: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
7330: 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28  e (map (lambda (
7340: 6b 29 0a 09 09 09 09 09 09 28 64 62 3a 67 65 74  k).......(db:get
7350: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
7360: 20 72 75 6e 20 68 65 61 64 65 72 20 28 76 65 63   run header (vec
7370: 74 6f 72 2d 72 65 66 20 6b 20 30 29 29 29 20 6b  tor-ref k 0))) k
7380: 65 79 73 29 20 22 2f 22 29 29 0a 09 20 20 20 20  eys) "/"))..    
7390: 20 28 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65   (dirs-to-remove
73a0: 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c   (make-hash-tabl
73b0: 65 29 29 29 0a 09 20 28 6c 65 74 2a 20 28 28 72  e))).. (let* ((r
73c0: 75 6e 2d 69 64 20 20 20 20 28 64 62 3a 67 65 74  un-id    (db:get
73d0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
73e0: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22   run header "id"
73f0: 29 29 0a 09 09 28 72 75 6e 2d 73 74 61 74 65 20  ))...(run-state 
7400: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
7410: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
7420: 65 72 20 22 73 74 61 74 65 22 29 29 0a 09 09 28  er "state"))...(
7430: 74 65 73 74 73 20 20 20 20 20 28 69 66 20 28 6e  tests     (if (n
7440: 6f 74 20 28 65 71 75 61 6c 3f 20 72 75 6e 2d 73  ot (equal? run-s
7450: 74 61 74 65 20 22 6c 6f 63 6b 65 64 22 29 29 0a  tate "locked")).
7460: 09 09 09 20 20 20 20 20 20 20 28 72 64 62 3a 67  ...       (rdb:g
7470: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e  et-tests-for-run
7480: 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75   db (db:get-valu
7490: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20  e-by-header run 
74a0: 68 65 61 64 65 72 20 22 69 64 22 29 0a 09 09 09  header "id")....
74b0: 09 09 09 20 20 20 20 20 20 74 65 73 74 70 61 74  ...      testpat
74c0: 74 20 69 74 65 6d 70 61 74 74 20 73 74 61 74 65  t itempatt state
74d0: 73 20 73 74 61 74 75 73 65 73 0a 09 09 09 09 09  s statuses......
74e0: 09 20 20 20 20 20 20 6e 6f 74 2d 69 6e 3a 20 20  .      not-in:  
74f0: 23 66 0a 09 09 09 09 09 09 20 20 20 20 20 20 73  #f.......      s
7500: 6f 72 74 2d 62 79 3a 20 28 63 61 73 65 20 61 63  ort-by: (case ac
7510: 74 69 6f 6e 0a 09 09 09 09 09 09 09 09 20 28 28  tion......... ((
7520: 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20 27 72 75  remove-runs) 'ru
7530: 6e 64 69 72 29 0a 09 09 09 09 09 09 09 09 20 28  ndir)......... (
7540: 65 6c 73 65 20 20 20 20 20 20 20 20 20 20 27 65  else          'e
7550: 76 65 6e 74 5f 74 69 6d 65 29 29 29 0a 09 09 09  vent_time)))....
7560: 20 20 20 20 20 20 20 27 28 29 29 29 0a 09 09 28         '()))...(
7570: 6c 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65 73  lasttpath "/does
7580: 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70  /not/exist/I/hop
7590: 65 22 29 29 0a 0a 09 20 20 20 28 69 66 20 28 6e  e"))...   (if (n
75a0: 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29  ot (null? tests)
75b0: 29 0a 09 20 20 20 20 20 20 20 28 62 65 67 69 6e  )..       (begin
75c0: 0a 09 09 20 28 63 61 73 65 20 61 63 74 69 6f 6e  ... (case action
75d0: 0a 09 09 20 20 20 28 28 72 65 6d 6f 76 65 2d 72  ...   ((remove-r
75e0: 75 6e 73 29 0a 09 09 20 20 20 20 28 64 65 62 75  uns)...    (debu
75f0: 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76  g:print 1 "Remov
7600: 69 6e 67 20 74 65 73 74 73 20 66 6f 72 20 72 75  ing tests for ru
7610: 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20  n: " runkey " " 
7620: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
7630: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
7640: 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a  er "runname"))).
7650: 09 09 20 20 20 28 28 73 65 74 2d 73 74 61 74 65  ..   ((set-state
7660: 2d 73 74 61 74 75 73 29 0a 09 09 20 20 20 20 28  -status)...    (
7670: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4d  debug:print 1 "M
7680: 6f 64 69 66 79 69 6e 67 20 73 74 61 74 65 20 61  odifying state a
7690: 6e 64 20 73 74 61 75 73 20 66 6f 72 20 74 65 73  nd staus for tes
76a0: 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75  ts for run: " ru
76b0: 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74  nkey " " (db:get
76c0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
76d0: 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e   run header "run
76e0: 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28 65  name")))...   (e
76f0: 6c 73 65 0a 09 09 20 20 20 20 28 70 72 69 6e 74  lse...    (print
7700: 20 22 49 4e 46 4f 3a 20 61 63 74 69 6f 6e 20 6e   "INFO: action n
7710: 6f 74 20 72 65 63 6f 67 6e 69 73 65 64 20 22 20  ot recognised " 
7720: 61 63 74 69 6f 6e 29 29 29 0a 09 09 20 28 66 6f  action)))... (fo
7730: 72 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d 62  r-each...  (lamb
7740: 64 61 20 28 74 65 73 74 29 0a 09 09 20 20 20 20  da (test)...    
7750: 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 74  (let* ((item-pat
7760: 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  h (db:test-get-i
7770: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 0a  tem-path test)).
7780: 09 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d 65  ...   (test-name
7790: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
77a0: 73 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 09  stname test))...
77b0: 09 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20 28  .   (run-dir   (
77c0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64  db:test-get-rund
77d0: 69 72 20 74 65 73 74 29 29 29 0a 09 09 20 20 20  ir test)))...   
77e0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
77f0: 31 20 22 20 20 22 20 28 64 62 3a 74 65 73 74 2d  1 "  " (db:test-
7800: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73  get-testname tes
7810: 74 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a 74  t) " id: " (db:t
7820: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29  est-get-id test)
7830: 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22   " " item-path "
7840: 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f   action: " actio
7850: 6e 29 0a 09 09 20 20 20 20 20 20 28 63 61 73 65  n)...      (case
7860: 20 61 63 74 69 6f 6e 0a 09 09 09 28 28 72 65 6d   action....((rem
7870: 6f 76 65 2d 72 75 6e 73 29 0a 09 09 09 20 28 72  ove-runs).... (r
7880: 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 2d 72  db:delete-test-r
7890: 65 63 6f 72 64 73 20 64 62 20 28 64 62 3a 74 65  ecords db (db:te
78a0: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29  st-get-id test))
78b0: 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e  .... (debug:prin
78c0: 74 20 31 20 22 49 4e 46 4f 3a 20 41 74 74 65 6d  t 1 "INFO: Attem
78d0: 70 74 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20  pting to remove 
78e0: 64 69 72 20 22 20 72 75 6e 2d 64 69 72 29 0a 09  dir " run-dir)..
78f0: 09 09 20 28 69 66 20 28 61 6e 64 20 28 3e 20 28  .. (if (and (> (
7900: 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 72 75  string-length ru
7910: 6e 2d 64 69 72 29 20 35 29 0a 09 09 09 09 20 20  n-dir) 5).....  
7920: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75  (file-exists? ru
7930: 6e 2d 64 69 72 29 29 20 3b 3b 20 62 61 64 20 68  n-dir)) ;; bad h
7940: 65 75 72 69 73 74 69 63 20 62 75 74 20 73 68 6f  euristic but sho
7950: 75 6c 64 20 70 72 65 76 65 6e 74 20 2f 74 6d 70  uld prevent /tmp
7960: 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20   /home etc..... 
7970: 20 20 20 20 28 6c 65 74 2a 20 28 28 72 65 61 6c      (let* ((real
7980: 70 61 74 68 20 28 72 65 73 6f 6c 76 65 2d 70 61  path (resolve-pa
7990: 74 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72 29 29  thname run-dir))
79a0: 29 0a 09 09 09 20 20 20 20 20 20 20 28 64 65 62  )....       (deb
79b0: 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f  ug:print 1 "INFO
79c0: 3a 20 52 65 61 6c 20 70 61 74 68 20 6f 66 20 69  : Real path of i
79d0: 73 20 22 20 72 65 61 6c 70 61 74 68 29 0a 09 09  s " realpath)...
79e0: 09 20 20 20 20 20 20 20 28 69 66 20 28 66 69 6c  .       (if (fil
79f0: 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c 70 61  e-exists? realpa
7a00: 74 68 29 0a 09 09 09 09 20 20 20 28 69 66 20 28  th).....   (if (
7a10: 3e 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20  > (system (conc 
7a20: 22 72 6d 20 2d 72 66 20 22 20 72 65 61 6c 70 61  "rm -rf " realpa
7a30: 74 68 29 29 20 30 29 0a 09 09 09 09 20 20 20 20  th)) 0).....    
7a40: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
7a50: 30 20 22 45 52 52 4f 52 3a 20 54 68 65 72 65 20  0 "ERROR: There 
7a60: 77 61 73 20 61 20 70 72 6f 62 6c 65 6d 20 72 65  was a problem re
7a70: 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c 70 61 74  moving " realpat
7a80: 68 20 22 20 77 69 74 68 20 72 6d 20 2d 66 22 29  h " with rm -f")
7a90: 29 0a 09 09 09 09 20 20 20 28 64 65 62 75 67 3a  ).....   (debug:
7aa0: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47  print 0 "WARNING
7ab0: 3a 20 74 65 73 74 20 72 75 6e 20 64 69 72 20 22  : test run dir "
7ac0: 20 72 65 61 6c 70 61 74 68 20 22 20 61 70 70 65   realpath " appe
7ad0: 61 72 73 20 74 6f 20 6e 6f 74 20 65 78 69 73 74  ars to not exist
7ae0: 22 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 69  "))....       (i
7af0: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20  f (file-exists? 
7b00: 72 75 6e 2d 64 69 72 29 20 3b 3b 20 74 68 65 20  run-dir) ;; the 
7b10: 6c 69 6e 6b 0a 09 09 09 09 20 20 20 28 69 66 20  link.....   (if 
7b20: 28 73 79 6d 62 6f 6c 69 63 2d 6c 69 6e 6b 3f 20  (symbolic-link? 
7b30: 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 20 20 20  run-dir).....   
7b40: 20 20 20 20 28 64 65 6c 65 74 65 2d 66 69 6c 65      (delete-file
7b50: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 20 20   run-dir).....  
7b60: 20 20 20 20 20 28 69 66 20 28 64 69 72 65 63 74       (if (direct
7b70: 6f 72 79 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09  ory? run-dir)...
7b80: 09 09 09 20 20 20 28 69 66 20 28 3e 20 28 64 69  ...   (if (> (di
7b90: 72 65 63 74 6f 72 79 2d 66 6f 6c 64 20 28 6c 61  rectory-fold (la
7ba0: 6d 62 64 61 20 28 66 20 78 29 28 2b 20 31 20 78  mbda (f x)(+ 1 x
7bb0: 29 29 20 30 20 72 75 6e 2d 64 69 72 29 20 30 29  )) 0 run-dir) 0)
7bc0: 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 64 65  ......       (de
7bd0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52  bug:print 0 "WAR
7be0: 4e 49 4e 47 3a 20 72 65 66 75 73 69 6e 67 20 74  NING: refusing t
7bf0: 6f 20 72 65 6d 6f 76 65 20 22 20 72 75 6e 2d 64  o remove " run-d
7c00: 69 72 20 22 20 61 73 20 69 74 20 69 73 20 6e 6f  ir " as it is no
7c10: 74 20 65 6d 70 74 79 22 29 0a 09 09 09 09 09 20  t empty")...... 
7c20: 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d 64 69        (delete-di
7c30: 72 65 63 74 6f 72 79 20 72 75 6e 2d 64 69 72 29  rectory run-dir)
7c40: 29 20 3b 3b 20 69 74 20 73 68 6f 75 6c 64 20 62  ) ;; it should b
7c50: 65 20 65 6d 70 74 79 20 62 79 20 68 65 72 65 20  e empty by here 
7c60: 42 55 47 20 42 55 47 2c 20 61 64 64 20 65 72 72  BUG BUG, add err
7c70: 6f 72 20 63 61 74 63 68 0a 09 09 09 09 09 20 20  or catch......  
7c80: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
7c90: 22 45 52 52 4f 52 3a 20 72 65 66 75 73 69 6e 67  "ERROR: refusing
7ca0: 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72 75 6e   to remove " run
7cb0: 2d 64 69 72 20 22 20 61 73 20 69 74 20 69 73 20  -dir " as it is 
7cc0: 6e 65 69 74 68 65 72 20 61 20 73 79 6d 6c 69 6e  neither a symlin
7cd0: 6b 20 6e 6f 72 20 61 20 64 69 72 65 63 74 6f 72  k nor a director
7ce0: 79 22 29 0a 09 09 09 09 09 20 20 20 29 29 29 29  y")......   ))))
7cf0: 0a 09 09 09 20 20 20 20 20 28 64 65 62 75 67 3a  ....     (debug:
7d00: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47  print 0 "WARNING
7d10: 3a 20 64 69 72 65 63 74 6f 72 79 20 61 6c 72 65  : directory alre
7d20: 61 64 79 20 72 65 6d 6f 76 65 64 20 22 20 72 75  ady removed " ru
7d30: 6e 2d 64 69 72 29 29 29 0a 09 09 09 28 28 73 65  n-dir)))....((se
7d40: 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a  t-state-status).
7d50: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ... (debug:print
7d60: 20 32 20 22 49 4e 46 4f 3a 20 6e 65 77 20 73 74   2 "INFO: new st
7d70: 61 74 65 20 22 20 28 63 61 72 20 73 74 61 74 65  ate " (car state
7d80: 2d 73 74 61 74 75 73 29 20 22 2c 20 6e 65 77 20  -status) ", new 
7d90: 73 74 61 74 75 73 20 22 20 28 63 61 64 72 20 73  status " (cadr s
7da0: 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a 09 09  tate-status))...
7db0: 09 20 28 64 62 3a 74 65 73 74 2d 73 65 74 2d 73  . (db:test-set-s
7dc0: 74 61 74 65 2d 73 74 61 74 75 73 2d 62 79 2d 69  tate-status-by-i
7dd0: 64 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65  d db (db:test-ge
7de0: 74 2d 69 64 20 74 65 73 74 29 20 28 63 61 72 20  t-id test) (car 
7df0: 73 74 61 74 65 2d 73 74 61 74 75 73 29 28 63 61  state-status)(ca
7e00: 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29  dr state-status)
7e10: 20 23 66 29 29 29 29 29 0a 09 09 20 20 74 65 73   #f)))))...  tes
7e20: 74 73 29 29 29 0a 09 20 20 20 0a 09 20 20 20 3b  ts)))..   ..   ;
7e30: 3b 20 72 65 6d 6f 76 65 20 74 68 65 20 72 75 6e  ; remove the run
7e40: 20 69 66 20 7a 65 72 6f 20 74 65 73 74 73 20 72   if zero tests r
7e50: 65 6d 61 69 6e 0a 09 20 20 20 28 69 66 20 28 65  emain..   (if (e
7e60: 71 3f 20 61 63 74 69 6f 6e 20 27 72 65 6d 6f 76  q? action 'remov
7e70: 65 2d 72 75 6e 73 29 0a 09 20 20 20 20 20 20 20  e-runs)..       
7e80: 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73 20  (let ((remtests 
7e90: 28 72 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66  (rdb:get-tests-f
7ea0: 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65  or-run db (db:ge
7eb0: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65  t-value-by-heade
7ec0: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64  r run header "id
7ed0: 22 29 20 23 66 20 23 66 20 27 28 29 20 27 28 29  ") #f #f '() '()
7ee0: 29 29 29 0a 09 09 20 28 69 66 20 28 6e 75 6c 6c  )))... (if (null
7ef0: 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b 20 6e  ? remtests) ;; n
7f00: 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72 65 6d  o more tests rem
7f10: 61 69 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 6c  aining...     (l
7f20: 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 28 73  et* ((dparts  (s
7f30: 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73 74  tring-split last
7f40: 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09 20  tpath "/")).... 
7f50: 20 20 20 28 72 75 6e 70 61 74 68 20 28 63 6f 6e     (runpath (con
7f60: 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e  c "/" (string-in
7f70: 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 09 09  tersperse ......
7f80: 09 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d  .(take dparts (-
7f90: 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29   (length dparts)
7fa0: 20 31 29 29 0a 09 09 09 09 09 09 22 2f 22 29 29   1))......."/"))
7fb0: 29 29 0a 09 09 20 20 20 20 20 20 20 28 64 65 62  ))...       (deb
7fc0: 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f  ug:print 1 "Remo
7fd0: 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b  ving run: " runk
7fe0: 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76  ey " " (db:get-v
7ff0: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72  alue-by-header r
8000: 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61  un header "runna
8010: 6d 65 22 29 29 0a 09 09 20 20 20 20 20 20 20 28  me"))...       (
8020: 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e 20 64 62  db:delete-run db
8030: 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 20 20   run-id)...     
8040: 20 20 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 67    ;; need to fig
8050: 75 72 65 20 6f 75 74 20 74 68 65 20 70 61 74 68  ure out the path
8060: 20 74 6f 20 74 68 65 20 72 75 6e 20 64 69 72 20   to the run dir 
8070: 61 6e 64 20 72 65 6d 6f 76 65 20 69 74 20 69 66  and remove it if
8080: 20 65 6d 70 74 79 0a 09 09 20 20 20 20 20 20 20   empty...       
8090: 3b 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f  ;;    (if (null?
80a0: 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e   (glob (conc run
80b0: 70 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 20  path "/*")))... 
80c0: 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20        ;;        
80d0: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 20 20  (begin...       
80e0: 3b 3b 20 09 20 28 64 65 62 75 67 3a 70 72 69 6e  ;; . (debug:prin
80f0: 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75  t 1 "Removing ru
8100: 6e 20 64 69 72 20 22 20 72 75 6e 70 61 74 68 29  n dir " runpath)
8110: 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28  ...       ;; . (
8120: 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d  system (conc "rm
8130: 64 69 72 20 2d 70 20 22 20 72 75 6e 70 61 74 68  dir -p " runpath
8140: 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 29 29  ))))...       ))
8150: 29 29 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75  ))).. )).     ru
8160: 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d  ns)))..;;=======
8170: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8180: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8190: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
81a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
81b0: 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f 72 20  ;; Routines for 
81c0: 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 72 75 6e  manipulating run
81d0: 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  s.;;============
81e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
81f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8200: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8210: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53  ==========..;; S
8220: 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73 20  ince many calls 
8230: 74 6f 20 61 20 72 75 6e 20 72 65 71 75 69 72 65  to a run require
8240: 20 70 72 65 74 74 79 20 6d 75 63 68 20 74 68 65   pretty much the
8250: 20 73 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b 20   same setup .;; 
8260: 74 68 69 73 20 77 72 61 70 70 65 72 20 69 73 20  this wrapper is 
8270: 75 73 65 64 20 74 6f 20 72 65 64 75 63 65 20 74  used to reduce t
8280: 68 65 20 72 65 70 6c 69 63 61 74 69 6f 6e 20 6f  he replication o
8290: 66 20 63 6f 64 65 0a 28 64 65 66 69 6e 65 20 28  f code.(define (
82a0: 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c  general-run-call
82b0: 20 73 77 69 74 63 68 6e 61 6d 65 20 61 63 74 69   switchname acti
82c0: 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a 20 20  on-desc proc).  
82d0: 28 6c 65 74 20 28 28 72 75 6e 6e 61 6d 65 20 28  (let ((runname (
82e0: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72  args:get-arg ":r
82f0: 75 6e 6e 61 6d 65 22 29 29 0a 09 28 74 61 72 67  unname"))..(targ
8300: 65 74 20 20 28 69 66 20 28 61 72 67 73 3a 67 65  et  (if (args:ge
8310: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29  t-arg "-target")
8320: 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 65  ...     (args:ge
8330: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29  t-arg "-target")
8340: 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 65  ...     (args:ge
8350: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22  t-arg "-reqtarg"
8360: 29 29 29 0a 09 28 74 68 31 20 20 20 20 20 23 66  )))..(th1     #f
8370: 29 29 0a 20 20 20 20 28 63 6f 6e 64 0a 20 20 20  )).    (cond.   
8380: 20 20 28 28 6e 6f 74 20 74 61 72 67 65 74 29 0a    ((not target).
8390: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
83a0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73  nt 0 "ERROR: Mis
83b0: 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61  sing required pa
83c0: 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77  rameter for " sw
83d0: 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20  itchname ", you 
83e0: 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65  must specify the
83f0: 20 74 61 72 67 65 74 20 77 69 74 68 20 2d 74 61   target with -ta
8400: 72 67 65 74 22 29 0a 20 20 20 20 20 20 28 65 78  rget").      (ex
8410: 69 74 20 33 29 29 0a 20 20 20 20 20 28 28 6e 6f  it 3)).     ((no
8420: 74 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 20  t runname).     
8430: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
8440: 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20  "ERROR: Missing 
8450: 72 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 74  required paramet
8460: 65 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e  er for " switchn
8470: 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20  ame ", you must 
8480: 73 70 65 63 69 66 79 20 74 68 65 20 72 75 6e 20  specify the run 
8490: 6e 61 6d 65 20 77 69 74 68 20 3a 72 75 6e 6e 61  name with :runna
84a0: 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a 20 20 20  me runname").   
84b0: 20 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 20     (exit 3)).   
84c0: 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 28 6c    (else.      (l
84d0: 65 74 20 28 28 64 62 20 20 20 23 66 29 0a 09 20  et ((db   #f).. 
84e0: 20 20 20 28 6b 65 79 73 20 23 66 29 29 0a 09 28     (keys #f))..(
84f0: 69 66 20 28 6e 6f 74 20 28 73 65 74 75 70 2d 66  if (not (setup-f
8500: 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 20 28 62  or-run))..    (b
8510: 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64 65  egin ..      (de
8520: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 46 61 69  bug:print 0 "Fai
8530: 6c 65 64 20 74 6f 20 73 65 74 75 70 2c 20 65 78  led to setup, ex
8540: 69 74 69 6e 67 22 29 0a 09 20 20 20 20 20 20 28  iting")..      (
8550: 65 78 69 74 20 31 29 29 29 0a 09 28 73 65 74 21  exit 1)))..(set!
8560: 20 64 62 20 20 20 28 6f 70 65 6e 2d 64 62 29 29   db   (open-db))
8570: 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d  ..(if (args:get-
8580: 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 0a 09  arg "-server")..
8590: 20 20 20 20 28 73 65 72 76 65 72 3a 73 74 61 72      (server:star
85a0: 74 20 64 62 20 28 61 72 67 73 3a 67 65 74 2d 61  t db (args:get-a
85b0: 72 67 20 22 2d 73 65 72 76 65 72 22 29 29 0a 09  rg "-server"))..
85c0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6f 72      (if (not (or
85d0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
85e0: 2d 72 75 6e 61 6c 6c 22 29 0a 09 09 09 20 20 28  -runall")....  (
85f0: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72  args:get-arg "-r
8600: 75 6e 74 65 73 74 73 22 29 29 29 0a 09 09 28 73  untests")))...(s
8610: 65 72 76 65 72 3a 63 6c 69 65 6e 74 2d 73 65 74  erver:client-set
8620: 75 70 20 64 62 29 29 29 0a 09 28 73 65 74 21 20  up db)))..(set! 
8630: 6b 65 79 73 20 28 72 64 62 3a 67 65 74 2d 6b 65  keys (rdb:get-ke
8640: 79 73 20 64 62 29 29 0a 09 3b 3b 20 68 61 76 65  ys db))..;; have
8650: 20 65 6e 6f 75 67 68 20 74 6f 20 70 72 6f 63 65   enough to proce
8660: 73 73 20 2d 74 61 72 67 65 74 20 6f 72 20 2d 72  ss -target or -r
8670: 65 71 74 61 72 67 20 68 65 72 65 0a 09 28 69 66  eqtarg here..(if
8680: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
8690: 2d 72 65 71 74 61 72 67 22 29 0a 09 20 20 20 20  -reqtarg")..    
86a0: 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f 6e 66 69  (let* ((runconfi
86b0: 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61  gf (conc  *toppa
86c0: 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73  th* "/runconfigs
86d0: 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b 20 44 4f  .config")) ;; DO
86e0: 20 4e 4f 54 20 45 56 41 4c 55 41 54 45 20 41 4c   NOT EVALUATE AL
86f0: 4c 20 0a 09 09 20 20 20 28 72 75 6e 63 6f 6e 66  L ...   (runconf
8700: 69 67 20 20 28 72 65 61 64 2d 63 6f 6e 66 69 67  ig  (read-config
8710: 20 72 75 6e 63 6f 6e 66 69 67 66 20 23 66 20 23   runconfigf #f #
8720: 66 20 65 6e 76 69 72 6f 6e 2d 70 61 74 74 3a 20  f environ-patt: 
8730: 23 66 29 29 29 20 0a 09 20 20 20 20 20 20 28 69  #f))) ..      (i
8740: 66 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65  f (hash-table-re
8750: 66 2f 64 65 66 61 75 6c 74 20 72 75 6e 63 6f 6e  f/default runcon
8760: 66 69 67 20 28 61 72 67 73 3a 67 65 74 2d 61 72  fig (args:get-ar
8770: 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 23 66  g "-reqtarg") #f
8780: 29 0a 09 09 20 20 28 6b 65 79 73 3a 74 61 72 67  )...  (keys:targ
8790: 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 73  et-set-args keys
87a0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
87b0: 2d 72 65 71 74 61 72 67 22 29 20 61 72 67 73 3a  -reqtarg") args:
87c0: 61 72 67 2d 68 61 73 68 29 0a 09 09 20 20 28 62  arg-hash)...  (b
87d0: 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65 62 75  egin...    (debu
87e0: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
87f0: 3a 20 5b 22 20 28 61 72 67 73 3a 67 65 74 2d 61  : [" (args:get-a
8800: 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 22  rg "-reqtarg") "
8810: 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69 6e 20 22  ] not found in "
8820: 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 09 20   runconfigf)... 
8830: 20 20 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61     (sqlite3:fina
8840: 6c 69 7a 65 21 20 64 62 29 0a 09 09 20 20 20 20  lize! db)...    
8850: 28 65 78 69 74 20 31 29 29 29 29 0a 09 20 20 20  (exit 1))))..   
8860: 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61   (if (args:get-a
8870: 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09  rg "-target")...
8880: 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74  (keys:target-set
8890: 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 73  -args keys (args
88a0: 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65  :get-arg "-targe
88b0: 74 22 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68  t" args:arg-hash
88c0: 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29  ) args:arg-hash)
88d0: 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 63 61  ))..(if (not (ca
88e0: 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29  r *configinfo*))
88f0: 0a 09 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20  ..    (begin..  
8900: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
8910: 20 30 20 22 45 52 52 4f 52 3a 20 41 74 74 65 6d   0 "ERROR: Attem
8920: 70 74 65 64 20 74 6f 20 22 20 61 63 74 69 6f 6e  pted to " action
8930: 2d 64 65 73 63 20 22 20 62 75 74 20 72 75 6e 20  -desc " but run 
8940: 61 72 65 61 20 63 6f 6e 66 69 67 20 66 69 6c 65  area config file
8950: 20 6e 6f 74 20 66 6f 75 6e 64 22 29 0a 09 20 20   not found")..  
8960: 20 20 20 20 28 65 78 69 74 20 31 29 29 0a 09 20      (exit 1)).. 
8970: 20 20 20 3b 3b 20 45 78 74 72 61 63 74 20 6f 75     ;; Extract ou
8980: 74 20 73 74 75 66 66 20 6e 65 65 64 65 64 20 69  t stuff needed i
8990: 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63  n most or many c
89a0: 61 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 68 65 72  alls..    ;; her
89b0: 65 20 74 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63  e then call proc
89c0: 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 6b 65  ..    (let* ((ke
89d0: 79 6e 61 6d 65 73 20 20 20 28 6d 61 70 20 6b 65  ynames   (map ke
89e0: 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20  y:get-fieldname 
89f0: 6b 65 79 73 29 29 0a 09 09 20 20 20 28 6b 65 79  keys))...   (key
8a00: 76 61 6c 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76  vallst  (keys->v
8a10: 61 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 29 29  allist keys #t))
8a20: 29 0a 09 20 20 20 20 20 20 28 70 72 6f 63 20 64  )..      (proc d
8a30: 62 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65  b target runname
8a40: 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73 20 6b   keys keynames k
8a50: 65 79 76 61 6c 6c 73 74 29 29 29 0a 09 28 69 66  eyvallst)))..(if
8a60: 20 74 68 31 20 28 74 68 72 65 61 64 2d 6a 6f 69   th1 (thread-joi
8a70: 6e 21 20 74 68 31 29 29 0a 09 28 73 71 6c 69 74  n! th1))..(sqlit
8a80: 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29  e3:finalize! db)
8a90: 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f 6d 65  ..(set! *didsome
8aa0: 74 68 69 6e 67 2a 20 23 74 29 29 29 29 29 29 0a  thing* #t)))))).
8ab0: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
8ac0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8ad0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8ae0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8af0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c 6f 63  =========.;; Loc
8b00: 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73 0a 3b 3b  k/unlock runs.;;
8b10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b50: 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20  ======..(define 
8b60: 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d 6c 6f 63  (runs:handle-loc
8b70: 6b 69 6e 67 20 64 62 20 74 61 72 67 65 74 20 6b  king db target k
8b80: 65 79 73 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b  eys runname lock
8b90: 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 20 20   unlock user).  
8ba0: 28 6c 65 74 2a 20 28 28 72 75 6e 64 61 74 20 20  (let* ((rundat  
8bb0: 20 28 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d   (runs:get-runs-
8bc0: 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20  by-patt db keys 
8bd0: 72 75 6e 6e 61 6d 65 29 29 0a 09 20 28 68 65 61  runname)).. (hea
8be0: 64 65 72 20 20 20 28 76 65 63 74 6f 72 2d 72 65  der   (vector-re
8bf0: 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28  f rundat 0)).. (
8c00: 72 75 6e 73 20 20 20 20 20 28 76 65 63 74 6f 72  runs     (vector
8c10: 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 29  -ref rundat 1)))
8c20: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28  .    (for-each (
8c30: 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 09 09 28  lambda (run)...(
8c40: 6c 65 74 20 28 28 72 75 6e 2d 69 64 20 28 64 62  let ((run-id (db
8c50: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65  :get-value-by-he
8c60: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20  ader run header 
8c70: 22 69 64 22 29 29 29 0a 09 09 20 20 28 69 66 20  "id")))...  (if 
8c80: 28 6f 72 20 6c 6f 63 6b 0a 09 09 09 20 20 28 61  (or lock....  (a
8c90: 6e 64 20 75 6e 6c 6f 63 6b 0a 09 09 09 20 20 20  nd unlock....   
8ca0: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09 20      (begin..... 
8cb0: 28 70 72 69 6e 74 20 22 44 6f 20 79 6f 75 20 72  (print "Do you r
8cc0: 65 61 6c 6c 79 20 77 69 73 68 20 74 6f 20 75 6e  eally wish to un
8cd0: 6c 6f 63 6b 20 72 75 6e 20 22 20 72 75 6e 2d 69  lock run " run-i
8ce0: 64 20 22 3f 5c 6e 20 20 20 79 2f 6e 3a 20 22 29  d "?\n   y/n: ")
8cf0: 0a 09 09 09 09 20 28 65 71 75 61 6c 3f 20 22 79  ..... (equal? "y
8d00: 22 20 28 72 65 61 64 2d 6c 69 6e 65 29 29 29 29  " (read-line))))
8d10: 29 0a 09 09 20 20 20 20 20 20 28 64 62 3a 6c 6f  )...      (db:lo
8d20: 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 75 6e 20 64 62  ck/unlock-run db
8d30: 20 72 75 6e 2d 69 64 20 6c 6f 63 6b 20 75 6e 6c   run-id lock unl
8d40: 6f 63 6b 20 75 73 65 72 29 0a 09 09 20 20 20 20  ock user)...    
8d50: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
8d60: 20 22 49 4e 46 4f 3a 20 53 6b 69 70 70 69 6e 67   "INFO: Skipping
8d70: 20 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e 20   lock/unlock on 
8d80: 22 20 72 75 6e 2d 69 64 29 29 29 29 0a 09 20 20  " run-id))))..  
8d90: 20 20 20 20 72 75 6e 73 29 29 29 0a 3b 3b 3d 3d      runs))).;;==
8da0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8db0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8dc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8dd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8de0: 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72  ====.;; Rollup r
8df0: 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  uns.;;==========
8e00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8e10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8e20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8e30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b  ============..;;
8e40: 20 55 70 64 61 74 65 20 74 68 65 20 74 65 73 74   Update the test
8e50: 5f 6d 65 74 61 20 74 61 62 6c 65 20 66 6f 72 20  _meta table for 
8e60: 74 68 69 73 20 74 65 73 74 0a 28 64 65 66 69 6e  this test.(defin
8e70: 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74  e (runs:update-t
8e80: 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74  est_meta db test
8e90: 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29  -name test-conf)
8ea0: 0a 20 20 28 6c 65 74 20 28 28 63 75 72 72 72 65  .  (let ((currre
8eb0: 63 6f 72 64 20 28 64 62 3a 74 65 73 74 6d 65 74  cord (db:testmet
8ec0: 61 2d 67 65 74 2d 72 65 63 6f 72 64 20 64 62 20  a-get-record db 
8ed0: 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20  test-name))).   
8ee0: 20 28 69 66 20 28 6e 6f 74 20 63 75 72 72 72 65   (if (not currre
8ef0: 63 6f 72 64 29 0a 09 28 62 65 67 69 6e 0a 09 20  cord)..(begin.. 
8f00: 20 28 73 65 74 21 20 63 75 72 72 72 65 63 6f 72   (set! currrecor
8f10: 64 20 28 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31  d (make-vector 1
8f20: 30 20 23 66 29 29 0a 09 20 20 28 64 62 3a 74 65  0 #f))..  (db:te
8f30: 73 74 6d 65 74 61 2d 61 64 64 2d 72 65 63 6f 72  stmeta-add-recor
8f40: 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29  d db test-name))
8f50: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20  ).    (for-each 
8f60: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6b  .     (lambda (k
8f70: 65 79 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a  ey).       (let*
8f80: 20 28 28 69 64 78 20 28 63 61 64 72 20 6b 65 79   ((idx (cadr key
8f90: 29 29 0a 09 20 20 20 20 20 20 28 66 6c 64 20 28  ))..      (fld (
8fa0: 63 61 72 20 20 6b 65 79 29 29 0a 09 20 20 20 20  car  key))..    
8fb0: 20 20 28 76 61 6c 20 28 63 6f 6e 66 69 67 2d 6c    (val (config-l
8fc0: 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20  ookup test-conf 
8fd0: 22 74 65 73 74 5f 6d 65 74 61 22 20 66 6c 64 29  "test_meta" fld)
8fe0: 29 29 0a 09 20 3b 3b 20 28 64 65 62 75 67 3a 70  )).. ;; (debug:p
8ff0: 72 69 6e 74 20 35 20 22 69 64 78 3a 20 22 20 69  rint 5 "idx: " i
9000: 64 78 20 22 20 66 6c 64 3a 20 22 20 66 6c 64 20  dx " fld: " fld 
9010: 22 20 76 61 6c 3a 20 22 20 76 61 6c 29 0a 09 20  " val: " val).. 
9020: 28 69 66 20 28 61 6e 64 20 76 61 6c 20 28 6e 6f  (if (and val (no
9030: 74 20 28 65 71 75 61 6c 3f 20 28 76 65 63 74 6f  t (equal? (vecto
9040: 72 2d 72 65 66 20 63 75 72 72 72 65 63 6f 72 64  r-ref currrecord
9050: 20 69 64 78 29 20 76 61 6c 29 29 29 0a 09 20 20   idx) val)))..  
9060: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20     (begin..     
9070: 20 20 28 70 72 69 6e 74 20 22 55 70 64 61 74 69    (print "Updati
9080: 6e 67 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22  ng " test-name "
9090: 20 22 20 66 6c 64 20 22 20 74 6f 20 22 20 76 61   " fld " to " va
90a0: 6c 29 0a 09 20 20 20 20 20 20 20 28 64 62 3a 74  l)..       (db:t
90b0: 65 73 74 6d 65 74 61 2d 75 70 64 61 74 65 2d 66  estmeta-update-f
90c0: 69 65 6c 64 20 64 62 20 74 65 73 74 2d 6e 61 6d  ield db test-nam
90d0: 65 20 66 6c 64 20 76 61 6c 29 29 29 29 29 0a 20  e fld val))))). 
90e0: 20 20 20 20 27 28 28 22 61 75 74 68 6f 72 22 20      '(("author" 
90f0: 32 29 28 22 6f 77 6e 65 72 22 20 33 29 28 22 64  2)("owner" 3)("d
9100: 65 73 63 72 69 70 74 69 6f 6e 22 20 34 29 28 22  escription" 4)("
9110: 72 65 76 69 65 77 65 64 22 20 35 29 28 22 74 61  reviewed" 5)("ta
9120: 67 73 22 20 39 29 29 29 29 29 0a 0a 3b 3b 20 55  gs" 9)))))..;; U
9130: 70 64 61 74 65 20 74 65 73 74 5f 6d 65 74 61 20  pdate test_meta 
9140: 66 6f 72 20 61 6c 6c 20 74 65 73 74 73 0a 28 64  for all tests.(d
9150: 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61  efine (runs:upda
9160: 74 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 61  te-all-test_meta
9170: 20 64 62 29 0a 20 20 28 6c 65 74 20 28 28 74 65   db).  (let ((te
9180: 73 74 2d 6e 61 6d 65 73 20 28 67 65 74 2d 61 6c  st-names (get-al
9190: 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73 29 29 29  l-legal-tests)))
91a0: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a  .    (for-each .
91b0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65       (lambda (te
91c0: 73 74 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20 20  st-name).       
91d0: 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 70 61 74  (let* ((test-pat
91e0: 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70  h    (conc *topp
91f0: 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74  ath* "/tests/" t
9200: 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20 20 20 20  est-name))..    
9210: 20 20 28 74 65 73 74 2d 63 6f 6e 66 69 67 66 20    (test-configf 
9220: 28 63 6f 6e 63 20 74 65 73 74 2d 70 61 74 68 20  (conc test-path 
9230: 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29 0a  "/testconfig")).
9240: 09 20 20 20 20 20 20 28 74 65 73 74 65 78 69 73  .      (testexis
9250: 74 73 20 20 20 28 61 6e 64 20 28 66 69 6c 65 2d  ts   (and (file-
9260: 65 78 69 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e  exists? test-con
9270: 66 69 67 66 29 28 66 69 6c 65 2d 72 65 61 64 2d  figf)(file-read-
9280: 61 63 63 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e  access? test-con
9290: 66 69 67 66 29 29 29 0a 09 20 20 20 20 20 20 3b  figf)))..      ;
92a0: 3b 20 72 65 61 64 20 63 6f 6e 66 69 67 73 20 77  ; read configs w
92b0: 69 74 68 20 74 72 69 63 6b 73 20 74 75 72 6e 65  ith tricks turne
92c0: 64 20 6f 66 66 20 28 69 2e 65 2e 20 6e 6f 20 73  d off (i.e. no s
92d0: 79 73 74 65 6d 29 0a 09 20 20 20 20 20 20 28 74  ystem)..      (t
92e0: 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 20  est-conf    (if 
92f0: 74 65 73 74 65 78 69 73 74 73 20 28 72 65 61 64  testexists (read
9300: 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e  -config test-con
9310: 66 69 67 66 20 23 66 20 23 66 29 28 6d 61 6b 65  figf #f #f)(make
9320: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 29 0a  -hash-table)))).
9330: 09 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74  . (runs:update-t
9340: 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74  est_meta db test
9350: 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29  -name test-conf)
9360: 29 29 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 6d  )).     test-nam
9370: 65 73 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63  es)))..;; This c
9380: 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 65  ould probably be
9390: 20 72 65 66 61 63 74 6f 72 65 64 20 69 6e 74 6f   refactored into
93a0: 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75 65   one complex que
93b0: 72 79 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28  ry ....(define (
93c0: 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20  runs:rollup-run 
93d0: 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73  db keys keyvalls
93e0: 74 20 72 75 6e 6e 61 6d 65 20 75 73 65 72 29 20  t runname user) 
93f0: 3b 3b 20 77 61 73 20 74 61 72 67 65 74 2c 20 6e  ;; was target, n
9400: 6f 77 20 6b 65 79 76 61 6c 6c 73 74 0a 20 20 28  ow keyvallst.  (
9410: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 72  debug:print 4 "r
9420: 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20  uns:rollup-run, 
9430: 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22 20 6b  keys: " keys " k
9440: 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76  eyvallst: " keyv
9450: 61 6c 6c 73 74 20 22 20 3a 72 75 6e 6e 61 6d 65  allst " :runname
9460: 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 75 73 65   " runname " use
9470: 72 3a 20 22 20 75 73 65 72 29 0a 20 20 28 6c 65  r: " user).  (le
9480: 74 2a 20 28 3b 20 28 6b 65 79 76 61 6c 6c 6c 73  t* (; (keyvallls
9490: 74 20 20 20 20 20 20 28 6b 65 79 73 3a 74 61 72  t      (keys:tar
94a0: 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73  get->keyval keys
94b0: 20 74 61 72 67 65 74 29 29 0a 09 20 28 6e 65 77   target)).. (new
94c0: 2d 72 75 6e 2d 69 64 20 20 20 20 20 20 28 72 75  -run-id      (ru
94d0: 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20  ns:register-run 
94e0: 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73  db keys keyvalls
94f0: 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20  t runname "new" 
9500: 22 6e 2f 61 22 20 75 73 65 72 29 29 0a 09 20 28  "n/a" user)).. (
9510: 70 72 65 76 2d 74 65 73 74 73 20 20 20 20 20 20  prev-tests      
9520: 28 74 65 73 74 3a 67 65 74 2d 6d 61 74 63 68 69  (test:get-matchi
9530: 6e 67 2d 70 72 65 76 69 6f 75 73 2d 74 65 73 74  ng-previous-test
9540: 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 62 20  -run-records db 
9550: 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 22  new-run-id "%" "
9560: 25 22 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73  %")).. (curr-tes
9570: 74 73 20 20 20 20 20 20 28 72 64 62 3a 67 65 74  ts      (rdb:get
9580: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64  -tests-for-run d
9590: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22  b new-run-id "%"
95a0: 20 22 25 22 20 27 28 29 20 27 28 29 29 29 0a 09   "%" '() '()))..
95b0: 20 28 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73   (curr-tests-has
95c0: 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62  h (make-hash-tab
95d0: 6c 65 29 29 29 0a 20 20 20 20 28 64 62 3a 75 70  le))).    (db:up
95e0: 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e 74 5f 74  date-run-event_t
95f0: 69 6d 65 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69  ime db new-run-i
9600: 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64 65 78 20  d).    ;; index 
9610: 74 68 65 20 61 6c 72 65 61 64 79 20 73 61 76 65  the already save
9620: 64 20 74 65 73 74 73 20 62 79 20 74 65 73 74 6e  d tests by testn
9630: 61 6d 65 20 61 6e 64 20 69 74 65 6d 64 61 74 20  ame and itemdat 
9640: 69 6e 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61  in curr-tests-ha
9650: 73 68 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  sh.    (for-each
9660: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74  .     (lambda (t
9670: 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28  estdat).       (
9680: 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20  let* ((testname 
9690: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
96a0: 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29  stname testdat))
96b0: 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61  ..      (item-pa
96c0: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  th (db:test-get-
96d0: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61  item-path testda
96e0: 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c  t))..      (full
96f0: 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74  -name (conc test
9700: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
9710: 74 68 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61  th))).. (hash-ta
9720: 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65  ble-set! curr-te
9730: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61  sts-hash full-na
9740: 6d 65 20 74 65 73 74 64 61 74 29 29 29 0a 20 20  me testdat))).  
9750: 20 20 20 63 75 72 72 2d 74 65 73 74 73 29 0a 20     curr-tests). 
9760: 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d     ;; NOPE: Non-
9770: 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f 61 63 68  optimal approach
9780: 2e 20 54 72 79 20 74 68 69 73 20 69 6e 73 74 65  . Try this inste
9790: 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20 31 2e 20  ad..    ;;   1. 
97a0: 74 65 73 74 73 20 61 72 65 20 72 65 63 65 69 76  tests are receiv
97b0: 65 64 20 69 6e 20 61 20 6c 69 73 74 2c 20 6d 6f  ed in a list, mo
97c0: 73 74 20 72 65 63 65 6e 74 20 66 69 72 73 74 0a  st recent first.
97d0: 20 20 20 20 3b 3b 20 20 20 32 2e 20 72 65 70 6c      ;;   2. repl
97e0: 61 63 65 20 74 68 65 20 72 6f 6c 6c 75 70 20 74  ace the rollup t
97f0: 65 73 74 20 77 69 74 68 20 74 68 65 20 6e 65 77  est with the new
9800: 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20 20 28 66   *always*.    (f
9810: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c  or-each .     (l
9820: 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a  ambda (testdat).
9830: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74         (let* ((t
9840: 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73  estname  (db:tes
9850: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  t-get-testname t
9860: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20  estdat))..      
9870: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74  (item-path (db:t
9880: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74  est-get-item-pat
9890: 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  h testdat))..   
98a0: 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63     (full-name (c
98b0: 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22  onc testname "/"
98c0: 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20   item-path))..  
98d0: 20 20 20 20 28 70 72 65 76 2d 74 65 73 74 2d 64      (prev-test-d
98e0: 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72  at (hash-table-r
98f0: 65 66 2f 64 65 66 61 75 6c 74 20 63 75 72 72 2d  ef/default curr-
9900: 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d  tests-hash full-
9910: 6e 61 6d 65 20 23 66 29 29 0a 09 20 20 20 20 20  name #f))..     
9920: 20 28 74 65 73 74 2d 73 74 65 70 73 20 20 20 20   (test-steps    
9930: 20 20 28 64 62 3a 67 65 74 2d 73 74 65 70 73 2d    (db:get-steps-
9940: 66 6f 72 2d 74 65 73 74 20 64 62 20 28 64 62 3a  for-test db (db:
9950: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
9960: 64 61 74 29 29 29 0a 09 20 20 20 20 20 20 28 6e  dat)))..      (n
9970: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23  ew-test-record #
9980: 66 29 29 0a 09 20 3b 3b 20 72 65 70 6c 61 63 65  f)).. ;; replace
9990: 20 74 68 65 73 65 20 77 69 74 68 20 69 6e 73 65   these with inse
99a0: 72 74 20 2e 2e 2e 20 73 65 6c 65 63 74 0a 09 20  rt ... select.. 
99b0: 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65  (apply sqlite3:e
99c0: 78 65 63 75 74 65 20 0a 09 09 64 62 20 0a 09 09  xecute ...db ...
99d0: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52  (conc "INSERT OR
99e0: 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65   REPLACE INTO te
99f0: 73 74 73 20 28 72 75 6e 5f 69 64 2c 74 65 73 74  sts (run_id,test
9a00: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75  name,state,statu
9a10: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 68 6f 73  s,event_time,hos
9a20: 74 2c 63 70 75 6c 6f 61 64 2c 64 69 73 6b 66 72  t,cpuload,diskfr
9a30: 65 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 69 72 2c  ee,uname,rundir,
9a40: 69 74 65 6d 5f 70 61 74 68 2c 72 75 6e 5f 64 75  item_path,run_du
9a50: 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67  ration,final_log
9a60: 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20  f,comment) "... 
9a70: 20 20 20 20 20 22 56 41 4c 55 45 53 20 28 3f 2c       "VALUES (?,
9a80: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c  ?,?,?,?,?,?,?,?,
9a90: 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09  ?,?,?,?,?);")...
9aa0: 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 64 64 72  new-run-id (cddr
9ab0: 20 28 76 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74   (vector->list t
9ac0: 65 73 74 64 61 74 29 29 29 0a 09 20 28 73 65 74  estdat))).. (set
9ad0: 21 20 6e 65 77 2d 74 65 73 74 64 61 74 20 28 63  ! new-testdat (c
9ae0: 61 72 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74  ar (rdb:get-test
9af0: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77  s-for-run db new
9b00: 2d 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65  -run-id testname
9b10: 20 69 74 65 6d 2d 70 61 74 68 20 27 28 29 20 27   item-path '() '
9b20: 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61  ()))).. (hash-ta
9b30: 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65  ble-set! curr-te
9b40: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61  sts-hash full-na
9b50: 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20  me new-testdat) 
9b60: 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65  ;; this could be
9b70: 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 63   confusing, whic
9b80: 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 20  h record should 
9b90: 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b  go into the look
9ba0: 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e  up table?.. ;; N
9bb0: 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65  ow duplicate the
9bc0: 20 74 65 73 74 20 73 74 65 70 73 0a 09 20 28 64   test steps.. (d
9bd0: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f  ebug:print 4 "Co
9be0: 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e  pying records in
9bf0: 20 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f 6d   test_steps from
9c00: 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74   test_id=" (db:t
9c10: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
9c20: 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74  at) " to " (db:t
9c30: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74  est-get-id new-t
9c40: 65 73 74 64 61 74 29 29 0a 09 20 28 73 71 6c 69  estdat)).. (sqli
9c50: 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20  te3:execute ..  
9c60: 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e  db ..  (conc "IN
9c70: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20  SERT OR REPLACE 
9c80: 49 4e 54 4f 20 74 65 73 74 5f 73 74 65 70 73 20  INTO test_steps 
9c90: 28 74 65 73 74 5f 69 64 2c 73 74 65 70 6e 61 6d  (test_id,stepnam
9ca0: 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65  e,state,status,e
9cb0: 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e  vent_time,commen
9cc0: 74 29 20 22 0a 09 09 22 53 45 4c 45 43 54 20 22  t) "..."SELECT "
9cd0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
9ce0: 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c   new-testdat) ",
9cf0: 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73  stepname,state,s
9d00: 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65  tatus,event_time
9d10: 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65  ,comment FROM te
9d20: 73 74 5f 73 74 65 70 73 20 57 48 45 52 45 20 74  st_steps WHERE t
9d30: 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 28  est_id=?;")..  (
9d40: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
9d50: 65 73 74 64 61 74 29 29 0a 09 20 3b 3b 20 4e 6f  estdat)).. ;; No
9d60: 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65 20  w duplicate the 
9d70: 74 65 73 74 20 64 61 74 61 0a 09 20 28 64 65 62  test data.. (deb
9d80: 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79  ug:print 4 "Copy
9d90: 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74  ing records in t
9da0: 65 73 74 5f 64 61 74 61 20 66 72 6f 6d 20 74 65  est_data from te
9db0: 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74  st_id=" (db:test
9dc0: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29  -get-id testdat)
9dd0: 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74   " to " (db:test
9de0: 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74  -get-id new-test
9df0: 64 61 74 29 29 0a 09 20 28 73 71 6c 69 74 65 33  dat)).. (sqlite3
9e00: 3a 65 78 65 63 75 74 65 20 0a 09 20 20 64 62 20  :execute ..  db 
9e10: 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52  ..  (conc "INSER
9e20: 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54  T OR REPLACE INT
9e30: 4f 20 74 65 73 74 5f 64 61 74 61 20 28 74 65 73  O test_data (tes
9e40: 74 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61  t_id,category,va
9e50: 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70  riable,value,exp
9e60: 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c  ected,tol,units,
9e70: 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 22 53 45  comment) "..."SE
9e80: 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d  LECT " (db:test-
9e90: 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64  get-id new-testd
9ea0: 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79 2c 76  at) ",category,v
9eb0: 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78  ariable,value,ex
9ec0: 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73  pected,tol,units
9ed0: 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65  ,comment FROM te
9ee0: 73 74 5f 64 61 74 61 20 57 48 45 52 45 20 74 65  st_data WHERE te
9ef0: 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 28 64  st_id=?;")..  (d
9f00: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
9f10: 73 74 64 61 74 29 29 0a 09 20 29 29 0a 20 20 20  stdat)).. )).   
9f20: 20 20 70 72 65 76 2d 74 65 73 74 73 29 29 29 0a    prev-tests))).
9f30: 09 20 0a 20 20 20 20 20 0a                       . .     .