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 0a 28 64 65 66 69 6e 65 20 28 73 65 74 2d ...(define (set-
0870: 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 megatest-env-var
0880: 73 20 64 62 20 72 75 6e 2d 69 64 29 0a 20 20 28 s db run-id). (
0890: 6c 65 74 20 28 28 6b 65 79 73 20 28 72 64 62 3a let ((keys (rdb:
08a0: 67 65 74 2d 6b 65 79 73 20 64 62 29 29 29 0a 20 get-keys db))).
08b0: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 (for-each (la
08c0: 6d 62 64 61 20 28 6b 65 79 29 0a 09 09 28 73 71 mbda (key)...(sq
08d0: 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 lite3:for-each-r
08e0: 6f 77 0a 09 09 20 28 6c 61 6d 62 64 61 20 28 76 ow... (lambda (v
08f0: 61 6c 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a al)... (debug:
0900: 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e 76 20 print 2 "setenv
0910: 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 " (key:get-field
0920: 6e 61 6d 65 20 6b 65 79 29 20 22 20 22 20 76 61 name key) " " va
0930: 6c 29 0a 09 09 20 20 20 28 73 65 74 65 6e 76 20 l)... (setenv
0940: 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 (key:get-fieldna
0950: 6d 65 20 6b 65 79 29 20 76 61 6c 29 29 0a 09 09 me key) val))...
0960: 20 64 62 20 0a 09 09 20 28 63 6f 6e 63 20 22 53 db ... (conc "S
0970: 45 4c 45 43 54 20 22 20 28 6b 65 79 3a 67 65 74 ELECT " (key:get
0980: 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 -fieldname key)
0990: 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 " FROM runs WHER
09a0: 45 20 69 64 3d 3f 3b 22 29 0a 09 09 20 72 75 6e E id=?;")... run
09b0: 2d 69 64 29 29 0a 09 20 20 20 20 20 20 6b 65 79 -id)).. key
09c0: 73 29 0a 20 20 20 20 28 61 6c 69 73 74 2d 3e 65 s). (alist->e
09d0: 6e 76 2d 76 61 72 73 20 28 68 61 73 68 2d 74 61 nv-vars (hash-ta
09e0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
09f0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 65 6e 76 *configdat* "env
0a00: 2d 6f 76 65 72 72 69 64 65 22 20 27 28 29 29 29 -override" '()))
0a10: 0a 20 20 20 20 3b 3b 20 4c 65 74 73 20 75 73 65 . ;; Lets use
0a20: 20 74 68 69 73 20 61 73 20 61 6e 20 6f 70 70 6f this as an oppo
0a30: 72 74 75 6e 69 74 79 20 74 6f 20 70 75 74 20 4d rtunity to put M
0a40: 54 5f 52 55 4e 4e 41 4d 45 20 69 6e 20 74 68 65 T_RUNNAME in the
0a50: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20 environment.
0a60: 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 (sqlite3:for-ea
0a70: 63 68 2d 72 6f 77 0a 20 20 20 20 20 28 6c 61 6d ch-row. (lam
0a80: 62 64 61 20 28 72 75 6e 6e 61 6d 65 29 0a 20 20 bda (runname).
0a90: 20 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 (setenv "MT
0aa0: 5f 52 55 4e 4e 41 4d 45 22 20 72 75 6e 6e 61 6d _RUNNAME" runnam
0ab0: 65 29 29 0a 20 20 20 20 20 64 62 0a 20 20 20 20 e)). db.
0ac0: 20 22 53 45 4c 45 43 54 20 72 75 6e 6e 61 6d 65 "SELECT runname
0ad0: 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 FROM runs WHERE
0ae0: 20 69 64 3d 3f 3b 22 0a 20 20 20 20 20 72 75 6e id=?;". run
0af0: 2d 69 64 29 0a 20 20 20 20 29 29 0a 0a 28 64 65 -id). ))..(de
0b00: 66 69 6e 65 20 28 73 65 74 2d 69 74 65 6d 2d 65 fine (set-item-e
0b10: 6e 76 2d 76 61 72 73 20 69 74 65 6d 64 61 74 29 nv-vars itemdat)
0b20: 0a 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 . (for-each (la
0b30: 6d 62 64 61 20 28 69 74 65 6d 29 0a 09 20 20 20 mbda (item)..
0b40: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
0b50: 32 20 22 73 65 74 65 6e 76 20 22 20 28 63 61 72 2 "setenv " (car
0b60: 20 69 74 65 6d 29 20 22 20 22 20 28 63 61 64 72 item) " " (cadr
0b70: 20 69 74 65 6d 29 29 0a 09 20 20 20 20 20 20 28 item)).. (
0b80: 73 65 74 65 6e 76 20 28 63 61 72 20 69 74 65 6d setenv (car item
0b90: 29 20 28 63 61 64 72 20 69 74 65 6d 29 29 29 0a ) (cadr item))).
0ba0: 09 20 20 20 20 69 74 65 6d 64 61 74 29 29 0a 0a . itemdat))..
0bb0: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 (define (runs:ca
0bc0: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 n-run-more-tests
0bd0: 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72 64 29 db test-record)
0be0: 0a 20 20 28 6c 65 74 2a 20 28 28 74 63 6f 6e 66 . (let* ((tconf
0bf0: 69 67 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ig
0c00: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 (tests:testqu
0c10: 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 eue-get-testconf
0c20: 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 ig test-record))
0c30: 0a 09 20 28 6a 6f 62 67 72 6f 75 70 20 20 20 20 .. (jobgroup
0c40: 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e (con
0c50: 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 fig-lookup tconf
0c60: 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 ig "requirements
0c70: 22 20 22 6a 6f 62 67 72 6f 75 70 22 29 29 0a 09 " "jobgroup"))..
0c80: 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 20 20 (num-running
0c90: 20 20 20 20 20 20 20 20 20 20 28 64 62 3a 67 65 (db:ge
0ca0: 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75 t-count-tests-ru
0cb0: 6e 6e 69 6e 67 20 64 62 29 29 0a 09 20 28 6e 75 nning db)).. (nu
0cc0: 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 m-running-in-job
0cd0: 67 72 6f 75 70 20 28 64 62 3a 67 65 74 2d 63 6f group (db:get-co
0ce0: 75 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e unt-tests-runnin
0cf0: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 64 62 g-in-jobgroup db
0d00: 20 6a 6f 62 67 72 6f 75 70 29 29 0a 09 20 28 6d jobgroup)).. (m
0d10: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
0d20: 62 73 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c bs (config-l
0d30: 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 ookup *configdat
0d40: 2a 20 22 73 65 74 75 70 22 20 20 20 20 20 22 6d * "setup" "m
0d50: 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f ax_concurrent_jo
0d60: 62 73 22 29 29 0a 09 20 28 6a 6f 62 2d 67 72 6f bs")).. (job-gro
0d70: 75 70 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20 up-limit
0d80: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 (config-lookup
0d90: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 6a 6f 62 *configdat* "job
0da0: 67 72 6f 75 70 73 22 20 6a 6f 62 67 72 6f 75 70 groups" jobgroup
0db0: 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 ))). (debug:p
0dc0: 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 6f 6e 63 rint 2 "max-conc
0dd0: 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d urrent-jobs: " m
0de0: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
0df0: 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e bs ", num-runnin
0e00: 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 g: " num-running
0e10: 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 ). (if (not (
0e20: 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c 65 78 69 eq? 0 *globalexi
0e30: 74 73 74 61 74 75 73 2a 29 29 0a 09 23 66 0a 09 tstatus*))..#f..
0e40: 28 6c 65 74 20 28 28 63 61 6e 2d 6e 6f 74 2d 72 (let ((can-not-r
0e50: 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e 64 0a 09 09 un-more (cond...
0e60: 09 09 20 3b 3b 20 69 66 20 6d 61 78 2d 63 6f 6e .. ;; if max-con
0e70: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 69 73 20 current-jobs is
0e80: 73 65 74 20 61 6e 64 20 74 68 65 20 6e 75 6d 62 set and the numb
0e90: 65 72 20 72 75 6e 6e 69 6e 67 20 69 73 20 67 72 er running is gr
0ea0: 65 61 74 65 72 20 0a 09 09 09 09 20 3b 3b 20 74 eater ..... ;; t
0eb0: 68 61 6e 20 69 74 20 74 68 61 6e 20 63 61 6e 6e han it than cann
0ec0: 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 ot run more jobs
0ed0: 0a 09 09 09 09 20 28 28 61 6e 64 20 6d 61 78 2d ..... ((and max-
0ee0: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 0a concurrent-jobs.
0ef0: 09 09 09 09 20 20 20 20 20 20 20 28 73 74 72 69 .... (stri
0f00: 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 63 ng->number max-c
0f10: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a oncurrent-jobs).
0f20: 09 09 09 09 20 20 20 20 20 20 20 28 3e 3d 20 6e .... (>= n
0f30: 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 73 74 72 69 um-running (stri
0f40: 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 63 ng->number max-c
0f50: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 29 oncurrent-jobs))
0f60: 29 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 )..... (debug:p
0f70: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a rint 0 "WARNING:
0f80: 20 4d 61 78 20 72 75 6e 6e 69 6e 67 20 6a 6f 62 Max running job
0f90: 73 20 65 78 63 65 65 64 65 64 2c 20 63 75 72 72 s exceeded, curr
0fa0: 65 6e 74 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 ent number runni
0fb0: 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e ng: " num-runnin
0fc0: 67 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 22 g ...... "
0fd0: 2c 20 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 , max_concurrent
0fe0: 5f 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e _jobs: " max-con
0ff0: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 09 current-jobs)...
1000: 09 09 20 20 23 74 29 0a 09 09 09 09 20 3b 3b 20 .. #t)..... ;;
1010: 69 66 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d if job-group-lim
1020: 69 74 20 69 73 20 73 65 74 20 61 6e 64 20 6e 75 it is set and nu
1030: 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 69 6e 20 mber of jobs in
1040: 74 68 65 20 67 72 6f 75 70 20 69 73 20 67 72 65 the group is gre
1050: 61 74 65 72 0a 09 09 09 09 20 3b 3b 20 74 68 61 ater..... ;; tha
1060: 6e 20 74 68 65 20 6c 69 6d 69 74 20 74 68 65 6e n the limit then
1070: 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 cannot run more
1080: 20 6a 6f 62 73 20 6f 66 20 74 68 69 73 20 6b 69 jobs of this ki
1090: 6e 64 0a 09 09 09 09 20 28 28 61 6e 64 20 6a 6f nd..... ((and jo
10a0: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 0a 09 09 b-group-limit...
10b0: 09 09 20 20 20 20 20 20 20 28 3e 3d 20 6e 75 6d .. (>= num
10c0: 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 -running-in-jobg
10d0: 72 6f 75 70 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c roup job-group-l
10e0: 69 6d 69 74 29 29 0a 09 09 09 09 20 20 28 64 65 imit))..... (de
10f0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52 bug:print 1 "WAR
1100: 4e 49 4e 47 3a 20 6e 75 6d 62 65 72 20 6f 66 20 NING: number of
1110: 6a 6f 62 73 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 jobs " num-runni
1120: 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 0a ng-in-jobgroup .
1130: 09 09 09 09 09 20 20 20 20 20 20 20 22 20 69 6e ..... " in
1140: 20 22 20 6a 6f 62 67 72 6f 75 70 20 22 20 65 78 " jobgroup " ex
1150: 63 65 65 64 65 64 2c 20 77 69 6c 6c 20 6e 6f 74 ceeded, will not
1160: 20 72 75 6e 20 22 20 28 74 65 73 74 73 3a 74 65 run " (tests:te
1170: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 stqueue-get-test
1180: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 name test-record
1190: 29 29 0a 09 09 09 09 20 20 23 74 29 0a 09 09 09 ))..... #t)....
11a0: 09 20 28 65 6c 73 65 20 23 66 29 29 29 29 0a 09 . (else #f))))..
11b0: 20 20 28 6e 6f 74 20 63 61 6e 2d 6e 6f 74 2d 72 (not can-not-r
11c0: 75 6e 2d 6d 6f 72 65 29 29 29 29 29 0a 0a 3b 3b un-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 3d 0a 3b 3b 20 4e 65 77 20 6d 65 ======.;; New me
1220: 74 68 6f 64 6f 6c 6f 67 79 2e 20 54 68 65 73 65 thodology. These
1230: 20 72 6f 75 74 69 6e 65 73 20 77 69 6c 6c 20 72 routines will r
1240: 65 70 6c 61 63 65 20 74 68 65 20 61 62 6f 76 65 eplace the above
1250: 20 69 6e 20 74 69 6d 65 2e 20 46 6f 72 0a 3b 3b in time. For.;;
1260: 20 6e 6f 77 20 74 68 65 20 63 6f 64 65 20 69 73 now the code is
1270: 20 64 75 70 6c 69 63 61 74 65 64 2e 20 54 68 69 duplicated. Thi
1280: 73 20 73 74 75 66 66 20 69 73 20 69 6e 69 74 69 s stuff is initi
1290: 61 6c 6c 79 20 75 73 65 64 20 69 6e 20 74 68 65 ally used in the
12a0: 20 6d 6f 6e 69 74 6f 72 0a 3b 3b 20 62 61 73 65 monitor.;; base
12b0: 64 20 63 6f 64 65 2e 0a 3b 3b 3d 3d 3d 3d 3d 3d d 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 3d ================
1300: 0a 0a 3b 3b 20 72 65 67 69 73 74 65 72 20 61 20 ..;; register a
1310: 74 65 73 74 20 72 75 6e 20 77 69 74 68 20 74 68 test run with th
1320: 65 20 64 62 0a 28 64 65 66 69 6e 65 20 28 72 75 e db.(define (ru
1330: 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 ns:register-run
1340: 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 db keys keyvalls
1350: 74 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 65 20 t runname state
1360: 73 74 61 74 75 73 20 75 73 65 72 29 0a 20 20 28 status user). (
1370: 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 72 debug:print 3 "r
1380: 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e uns:register-run
1390: 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22 , keys: " keys "
13a0: 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 keyvallst: " ke
13b0: 79 76 61 6c 6c 73 74 20 22 20 72 75 6e 6e 61 6d yvallst " runnam
13c0: 65 3a 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 73 e: " runname " s
13d0: 74 61 74 65 3a 20 22 20 73 74 61 74 65 20 22 20 tate: " state "
13e0: 73 74 61 74 75 73 3a 20 22 20 73 74 61 74 75 73 status: " status
13f0: 20 22 20 75 73 65 72 3a 20 22 20 75 73 65 72 29 " user: " user)
1400: 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 74 . (let* ((keyst
1410: 72 20 20 20 20 28 6b 65 79 73 2d 3e 6b 65 79 73 r (keys->keys
1420: 74 72 20 6b 65 79 73 29 29 0a 09 20 28 63 6f 6d tr keys)).. (com
1430: 6d 61 20 20 20 20 20 28 69 66 20 28 3e 20 28 6c ma (if (> (l
1440: 65 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 ength keys) 0) "
1450: 2c 22 20 22 22 29 29 0a 09 20 28 61 6e 64 73 74 ," "")).. (andst
1460: 72 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 6e r (if (> (len
1470: 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 20 41 gth keys) 0) " A
1480: 4e 44 20 22 20 22 22 29 29 0a 09 20 28 76 61 6c ND " "")).. (val
1490: 73 6c 6f 74 73 20 20 28 6b 65 79 73 2d 3e 76 61 slots (keys->va
14a0: 6c 73 6c 6f 74 73 20 6b 65 79 73 29 29 20 3b 3b lslots keys)) ;;
14b0: 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 28 6b 65 ?,?,? ..... (ke
14c0: 79 76 61 6c 73 20 20 20 28 6d 61 70 20 63 61 64 yvals (map cad
14d0: 72 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20 r keyvallst))..
14e0: 28 61 6c 6c 76 61 6c 73 20 20 20 28 61 70 70 65 (allvals (appe
14f0: 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 nd (list runname
1500: 20 73 74 61 74 65 20 73 74 61 74 75 73 20 75 73 state status us
1510: 65 72 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 20 er) keyvals))..
1520: 28 71 72 79 76 61 6c 73 20 20 20 28 61 70 70 65 (qryvals (appe
1530: 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 nd (list runname
1540: 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 20 28 6b ) keyvals)).. (k
1550: 65 79 3d 3f 73 74 72 20 20 28 73 74 72 69 6e 67 ey=?str (string
1560: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 -intersperse (ma
1570: 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 28 63 6f p (lambda (k)(co
1580: 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c nc (key:get-fiel
1590: 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 29 29 20 dname k) "=?"))
15a0: 6b 65 79 73 29 20 22 20 41 4e 44 20 22 29 29 29 keys) " AND ")))
15b0: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
15c0: 74 20 33 20 22 6b 65 79 73 3a 20 22 20 6b 65 79 t 3 "keys: " key
15d0: 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20 22 20 61 s " allvals: " a
15e0: 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76 61 6c 73 llvals " keyvals
15f0: 3a 20 22 20 6b 65 79 76 61 6c 73 29 0a 20 20 20 : " keyvals).
1600: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
1610: 22 4e 4f 54 45 3a 20 75 73 69 6e 67 20 74 61 72 "NOTE: using tar
1620: 67 65 74 20 22 20 28 73 74 72 69 6e 67 2d 69 6e get " (string-in
1630: 74 65 72 73 70 65 72 73 65 20 6b 65 79 76 61 6c tersperse keyval
1640: 73 20 22 2f 22 29 20 22 20 66 6f 72 20 74 68 69 s "/") " for thi
1650: 73 20 72 75 6e 22 29 0a 20 20 20 20 28 69 66 20 s run"). (if
1660: 28 61 6e 64 20 72 75 6e 6e 61 6d 65 20 28 6e 75 (and runname (nu
1670: 6c 6c 3f 20 28 66 69 6c 74 65 72 20 28 6c 61 6d ll? (filter (lam
1680: 62 64 61 20 28 78 29 28 6e 6f 74 20 78 29 29 20 bda (x)(not x))
1690: 6b 65 79 76 61 6c 73 29 29 29 20 3b 3b 20 74 68 keyvals))) ;; th
16a0: 65 72 65 20 6d 75 73 74 20 62 65 20 61 20 62 65 ere must be a be
16b0: 74 74 65 72 20 77 61 79 20 74 6f 20 22 61 70 70 tter way to "app
16c0: 6c 79 20 61 6e 64 22 0a 09 28 6c 65 74 20 28 28 ly and"..(let ((
16d0: 72 65 73 20 23 66 29 29 0a 09 20 20 28 61 70 70 res #f)).. (app
16e0: 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75 ly sqlite3:execu
16f0: 74 65 20 64 62 20 28 63 6f 6e 63 20 22 49 4e 53 te db (conc "INS
1700: 45 52 54 20 4f 52 20 49 47 4e 4f 52 45 20 49 4e ERT OR IGNORE IN
1710: 54 4f 20 72 75 6e 73 20 28 72 75 6e 6e 61 6d 65 TO runs (runname
1720: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 6f 77 ,state,status,ow
1730: 6e 65 72 2c 65 76 65 6e 74 5f 74 69 6d 65 22 20 ner,event_time"
1740: 63 6f 6d 6d 61 20 6b 65 79 73 74 72 20 22 29 20 comma keystr ")
1750: 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c VALUES (?,?,?,?,
1760: 73 74 72 66 74 69 6d 65 28 27 25 73 27 2c 27 6e strftime('%s','n
1770: 6f 77 27 29 22 20 63 6f 6d 6d 61 20 76 61 6c 73 ow')" comma vals
1780: 6c 6f 74 73 20 22 29 3b 22 29 0a 09 09 20 61 6c lots ");")... al
1790: 6c 76 61 6c 73 29 0a 09 20 20 28 61 70 70 6c 79 lvals).. (apply
17a0: 20 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 sqlite3:for-eac
17b0: 68 2d 72 6f 77 20 0a 09 20 20 20 28 6c 61 6d 62 h-row .. (lamb
17c0: 64 61 20 28 69 64 29 0a 09 20 20 20 20 20 28 73 da (id).. (s
17d0: 65 74 21 20 72 65 73 20 69 64 29 29 0a 09 20 20 et! res id))..
17e0: 20 64 62 0a 09 20 20 20 28 6c 65 74 20 28 28 71 db.. (let ((q
17f0: 72 79 20 28 63 6f 6e 63 20 22 53 45 4c 45 43 54 ry (conc "SELECT
1800: 20 69 64 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 id FROM runs WH
1810: 45 52 45 20 28 72 75 6e 6e 61 6d 65 3d 3f 20 22 ERE (runname=? "
1820: 20 61 6e 64 73 74 72 20 6b 65 79 3d 3f 73 74 72 andstr key=?str
1830: 20 22 29 3b 22 29 29 29 0a 09 20 20 20 20 20 3b ");"))).. ;
1840: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
1850: 71 72 79 3a 20 22 20 71 72 79 29 20 0a 09 20 20 qry: " qry) ..
1860: 20 20 20 71 72 79 29 0a 09 20 20 20 71 72 79 76 qry).. qryv
1870: 61 6c 73 29 0a 09 20 20 28 73 71 6c 69 74 65 33 als).. (sqlite3
1880: 3a 65 78 65 63 75 74 65 20 64 62 20 22 55 50 44 :execute db "UPD
1890: 41 54 45 20 72 75 6e 73 20 53 45 54 20 73 74 61 ATE runs SET sta
18a0: 74 65 3d 3f 2c 73 74 61 74 75 73 3d 3f 20 57 48 te=?,status=? WH
18b0: 45 52 45 20 69 64 3d 3f 3b 22 20 73 74 61 74 65 ERE id=?;" state
18c0: 20 73 74 61 74 75 73 20 72 65 73 29 0a 09 20 20 status res)..
18d0: 72 65 73 29 20 0a 09 28 62 65 67 69 6e 0a 09 20 res) ..(begin..
18e0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
18f0: 22 45 52 52 4f 52 3a 20 43 61 6c 6c 65 64 20 77 "ERROR: Called w
1900: 69 74 68 6f 75 74 20 61 6c 6c 20 6e 65 63 65 73 ithout all neces
1910: 73 61 72 79 20 6b 65 79 73 22 29 0a 09 20 20 23 sary keys").. #
1920: 66 29 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 69 f))))..;; This i
1930: 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 6f 66 s a duplicate of
1940: 20 72 75 6e 2d 74 65 73 74 73 20 28 77 68 69 63 run-tests (whic
1950: 68 20 68 61 73 20 62 65 65 6e 20 64 65 70 72 65 h has been depre
1960: 63 61 74 65 64 29 2e 20 55 73 65 20 74 68 69 73 cated). Use this
1970: 20 6f 6e 65 20 69 6e 73 74 65 61 64 20 6f 66 20 one instead of
1980: 72 75 6e 20 74 65 73 74 73 2e 0a 3b 3b 20 6b 65 run tests..;; ke
1990: 79 76 61 6c 73 0a 28 64 65 66 69 6e 65 20 28 72 yvals.(define (r
19a0: 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 20 64 62 uns:run-tests db
19b0: 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 target runname
19c0: 74 65 73 74 2d 70 61 74 74 73 20 75 73 65 72 20 test-patts user
19d0: 66 6c 61 67 73 29 0a 20 20 28 6c 65 74 2a 20 28 flags). (let* (
19e0: 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 72 64 (keys (rd
19f0: 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a b:get-keys db)).
1a00: 09 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 28 . (keyvallst (
1a10: 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 keys:target->key
1a20: 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29 val keys target)
1a30: 29 0a 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20 ).. (run-id
1a40: 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d (runs:register-
1a50: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 run db keys keyv
1a60: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e allst runname "n
1a70: 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 ew" "n/a" user))
1a80: 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29 ;; test-name)
1a90: 29 29 0a 09 20 28 64 65 66 65 72 72 65 64 20 20 )).. (deferred
1aa0: 20 20 27 28 29 29 20 3b 3b 20 64 65 6c 61 79 20 '()) ;; delay
1ab0: 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20 73 69 running these si
1ac0: 6e 63 65 20 74 68 65 79 20 68 61 76 65 20 61 20 nce they have a
1ad0: 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20 waiton clause..
1ae0: 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69 73 20 ;; keepgoing is
1af0: 74 68 65 20 64 65 66 61 63 74 6f 20 6d 6f 64 61 the defacto moda
1b00: 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 61 lity now, will a
1b10: 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61 20 62 dd hit-n-run a b
1b20: 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20 28 6b it later.. ;; (k
1b30: 65 65 70 67 6f 69 6e 67 20 20 20 28 68 61 73 68 eepgoing (hash
1b40: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
1b50: 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 lt flags "-keepg
1b60: 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 74 65 oing" #f)).. (te
1b70: 73 74 2d 6e 61 6d 65 73 20 20 27 28 29 29 0a 09 st-names '())..
1b80: 20 28 72 75 6e 63 6f 6e 66 69 67 66 20 20 20 28 (runconfigf (
1b90: 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 conc *toppath*
1ba0: 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e "/runconfigs.con
1bb0: 66 69 67 22 29 29 0a 09 20 28 72 65 71 75 69 72 fig")).. (requir
1bc0: 65 64 2d 74 65 73 74 73 20 27 28 29 29 0a 09 20 ed-tests '())..
1bd0: 28 74 65 73 74 2d 72 65 63 6f 72 64 73 20 28 6d (test-records (m
1be0: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 ake-hash-table))
1bf0: 29 0a 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 61 ).. (set-mega
1c00: 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 test-env-vars db
1c10: 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 run-id) ;; thes
1c20: 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 e may be needed
1c30: 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 by the launching
1c40: 20 70 72 6f 63 65 73 73 0a 0a 20 20 20 20 28 69 process.. (i
1c50: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 f (file-exists?
1c60: 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 28 73 65 runconfigf)..(se
1c70: 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74 73 tup-env-defaults
1c80: 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 66 20 72 db runconfigf r
1c90: 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d 73 un-id *already-s
1ca0: 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e een-runconfig-in
1cb0: 66 6f 2a 20 22 70 72 65 2d 6c 61 75 6e 63 68 2d fo* "pre-launch-
1cc0: 65 6e 76 2d 76 61 72 73 22 29 0a 09 28 64 65 62 env-vars")..(deb
1cd0: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e ug:print 0 "WARN
1ce0: 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f 74 20 ING: You do not
1cf0: 68 61 76 65 20 61 20 72 75 6e 20 63 6f 6e 66 69 have a run confi
1d00: 67 20 66 69 6c 65 3a 20 22 20 72 75 6e 63 6f 6e g file: " runcon
1d10: 66 69 67 66 29 29 0a 20 20 20 20 0a 20 20 20 20 figf)). .
1d20: 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c 20 74 ;; look up all t
1d30: 65 73 74 73 20 6d 61 74 63 68 69 6e 67 20 74 68 ests matching th
1d40: 65 20 63 6f 6d 6d 61 20 73 65 70 61 72 61 74 65 e comma separate
1d50: 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f 62 73 20 d list of globs
1d60: 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73 74 2d 70 in. ;; test-p
1d70: 61 74 74 73 20 28 75 73 69 6e 67 20 25 20 61 73 atts (using % as
1d80: 20 77 69 6c 64 63 61 72 64 29 0a 20 20 20 20 28 wildcard). (
1d90: 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 for-each . (
1da0: 6c 61 6d 62 64 61 20 28 70 61 74 74 29 0a 20 20 lambda (patt).
1db0: 20 20 20 20 20 28 6c 65 74 20 28 28 74 65 73 74 (let ((test
1dc0: 73 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 2a 74 s (glob (conc *t
1dd0: 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f oppath* "/tests/
1de0: 22 20 28 73 74 72 69 6e 67 2d 74 72 61 6e 73 6c " (string-transl
1df0: 61 74 65 20 70 61 74 74 20 22 25 22 20 22 2a 22 ate patt "%" "*"
1e00: 29 29 29 29 29 0a 09 20 28 73 65 74 21 20 74 65 ))))).. (set! te
1e10: 73 74 73 20 28 66 69 6c 74 65 72 20 28 6c 61 6d sts (filter (lam
1e20: 62 64 61 20 28 74 65 73 74 29 28 66 69 6c 65 2d bda (test)(file-
1e30: 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 20 74 65 exists? (conc te
1e40: 73 74 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 st "/testconfig"
1e50: 29 29 29 20 74 65 73 74 73 29 29 0a 09 20 28 73 ))) tests)).. (s
1e60: 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 et! test-names (
1e70: 61 70 70 65 6e 64 20 74 65 73 74 2d 6e 61 6d 65 append test-name
1e80: 73 20 0a 09 09 09 09 20 20 28 6d 61 70 20 28 6c s ..... (map (l
1e90: 61 6d 62 64 61 20 28 74 65 73 74 70 29 0a 09 09 ambda (testp)...
1ea0: 09 09 09 20 28 6c 61 73 74 20 28 73 74 72 69 6e ... (last (strin
1eb0: 67 2d 73 70 6c 69 74 20 74 65 73 74 70 20 22 2f g-split testp "/
1ec0: 22 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 20 "))).....
1ed0: 74 65 73 74 73 29 29 29 29 29 0a 20 20 20 20 20 tests))))).
1ee0: 28 69 66 20 74 65 73 74 2d 70 61 74 74 73 20 28 (if test-patts (
1ef0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 73 string-split tes
1f00: 74 2d 70 61 74 74 73 20 22 2c 22 29 28 6c 69 73 t-patts ",")(lis
1f10: 74 20 22 25 22 29 29 29 0a 0a 20 20 20 20 20 3b t "%"))).. ;
1f20: 3b 20 6e 6f 77 20 72 65 6d 6f 76 65 20 64 75 70 ; now remove dup
1f30: 6c 69 63 61 74 65 73 0a 20 20 20 20 28 73 65 74 licates. (set
1f40: 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 64 65 ! test-names (de
1f50: 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 20 lete-duplicates
1f60: 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 0a 20 20 test-names))..
1f70: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
1f80: 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 6e 61 6d "INFO: test nam
1f90: 65 73 20 22 20 74 65 73 74 2d 6e 61 6d 65 73 29 es " test-names)
1fa0: 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65 20 .. ;; on the
1fb0: 66 69 72 73 74 20 70 61 73 73 20 6f 72 20 63 61 first pass or ca
1fc0: 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 73 20 ll to run-tests
1fd0: 73 65 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f 54 set FAILS to NOT
1fe0: 5f 53 54 41 52 54 45 44 20 69 66 0a 20 20 20 20 _STARTED if.
1ff0: 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69 73 ;; -keepgoing is
2000: 20 73 70 65 63 69 66 69 65 64 0a 20 20 20 20 28 specified. (
2010: 69 66 20 28 65 71 3f 20 2a 70 61 73 73 6e 75 6d if (eq? *passnum
2020: 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 * 0)..(begin..
2030: 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 6c 65 74 ;; have to delet
2040: 65 20 74 65 73 74 20 72 65 63 6f 72 64 73 20 77 e test records w
2050: 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 54 45 44 here NOT_STARTED
2060: 20 73 69 6e 63 65 20 74 68 65 79 20 63 61 6e 20 since they can
2070: 63 61 75 73 65 20 2d 6b 65 65 70 67 6f 69 6e 67 cause -keepgoing
2080: 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74 20 73 to .. ;; get s
2090: 74 75 63 6b 20 64 75 65 20 74 6f 20 62 65 63 6f tuck due to beco
20a0: 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 69 62 6c ming inaccessibl
20b0: 65 20 66 72 6f 6d 20 61 20 66 61 69 6c 65 64 20 e from a failed
20c0: 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 20 74 65 test. I.e. if te
20d0: 73 74 20 42 20 64 65 70 65 6e 64 73 20 0a 09 20 st B depends ..
20e0: 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20 62 75 ;; on test A bu
20f0: 74 20 74 65 73 74 20 42 20 72 65 61 63 68 65 64 t test B reached
2100: 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20 62 65 the point on be
2110: 69 6e 67 20 72 65 67 69 73 74 65 72 65 64 20 61 ing registered a
2120: 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 61 6e s NOT_STARTED an
2130: 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 41 20 66 d test.. ;; A f
2140: 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65 20 72 ailed for some r
2150: 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 72 65 eason then on re
2160: 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65 65 70 -run using -keep
2170: 67 6f 69 6e 67 20 74 68 65 20 72 75 6e 20 63 61 going the run ca
2180: 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65 74 65 n never complete
2190: 2e 0a 09 20 20 28 64 62 3a 64 65 6c 65 74 65 2d ... (db:delete-
21a0: 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 20 64 tests-in-state d
21b0: 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 54 b run-id "NOT_ST
21c0: 41 52 54 45 44 22 29 0a 09 20 20 28 72 64 62 3a ARTED").. (rdb:
21d0: 73 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65 2d set-tests-state-
21e0: 73 74 61 74 75 73 20 64 62 20 72 75 6e 2d 69 64 status db run-id
21f0: 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 22 test-names #f "
2200: 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54 FAIL" "NOT_START
2210: 45 44 22 20 22 46 41 49 4c 22 29 29 29 0a 0a 20 ED" "FAIL")))..
2220: 20 20 20 3b 3b 20 6e 6f 77 20 61 64 64 20 6e 6f ;; now add no
2230: 6e 2d 64 69 72 65 63 74 6c 79 20 72 65 66 65 72 n-directly refer
2240: 65 6e 63 65 64 20 64 65 70 65 6e 64 65 6e 63 69 enced dependenci
2250: 65 73 20 28 69 2e 65 2e 20 77 61 69 74 6f 6e 29 es (i.e. waiton)
2260: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e . (if (not (n
2270: 75 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 73 29 ull? test-names)
2280: 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 )..(let loop ((h
2290: 65 64 20 28 63 61 72 20 74 65 73 74 2d 6e 61 6d ed (car test-nam
22a0: 65 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 28 es))... (tal (
22b0: 63 64 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 cdr test-names))
22c0: 29 20 20 20 20 20 20 20 20 20 3b 3b 20 27 72 65 ) ;; 're
22d0: 74 75 72 6e 2d 70 72 6f 63 73 20 74 65 6c 6c 73 turn-procs tells
22e0: 20 74 68 65 20 63 6f 6e 66 69 67 20 72 65 61 64 the config read
22f0: 65 72 20 74 6f 20 70 72 65 70 20 72 75 6e 6e 69 er to prep runni
2300: 6e 67 20 73 79 73 74 65 6d 20 62 75 74 20 72 65 ng system but re
2310: 74 75 72 6e 20 61 20 70 72 6f 63 0a 09 20 20 28 turn a proc.. (
2320: 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20 28 let* ((config (
2330: 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f tests:get-testco
2340: 6e 66 69 67 20 68 65 64 20 27 72 65 74 75 72 6e nfig hed 'return
2350: 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61 69 -procs))... (wai
2360: 74 6f 6e 73 20 28 73 74 72 69 6e 67 2d 73 70 6c tons (string-spl
2370: 69 74 20 28 6c 65 74 20 28 28 77 20 28 63 6f 6e it (let ((w (con
2380: 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 fig-lookup confi
2390: 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 g "requirements"
23a0: 20 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09 "waiton")))....
23b0: 09 09 20 20 28 69 66 20 77 20 77 20 22 22 29 29 .. (if w w ""))
23c0: 29 29 29 0a 09 20 20 20 20 3b 3b 20 28 69 74 65 ))).. ;; (ite
23d0: 6d 73 20 20 20 28 69 74 65 6d 73 3a 67 65 74 2d ms (items:get-
23e0: 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 items-from-confi
23f0: 67 20 63 6f 6e 66 69 67 29 29 29 0a 09 20 20 20 g config)))..
2400: 20 28 69 66 20 28 6e 6f 74 20 28 68 61 73 68 2d (if (not (hash-
2410: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
2420: 74 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 68 t test-records h
2430: 65 64 20 23 66 29 29 0a 09 09 28 68 61 73 68 2d ed #f))...(hash-
2440: 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d table-set! test-
2450: 72 65 63 6f 72 64 73 0a 09 09 09 09 20 68 65 64 records..... hed
2460: 20 28 76 65 63 74 6f 72 20 68 65 64 20 20 20 20 (vector hed
2470: 20 3b 3b 20 30 0a 09 09 09 09 09 20 20 20 20 20 ;; 0......
2480: 63 6f 6e 66 69 67 20 20 3b 3b 20 31 0a 09 09 09 config ;; 1....
2490: 09 09 20 20 20 20 20 77 61 69 74 6f 6e 73 20 3b .. waitons ;
24a0: 3b 20 32 0a 09 09 09 09 09 20 20 20 20 20 28 63 ; 2...... (c
24b0: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e onfig-lookup con
24c0: 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 fig "requirement
24d0: 73 22 20 22 70 72 69 6f 72 69 74 79 22 29 20 20 s" "priority")
24e0: 20 20 20 3b 3b 20 70 72 69 6f 72 69 74 79 20 33 ;; priority 3
24f0: 0a 09 09 09 09 09 20 20 20 20 20 28 6c 65 74 20 ...... (let
2500: 28 28 69 74 65 6d 73 20 20 20 20 20 20 28 68 61 ((items (ha
2510: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
2520: 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 65 ault config "ite
2530: 6d 73 22 20 23 66 29 29 20 3b 3b 20 69 74 65 6d ms" #f)) ;; item
2540: 73 20 34 0a 09 09 09 09 09 09 20 20 20 28 69 74 s 4....... (it
2550: 65 6d 73 74 61 62 6c 65 20 28 68 61 73 68 2d 74 emstable (hash-t
2560: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
2570: 20 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 74 61 config "itemsta
2580: 62 6c 65 22 20 23 66 29 29 29 20 0a 09 09 09 09 ble" #f))) .....
2590: 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20 65 69 . ;; if ei
25a0: 74 68 65 72 20 69 74 65 6d 73 20 6f 72 20 69 74 ther items or it
25b0: 65 6d 73 20 74 61 62 6c 65 20 69 73 20 61 20 70 ems table is a p
25c0: 72 6f 63 20 72 65 74 75 72 6e 20 69 74 20 73 6f roc return it so
25d0: 20 74 65 73 74 20 72 75 6e 6e 69 6e 67 0a 09 09 test running...
25e0: 09 09 09 20 20 20 20 20 20 20 3b 3b 20 70 72 6f ... ;; pro
25f0: 63 65 73 73 20 63 61 6e 20 6b 6e 6f 77 20 74 6f cess can know to
2600: 20 63 61 6c 6c 20 69 74 65 6d 73 3a 67 65 74 2d call items:get-
2610: 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 items-from-confi
2620: 67 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b g...... ;;
2630: 20 69 66 20 65 69 74 68 65 72 20 69 73 20 61 20 if either is a
2640: 6c 69 73 74 20 61 6e 64 20 6e 6f 6e 65 20 69 73 list and none is
2650: 20 61 20 70 72 6f 63 20 67 6f 20 61 68 65 61 64 a proc go ahead
2660: 20 61 6e 64 20 63 61 6c 6c 20 67 65 74 2d 69 74 and call get-it
2670: 65 6d 73 0a 09 09 09 09 09 20 20 20 20 20 20 20 ems......
2680: 3b 3b 20 6f 74 68 65 72 77 69 73 65 20 72 65 74 ;; otherwise ret
2690: 75 72 6e 20 23 66 20 2d 20 74 68 69 73 20 69 73 urn #f - this is
26a0: 20 6e 6f 74 20 61 6e 20 69 74 65 72 61 74 65 64 not an iterated
26b0: 20 74 65 73 74 0a 09 09 09 09 09 20 20 20 20 20 test......
26c0: 20 20 28 63 6f 6e 64 0a 09 09 09 09 09 09 28 28 (cond.......((
26d0: 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 procedure? items
26e0: 29 20 20 20 20 20 20 0a 09 09 09 09 09 09 20 28 ) ....... (
26f0: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 debug:print 4 "I
2700: 4e 46 4f 3a 20 69 74 65 6d 73 20 69 73 20 61 20 NFO: items is a
2710: 70 72 6f 63 65 64 75 72 65 2c 20 77 69 6c 6c 20 procedure, will
2720: 63 61 6c 63 20 6c 61 74 65 72 22 29 0a 09 09 09 calc later")....
2730: 09 09 09 20 69 74 65 6d 73 29 20 20 20 20 20 20 ... items)
2740: 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c 61 ;; calc la
2750: 74 65 72 0a 09 09 09 09 09 09 28 28 70 72 6f 63 ter.......((proc
2760: 65 64 75 72 65 3f 20 69 74 65 6d 73 74 61 62 6c edure? itemstabl
2770: 65 29 0a 09 09 09 09 09 09 20 28 64 65 62 75 67 e)....... (debug
2780: 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 :print 4 "INFO:
2790: 69 74 65 6d 73 74 61 62 6c 65 20 69 73 20 61 20 itemstable is a
27a0: 70 72 6f 63 65 64 75 72 65 2c 20 77 69 6c 6c 20 procedure, will
27b0: 63 61 6c 63 20 6c 61 74 65 72 22 29 0a 09 09 09 calc later")....
27c0: 09 09 09 20 69 74 65 6d 73 74 61 62 6c 65 29 20 ... itemstable)
27d0: 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c 61 ;; calc la
27e0: 74 65 72 0a 09 09 09 09 09 09 28 28 66 69 6c 74 ter.......((filt
27f0: 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 0a 09 er (lambda (x)..
2800: 09 09 09 09 09 09 20 20 20 28 6c 65 74 20 28 28 ...... (let ((
2810: 76 61 6c 20 28 63 61 72 20 78 29 29 29 0a 09 09 val (car x)))...
2820: 09 09 09 09 09 20 20 20 20 20 28 69 66 20 28 70 ..... (if (p
2830: 72 6f 63 65 64 75 72 65 3f 20 76 61 6c 29 20 76 rocedure? val) v
2840: 61 6c 20 23 66 29 29 29 0a 09 09 09 09 09 09 09 al #f)))........
2850: 20 28 61 70 70 65 6e 64 20 28 69 66 20 28 6c 69 (append (if (li
2860: 73 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 73 st? items) items
2870: 20 27 28 29 29 0a 09 09 09 09 09 09 09 09 20 28 '())......... (
2880: 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 74 if (list? itemst
2890: 61 62 6c 65 29 20 69 74 65 6d 73 74 61 62 6c 65 able) itemstable
28a0: 20 27 28 29 29 29 29 0a 09 09 09 09 09 09 20 27 '())))....... '
28b0: 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 0a have-procedure).
28c0: 09 09 09 09 09 09 28 28 6f 72 20 28 6c 69 73 74 ......((or (list
28d0: 3f 20 69 74 65 6d 73 29 28 6c 69 73 74 3f 20 69 ? items)(list? i
28e0: 74 65 6d 73 74 61 62 6c 65 29 29 20 3b 3b 20 63 temstable)) ;; c
28f0: 61 6c 63 20 6e 6f 77 0a 09 09 09 09 09 09 20 28 alc now....... (
2900: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 debug:print 4 "I
2910: 4e 46 4f 3a 20 69 74 65 6d 73 20 61 6e 64 20 69 NFO: items and i
2920: 74 65 6d 73 74 61 62 6c 65 20 61 72 65 20 6c 69 temstable are li
2930: 73 74 73 2c 20 63 61 6c 63 20 6e 6f 77 5c 6e 22 sts, calc now\n"
2940: 0a 09 09 09 09 09 09 09 20 20 20 20 20 20 22 20 ........ "
2950: 20 20 20 69 74 65 6d 73 3a 20 22 20 69 74 65 6d items: " item
2960: 73 20 22 20 69 74 65 6d 73 74 61 62 6c 65 3a 20 s " itemstable:
2970: 22 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 09 " itemstable)...
2980: 09 09 09 09 20 28 69 74 65 6d 73 3a 67 65 74 2d .... (items:get-
2990: 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 items-from-confi
29a0: 67 20 63 6f 6e 66 69 67 29 29 0a 09 09 09 09 09 g config))......
29b0: 09 28 65 6c 73 65 20 23 66 29 29 29 20 20 20 20 .(else #f)))
29c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
29d0: 20 20 20 20 20 20 20 3b 3b 20 6e 6f 74 20 69 74 ;; not it
29e0: 65 72 61 74 65 64 0a 09 09 09 09 09 20 20 20 20 erated......
29f0: 20 23 66 20 20 20 20 20 20 3b 3b 20 69 74 65 6d #f ;; item
2a00: 73 64 61 74 20 35 0a 09 09 09 09 09 20 20 20 20 sdat 5......
2a10: 20 23 66 20 20 20 20 20 20 3b 3b 20 73 70 61 72 #f ;; spar
2a20: 65 20 2d 20 75 73 65 64 20 66 6f 72 20 69 74 65 e - used for ite
2a30: 6d 2d 70 61 74 68 0a 09 09 09 09 09 20 20 20 20 m-path......
2a40: 20 29 29 29 0a 09 20 20 20 20 28 66 6f 72 2d 65 ))).. (for-e
2a50: 61 63 68 20 0a 09 20 20 20 20 20 28 6c 61 6d 62 ach .. (lamb
2a60: 64 61 20 28 77 61 69 74 6f 6e 29 0a 09 20 20 20 da (waiton)..
2a70: 20 20 20 20 28 69 66 20 28 61 6e 64 20 77 61 69 (if (and wai
2a80: 74 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72 ton (not (member
2a90: 20 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d waiton test-nam
2aa0: 65 73 29 29 29 0a 09 09 20 20 20 28 62 65 67 69 es)))... (begi
2ab0: 6e 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 72 n... (set! r
2ac0: 65 71 75 69 72 65 64 2d 74 65 73 74 73 20 28 63 equired-tests (c
2ad0: 6f 6e 73 20 77 61 69 74 6f 6e 20 72 65 71 75 69 ons waiton requi
2ae0: 72 65 64 2d 74 65 73 74 73 29 29 0a 09 09 20 20 red-tests))...
2af0: 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 (set! test-na
2b00: 6d 65 73 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e mes (cons waiton
2b10: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 29 29 test-names)))))
2b20: 20 3b 3b 20 77 61 73 20 61 6e 20 61 70 70 65 6e ;; was an appen
2b30: 64 2c 20 6e 6f 77 20 61 20 63 6f 6e 73 0a 09 20 d, now a cons..
2b40: 20 20 20 20 77 61 69 74 6f 6e 73 29 0a 09 20 20 waitons)..
2b50: 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 (let ((remtest
2b60: 73 20 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 s (delete-duplic
2b70: 61 74 65 73 20 28 61 70 70 65 6e 64 20 77 61 69 ates (append wai
2b80: 74 6f 6e 73 20 74 61 6c 29 29 29 29 0a 09 20 20 tons tal))))..
2b90: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 (if (not (nu
2ba0: 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 29 0a 09 ll? remtests))..
2bb0: 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 72 65 . (loop (car re
2bc0: 6d 74 65 73 74 73 29 28 63 64 72 20 72 65 6d 74 mtests)(cdr remt
2bd0: 65 73 74 73 29 29 29 29 29 29 29 0a 0a 20 20 20 ests)))))))..
2be0: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (if (not (null?
2bf0: 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 29 required-tests)
2c00: 29 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 )..(debug:print
2c10: 31 20 22 49 4e 46 4f 3a 20 41 64 64 69 6e 67 20 1 "INFO: Adding
2c20: 22 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 " required-tests
2c30: 20 22 20 74 6f 20 74 68 65 20 72 75 6e 20 71 75 " to the run qu
2c40: 65 75 65 22 29 29 0a 20 20 20 20 3b 3b 20 4e 4f eue")). ;; NO
2c50: 54 45 3a 20 74 68 65 73 65 20 61 72 65 20 61 6c TE: these are al
2c60: 6c 20 70 61 72 65 6e 74 20 74 65 73 74 73 2c 20 l parent tests,
2c70: 69 74 65 6d 73 20 61 72 65 20 6e 6f 74 20 65 78 items are not ex
2c80: 70 61 6e 64 65 64 20 79 65 74 2e 0a 20 20 20 20 panded yet..
2c90: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d (runs:run-tests-
2ca0: 71 75 65 75 65 20 64 62 20 72 75 6e 2d 69 64 20 queue db run-id
2cb0: 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 runname test-rec
2cc0: 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 ords keyvallst f
2cd0: 6c 61 67 73 29 0a 20 20 20 20 28 69 66 20 2a 72 lags). (if *r
2ce0: 70 63 3a 6c 69 73 74 65 6e 65 72 2a 20 28 73 65 pc:listener* (se
2cf0: 72 76 65 72 3a 6b 65 65 70 2d 72 75 6e 6e 69 6e rver:keep-runnin
2d00: 67 20 64 62 29 29 0a 20 20 20 20 28 64 65 62 75 g db)). (debu
2d10: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a g:print 4 "INFO:
2d20: 20 41 6c 6c 20 64 6f 6e 65 20 62 79 20 68 65 72 All done by her
2d30: 65 22 29 29 29 0a 0a 3b 3b 20 74 65 73 74 2d 72 e")))..;; test-r
2d40: 65 63 6f 72 64 73 20 69 73 20 61 20 68 61 73 68 ecords is a hash
2d50: 20 74 61 62 6c 65 20 74 65 73 74 6e 61 6d 65 3a table testname:
2d60: 69 74 65 6d 5f 70 61 74 68 20 3d 3e 20 76 65 63 item_path => vec
2d70: 74 6f 72 20 3c 20 74 65 73 74 6e 61 6d 65 20 74 tor < testname t
2d80: 65 73 74 63 6f 6e 66 69 67 20 77 61 69 74 6f 6e estconfig waiton
2d90: 73 20 70 72 69 6f 72 69 74 79 20 69 74 65 6d 73 s priority items
2da0: 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66 -info ... >.(def
2db0: 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 ine (runs:run-te
2dc0: 73 74 73 2d 71 75 65 75 65 20 64 62 20 72 75 6e sts-queue db run
2dd0: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 -id runname test
2de0: 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c -records keyvall
2df0: 73 74 20 66 6c 61 67 73 29 0a 20 20 20 20 3b 3b st flags). ;;
2e00: 20 41 74 20 74 68 69 73 20 70 6f 69 6e 74 20 74 At this point t
2e10: 68 65 20 6c 69 73 74 20 6f 66 20 70 61 72 65 6e he list of paren
2e20: 74 20 74 65 73 74 73 20 69 73 20 65 78 70 61 6e t tests is expan
2e30: 64 65 64 20 0a 20 20 20 20 3b 3b 20 4e 42 2f 2f ded . ;; NB//
2e40: 20 53 68 6f 75 6c 64 20 65 78 70 61 6e 64 20 69 Should expand i
2e50: 74 65 6d 73 20 68 65 72 65 20 61 6e 64 20 74 68 tems here and th
2e60: 65 6e 20 69 6e 73 65 72 74 20 69 6e 74 6f 20 74 en insert into t
2e70: 68 65 20 72 75 6e 20 71 75 65 75 65 2e 0a 20 20 he run queue..
2e80: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22 (debug:print 5 "
2e90: 74 65 73 74 2d 72 65 63 6f 72 64 73 3a 20 22 20 test-records: "
2ea0: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 22 2c 20 test-records ",
2eb0: 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 keyvallst: " key
2ec0: 76 61 6c 6c 73 74 20 22 20 66 6c 61 67 73 3a 20 vallst " flags:
2ed0: 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 " (hash-table->a
2ee0: 6c 69 73 74 20 66 6c 61 67 73 29 29 0a 20 20 28 list flags)). (
2ef0: 6c 65 74 20 28 28 73 6f 72 74 65 64 2d 74 65 73 let ((sorted-tes
2f00: 74 2d 6e 61 6d 65 73 20 28 74 65 73 74 73 3a 73 t-names (tests:s
2f10: 6f 72 74 2d 62 79 2d 70 72 69 6f 72 69 74 79 2d ort-by-priority-
2f20: 61 6e 64 2d 77 61 69 74 6f 6e 20 74 65 73 74 2d and-waiton test-
2f30: 72 65 63 6f 72 64 73 29 29 0a 09 28 69 74 65 6d records))..(item
2f40: 2d 70 61 74 74 73 20 20 20 20 20 20 20 20 28 68 -patts (h
2f50: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
2f60: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 69 74 fault flags "-it
2f70: 65 6d 70 61 74 74 22 20 23 66 29 29 29 0a 20 20 empatt" #f))).
2f80: 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c (if (not (null
2f90: 3f 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 ? sorted-test-na
2fa0: 6d 65 73 29 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 mes))..(let loop
2fb0: 20 28 3b 20 28 6e 75 6d 74 69 6d 65 73 20 30 29 (; (numtimes 0)
2fc0: 20 3b 3b 20 73 68 6f 75 6c 64 6e 27 74 20 6e 65 ;; shouldn't ne
2fd0: 65 64 20 74 68 69 73 0a 09 09 20 20 20 28 68 65 ed this... (he
2fe0: 64 20 20 20 20 20 20 20 20 20 28 63 61 72 20 73 d (car s
2ff0: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 orted-test-names
3000: 29 29 0a 09 09 20 20 20 28 74 61 6c 20 20 20 20 ))... (tal
3010: 20 20 20 20 20 28 63 64 72 20 73 6f 72 74 65 64 (cdr sorted
3020: 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09 -test-names)))..
3030: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 72 (let* ((test-r
3040: 65 63 6f 72 64 20 28 68 61 73 68 2d 74 61 62 6c ecord (hash-tabl
3050: 65 2d 72 65 66 20 74 65 73 74 2d 72 65 63 6f 72 e-ref test-recor
3060: 64 73 20 68 65 64 29 29 0a 09 09 20 28 74 63 6f ds hed))... (tco
3070: 6e 66 69 67 20 20 20 20 20 28 74 65 73 74 73 3a nfig (tests:
3080: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 testqueue-get-te
3090: 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 stconfig test-re
30a0: 63 6f 72 64 29 29 0a 09 09 20 28 77 61 69 74 6f cord))... (waito
30b0: 6e 73 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 ns (tests:te
30c0: 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74 stqueue-get-wait
30d0: 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f ons test-reco
30e0: 72 64 29 29 0a 09 09 20 28 70 72 69 6f 72 69 74 rd))... (priorit
30f0: 79 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 y (tests:test
3100: 71 75 65 75 65 2d 67 65 74 2d 70 72 69 6f 72 69 queue-get-priori
3110: 74 79 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 ty test-record
3120: 29 29 0a 09 09 20 28 69 74 65 6d 64 61 74 20 20 ))... (itemdat
3130: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 (tests:testqu
3140: 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 eue-get-itemdat
3150: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 test-record))
3160: 20 3b 3b 20 69 74 65 6d 64 61 74 20 63 61 6e 20 ;; itemdat can
3170: 62 65 20 61 20 73 74 72 69 6e 67 2c 20 6c 69 73 be a string, lis
3180: 74 20 6f 72 20 23 66 0a 09 09 20 28 69 74 65 6d t or #f... (item
3190: 73 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 s (tests:t
31a0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 estqueue-get-ite
31b0: 6d 73 20 20 20 20 20 20 74 65 73 74 2d 72 65 63 ms test-rec
31c0: 6f 72 64 29 29 0a 09 09 20 28 69 74 65 6d 2d 70 ord))... (item-p
31d0: 61 74 68 20 20 20 28 69 74 65 6d 2d 6c 69 73 74 ath (item-list
31e0: 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 ->path itemdat))
31f0: 29 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 ).. (debug:pr
3200: 69 6e 74 20 36 0a 09 09 09 20 22 69 74 65 6d 64 int 6.... "itemd
3210: 61 74 3a 20 20 20 20 20 22 20 69 74 65 6d 64 61 at: " itemda
3220: 74 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 73 t.... "\n items
3230: 3a 20 20 20 20 20 22 20 69 74 65 6d 73 0a 09 09 : " items...
3240: 09 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68 . "\n item-path
3250: 3a 20 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 : " item-path)..
3260: 20 20 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 20 (cond..
3270: 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b 3b 20 ((not items) ;;
3280: 77 68 65 6e 20 66 61 6c 73 65 20 74 68 65 20 74 when false the t
3290: 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 62 65 20 est is ok to be
32a0: 68 61 6e 64 65 64 20 6f 66 66 20 74 6f 20 6c 61 handed off to la
32b0: 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 20 62 65 unch (but not be
32c0: 66 6f 72 65 29 0a 09 20 20 20 20 20 20 28 6c 65 fore).. (le
32d0: 74 20 28 28 68 61 76 65 2d 72 65 73 6f 75 72 63 t ((have-resourc
32e0: 65 73 20 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 es (runs:can-ru
32f0: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 20 n-more-tests db
3300: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b test-record)) ;;
3310: 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 74 65 73 look at the tes
3320: 74 20 6a 6f 62 67 72 6f 75 70 20 61 6e 64 20 74 t jobgroup and t
3330: 6f 74 20 6a 6f 62 73 20 72 75 6e 6e 69 6e 67 0a ot jobs running.
3340: 09 09 20 20 20 20 28 70 72 65 72 65 71 73 2d 6e .. (prereqs-n
3350: 6f 74 2d 6d 65 74 20 28 64 62 3a 67 65 74 2d 70 ot-met (db:get-p
3360: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 64 rereqs-not-met d
3370: 62 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 b run-id waitons
3380: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 09 item-path)))...
3390: 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 61 74 ;; Don't know at
33a0: 20 74 68 69 73 20 74 69 6d 65 20 69 66 20 74 68 this time if th
33b0: 65 20 74 65 73 74 20 68 61 76 65 20 62 65 65 6e e test have been
33c0: 20 6c 61 75 6e 63 68 65 64 20 61 74 20 73 6f 6d launched at som
33d0: 65 20 74 69 6d 65 20 69 6e 20 74 68 65 20 70 61 e time in the pa
33e0: 73 74 0a 09 09 3b 3b 20 69 2e 65 2e 20 69 73 20 st...;; i.e. is
33f0: 74 68 69 73 20 61 20 72 65 2d 6c 61 75 6e 63 68 this a re-launch
3400: 3f 0a 09 09 28 69 66 20 28 61 6e 64 20 68 61 76 ?...(if (and hav
3410: 65 2d 72 65 73 6f 75 72 63 65 73 0a 09 09 09 20 e-resources....
3420: 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e (null? prereqs-n
3430: 6f 74 2d 6d 65 74 29 29 0a 09 09 20 20 20 20 3b ot-met))... ;
3440: 3b 20 6e 6f 20 6c 6f 6f 70 20 2d 20 64 72 6f 70 ; no loop - drop
3450: 20 74 68 6f 75 67 68 20 61 6e 64 20 75 73 65 20 though and use
3460: 74 68 65 20 6c 6f 6f 70 20 61 74 20 74 68 65 20 the loop at the
3470: 62 6f 74 74 6f 6d 20 0a 09 09 20 20 20 20 28 69 bottom ... (i
3480: 66 20 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 f (patt-list-mat
3490: 63 68 20 69 74 65 6d 2d 70 61 74 68 20 69 74 65 ch item-path ite
34a0: 6d 2d 70 61 74 74 73 29 0a 09 09 09 28 72 75 6e m-patts)....(run
34b0: 3a 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 :test db run-id
34c0: 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 runname keyvalls
34d0: 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c t test-record fl
34e0: 61 67 73 20 23 66 29 0a 09 09 09 28 64 65 62 75 ags #f)....(debu
34f0: 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a g:print 1 "INFO:
3500: 20 53 6b 69 70 70 69 6e 67 20 22 20 28 74 65 73 Skipping " (tes
3510: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
3520: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 -testname test-r
3530: 65 63 6f 72 64 29 20 22 20 22 20 69 74 65 6d 2d ecord) " " item-
3540: 70 61 74 68 20 22 20 61 73 20 69 74 20 64 6f 65 path " as it doe
3550: 73 6e 27 74 20 6d 61 74 63 68 20 22 20 69 74 65 sn't match " ite
3560: 6d 2d 70 61 74 74 73 29 29 0a 09 09 20 20 20 20 m-patts))...
3570: 3b 3b 20 65 6c 73 65 20 74 68 65 20 72 75 6e 20 ;; else the run
3580: 69 73 20 73 74 75 63 6b 2c 20 74 65 6d 70 6f 72 is stuck, tempor
3590: 61 72 69 6c 79 20 6f 72 20 70 65 72 6d 61 6e 65 arily or permane
35a0: 6e 74 6c 79 0a 09 09 20 20 20 20 28 6c 65 74 20 ntly... (let
35b0: 28 28 6e 65 77 74 61 6c 20 28 61 70 70 65 6e 64 ((newtal (append
35c0: 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64 29 29 tal (list hed))
35d0: 29 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 63 6f ))... ;; co
35e0: 75 6c 64 6e 27 74 20 72 75 6e 2c 20 74 61 6b 65 uldn't run, take
35f0: 20 61 20 62 72 65 61 74 68 65 72 0a 09 09 20 20 a breather...
3600: 20 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 (thread-slee
3610: 70 21 20 30 2e 31 29 20 3b 3b 20 6c 6f 6e 67 20 p! 0.1) ;; long
3620: 73 6c 65 65 70 20 68 65 72 65 20 2d 20 6e 6f 20 sleep here - no
3630: 72 65 73 6f 75 72 63 65 73 2c 20 6d 61 79 20 61 resources, may a
3640: 73 20 77 65 6c 6c 20 62 65 20 70 61 74 69 65 6e s well be patien
3650: 74 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 t... (loop
3660: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 (car newtal)(cdr
3670: 20 6e 65 77 74 61 6c 29 29 29 29 29 29 0a 09 20 newtal))))))..
3680: 20 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 63 61 .. ;; ca
3690: 73 65 20 77 68 65 72 65 20 61 6e 20 69 74 65 6d se where an item
36a0: 73 20 63 61 6d 65 20 69 6e 20 61 73 20 61 20 6c s came in as a l
36b0: 69 73 74 20 62 65 65 6e 20 70 72 6f 63 65 73 73 ist been process
36c0: 65 64 0a 09 20 20 20 20 20 28 28 61 6e 64 20 28 ed.. ((and (
36d0: 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 20 20 20 list? items)
36e0: 20 3b 3b 20 74 68 75 73 20 77 65 20 6b 6e 6f 77 ;; thus we know
36f0: 20 6f 75 72 20 69 74 65 6d 73 20 61 72 65 20 61 our items are a
3700: 6c 72 65 61 64 79 20 63 61 6c 63 75 6c 61 74 65 lready calculate
3710: 64 0a 09 09 20 20 20 28 6e 6f 74 20 20 20 69 74 d... (not it
3720: 65 6d 64 61 74 29 29 20 3b 3b 20 61 6e 64 20 6e emdat)) ;; and n
3730: 6f 74 20 79 65 74 20 65 78 70 61 6e 64 65 64 20 ot yet expanded
3740: 69 6e 74 6f 20 74 68 65 20 6c 69 73 74 20 6f 66 into the list of
3750: 20 74 68 69 6e 67 73 20 74 6f 20 62 65 20 64 6f things to be do
3760: 6e 65 0a 09 20 20 20 20 20 20 28 69 66 20 28 61 ne.. (if (a
3770: 6e 64 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 nd (>= *verbosit
3780: 79 2a 20 31 29 0a 09 09 20 20 20 20 20 20 20 28 y* 1)... (
3790: 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 6d 73 29 > (length items)
37a0: 20 30 29 0a 09 09 20 20 20 20 20 20 20 28 3e 20 0)... (>
37b0: 28 6c 65 6e 67 74 68 20 28 63 61 72 20 69 74 65 (length (car ite
37c0: 6d 73 29 29 20 30 29 29 0a 09 09 20 20 28 70 70 ms)) 0))... (pp
37d0: 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20 20 20 items))..
37e0: 3b 3b 20 28 69 66 20 28 3e 3d 20 2a 76 65 72 62 ;; (if (>= *verb
37f0: 6f 73 69 74 79 2a 20 35 29 0a 09 20 20 20 20 20 osity* 5)..
3800: 20 3b 3b 20 20 20 20 20 28 62 65 67 69 6e 0a 09 ;; (begin..
3810: 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 28 ;; (
3820: 70 72 69 6e 74 20 22 69 74 65 6d 73 3a 20 22 29 print "items: ")
3830: 20 20 20 20 20 28 70 70 20 28 69 74 65 6d 2d 61 (pp (item-a
3840: 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 ssoc->item-list
3850: 69 74 65 6d 73 29 29 0a 09 20 20 20 20 20 20 3b items)).. ;
3860: 3b 20 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 ; (print "
3870: 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 29 28 70 itemstable: ")(p
3880: 70 20 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69 p (item-table->i
3890: 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74 61 tem-list itemsta
38a0: 62 6c 65 29 29 29 29 0a 09 20 20 20 20 20 20 28 ble)))).. (
38b0: 66 6f 72 2d 65 61 63 68 0a 09 20 20 20 20 20 20 for-each..
38c0: 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d 69 74 65 (lambda (my-ite
38d0: 6d 64 61 74 29 0a 09 09 20 28 6c 65 74 2a 20 28 mdat)... (let* (
38e0: 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 (new-test-record
38f0: 20 28 6c 65 74 20 28 28 6e 65 77 72 65 63 20 28 (let ((newrec (
3900: 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65 73 74 71 make-tests:testq
3910: 75 65 75 65 29 29 29 0a 09 09 09 09 09 20 20 20 ueue)))......
3920: 28 76 65 63 74 6f 72 2d 63 6f 70 79 21 20 74 65 (vector-copy! te
3930: 73 74 2d 72 65 63 6f 72 64 20 6e 65 77 72 65 63 st-record newrec
3940: 29 0a 09 09 09 09 09 20 20 20 6e 65 77 72 65 63 )...... newrec
3950: 29 29 0a 09 09 09 28 6d 79 2d 69 74 65 6d 2d 70 ))....(my-item-p
3960: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e ath (item-list->
3970: 70 61 74 68 20 6d 79 2d 69 74 65 6d 64 61 74 29 path my-itemdat)
3980: 29 29 0a 09 09 20 20 20 28 69 66 20 28 70 61 74 ))... (if (pat
3990: 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 6d 79 2d t-list-match my-
39a0: 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70 item-path item-p
39b0: 61 74 74 73 29 20 20 20 20 20 20 20 20 20 20 20 atts)
39c0: 3b 3b 20 79 65 73 2c 20 77 65 20 77 61 6e 74 20 ;; yes, we want
39d0: 74 6f 20 70 72 6f 63 65 73 73 20 74 68 69 73 20 to process this
39e0: 69 74 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f 75 item, NOTE: Shou
39f0: 6c 64 20 6e 6f 74 20 6e 65 65 64 20 74 68 69 73 ld not need this
3a00: 20 63 68 65 63 6b 20 68 65 72 65 21 0a 09 09 20 check here!...
3a10: 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 (let ((new
3a20: 74 65 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20 68 testname (conc h
3a30: 65 64 20 22 2f 22 20 6d 79 2d 69 74 65 6d 2d 70 ed "/" my-item-p
3a40: 61 74 68 29 29 29 20 20 20 20 3b 3b 20 74 65 73 ath))) ;; tes
3a50: 74 20 6e 61 6d 65 73 20 61 72 65 20 75 6e 69 71 t names are uniq
3a60: 75 65 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f 69 ue on testname/i
3a70: 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 28 74 65 tem-path.... (te
3a80: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 sts:testqueue-se
3a90: 74 2d 69 74 65 6d 73 21 20 20 20 20 20 6e 65 77 t-items! new
3aa0: 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 -test-record #f)
3ab0: 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 .... (tests:test
3ac0: 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 61 queue-set-itemda
3ad0: 74 21 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 t! new-test-re
3ae0: 63 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 29 cord my-itemdat)
3af0: 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 .... (tests:test
3b00: 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f 70 queue-set-item_p
3b10: 61 74 68 21 20 6e 65 77 2d 74 65 73 74 2d 72 65 ath! new-test-re
3b20: 63 6f 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74 cord my-item-pat
3b30: 68 29 0a 09 09 09 20 28 68 61 73 68 2d 74 61 62 h).... (hash-tab
3b40: 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 le-set! test-rec
3b50: 6f 72 64 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 ords newtestname
3b60: 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 new-test-record
3b70: 29 0a 09 09 09 20 28 73 65 74 21 20 74 61 6c 20 ).... (set! tal
3b80: 28 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d (cons newtestnam
3b90: 65 20 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 73 e tal)))))) ;; s
3ba0: 69 6e 63 65 20 74 68 65 73 65 20 61 72 65 20 69 ince these are i
3bb0: 74 65 6d 69 7a 65 64 20 63 72 65 61 74 65 20 6e temized create n
3bc0: 65 77 20 74 65 73 74 20 6e 61 6d 65 73 20 74 65 ew test names te
3bd0: 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a stname/itempath.
3be0: 09 20 20 20 20 20 20 20 69 74 65 6d 73 29 0a 09 . items)..
3bf0: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 (if (not (
3c00: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 null? tal))...
3c10: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 (loop (car tal)(
3c20: 63 64 72 20 74 61 6c 29 29 29 29 0a 0a 09 20 20 cdr tal))))...
3c30: 20 20 20 3b 3b 20 69 66 20 69 74 65 6d 73 20 69 ;; if items i
3c40: 73 20 61 20 70 72 6f 63 20 74 68 65 6e 20 6e 65 s a proc then ne
3c50: 65 64 20 74 6f 20 72 75 6e 20 69 74 65 6d 73 3a ed to run items:
3c60: 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 get-items-from-c
3c70: 6f 6e 66 69 67 2c 20 67 65 74 20 74 68 65 20 6c onfig, get the l
3c80: 69 73 74 20 61 6e 64 20 6c 6f 6f 70 20 0a 09 20 ist and loop ..
3c90: 20 20 20 20 3b 3b 20 20 20 20 2d 20 62 75 74 20 ;; - but
3ca0: 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20 69 66 20 only do that if
3cb0: 72 65 73 6f 75 72 63 65 73 20 65 78 69 73 74 20 resources exist
3cc0: 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74 68 65 20 to kick off the
3cd0: 6a 6f 62 0a 09 20 20 20 20 20 28 28 6f 72 20 28 job.. ((or (
3ce0: 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 procedure? items
3cf0: 29 28 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76 )(eq? items 'hav
3d00: 65 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20 e-procedure))..
3d10: 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 72 (if (and (r
3d20: 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 uns:can-run-more
3d30: 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 2d 72 -tests db test-r
3d40: 65 63 6f 72 64 29 0a 09 09 20 20 20 20 20 20 20 ecord)...
3d50: 28 6e 75 6c 6c 3f 20 28 64 62 3a 67 65 74 2d 70 (null? (db:get-p
3d60: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 64 rereqs-not-met d
3d70: 62 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 b run-id waitons
3d80: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 09 item-path)))...
3d90: 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 (let ((test-na
3da0: 6d 65 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 me (tests:testqu
3db0: 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 eue-get-testname
3dc0: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29 0a test-record))).
3dd0: 09 09 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d .. (setenv "M
3de0: 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 T_TEST_NAME" tes
3df0: 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 09 09 20 20 t-name) ;; ...
3e00: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 (setenv "MT_RU
3e10: 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 NNAME" runname
3e20: 29 0a 09 09 20 20 20 20 28 73 65 74 2d 6d 65 67 )... (set-meg
3e30: 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 atest-env-vars d
3e40: 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 b run-id) ;; the
3e50: 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 se may be needed
3e60: 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e by the launchin
3e70: 67 20 70 72 6f 63 65 73 73 0a 09 09 20 20 20 20 g process...
3e80: 28 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c 69 73 (let ((items-lis
3e90: 74 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 t (items:get-ite
3ea0: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 74 ms-from-config t
3eb0: 63 6f 6e 66 69 67 29 29 29 0a 09 09 20 20 20 20 config)))...
3ec0: 20 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 (if (list? ite
3ed0: 6d 73 2d 6c 69 73 74 29 0a 09 09 09 20 20 28 62 ms-list).... (b
3ee0: 65 67 69 6e 0a 09 09 09 20 20 20 20 28 74 65 73 egin.... (tes
3ef0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 ts:testqueue-set
3f00: 2d 69 74 65 6d 73 21 20 74 65 73 74 2d 72 65 63 -items! test-rec
3f10: 6f 72 64 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a ord items-list).
3f20: 09 09 09 20 20 20 20 28 6c 6f 6f 70 20 68 65 64 ... (loop hed
3f30: 20 74 61 6c 29 29 0a 09 09 09 20 20 28 62 65 67 tal)).... (beg
3f40: 69 6e 0a 09 09 09 20 20 20 20 28 64 65 62 75 67 in.... (debug
3f50: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
3f60: 20 54 68 65 20 70 72 6f 63 20 66 72 6f 6d 20 72 The proc from r
3f70: 65 61 64 69 6e 67 20 74 68 65 20 73 65 74 75 70 eading the setup
3f80: 20 64 69 64 20 6e 6f 74 20 79 69 65 6c 64 20 61 did not yield a
3f90: 20 6c 69 73 74 20 2d 20 70 6c 65 61 73 65 20 72 list - please r
3fa0: 65 70 6f 72 74 20 74 68 69 73 22 29 0a 09 09 09 eport this")....
3fb0: 20 20 20 20 28 65 78 69 74 20 31 29 29 29 29 29 (exit 1)))))
3fc0: 0a 09 09 20 20 28 6c 65 74 20 28 28 6e 65 77 74 ... (let ((newt
3fd0: 61 6c 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28 al (append tal (
3fe0: 6c 69 73 74 20 68 65 64 29 29 29 29 0a 09 09 20 list hed))))...
3ff0: 20 20 20 3b 3b 20 69 66 20 63 61 6e 27 74 20 72 ;; if can't r
4000: 75 6e 20 6d 6f 72 65 20 74 65 73 74 73 2c 20 6c un more tests, l
4010: 65 74 73 20 74 61 6b 65 20 61 20 62 72 65 61 74 ets take a breat
4020: 68 65 72 0a 09 09 20 20 20 20 28 74 68 72 65 61 her... (threa
4030: 64 2d 73 6c 65 65 70 21 20 30 2e 31 29 20 3b 3b d-sleep! 0.1) ;;
4040: 20 6d 61 79 20 61 73 20 77 65 6c 6c 20 77 61 69 may as well wai
4050: 74 20 61 20 77 68 69 6c 65 20 66 6f 72 20 72 65 t a while for re
4060: 73 6f 75 72 63 65 73 20 74 6f 20 66 72 65 65 20 sources to free
4070: 75 70 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 up... (loop (
4080: 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 car newtal)(cdr
4090: 6e 65 77 74 61 6c 29 29 29 29 29 0a 0a 09 20 20 newtal)))))...
40a0: 20 20 20 3b 3b 20 74 68 69 73 20 63 61 73 65 20 ;; this case
40b0: 73 68 6f 75 6c 64 20 6e 6f 74 20 68 61 70 70 65 should not happe
40c0: 6e 2c 20 61 64 64 65 64 20 74 6f 20 68 65 6c 70 n, added to help
40d0: 20 63 61 74 63 68 20 61 6e 79 20 62 75 67 73 0a catch any bugs.
40e0: 09 20 20 20 20 20 28 28 61 6e 64 20 28 6c 69 73 . ((and (lis
40f0: 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 64 61 t? items) itemda
4100: 74 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 t).. (debug
4110: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
4120: 20 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65 Should not have
4130: 20 61 20 6c 69 73 74 20 6f 66 20 69 74 65 6d 73 a list of items
4140: 20 69 6e 20 61 20 74 65 73 74 20 61 6e 64 20 74 in a test and t
4150: 68 65 20 69 74 65 6d 73 70 61 74 68 20 73 65 74 he itemspath set
4160: 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 - please report
4170: 20 74 68 69 73 22 29 0a 09 20 20 20 20 20 20 28 this").. (
4180: 65 78 69 74 20 31 29 29 29 29 0a 09 20 20 0a 09 exit 1)))).. ..
4190: 20 20 3b 3b 20 77 65 20 67 65 74 20 68 65 72 65 ;; we get here
41a0: 20 6f 6e 20 22 64 72 6f 70 20 74 68 72 6f 75 67 on "drop throug
41b0: 68 22 20 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e 65 h" - loop for ne
41c0: 78 74 20 74 65 73 74 20 69 6e 20 71 75 65 75 65 xt test in queue
41d0: 0a 09 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74 .. (if (null? t
41e0: 61 6c 29 0a 09 20 20 20 20 20 20 28 62 65 67 69 al).. (begi
41f0: 6e 0a 09 09 3b 3b 20 46 49 58 4d 45 21 21 21 21 n...;; FIXME!!!!
4200: 20 54 48 49 53 20 53 48 4f 55 4c 44 20 4e 4f 54 THIS SHOULD NOT
4210: 20 52 45 51 55 49 52 45 20 41 4e 20 45 58 49 54 REQUIRE AN EXIT
4220: 21 21 21 21 21 21 21 0a 09 09 28 64 65 62 75 67 !!!!!!!...(debug
4230: 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 :print 1 "INFO:
4240: 41 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e 63 68 All tests launch
4250: 65 64 22 29 0a 09 09 28 74 68 72 65 61 64 2d 73 ed")...(thread-s
4260: 6c 65 65 70 21 20 30 2e 35 29 0a 09 09 3b 3b 20 leep! 0.5)...;;
4270: 46 49 58 4d 45 21 20 54 68 69 73 20 68 61 72 73 FIXME! This hars
4280: 68 20 65 78 69 74 20 73 68 6f 75 6c 64 20 6e 6f h exit should no
4290: 74 20 62 65 20 6e 65 63 65 73 73 61 72 79 2e 2e t be necessary..
42a0: 2e 2e 0a 09 09 28 69 66 20 28 6e 6f 74 20 2a 72 .....(if (not *r
42b0: 75 6e 72 65 6d 6f 74 65 2a 29 28 65 78 69 74 29 unremote*)(exit)
42c0: 29 20 3b 3b 20 0a 09 09 23 66 29 20 3b 3b 20 72 ) ;; ...#f) ;; r
42d0: 65 74 75 72 6e 20 61 20 23 66 20 61 73 20 61 20 eturn a #f as a
42e0: 68 69 6e 74 20 74 68 61 74 20 77 65 20 61 72 65 hint that we are
42f0: 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 3b 3b 20 done.. ;;
4300: 48 65 72 65 20 77 65 20 6e 65 65 64 20 74 6f 20 Here we need to
4310: 63 68 65 63 6b 20 74 68 61 74 20 61 6c 6c 20 74 check that all t
4320: 68 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 he tests remaini
4330: 6e 67 20 74 6f 20 62 65 20 72 75 6e 20 61 72 65 ng to be run are
4340: 20 65 6c 69 67 69 62 6c 65 20 74 6f 20 72 75 6e eligible to run
4350: 0a 09 20 20 20 20 20 20 3b 3b 20 61 6e 64 20 61 .. ;; and a
4360: 72 65 20 6e 6f 74 20 62 6c 6f 63 6b 65 64 20 62 re not blocked b
4370: 79 20 66 61 69 6c 65 64 0a 09 20 20 20 20 20 20 y failed..
4380: 28 6c 65 74 20 28 28 6e 65 77 6c 73 74 20 28 74 (let ((newlst (t
4390: 65 73 74 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d ests:filter-non-
43a0: 72 75 6e 6e 61 62 6c 65 20 64 62 20 72 75 6e 2d runnable db run-
43b0: 69 64 20 74 61 6c 20 74 65 73 74 2d 72 65 63 6f id tal test-reco
43c0: 72 64 73 29 29 29 20 3b 3b 20 69 2e 65 2e 20 6e rds))) ;; i.e. n
43d0: 6f 74 20 46 41 49 4c 2c 20 57 41 49 56 45 44 2c ot FAIL, WAIVED,
43e0: 20 49 4e 43 4f 4d 50 4c 45 54 45 2c 20 50 41 53 INCOMPLETE, PAS
43f0: 53 2c 20 4b 49 4c 4c 45 44 2c 0a 09 09 28 74 68 S, KILLED,...(th
4400: 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 31 29 read-sleep! 0.1)
4410: 0a 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c ...(if (not (nul
4420: 6c 3f 20 6e 65 77 6c 73 74 29 29 0a 09 09 20 20 l? newlst))...
4430: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 (loop (car new
4440: 6c 73 74 29 28 63 64 72 20 6e 65 77 6c 73 74 29 lst)(cdr newlst)
4450: 29 29 29 29 29 29 29 29 0a 0a 3b 3b 20 70 61 72 ))))))))..;; par
4460: 65 6e 74 2d 74 65 73 74 20 69 73 20 74 68 65 72 ent-test is ther
4470: 65 20 61 73 20 61 20 70 6c 61 63 65 68 6f 6c 64 e as a placehold
4480: 65 72 20 66 6f 72 20 77 68 65 6e 20 70 61 72 65 er for when pare
4490: 6e 74 2d 74 65 73 74 73 20 63 61 6e 20 62 65 20 nt-tests can be
44a0: 72 75 6e 20 61 73 20 61 20 73 65 74 75 70 20 73 run as a setup s
44b0: 74 65 70 0a 28 64 65 66 69 6e 65 20 28 72 75 6e tep.(define (run
44c0: 3a 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 :test db run-id
44d0: 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 runname keyvalls
44e0: 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c t test-record fl
44f0: 61 67 73 20 70 61 72 65 6e 74 2d 74 65 73 74 29 ags parent-test)
4500: 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 20 . ;; All these
4510: 76 61 72 73 20 6d 69 67 68 74 20 62 65 20 72 65 vars might be re
4520: 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 ferenced by the
4530: 74 65 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 20 testconfig file
4540: 72 65 61 64 65 72 0a 20 20 28 6c 65 74 2a 20 28 reader. (let* (
4550: 28 74 65 73 74 2d 6e 61 6d 65 20 20 20 20 28 74 (test-name (t
4560: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 ests:testqueue-g
4570: 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65 et-testname te
4580: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 st-record)).. (t
4590: 65 73 74 2d 77 61 69 74 6f 6e 73 20 28 74 65 73 est-waitons (tes
45a0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
45b0: 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 -waitons test
45c0: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 -record)).. (tes
45d0: 74 2d 63 6f 6e 66 20 20 20 20 28 74 65 73 74 73 t-conf (tests
45e0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 :testqueue-get-t
45f0: 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 estconfig test-r
4600: 65 63 6f 72 64 29 29 0a 09 20 28 69 74 65 6d 64 ecord)).. (itemd
4610: 61 74 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 at (tests:t
4620: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 estqueue-get-ite
4630: 6d 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 mdat test-rec
4640: 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 70 61 ord)).. (test-pa
4650: 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 th (conc *top
4660: 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 path* "/tests/"
4670: 74 65 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20 63 test-name)) ;; c
4680: 6f 75 6c 64 20 75 73 65 20 74 65 73 74 73 3a 67 ould use tests:g
4690: 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65 et-testconfig he
46a0: 72 65 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65 20 re ..... (force
46b0: 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 (hash-tab
46c0: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 le-ref/default f
46d0: 6c 61 67 73 20 22 2d 66 6f 72 63 65 22 20 23 66 lags "-force" #f
46e0: 29 29 0a 09 20 28 72 65 72 75 6e 20 20 20 20 20 )).. (rerun
46f0: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 (hash-table-r
4700: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 ef/default flags
4710: 20 22 2d 72 65 72 75 6e 22 20 23 66 29 29 0a 09 "-rerun" #f))..
4720: 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 28 (keepgoing (
4730: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
4740: 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b efault flags "-k
4750: 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 eepgoing" #f))..
4760: 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 20 20 (item-path
4770: 22 22 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a "")). (debug:
4780: 70 72 69 6e 74 20 35 0a 09 09 20 22 74 65 73 74 print 5... "test
4790: 2d 63 6f 6e 66 69 67 3a 20 22 20 28 68 61 73 68 -config: " (hash
47a0: 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 -table->alist te
47b0: 73 74 2d 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20 st-conf)... "\n
47c0: 20 20 69 74 65 6d 64 61 74 3a 20 22 20 69 74 65 itemdat: " ite
47d0: 6d 64 61 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b mdat... ). ;;
47e0: 20 73 65 74 74 69 6e 67 20 69 74 65 6d 64 61 74 setting itemdat
47f0: 20 74 6f 20 61 20 6c 69 73 74 20 69 66 20 69 74 to a list if it
4800: 20 69 73 20 23 66 0a 20 20 20 20 28 69 66 20 28 is #f. (if (
4810: 6e 6f 74 20 69 74 65 6d 64 61 74 29 28 73 65 74 not itemdat)(set
4820: 21 20 69 74 65 6d 64 61 74 20 27 28 29 29 29 0a ! itemdat '())).
4830: 20 20 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70 (set! item-p
4840: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e ath (item-list->
4850: 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 20 path itemdat)).
4860: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
4870: 32 20 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 2 "Attempting to
4880: 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 74 launch test " t
4890: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 est-name "/" ite
48a0: 6d 2d 70 61 74 68 29 0a 20 20 20 20 28 73 65 74 m-path). (set
48b0: 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d env "MT_TEST_NAM
48c0: 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b E" test-name) ;;
48d0: 20 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d . (setenv "M
48e0: 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e T_RUNNAME" run
48f0: 6e 61 6d 65 29 0a 20 20 20 20 28 73 65 74 2d 6d name). (set-m
4900: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 egatest-env-vars
4910: 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 db run-id) ;; t
4920: 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 hese may be need
4930: 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 ed by the launch
4940: 69 6e 67 20 70 72 6f 63 65 73 73 0a 20 20 20 20 ing process.
4950: 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 (change-director
4960: 79 20 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20 y *toppath*)..
4970: 20 20 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65 ;; Here is whe
4980: 72 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 re the test_meta
4990: 20 74 61 62 6c 65 20 69 73 20 62 65 73 74 20 75 table is best u
49a0: 70 64 61 74 65 64 0a 20 20 20 20 3b 3b 20 59 65 pdated. ;; Ye
49b0: 73 2c 20 61 6e 6f 74 68 65 72 20 75 73 65 20 6f s, another use o
49c0: 66 20 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20 63 f a global for c
49d0: 61 63 68 69 6e 67 2e 20 4e 65 65 64 20 61 20 62 aching. Need a b
49e0: 65 74 74 65 72 20 77 61 79 3f 0a 20 20 20 20 28 etter way?. (
49f0: 69 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 if (not (hash-ta
4a00: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
4a10: 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 *test-meta-updat
4a20: 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 66 ed* test-name #f
4a30: 29 29 0a 20 20 20 20 20 20 20 20 28 62 65 67 69 )). (begi
4a40: 6e 0a 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c n.. (hash-tabl
4a50: 65 2d 73 65 74 21 20 2a 74 65 73 74 2d 6d 65 74 e-set! *test-met
4a60: 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d a-updated* test-
4a70: 6e 61 6d 65 20 23 74 29 0a 20 20 20 20 20 20 20 name #t).
4a80: 20 20 20 20 28 72 75 6e 73 3a 75 70 64 61 74 65 (runs:update
4a90: 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 -test_meta db te
4aa0: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e st-name test-con
4ab0: 66 29 29 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b f))). . ;;
4ac0: 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61 (lambda (itemda
4ad0: 74 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 t) ;;; ((ripenes
4ae0: 73 20 22 6f 76 65 72 72 69 70 65 22 29 20 28 74 s "overripe") (t
4af0: 65 6d 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c emperature "cool
4b00: 22 29 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d ") (season "summ
4b10: 65 72 22 29 29 0a 20 20 20 20 28 6c 65 74 2a 20 er")). (let*
4b20: 28 28 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20 ((new-test-path
4b30: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 (string-interspe
4b40: 72 73 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 rse (cons test-p
4b50: 61 74 68 20 28 6d 61 70 20 63 61 64 72 20 69 74 ath (map cadr it
4b60: 65 6d 64 61 74 29 29 20 22 2f 22 29 29 0a 09 20 emdat)) "/"))..
4b70: 20 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 (new-test-name
4b80: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 (if (equal? ite
4b90: 6d 2d 70 61 74 68 20 22 22 29 20 74 65 73 74 2d m-path "") test-
4ba0: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d name (conc test-
4bb0: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 name "/" item-pa
4bc0: 74 68 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 th))) ;; just ne
4bd0: 65 64 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71 ed it to be uniq
4be0: 75 65 0a 09 20 20 20 28 74 65 73 74 64 61 74 20 ue.. (testdat
4bf0: 20 20 20 20 20 20 28 64 62 3a 67 65 74 2d 74 65 (db:get-te
4c00: 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 st-info db run-i
4c10: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
4c20: 2d 70 61 74 68 29 29 0a 09 20 20 20 28 74 65 73 -path)).. (tes
4c30: 74 2d 69 64 20 20 20 20 20 20 20 23 66 29 29 0a t-id #f)).
4c40: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 (if (not t
4c50: 65 73 74 64 61 74 29 0a 09 20 20 28 62 65 67 69 estdat).. (begi
4c60: 6e 0a 09 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 n.. ;; ensure
4c70: 20 74 68 61 74 20 74 68 65 20 70 61 74 68 20 65 that the path e
4c80: 78 69 73 74 73 20 62 65 66 6f 72 65 20 72 65 67 xists before reg
4c90: 69 73 74 65 72 69 6e 67 20 74 68 65 20 74 65 73 istering the tes
4ca0: 74 0a 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 t.. ;; NOPE:
4cb0: 43 61 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e Cannot! Don't kn
4cc0: 6f 77 20 79 65 74 20 77 68 69 63 68 20 64 69 73 ow yet which dis
4cd0: 6b 20 61 72 65 61 20 77 69 6c 6c 20 62 65 20 61 k area will be a
4ce0: 73 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 ssigned......
4cf0: 20 3b 3b 20 28 73 79 73 74 65 6d 20 28 63 6f 6e ;; (system (con
4d00: 63 20 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 c "mkdir -p " ne
4d10: 77 2d 74 65 73 74 2d 70 61 74 68 29 29 0a 09 20 w-test-path))..
4d20: 20 20 20 28 72 74 65 73 74 73 3a 72 65 67 69 73 (rtests:regis
4d30: 74 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d ter-test db run-
4d40: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 id test-name ite
4d50: 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 28 73 65 m-path).. (se
4d60: 74 21 20 74 65 73 74 64 61 74 20 28 64 62 3a 67 t! testdat (db:g
4d70: 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 et-test-info db
4d80: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
4d90: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 20 item-path)))).
4da0: 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d (set! test-
4db0: 69 64 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d id (db:test-get-
4dc0: 69 64 20 74 65 73 74 64 61 74 29 29 0a 20 20 20 id testdat)).
4dd0: 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 (change-direc
4de0: 74 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a tory test-path).
4df0: 20 20 20 20 20 20 28 63 61 73 65 20 28 69 66 20 (case (if
4e00: 66 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 3a 67 force ;; (args:g
4e10: 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29 et-arg "-force")
4e20: 0a 09 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a ...'NOT_STARTED.
4e30: 09 09 28 69 66 20 74 65 73 74 64 61 74 0a 09 09 ..(if testdat...
4e40: 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d (string->sym
4e50: 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74 bol (test:get-st
4e60: 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 ate testdat))...
4e70: 20 20 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 'failed-to-i
4e80: 6e 73 65 72 74 29 29 0a 09 28 28 66 61 69 6c 65 nsert))..((faile
4e90: 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28 d-to-insert).. (
4ea0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
4eb0: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 RROR: Failed to
4ec0: 69 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f 72 insert the recor
4ed0: 64 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29 d into the db"))
4ee0: 0a 09 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 ..((NOT_STARTED
4ef0: 43 4f 4d 50 4c 45 54 45 44 29 0a 09 20 28 64 65 COMPLETED).. (de
4f00: 62 75 67 3a 70 72 69 6e 74 20 36 20 22 47 6f 74 bug:print 6 "Got
4f10: 20 68 65 72 65 2c 20 22 20 28 74 65 73 74 3a 67 here, " (test:g
4f20: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 et-state testdat
4f30: 29 29 0a 09 20 28 6c 65 74 20 28 28 72 75 6e 66 )).. (let ((runf
4f40: 6c 61 67 20 23 66 29 29 0a 09 20 20 20 28 63 6f lag #f)).. (co
4f50: 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 63 nd.. ;; -forc
4f60: 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 e, run no matter
4f70: 20 77 68 61 74 0a 09 20 20 20 20 28 66 6f 72 63 what.. (forc
4f80: 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 e (set! runflag
4f90: 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 #t)).. ;; NOT
4fa0: 5f 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f _STARTED, run no
4fb0: 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 matter what..
4fc0: 20 20 28 28 65 71 75 61 6c 3f 20 28 74 65 73 74 ((equal? (test
4fd0: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 :get-state testd
4fe0: 61 74 29 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 at) "NOT_STARTED
4ff0: 22 29 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 ")(set! runflag
5000: 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f 74 #t)).. ;; not
5010: 20 2d 72 65 72 75 6e 20 61 6e 64 20 50 41 53 53 -rerun and PASS
5020: 2c 20 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c , WARN or CHECK,
5030: 20 64 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20 20 do no run..
5040: 28 28 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72 ((and (or (not r
5050: 65 72 75 6e 29 0a 09 09 20 20 20 20 20 20 6b 65 erun)... ke
5060: 65 70 67 6f 69 6e 67 29 0a 09 09 20 20 3b 3b 20 epgoing)... ;;
5070: 52 65 71 75 69 72 65 20 74 6f 20 66 6f 72 63 65 Require to force
5080: 20 72 65 2d 72 75 6e 20 66 6f 72 20 43 4f 4d 50 re-run for COMP
5090: 4c 45 54 45 44 20 6f 72 20 2a 61 6e 79 74 68 69 LETED or *anythi
50a0: 6e 67 2a 20 2b 20 50 41 53 53 2c 57 41 52 4e 20 ng* + PASS,WARN
50b0: 6f 72 20 43 48 45 43 4b 0a 09 09 20 20 28 6f 72 or CHECK... (or
50c0: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 (member (test:g
50d0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
50e0: 74 29 20 27 28 22 50 41 53 53 22 20 22 57 41 52 t) '("PASS" "WAR
50f0: 4e 22 20 22 43 48 45 43 4b 22 29 29 0a 09 09 20 N" "CHECK"))...
5100: 20 20 20 20 20 28 6d 65 6d 62 65 72 20 28 74 65 (member (te
5110: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 20 74 65 st:get-state te
5120: 73 74 64 61 74 29 20 27 28 22 43 4f 4d 50 4c 45 stdat) '("COMPLE
5130: 54 45 44 22 29 29 29 29 20 0a 09 20 20 20 20 20 TED")))) ..
5140: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 (debug:print 2 "
5150: 49 4e 46 4f 3a 20 72 75 6e 6e 69 6e 67 20 74 65 INFO: running te
5160: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 st " test-name "
5170: 2f 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 73 /" item-path " s
5180: 75 70 70 72 65 73 73 65 64 20 61 73 20 69 74 20 uppressed as it
5190: 69 73 20 43 4f 4d 50 4c 45 54 45 44 20 61 6e 64 is COMPLETED and
51a0: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 " (test:get-sta
51b0: 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 te testdat))..
51c0: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 (set! runflag
51d0: 20 23 66 29 29 0a 09 20 20 20 20 3b 3b 20 2d 72 #f)).. ;; -r
51e0: 65 72 75 6e 20 61 6e 64 20 73 74 61 74 75 73 20 erun and status
51f0: 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 73 70 is one of the sp
5200: 65 63 69 66 65 64 2c 20 72 75 6e 20 69 74 0a 09 ecifed, run it..
5210: 20 20 20 20 28 28 61 6e 64 20 72 65 72 75 6e 0a ((and rerun.
5220: 09 09 20 20 28 6c 65 74 2a 20 28 28 72 65 72 75 .. (let* ((reru
5230: 6e 6c 73 74 20 20 20 28 73 74 72 69 6e 67 2d 73 nlst (string-s
5240: 70 6c 69 74 20 72 65 72 75 6e 20 22 2c 22 29 29 plit rerun ","))
5250: 0a 09 09 09 20 28 6d 75 73 74 2d 72 65 72 75 6e .... (must-rerun
5260: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 (member (test:g
5270: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
5280: 74 29 20 72 65 72 75 6e 6c 73 74 29 29 29 0a 09 t) rerunlst)))..
5290: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
52a0: 74 20 33 20 22 49 4e 46 4f 3a 20 2d 72 65 72 75 t 3 "INFO: -reru
52b0: 6e 20 6c 69 73 74 3a 20 22 20 72 65 72 75 6e 20 n list: " rerun
52c0: 22 2c 20 74 65 73 74 2d 73 74 61 74 75 73 3a 20 ", test-status:
52d0: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
52e0: 75 73 20 74 65 73 74 64 61 74 29 22 2c 20 6d 75 us testdat)", mu
52f0: 73 74 2d 72 65 72 75 6e 3a 20 22 20 6d 75 73 74 st-rerun: " must
5300: 2d 72 65 72 75 6e 29 0a 09 09 20 20 20 20 6d 75 -rerun)... mu
5310: 73 74 2d 72 65 72 75 6e 29 29 0a 09 20 20 20 20 st-rerun))..
5320: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
5330: 22 49 4e 46 4f 3a 20 52 65 72 75 6e 20 66 6f 72 "INFO: Rerun for
5340: 63 65 64 20 66 6f 72 20 74 65 73 74 20 22 20 74 ced for test " t
5350: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 est-name "/" ite
5360: 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 20 28 73 m-path).. (s
5370: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 et! runflag #t))
5380: 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f .. ;; -keepgo
5390: 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75 ing, do not reru
53a0: 6e 20 46 41 49 4c 0a 09 20 20 20 20 28 28 61 6e n FAIL.. ((an
53b0: 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09 20 20 d keepgoing...
53c0: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 (member (test:ge
53d0: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
53e0: 29 20 27 28 22 46 41 49 4c 22 29 29 29 0a 09 20 ) '("FAIL")))..
53f0: 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 (set! runfla
5400: 67 20 23 66 29 29 0a 09 20 20 20 20 28 28 61 6e g #f)).. ((an
5410: 64 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 d (not rerun)...
5420: 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a (member (test:
5430: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
5440: 61 74 29 20 27 28 22 46 41 49 4c 22 20 22 6e 2f at) '("FAIL" "n/
5450: 61 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 74 a"))).. (set
5460: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 ! runflag #t))..
5470: 20 20 20 20 28 65 6c 73 65 20 28 73 65 74 21 20 (else (set!
5480: 72 75 6e 66 6c 61 67 20 23 66 29 29 29 0a 09 20 runflag #f)))..
5490: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 (debug:print 6
54a0: 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e "RUNNING => run
54b0: 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 67 20 flag: " runflag
54c0: 22 20 53 54 41 54 45 3a 20 22 20 28 74 65 73 74 " STATE: " (test
54d0: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 :get-state testd
54e0: 61 74 29 20 22 20 53 54 41 54 55 53 3a 20 22 20 at) " STATUS: "
54f0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
5500: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 28 testdat)).. (
5510: 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 67 29 if (not runflag)
5520: 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f .. (if (no
5530: 74 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 09 t parent-test)..
5540: 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 . (debug:print
5550: 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 1 "NOTE: Not st
5560: 61 72 74 69 6e 67 20 74 65 73 74 20 22 20 6e 65 arting test " ne
5570: 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 73 w-test-name " as
5580: 20 69 74 20 69 73 20 73 74 61 74 65 20 5c 22 22 it is state \""
5590: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 (test:get-state
55a0: 20 74 65 73 74 64 61 74 29 20 0a 09 09 09 09 22 testdat) ....."
55b0: 5c 22 20 61 6e 64 20 73 74 61 74 75 73 20 5c 22 \" and status \"
55c0: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
55d0: 75 73 20 74 65 73 74 64 61 74 29 20 22 5c 22 2c us testdat) "\",
55e0: 20 75 73 65 20 2d 72 65 72 75 6e 20 5c 22 22 20 use -rerun \""
55f0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
5600: 20 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 testdat).
5610: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
5620: 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 6f 72 "\" or
5630: 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 72 -force to overr
5640: 69 64 65 22 29 29 0a 09 20 20 20 20 20 20 20 3b ide")).. ;
5650: 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 ; NOTE: No longe
5660: 72 20 62 65 20 63 68 65 63 6b 69 6e 67 20 70 72 r be checking pr
5670: 65 72 65 71 75 69 73 69 74 65 73 20 68 65 72 65 erequisites here
5680: 21 20 57 69 6c 6c 20 6e 65 76 65 72 20 67 65 74 ! Will never get
5690: 20 68 65 72 65 20 75 6e 6c 65 73 73 20 70 72 65 here unless pre
56a0: 72 65 71 73 20 61 72 65 0a 09 20 20 20 20 20 20 reqs are..
56b0: 20 3b 3b 20 20 20 20 20 20 20 61 6c 72 65 61 64 ;; alread
56c0: 79 20 6d 65 74 2e 0a 09 20 20 20 20 20 20 20 28 y met... (
56d0: 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d if (not (launch-
56e0: 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 test db run-id r
56f0: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 unname test-conf
5700: 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d keyvallst test-
5710: 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 68 20 69 name test-path i
5720: 74 65 6d 64 61 74 20 66 6c 61 67 73 29 29 0a 09 temdat flags))..
5730: 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 . (begin...
5740: 20 20 28 70 72 69 6e 74 20 22 45 52 52 4f 52 3a (print "ERROR:
5750: 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 Failed to launc
5760: 68 20 74 68 65 20 74 65 73 74 2e 20 45 78 69 74 h the test. Exit
5770: 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 ing as soon as p
5780: 6f 73 73 69 62 6c 65 22 29 0a 09 09 20 20 20 20 ossible")...
5790: 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 (set! *globalex
57a0: 69 74 73 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 itstatus* 1) ;;
57b0: 0a 09 09 20 20 20 20 20 28 70 72 6f 63 65 73 73 ... (process
57c0: 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 -signal (current
57d0: 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 73 69 67 -process-id) sig
57e0: 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09 nal/kill))))))..
57f0: 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20 28 64 65 ((KILLED) .. (de
5800: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 bug:print 1 "NOT
5810: 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 E: " new-test-na
5820: 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 me " is already
5830: 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 running or was e
5840: 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c xplictly killed,
5850: 20 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c use -force to l
5860: 61 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 28 28 aunch it."))..((
5870: 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f 54 45 48 LAUNCHED REMOTEH
5880: 4f 53 54 53 54 41 52 54 20 52 55 4e 4e 49 4e 47 OSTSTART RUNNING
5890: 29 20 20 0a 09 20 28 69 66 20 28 3e 20 28 2d 20 ) .. (if (> (-
58a0: 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 (current-seconds
58b0: 29 28 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 74 )(+ (db:test-get
58c0: 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 -event_time test
58d0: 64 61 74 29 0a 09 09 09 09 20 20 20 20 20 20 20 dat).....
58e0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e (db:test-get-run
58f0: 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 74 64 61 _duration testda
5900: 74 29 29 29 0a 09 09 36 30 30 29 20 3b 3b 20 69 t)))...600) ;; i
5910: 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 6f .e. no update fo
5920: 72 20 6d 6f 72 65 20 74 68 61 6e 20 36 30 30 20 r more than 600
5930: 73 65 63 6f 6e 64 73 0a 09 20 20 20 20 20 28 62 seconds.. (b
5940: 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 64 65 egin.. (de
5950: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
5960: 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 74 65 73 NING: Test " tes
5970: 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 61 72 73 t-name " appears
5980: 20 74 6f 20 62 65 20 64 65 61 64 2e 20 46 6f 72 to be dead. For
5990: 63 69 6e 67 20 69 74 20 74 6f 20 73 74 61 74 65 cing it to state
59a0: 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 INCOMPLETE and
59b0: 73 74 61 74 75 73 20 53 54 55 43 4b 2f 44 45 41 status STUCK/DEA
59c0: 44 22 29 0a 09 20 20 20 20 20 20 20 28 74 65 73 D").. (tes
59d0: 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 62 t-set-status! db
59e0: 20 74 65 73 74 2d 69 64 20 22 49 4e 43 4f 4d 50 test-id "INCOMP
59f0: 4c 45 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41 LETE" "STUCK/DEA
5a00: 44 22 20 22 54 65 73 74 20 69 73 20 73 74 75 63 D" "Test is stuc
5a10: 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 0a k or dead" #f)).
5a20: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 . (debug:pri
5a30: 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 65 nt 2 "NOTE: " te
5a40: 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 st-name " is alr
5a50: 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 29 eady running")))
5a60: 0a 09 28 65 6c 73 65 20 20 20 20 20 20 20 28 64 ..(else (d
5a70: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
5a80: 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c ROR: Failed to l
5a90: 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65 77 aunch test " new
5aa0: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e -test-name ". Un
5ab0: 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74 65 recognised state
5ac0: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 " (test:get-sta
5ad0: 74 65 20 74 65 73 74 64 61 74 29 29 29 29 29 29 te testdat))))))
5ae0: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d )..;;===========
5af0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 ===========.;; E
5b30: 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46 0a ND OF NEW STUFF.
5b40: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
5b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b80: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e ========..(defin
5b90: 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 e (get-dir-up-n
5ba0: 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20 dir . params) .
5bb0: 20 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 20 (let ((dparts
5bc0: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69 (string-split di
5bd0: 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20 r "/"))..(count
5be0: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72 (if (null? par
5bf0: 61 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 61 ams) 1 (car para
5c00: 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 ms)))). (conc
5c10: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 "/" (string-int
5c20: 65 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 20 ersperse ..
5c30: 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 (take dparts (
5c40: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 - (length dparts
5c50: 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20 ) count))..
5c60: 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d "/")))).;; Rem
5c70: 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c ove runs.;; fiel
5c80: 64 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 69 ds are passing i
5c90: 6e 20 74 68 72 6f 75 67 68 20 0a 3b 3b 20 61 63 n through .;; ac
5ca0: 74 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27 72 65 6d tion:.;; 'rem
5cb0: 6f 76 65 2d 72 75 6e 73 0a 3b 3b 20 20 20 20 27 ove-runs.;; '
5cc0: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 set-state-status
5cd0: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 6f .(define (runs:o
5ce0: 70 65 72 61 74 65 2d 6f 6e 20 64 62 20 61 63 74 perate-on db act
5cf0: 69 6f 6e 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 ion runnamepatt
5d00: 74 65 73 74 70 61 74 74 20 69 74 65 6d 70 61 74 testpatt itempat
5d10: 74 20 23 21 6b 65 79 20 28 73 74 61 74 65 20 23 t #!key (state #
5d20: 66 29 28 73 74 61 74 75 73 20 23 66 29 28 6e 65 f)(status #f)(ne
5d30: 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 23 w-state-status #
5d40: 66 29 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 f)). (let* ((ke
5d50: 79 73 20 20 20 20 20 20 20 20 20 28 72 64 62 3a ys (rdb:
5d60: 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 get-keys db))..
5d70: 28 72 75 6e 64 61 74 20 20 20 20 20 20 20 28 72 (rundat (r
5d80: 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d uns:get-runs-by-
5d90: 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e patt db keys run
5da0: 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 28 68 65 namepatt)).. (he
5db0: 61 64 65 72 20 20 20 20 20 20 20 28 76 65 63 74 ader (vect
5dc0: 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 or-ref rundat 0)
5dd0: 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 20 20 ).. (runs
5de0: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 (vector-ref ru
5df0: 6e 64 61 74 20 31 29 29 0a 09 20 28 73 74 61 74 ndat 1)).. (stat
5e00: 65 73 20 20 20 20 20 20 20 28 69 66 20 73 74 61 es (if sta
5e10: 74 65 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 te (string-spli
5e20: 74 20 73 74 61 74 65 20 20 22 2c 22 29 20 27 28 t state ",") '(
5e30: 29 29 29 0a 09 20 28 73 74 61 74 75 73 65 73 20 ))).. (statuses
5e40: 20 20 20 20 28 69 66 20 73 74 61 74 75 73 20 28 (if status (
5e50: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 string-split sta
5e60: 74 75 73 20 22 2c 22 29 20 27 28 29 29 29 0a 09 tus ",") '()))..
5e70: 20 28 73 74 61 74 65 2d 73 74 61 74 75 73 20 28 (state-status (
5e80: 69 66 20 28 73 74 72 69 6e 67 3f 20 6e 65 77 2d if (string? new-
5e90: 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 28 73 state-status) (s
5ea0: 74 72 69 6e 67 2d 73 70 6c 69 74 20 6e 65 77 2d tring-split new-
5eb0: 73 74 61 74 65 2d 73 74 61 74 75 73 20 22 2c 22 state-status ","
5ec0: 29 20 27 28 23 66 20 23 66 29 29 29 29 0a 20 20 ) '(#f #f)))).
5ed0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 (debug:print 2
5ee0: 20 22 48 65 61 64 65 72 3a 20 22 20 68 65 61 64 "Header: " head
5ef0: 65 72 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 er " action: " a
5f00: 63 74 69 6f 6e 20 22 20 6e 65 77 2d 73 74 61 74 ction " new-stat
5f10: 65 2d 73 74 61 74 75 73 3a 20 22 20 6e 65 77 2d e-status: " new-
5f20: 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a 20 20 state-status).
5f30: 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 (for-each.
5f40: 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 20 (lambda (run).
5f50: 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 6e (let ((run
5f60: 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 key (string-inte
5f70: 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 rsperse (map (la
5f80: 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 09 09 28 mbda (k).......(
5f90: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
5fa0: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
5fb0: 72 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 20 r (vector-ref k
5fc0: 30 29 29 29 20 6b 65 79 73 29 20 22 2f 22 29 29 0))) keys) "/"))
5fd0: 0a 09 20 20 20 20 20 28 64 69 72 73 2d 74 6f 2d .. (dirs-to-
5fe0: 72 65 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 61 73 remove (make-has
5ff0: 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 28 6c 65 h-table))).. (le
6000: 74 2a 20 28 28 72 75 6e 2d 69 64 20 20 20 20 28 t* ((run-id (
6010: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
6020: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
6030: 72 20 22 69 64 22 29 29 0a 09 09 28 72 75 6e 2d r "id"))...(run-
6040: 73 74 61 74 65 20 28 64 62 3a 67 65 74 2d 76 61 state (db:get-va
6050: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
6060: 6e 20 68 65 61 64 65 72 20 22 73 74 61 74 65 22 n header "state"
6070: 29 29 0a 09 09 28 74 65 73 74 73 20 20 20 20 20 ))...(tests
6080: 28 69 66 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f (if (not (equal?
6090: 20 72 75 6e 2d 73 74 61 74 65 20 22 6c 6f 63 6b run-state "lock
60a0: 65 64 22 29 29 0a 09 09 09 20 20 20 20 20 20 20 ed"))....
60b0: 28 72 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 (rdb:get-tests-f
60c0: 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 or-run db (db:ge
60d0: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
60e0: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 r run header "id
60f0: 22 29 0a 09 09 09 09 09 09 20 20 20 20 20 20 74 ")....... t
6100: 65 73 74 70 61 74 74 20 69 74 65 6d 70 61 74 74 estpatt itempatt
6110: 20 73 74 61 74 65 73 20 73 74 61 74 75 73 65 73 states statuses
6120: 0a 09 09 09 09 09 09 20 20 20 20 20 20 6e 6f 74 ....... not
6130: 2d 69 6e 3a 20 20 23 66 0a 09 09 09 09 09 09 20 -in: #f.......
6140: 20 20 20 20 20 73 6f 72 74 2d 62 79 3a 20 28 63 sort-by: (c
6150: 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 09 09 ase action......
6160: 09 09 09 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e ... ((remove-run
6170: 73 29 20 27 72 75 6e 64 69 72 29 0a 09 09 09 09 s) 'rundir).....
6180: 09 09 09 09 20 28 65 6c 73 65 20 20 20 20 20 20 .... (else
6190: 20 20 20 20 27 65 76 65 6e 74 5f 74 69 6d 65 29 'event_time)
61a0: 29 29 0a 09 09 09 20 20 20 20 20 20 20 27 28 29 )).... '()
61b0: 29 29 0a 09 09 28 6c 61 73 74 74 70 61 74 68 20 ))...(lasttpath
61c0: 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 "/does/not/exist
61d0: 2f 49 2f 68 6f 70 65 22 29 29 0a 0a 09 20 20 20 /I/hope"))...
61e0: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 (if (not (null?
61f0: 74 65 73 74 73 29 29 0a 09 20 20 20 20 20 20 20 tests))..
6200: 28 62 65 67 69 6e 0a 09 09 20 28 63 61 73 65 20 (begin... (case
6210: 61 63 74 69 6f 6e 0a 09 09 20 20 20 28 28 72 65 action... ((re
6220: 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 09 20 20 20 move-runs)...
6230: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
6240: 22 52 65 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 "Removing tests
6250: 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 for run: " runke
6260: 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 y " " (db:get-va
6270: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
6280: 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d n header "runnam
6290: 65 22 29 29 29 0a 09 09 20 20 20 28 28 73 65 74 e")))... ((set
62a0: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a 09 -state-status)..
62b0: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
62c0: 74 20 31 20 22 4d 6f 64 69 66 79 69 6e 67 20 73 t 1 "Modifying s
62d0: 74 61 74 65 20 61 6e 64 20 73 74 61 75 73 20 66 tate and staus f
62e0: 6f 72 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e or tests for run
62f0: 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 : " runkey " " (
6300: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
6310: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
6320: 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 r "runname")))..
6330: 09 20 20 20 28 65 6c 73 65 0a 09 09 20 20 20 20 . (else...
6340: 28 70 72 69 6e 74 20 22 49 4e 46 4f 3a 20 61 63 (print "INFO: ac
6350: 74 69 6f 6e 20 6e 6f 74 20 72 65 63 6f 67 6e 69 tion not recogni
6360: 73 65 64 20 22 20 61 63 74 69 6f 6e 29 29 29 0a sed " action))).
6370: 09 09 20 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 .. (for-each...
6380: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a (lambda (test).
6390: 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28 69 74 .. (let* ((it
63a0: 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 em-path (db:test
63b0: 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 -get-item-path t
63c0: 65 73 74 29 29 0a 09 09 09 20 20 20 28 74 65 73 est)).... (tes
63d0: 74 2d 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d t-name (db:test-
63e0: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 get-testname tes
63f0: 74 29 29 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 t)).... (run-d
6400: 69 72 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 ir (db:test-ge
6410: 74 2d 72 75 6e 64 69 72 20 74 65 73 74 29 29 29 t-rundir test)))
6420: 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a ... (debug:
6430: 70 72 69 6e 74 20 31 20 22 20 20 22 20 28 64 62 print 1 " " (db
6440: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 :test-get-testna
6450: 6d 65 20 74 65 73 74 29 20 22 20 69 64 3a 20 22 me test) " id: "
6460: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
6470: 20 74 65 73 74 29 20 22 20 22 20 69 74 65 6d 2d test) " " item-
6480: 70 61 74 68 20 22 20 61 63 74 69 6f 6e 3a 20 22 path " action: "
6490: 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 20 20 20 action)...
64a0: 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 (case action...
64b0: 09 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a .((remove-runs).
64c0: 09 09 09 20 28 72 64 62 3a 64 65 6c 65 74 65 2d ... (rdb:delete-
64d0: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64 62 20 test-records db
64e0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
64f0: 74 65 73 74 29 29 0a 09 09 09 20 28 64 65 62 75 test)).... (debu
6500: 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a g:print 1 "INFO:
6510: 20 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 72 Attempting to r
6520: 65 6d 6f 76 65 20 64 69 72 20 22 20 72 75 6e 2d emove dir " run-
6530: 64 69 72 29 0a 09 09 09 20 28 69 66 20 28 61 6e dir).... (if (an
6540: 64 20 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e d (> (string-len
6550: 67 74 68 20 72 75 6e 2d 64 69 72 29 20 35 29 0a gth run-dir) 5).
6560: 09 09 09 09 20 20 28 66 69 6c 65 2d 65 78 69 73 .... (file-exis
6570: 74 73 3f 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b ts? run-dir)) ;;
6580: 20 62 61 64 20 68 65 75 72 69 73 74 69 63 20 62 bad heuristic b
6590: 75 74 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e ut should preven
65a0: 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 t /tmp /home etc
65b0: 2e 0a 09 09 09 20 20 20 20 20 28 6c 65 74 2a 20 ..... (let*
65c0: 28 28 72 65 61 6c 70 61 74 68 20 28 72 65 73 6f ((realpath (reso
65d0: 6c 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e lve-pathname run
65e0: 2d 64 69 72 29 29 29 0a 09 09 09 20 20 20 20 20 -dir)))....
65f0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
6600: 20 22 49 4e 46 4f 3a 20 52 65 61 6c 20 70 61 74 "INFO: Real pat
6610: 68 20 6f 66 20 69 73 20 22 20 72 65 61 6c 70 61 h of is " realpa
6620: 74 68 29 0a 09 09 09 20 20 20 20 20 20 20 28 69 th).... (i
6630: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 f (file-exists?
6640: 72 65 61 6c 70 61 74 68 29 0a 09 09 09 09 20 20 realpath).....
6650: 20 28 69 66 20 28 3e 20 28 73 79 73 74 65 6d 20 (if (> (system
6660: 28 63 6f 6e 63 20 22 72 6d 20 2d 72 66 20 22 20 (conc "rm -rf "
6670: 72 65 61 6c 70 61 74 68 29 29 20 30 29 0a 09 09 realpath)) 0)...
6680: 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a .. (debug:
6690: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 print 0 "ERROR:
66a0: 54 68 65 72 65 20 77 61 73 20 61 20 70 72 6f 62 There was a prob
66b0: 6c 65 6d 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 lem removing " r
66c0: 65 61 6c 70 61 74 68 20 22 20 77 69 74 68 20 72 ealpath " with r
66d0: 6d 20 2d 66 22 29 29 0a 09 09 09 09 20 20 20 28 m -f"))..... (
66e0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 debug:print 0 "W
66f0: 41 52 4e 49 4e 47 3a 20 74 65 73 74 20 72 75 6e ARNING: test run
6700: 20 64 69 72 20 22 20 72 65 61 6c 70 61 74 68 20 dir " realpath
6710: 22 20 61 70 70 65 61 72 73 20 74 6f 20 6e 6f 74 " appears to not
6720: 20 65 78 69 73 74 22 29 29 0a 09 09 09 20 20 20 exist"))....
6730: 20 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 (if (file-ex
6740: 69 73 74 73 3f 20 72 75 6e 2d 64 69 72 29 20 3b ists? run-dir) ;
6750: 3b 20 74 68 65 20 6c 69 6e 6b 0a 09 09 09 09 20 ; the link.....
6760: 20 20 28 69 66 20 28 73 79 6d 62 6f 6c 69 63 2d (if (symbolic-
6770: 6c 69 6e 6b 3f 20 72 75 6e 2d 64 69 72 29 0a 09 link? run-dir)..
6780: 09 09 09 20 20 20 20 20 20 20 28 64 65 6c 65 74 ... (delet
6790: 65 2d 66 69 6c 65 20 72 75 6e 2d 64 69 72 29 0a e-file run-dir).
67a0: 09 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28 .... (if (
67b0: 64 69 72 65 63 74 6f 72 79 3f 20 72 75 6e 2d 64 directory? run-d
67c0: 69 72 29 0a 09 09 09 09 09 20 20 20 28 69 66 20 ir)...... (if
67d0: 28 3e 20 28 64 69 72 65 63 74 6f 72 79 2d 66 6f (> (directory-fo
67e0: 6c 64 20 28 6c 61 6d 62 64 61 20 28 66 20 78 29 ld (lambda (f x)
67f0: 28 2b 20 31 20 78 29 29 20 30 20 72 75 6e 2d 64 (+ 1 x)) 0 run-d
6800: 69 72 29 20 30 29 0a 09 09 09 09 09 20 20 20 20 ir) 0)......
6810: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
6820: 30 20 22 57 41 52 4e 49 4e 47 3a 20 72 65 66 75 0 "WARNING: refu
6830: 73 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 sing to remove "
6840: 20 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 run-dir " as it
6850: 20 69 73 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a is not empty").
6860: 09 09 09 09 09 20 20 20 20 20 20 20 28 64 65 6c ..... (del
6870: 65 74 65 2d 64 69 72 65 63 74 6f 72 79 20 72 75 ete-directory ru
6880: 6e 2d 64 69 72 29 29 20 3b 3b 20 69 74 20 73 68 n-dir)) ;; it sh
6890: 6f 75 6c 64 20 62 65 20 65 6d 70 74 79 20 62 79 ould be empty by
68a0: 20 68 65 72 65 20 42 55 47 20 42 55 47 2c 20 61 here BUG BUG, a
68b0: 64 64 20 65 72 72 6f 72 20 63 61 74 63 68 0a 09 dd error catch..
68c0: 09 09 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 .... (debug:pr
68d0: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 72 65 int 0 "ERROR: re
68e0: 66 75 73 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 fusing to remove
68f0: 20 22 20 72 75 6e 2d 64 69 72 20 22 20 61 73 20 " run-dir " as
6900: 69 74 20 69 73 20 6e 65 69 74 68 65 72 20 61 20 it is neither a
6910: 73 79 6d 6c 69 6e 6b 20 6e 6f 72 20 61 20 64 69 symlink nor a di
6920: 72 65 63 74 6f 72 79 22 29 0a 09 09 09 09 09 20 rectory")......
6930: 20 20 29 29 29 29 0a 09 09 09 20 20 20 20 20 28 )))).... (
6940: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 debug:print 0 "W
6950: 41 52 4e 49 4e 47 3a 20 64 69 72 65 63 74 6f 72 ARNING: director
6960: 79 20 61 6c 72 65 61 64 79 20 72 65 6d 6f 76 65 y already remove
6970: 64 20 22 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 d " run-dir)))..
6980: 09 09 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 ..((set-state-st
6990: 61 74 75 73 29 0a 09 09 09 20 28 64 65 62 75 67 atus).... (debug
69a0: 3a 70 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20 :print 2 "INFO:
69b0: 6e 65 77 20 73 74 61 74 65 20 22 20 28 63 61 72 new state " (car
69c0: 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 22 state-status) "
69d0: 2c 20 6e 65 77 20 73 74 61 74 75 73 20 22 20 28 , new status " (
69e0: 63 61 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 cadr state-statu
69f0: 73 29 29 0a 09 09 09 20 28 64 62 3a 74 65 73 74 s)).... (db:test
6a00: 2d 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 -set-state-statu
6a10: 73 2d 62 79 2d 69 64 20 64 62 20 28 64 62 3a 74 s-by-id db (db:t
6a20: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 est-get-id test)
6a30: 20 28 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 (car state-stat
6a40: 75 73 29 28 63 61 64 72 20 73 74 61 74 65 2d 73 us)(cadr state-s
6a50: 74 61 74 75 73 29 20 23 66 29 29 29 29 29 0a 09 tatus) #f)))))..
6a60: 09 20 20 74 65 73 74 73 29 29 29 0a 09 20 20 20 . tests)))..
6a70: 0a 09 20 20 20 3b 3b 20 72 65 6d 6f 76 65 20 74 .. ;; remove t
6a80: 68 65 20 72 75 6e 20 69 66 20 7a 65 72 6f 20 74 he run if zero t
6a90: 65 73 74 73 20 72 65 6d 61 69 6e 0a 09 20 20 20 ests remain..
6aa0: 28 69 66 20 28 65 71 3f 20 61 63 74 69 6f 6e 20 (if (eq? action
6ab0: 27 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 20 'remove-runs)..
6ac0: 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d (let ((rem
6ad0: 74 65 73 74 73 20 28 72 64 62 3a 67 65 74 2d 74 tests (rdb:get-t
6ae0: 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 ests-for-run db
6af0: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 (db:get-value-by
6b00: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 -header run head
6b10: 65 72 20 22 69 64 22 29 20 23 66 20 23 66 20 27 er "id") #f #f '
6b20: 28 29 20 27 28 29 29 29 29 0a 09 09 20 28 69 66 () '())))... (if
6b30: 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 (null? remtests
6b40: 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 ) ;; no more tes
6b50: 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 ts remaining...
6b60: 20 20 20 20 28 6c 65 74 2a 20 28 28 64 70 61 72 (let* ((dpar
6b70: 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 ts (string-spli
6b80: 74 20 6c 61 73 74 74 70 61 74 68 20 22 2f 22 29 t lasttpath "/")
6b90: 29 0a 09 09 09 20 20 20 20 28 72 75 6e 70 61 74 ).... (runpat
6ba0: 68 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 h (conc "/" (str
6bb0: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 ing-intersperse
6bc0: 0a 09 09 09 09 09 09 28 74 61 6b 65 20 64 70 61 .......(take dpa
6bd0: 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 rts (- (length d
6be0: 70 61 72 74 73 29 20 31 29 29 0a 09 09 09 09 09 parts) 1))......
6bf0: 09 22 2f 22 29 29 29 29 0a 09 09 20 20 20 20 20 ."/"))))...
6c00: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
6c10: 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 "Removing run:
6c20: 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 " runkey " " (db
6c30: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
6c40: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
6c50: 22 72 75 6e 6e 61 6d 65 22 29 29 0a 09 09 20 20 "runname"))...
6c60: 20 20 20 20 20 28 64 62 3a 64 65 6c 65 74 65 2d (db:delete-
6c70: 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 run db run-id)..
6c80: 09 20 20 20 20 20 20 20 3b 3b 20 6e 65 65 64 20 . ;; need
6c90: 74 6f 20 66 69 67 75 72 65 20 6f 75 74 20 74 68 to figure out th
6ca0: 65 20 70 61 74 68 20 74 6f 20 74 68 65 20 72 75 e path to the ru
6cb0: 6e 20 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 n dir and remove
6cc0: 20 69 74 20 69 66 20 65 6d 70 74 79 0a 09 09 20 it if empty...
6cd0: 20 20 20 20 20 20 3b 3b 20 20 20 20 28 69 66 20 ;; (if
6ce0: 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f (null? (glob (co
6cf0: 6e 63 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 nc runpath "/*")
6d00: 29 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 20 ))... ;;
6d10: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 (begin...
6d20: 20 20 20 20 20 20 3b 3b 20 09 20 28 64 65 62 75 ;; . (debu
6d30: 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 g:print 1 "Remov
6d40: 69 6e 67 20 72 75 6e 20 64 69 72 20 22 20 72 75 ing run dir " ru
6d50: 6e 70 61 74 68 29 0a 09 09 20 20 20 20 20 20 20 npath)...
6d60: 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 28 63 6f ;; . (system (co
6d70: 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 22 20 72 nc "rmdir -p " r
6d80: 75 6e 70 61 74 68 29 29 29 29 0a 09 09 20 20 20 unpath))))...
6d90: 20 20 20 20 29 29 29 29 29 0a 09 20 29 29 0a 20 ))))).. )).
6da0: 20 20 20 20 72 75 6e 73 29 29 29 0a 0a 3b 3b 3d runs)))..;;=
6db0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6dc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6dd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6de0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6df0: 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 =====.;; Routine
6e00: 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 s for manipulati
6e10: 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d ng runs.;;======
6e20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6e30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6e40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6e50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6e60: 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 ..;; Since many
6e70: 63 61 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 calls to a run r
6e80: 65 71 75 69 72 65 20 70 72 65 74 74 79 20 6d 75 equire pretty mu
6e90: 63 68 20 74 68 65 20 73 61 6d 65 20 73 65 74 75 ch the same setu
6ea0: 70 20 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 70 p .;; this wrapp
6eb0: 65 72 20 69 73 20 75 73 65 64 20 74 6f 20 72 65 er is used to re
6ec0: 64 75 63 65 20 74 68 65 20 72 65 70 6c 69 63 61 duce the replica
6ed0: 74 69 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 tion of code.(de
6ee0: 66 69 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 fine (general-ru
6ef0: 6e 2d 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d n-call switchnam
6f00: 65 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 e action-desc pr
6f10: 6f 63 29 0a 20 20 28 6c 65 74 20 28 28 72 75 6e oc). (let ((run
6f20: 6e 61 6d 65 20 28 61 72 67 73 3a 67 65 74 2d 61 name (args:get-a
6f30: 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a rg ":runname")).
6f40: 09 28 74 61 72 67 65 74 20 20 28 69 66 20 28 61 .(target (if (a
6f50: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 rgs:get-arg "-ta
6f60: 72 67 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 rget")... (a
6f70: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 rgs:get-arg "-ta
6f80: 72 67 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 rget")... (a
6f90: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 rgs:get-arg "-re
6fa0: 71 74 61 72 67 22 29 29 29 0a 09 28 74 68 31 20 qtarg")))..(th1
6fb0: 20 20 20 20 23 66 29 29 0a 20 20 20 20 28 63 6f #f)). (co
6fc0: 6e 64 0a 20 20 20 20 20 28 28 6e 6f 74 20 74 61 nd. ((not ta
6fd0: 72 67 65 74 29 0a 20 20 20 20 20 20 28 64 65 62 rget). (deb
6fe0: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
6ff0: 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 R: Missing requi
7000: 72 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f red parameter fo
7010: 72 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 r " switchname "
7020: 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 , you must speci
7030: 66 79 20 74 68 65 20 74 61 72 67 65 74 20 77 69 fy the target wi
7040: 74 68 20 2d 74 61 72 67 65 74 22 29 0a 20 20 20 th -target").
7050: 20 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 (exit 3)).
7060: 20 20 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 ((not runname)
7070: 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
7080: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 int 0 "ERROR: Mi
7090: 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 ssing required p
70a0: 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 arameter for " s
70b0: 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 witchname ", you
70c0: 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68 must specify th
70d0: 65 20 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 e run name with
70e0: 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 :runname runname
70f0: 22 29 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 "). (exit 3
7100: 29 29 0a 20 20 20 20 20 28 65 6c 73 65 0a 20 20 )). (else.
7110: 20 20 20 20 28 6c 65 74 20 28 28 64 62 20 20 20 (let ((db
7120: 23 66 29 0a 09 20 20 20 20 28 6b 65 79 73 20 23 #f).. (keys #
7130: 66 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 f))..(if (not (s
7140: 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 etup-for-run))..
7150: 20 20 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 (begin ..
7160: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
7170: 30 20 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74 0 "Failed to set
7180: 75 70 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20 up, exiting")..
7190: 20 20 20 20 20 28 65 78 69 74 20 31 29 29 29 0a (exit 1))).
71a0: 09 28 73 65 74 21 20 64 62 20 20 20 28 6f 70 65 .(set! db (ope
71b0: 6e 2d 64 62 29 29 0a 09 28 69 66 20 28 61 72 67 n-db))..(if (arg
71c0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 72 76 s:get-arg "-serv
71d0: 65 72 22 29 0a 09 20 20 20 20 28 73 65 72 76 65 er").. (serve
71e0: 72 3a 73 74 61 72 74 20 64 62 20 28 61 72 67 73 r:start db (args
71f0: 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65 :get-arg "-serve
7200: 72 22 29 29 0a 09 20 20 20 20 28 69 66 20 28 6e r")).. (if (n
7210: 6f 74 20 28 6f 72 20 28 61 72 67 73 3a 67 65 74 ot (or (args:get
7220: 2d 61 72 67 20 22 2d 72 75 6e 61 6c 6c 22 29 0a -arg "-runall").
7230: 09 09 09 20 20 28 61 72 67 73 3a 67 65 74 2d 61 ... (args:get-a
7240: 72 67 20 22 2d 72 75 6e 74 65 73 74 73 22 29 29 rg "-runtests"))
7250: 29 0a 09 09 28 73 65 72 76 65 72 3a 63 6c 69 65 )...(server:clie
7260: 6e 74 2d 73 65 74 75 70 20 64 62 29 29 29 0a 09 nt-setup db)))..
7270: 28 73 65 74 21 20 6b 65 79 73 20 28 72 64 62 3a (set! keys (rdb:
7280: 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b get-keys db))..;
7290: 3b 20 68 61 76 65 20 65 6e 6f 75 67 68 20 74 6f ; have enough to
72a0: 20 70 72 6f 63 65 73 73 20 2d 74 61 72 67 65 74 process -target
72b0: 20 6f 72 20 2d 72 65 71 74 61 72 67 20 68 65 72 or -reqtarg her
72c0: 65 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 74 e..(if (args:get
72d0: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 -arg "-reqtarg")
72e0: 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 72 75 .. (let* ((ru
72f0: 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 20 nconfigf (conc
7300: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 *toppath* "/runc
7310: 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 onfigs.config"))
7320: 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55 ;; DO NOT EVALU
7330: 41 54 45 20 41 4c 4c 20 0a 09 09 20 20 20 28 72 ATE ALL ... (r
7340: 75 6e 63 6f 6e 66 69 67 20 20 28 72 65 61 64 2d unconfig (read-
7350: 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e 66 69 67 config runconfig
7360: 66 20 23 66 20 23 66 20 65 6e 76 69 72 6f 6e 2d f #f #f environ-
7370: 70 61 74 74 3a 20 23 66 29 29 29 20 0a 09 20 20 patt: #f))) ..
7380: 20 20 20 20 28 69 66 20 28 68 61 73 68 2d 74 61 (if (hash-ta
7390: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
73a0: 72 75 6e 63 6f 6e 66 69 67 20 28 61 72 67 73 3a runconfig (args:
73b0: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 get-arg "-reqtar
73c0: 67 22 29 20 23 66 29 0a 09 09 20 20 28 6b 65 79 g") #f)... (key
73d0: 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 s:target-set-arg
73e0: 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 s keys (args:get
73f0: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 -arg "-reqtarg")
7400: 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 0a args:arg-hash).
7410: 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 .. (begin...
7420: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
7430: 22 45 52 52 4f 52 3a 20 5b 22 20 28 61 72 67 73 "ERROR: [" (args
7440: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 :get-arg "-reqta
7450: 72 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e rg") "] not foun
7460: 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67 d in " runconfig
7470: 66 29 0a 09 09 20 20 20 20 28 73 71 6c 69 74 65 f)... (sqlite
7480: 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 0a 3:finalize! db).
7490: 09 09 20 20 20 20 28 65 78 69 74 20 31 29 29 29 .. (exit 1)))
74a0: 29 0a 09 20 20 20 20 28 69 66 20 28 61 72 67 73 ).. (if (args
74b0: 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 :get-arg "-targe
74c0: 74 22 29 0a 09 09 28 6b 65 79 73 3a 74 61 72 67 t")...(keys:targ
74d0: 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 73 et-set-args keys
74e0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
74f0: 2d 74 61 72 67 65 74 22 20 61 72 67 73 3a 61 72 -target" args:ar
7500: 67 2d 68 61 73 68 29 20 61 72 67 73 3a 61 72 67 g-hash) args:arg
7510: 2d 68 61 73 68 29 29 29 0a 09 28 69 66 20 28 6e -hash)))..(if (n
7520: 6f 74 20 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 ot (car *configi
7530: 6e 66 6f 2a 29 29 0a 09 20 20 20 20 28 62 65 67 nfo*)).. (beg
7540: 69 6e 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 in.. (debug
7550: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
7560: 20 41 74 74 65 6d 70 74 65 64 20 74 6f 20 22 20 Attempted to "
7570: 61 63 74 69 6f 6e 2d 64 65 73 63 20 22 20 62 75 action-desc " bu
7580: 74 20 72 75 6e 20 61 72 65 61 20 63 6f 6e 66 69 t run area confi
7590: 67 20 66 69 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 g file not found
75a0: 22 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 ").. (exit
75b0: 31 29 29 0a 09 20 20 20 20 3b 3b 20 45 78 74 72 1)).. ;; Extr
75c0: 61 63 74 20 6f 75 74 20 73 74 75 66 66 20 6e 65 act out stuff ne
75d0: 65 64 65 64 20 69 6e 20 6d 6f 73 74 20 6f 72 20 eded in most or
75e0: 6d 61 6e 79 20 63 61 6c 6c 73 0a 09 20 20 20 20 many calls..
75f0: 3b 3b 20 68 65 72 65 20 74 68 65 6e 20 63 61 6c ;; here then cal
7600: 6c 20 70 72 6f 63 0a 09 20 20 20 20 28 6c 65 74 l proc.. (let
7610: 2a 20 28 28 6b 65 79 6e 61 6d 65 73 20 20 20 28 * ((keynames (
7620: 6d 61 70 20 6b 65 79 3a 67 65 74 2d 66 69 65 6c map key:get-fiel
7630: 64 6e 61 6d 65 20 6b 65 79 73 29 29 0a 09 09 20 dname keys))...
7640: 20 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 28 6b (keyvallst (k
7650: 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 eys->vallist key
7660: 73 20 23 74 29 29 29 0a 09 20 20 20 20 20 20 28 s #t))).. (
7670: 70 72 6f 63 20 64 62 20 74 61 72 67 65 74 20 72 proc db target r
7680: 75 6e 6e 61 6d 65 20 6b 65 79 73 20 6b 65 79 6e unname keys keyn
7690: 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74 29 29 ames keyvallst))
76a0: 29 0a 09 28 69 66 20 74 68 31 20 28 74 68 72 65 )..(if th1 (thre
76b0: 61 64 2d 6a 6f 69 6e 21 20 74 68 31 29 29 0a 09 ad-join! th1))..
76c0: 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a (sqlite3:finaliz
76d0: 65 21 20 64 62 29 0a 09 28 73 65 74 21 20 2a 64 e! db)..(set! *d
76e0: 69 64 73 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29 idsomething* #t)
76f0: 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d )))))..;;=======
7700: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7710: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7720: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7730: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a ===============.
7740: 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b ;; Rollup runs.;
7750: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;===============
7760: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7770: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7780: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7790: 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 =======..;; Upda
77a0: 74 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 te the test_meta
77b0: 20 74 61 62 6c 65 20 66 6f 72 20 74 68 69 73 20 table for this
77c0: 74 65 73 74 0a 28 64 65 66 69 6e 65 20 28 72 75 test.(define (ru
77d0: 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d ns:update-test_m
77e0: 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 eta db test-name
77f0: 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 6c test-conf). (l
7800: 65 74 20 28 28 63 75 72 72 72 65 63 6f 72 64 20 et ((currrecord
7810: 28 64 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74 (db:testmeta-get
7820: 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d -record db test-
7830: 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20 name))). (if
7840: 28 6e 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29 (not currrecord)
7850: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74 ..(begin.. (set
7860: 21 20 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61 ! currrecord (ma
7870: 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29 ke-vector 10 #f)
7880: 29 0a 09 20 20 28 64 62 3a 74 65 73 74 6d 65 74 ).. (db:testmet
7890: 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 64 62 20 a-add-record db
78a0: 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 test-name))).
78b0: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 (for-each .
78c0: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 (lambda (key).
78d0: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 69 64 (let* ((id
78e0: 78 20 28 63 61 64 72 20 6b 65 79 29 29 0a 09 20 x (cadr key))..
78f0: 20 20 20 20 20 28 66 6c 64 20 28 63 61 72 20 20 (fld (car
7900: 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 76 61 key)).. (va
7910: 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 l (config-lookup
7920: 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 test-conf "test
7930: 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 0a 09 20 _meta" fld)))..
7940: 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 ;; (debug:print
7950: 35 20 22 69 64 78 3a 20 22 20 69 64 78 20 22 20 5 "idx: " idx "
7960: 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 76 61 6c fld: " fld " val
7970: 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 66 20 28 : " val).. (if (
7980: 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 and val (not (eq
7990: 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 ual? (vector-ref
79a0: 20 63 75 72 72 72 65 63 6f 72 64 20 69 64 78 29 currrecord idx)
79b0: 20 76 61 6c 29 29 29 0a 09 20 20 20 20 20 28 62 val))).. (b
79c0: 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 70 72 egin.. (pr
79d0: 69 6e 74 20 22 55 70 64 61 74 69 6e 67 20 22 20 int "Updating "
79e0: 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c test-name " " fl
79f0: 64 20 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 d " to " val)..
7a00: 20 20 20 20 20 20 28 64 62 3a 74 65 73 74 6d 65 (db:testme
7a10: 74 61 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 20 ta-update-field
7a20: 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 db test-name fld
7a30: 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20 20 27 val))))). '
7a40: 28 28 22 61 75 74 68 6f 72 22 20 32 29 28 22 6f (("author" 2)("o
7a50: 77 6e 65 72 22 20 33 29 28 22 64 65 73 63 72 69 wner" 3)("descri
7a60: 70 74 69 6f 6e 22 20 34 29 28 22 72 65 76 69 65 ption" 4)("revie
7a70: 77 65 64 22 20 35 29 28 22 74 61 67 73 22 20 39 wed" 5)("tags" 9
7a80: 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 )))))..;; Update
7a90: 20 74 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 test_meta for a
7aa0: 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 69 6e 65 ll tests.(define
7ab0: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c (runs:update-al
7ac0: 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 29 0a l-test_meta db).
7ad0: 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 (let ((test-na
7ae0: 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 mes (get-all-leg
7af0: 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20 al-tests))).
7b00: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 (for-each .
7b10: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 (lambda (test-na
7b20: 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a me). (let*
7b30: 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 ((test-path
7b40: 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 (conc *toppath*
7b50: 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e "/tests/" test-n
7b60: 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28 74 65 ame)).. (te
7b70: 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 st-configf (conc
7b80: 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 test-path "/tes
7b90: 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20 tconfig"))..
7ba0: 20 20 28 74 65 73 74 65 78 69 73 74 73 20 20 20 (testexists
7bb0: 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 (and (file-exist
7bc0: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 s? test-configf)
7bd0: 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 (file-read-acces
7be0: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 s? test-configf)
7bf0: 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61 )).. ;; rea
7c00: 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74 d configs with t
7c10: 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 ricks turned off
7c20: 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d (i.e. no system
7c30: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 ).. (test-c
7c40: 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 74 65 onf (if teste
7c50: 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 xists (read-conf
7c60: 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 ig test-configf
7c70: 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 #f #f)(make-hash
7c80: 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 28 72 75 -table)))).. (ru
7c90: 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d ns:update-test_m
7ca0: 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 eta db test-name
7cb0: 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 test-conf))).
7cc0: 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 test-names)))
7cd0: 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64 20 ..;; This could
7ce0: 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65 66 61 probably be refa
7cf0: 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65 20 ctored into one
7d00: 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 20 2e 2e complex query ..
7d10: 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a ..(define (runs:
7d20: 72 6f 6c 6c 75 70 2d 72 75 6e 20 64 62 20 6b 65 rollup-run db ke
7d30: 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e ys keyvallst run
7d40: 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61 name user) ;; wa
7d50: 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65 s target, now ke
7d60: 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67 yvallst. (debug
7d70: 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72 :print 4 "runs:r
7d80: 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a ollup-run, keys:
7d90: 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c " keys " keyval
7da0: 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 lst: " keyvallst
7db0: 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75 " :runname " ru
7dc0: 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20 nname " user: "
7dd0: 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 3b user). (let* (;
7de0: 20 28 6b 65 79 76 61 6c 6c 6c 73 74 20 20 20 20 (keyvalllst
7df0: 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e (keys:target->
7e00: 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67 keyval keys targ
7e10: 65 74 29 29 0a 09 20 28 6e 65 77 2d 72 75 6e 2d et)).. (new-run-
7e20: 69 64 20 20 20 20 20 20 28 72 75 6e 73 3a 72 65 id (runs:re
7e30: 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 gister-run db ke
7e40: 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e ys keyvallst run
7e50: 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 name "new" "n/a"
7e60: 20 75 73 65 72 29 29 0a 09 20 28 70 72 65 76 2d user)).. (prev-
7e70: 74 65 73 74 73 20 20 20 20 20 20 28 74 65 73 74 tests (test
7e80: 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d 70 72 :get-matching-pr
7e90: 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e 2d evious-test-run-
7ea0: 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77 2d 72 records db new-r
7eb0: 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29 29 0a un-id "%" "%")).
7ec0: 09 20 28 63 75 72 72 2d 74 65 73 74 73 20 20 20 . (curr-tests
7ed0: 20 20 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74 (rdb:get-test
7ee0: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 s-for-run db new
7ef0: 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 20 -run-id "%" "%"
7f00: 27 28 29 20 27 28 29 29 29 0a 09 20 28 63 75 72 '() '())).. (cur
7f10: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61 r-tests-hash (ma
7f20: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 ke-hash-table)))
7f30: 0a 20 20 20 20 28 64 62 3a 75 70 64 61 74 65 2d . (db:update-
7f40: 72 75 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 run-event_time d
7f50: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 b new-run-id).
7f60: 20 20 3b 3b 20 69 6e 64 65 78 20 74 68 65 20 61 ;; index the a
7f70: 6c 72 65 61 64 79 20 73 61 76 65 64 20 74 65 73 lready saved tes
7f80: 74 73 20 62 79 20 74 65 73 74 6e 61 6d 65 20 61 ts by testname a
7f90: 6e 64 20 69 74 65 6d 64 61 74 20 69 6e 20 63 75 nd itemdat in cu
7fa0: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 0a 20 20 rr-tests-hash.
7fb0: 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 (for-each.
7fc0: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 (lambda (testda
7fd0: 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 t). (let*
7fe0: 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a ((testname (db:
7ff0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
8000: 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 e testdat))..
8010: 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 (item-path (d
8020: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d b:test-get-item-
8030: 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 path testdat))..
8040: 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 (full-name
8050: 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 (conc testname
8060: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 "/" item-path)))
8070: 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 .. (hash-table-s
8080: 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 et! curr-tests-h
8090: 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 ash full-name te
80a0: 73 74 64 61 74 29 29 29 0a 20 20 20 20 20 63 75 stdat))). cu
80b0: 72 72 2d 74 65 73 74 73 29 0a 20 20 20 20 3b 3b rr-tests). ;;
80c0: 20 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d NOPE: Non-optim
80d0: 61 6c 20 61 70 70 72 6f 61 63 68 2e 20 54 72 79 al approach. Try
80e0: 20 74 68 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 this instead..
80f0: 20 20 20 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 ;; 1. tests
8100: 20 61 72 65 20 72 65 63 65 69 76 65 64 20 69 6e are received in
8110: 20 61 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 a list, most re
8120: 63 65 6e 74 20 66 69 72 73 74 0a 20 20 20 20 3b cent first. ;
8130: 3b 20 20 20 32 2e 20 72 65 70 6c 61 63 65 20 74 ; 2. replace t
8140: 68 65 20 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 he rollup test w
8150: 69 74 68 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 ith the new *alw
8160: 61 79 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 ays*. (for-ea
8170: 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 ch . (lambda
8180: 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 (testdat).
8190: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 (let* ((testna
81a0: 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 me (db:test-get
81b0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 -testname testda
81c0: 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d t)).. (item
81d0: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 -path (db:test-g
81e0: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 et-item-path tes
81f0: 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 tdat)).. (f
8200: 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 ull-name (conc t
8210: 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d estname "/" item
8220: 2d 70 61 74 68 29 29 0a 09 20 20 20 20 20 20 28 -path)).. (
8230: 70 72 65 76 2d 74 65 73 74 2d 64 61 74 20 28 68 prev-test-dat (h
8240: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
8250: 66 61 75 6c 74 20 63 75 72 72 2d 74 65 73 74 73 fault curr-tests
8260: 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 -hash full-name
8270: 23 66 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 #f)).. (tes
8280: 74 2d 73 74 65 70 73 20 20 20 20 20 20 28 64 62 t-steps (db
8290: 3a 67 65 74 2d 73 74 65 70 73 2d 66 6f 72 2d 74 :get-steps-for-t
82a0: 65 73 74 20 64 62 20 28 64 62 3a 74 65 73 74 2d est db (db:test-
82b0: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 get-id testdat))
82c0: 29 0a 09 20 20 20 20 20 20 28 6e 65 77 2d 74 65 ).. (new-te
82d0: 73 74 2d 72 65 63 6f 72 64 20 23 66 29 29 0a 09 st-record #f))..
82e0: 20 3b 3b 20 72 65 70 6c 61 63 65 20 74 68 65 73 ;; replace thes
82f0: 65 20 77 69 74 68 20 69 6e 73 65 72 74 20 2e 2e e with insert ..
8300: 2e 20 73 65 6c 65 63 74 0a 09 20 28 61 70 70 6c . select.. (appl
8310: 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 y sqlite3:execut
8320: 65 20 0a 09 09 64 62 20 0a 09 09 28 63 6f 6e 63 e ...db ...(conc
8330: 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c "INSERT OR REPL
8340: 41 43 45 20 49 4e 54 4f 20 74 65 73 74 73 20 28 ACE INTO tests (
8350: 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c run_id,testname,
8360: 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 state,status,eve
8370: 6e 74 5f 74 69 6d 65 2c 68 6f 73 74 2c 63 70 75 nt_time,host,cpu
8380: 6c 6f 61 64 2c 64 69 73 6b 66 72 65 65 2c 75 6e load,diskfree,un
8390: 61 6d 65 2c 72 75 6e 64 69 72 2c 69 74 65 6d 5f ame,rundir,item_
83a0: 70 61 74 68 2c 72 75 6e 5f 64 75 72 61 74 69 6f path,run_duratio
83b0: 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d n,final_logf,com
83c0: 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 20 20 20 ment) "...
83d0: 22 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f "VALUES (?,?,?,?
83e0: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f ,?,?,?,?,?,?,?,?
83f0: 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 2d 72 ,?,?);")...new-r
8400: 75 6e 2d 69 64 20 28 63 64 64 72 20 28 76 65 63 un-id (cddr (vec
8410: 74 6f 72 2d 3e 6c 69 73 74 20 74 65 73 74 64 61 tor->list testda
8420: 74 29 29 29 0a 09 20 28 73 65 74 21 20 6e 65 77 t))).. (set! new
8430: 2d 74 65 73 74 64 61 74 20 28 63 61 72 20 28 72 -testdat (car (r
8440: 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 db:get-tests-for
8450: 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d -run db new-run-
8460: 69 64 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d id testname item
8470: 2d 70 61 74 68 20 27 28 29 20 27 28 29 29 29 29 -path '() '())))
8480: 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 .. (hash-table-s
8490: 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 et! curr-tests-h
84a0: 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65 ash full-name ne
84b0: 77 2d 74 65 73 74 64 61 74 29 20 3b 3b 20 74 68 w-testdat) ;; th
84c0: 69 73 20 63 6f 75 6c 64 20 62 65 20 63 6f 6e 66 is could be conf
84d0: 75 73 69 6e 67 2c 20 77 68 69 63 68 20 72 65 63 using, which rec
84e0: 6f 72 64 20 73 68 6f 75 6c 64 20 67 6f 20 69 6e ord should go in
84f0: 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 70 20 74 61 to the lookup ta
8500: 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 ble?.. ;; Now du
8510: 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 74 plicate the test
8520: 20 73 74 65 70 73 0a 09 20 28 64 65 62 75 67 3a steps.. (debug:
8530: 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 print 4 "Copying
8540: 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 records in test
8550: 5f 73 74 65 70 73 20 66 72 6f 6d 20 74 65 73 74 _steps from test
8560: 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 _id=" (db:test-g
8570: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 et-id testdat) "
8580: 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 to " (db:test-g
8590: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 et-id new-testda
85a0: 74 29 29 0a 09 20 28 73 71 6c 69 74 65 33 3a 65 t)).. (sqlite3:e
85b0: 78 65 63 75 74 65 20 0a 09 20 20 64 62 20 0a 09 xecute .. db ..
85c0: 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 (conc "INSERT
85d0: 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 OR REPLACE INTO
85e0: 74 65 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 test_steps (test
85f0: 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 _id,stepname,sta
8600: 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f te,status,event_
8610: 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a time,comment) ".
8620: 09 09 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a .."SELECT " (db:
8630: 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d test-get-id new-
8640: 74 65 73 74 64 61 74 29 20 22 2c 73 74 65 70 6e testdat) ",stepn
8650: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 ame,state,status
8660: 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d ,event_time,comm
8670: 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 73 74 ent FROM test_st
8680: 65 70 73 20 57 48 45 52 45 20 74 65 73 74 5f 69 eps WHERE test_i
8690: 64 3d 3f 3b 22 29 0a 09 20 20 28 64 62 3a 74 65 d=?;").. (db:te
86a0: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 st-get-id testda
86b0: 74 29 29 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 t)).. ;; Now dup
86c0: 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 74 20 licate the test
86d0: 64 61 74 61 0a 09 20 28 64 65 62 75 67 3a 70 72 data.. (debug:pr
86e0: 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 int 4 "Copying r
86f0: 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 64 ecords in test_d
8700: 61 74 61 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 ata from test_id
8710: 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d =" (db:test-get-
8720: 69 64 20 74 65 73 74 64 61 74 29 20 22 20 74 6f id testdat) " to
8730: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d " (db:test-get-
8740: 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29 id new-testdat))
8750: 0a 09 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 .. (sqlite3:exec
8760: 75 74 65 20 0a 09 20 20 64 62 20 0a 09 20 20 28 ute .. db .. (
8770: 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 conc "INSERT OR
8780: 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 REPLACE INTO tes
8790: 74 5f 64 61 74 61 20 28 74 65 73 74 5f 69 64 2c t_data (test_id,
87a0: 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c category,variabl
87b0: 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 e,value,expected
87c0: 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 ,tol,units,comme
87d0: 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 43 54 20 nt) "..."SELECT
87e0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 " (db:test-get-i
87f0: 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 d new-testdat) "
8800: 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 ,category,variab
8810: 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 le,value,expecte
8820: 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d d,tol,units,comm
8830: 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 64 61 ent FROM test_da
8840: 74 61 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 ta WHERE test_id
8850: 3d 3f 3b 22 29 0a 09 20 20 28 64 62 3a 74 65 73 =?;").. (db:tes
8860: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 t-get-id testdat
8870: 29 29 0a 09 20 29 29 0a 20 20 20 20 20 70 72 65 )).. )). pre
8880: 76 2d 74 65 73 74 73 29 29 29 0a 09 20 0a 20 20 v-tests))).. .
8890: 20 20 20 0a .