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 29 0a 69 dot-locking).
01c0: 28 69 6d 70 6f 72 74 20 28 70 72 65 66 69 78 20 (import (prefix
01d0: 73 71 6c 69 74 65 33 20 73 71 6c 69 74 65 33 3a sqlite3 sqlite3:
01e0: 29 29 0a 0a 28 64 65 63 6c 61 72 65 20 28 75 6e ))..(declare (un
01f0: 69 74 20 72 75 6e 73 29 29 0a 28 64 65 63 6c 61 it runs)).(decla
0200: 72 65 20 28 75 73 65 73 20 64 62 29 29 0a 28 64 re (uses db)).(d
0210: 65 63 6c 61 72 65 20 28 75 73 65 73 20 63 6f 6d eclare (uses com
0220: 6d 6f 6e 29 29 0a 28 64 65 63 6c 61 72 65 20 28 mon)).(declare (
0230: 75 73 65 73 20 69 74 65 6d 73 29 29 0a 28 64 65 uses items)).(de
0240: 63 6c 61 72 65 20 28 75 73 65 73 20 72 75 6e 63 clare (uses runc
0250: 6f 6e 66 69 67 29 29 0a 28 64 65 63 6c 61 72 65 onfig)).(declare
0260: 20 28 75 73 65 73 20 74 65 73 74 73 29 29 0a 0a (uses tests))..
0270: 28 69 6e 63 6c 75 64 65 20 22 63 6f 6d 6d 6f 6e (include "common
0280: 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 _records.scm").(
0290: 69 6e 63 6c 75 64 65 20 22 6b 65 79 5f 72 65 63 include "key_rec
02a0: 6f 72 64 73 2e 73 63 6d 22 29 0a 28 69 6e 63 6c ords.scm").(incl
02b0: 75 64 65 20 22 64 62 5f 72 65 63 6f 72 64 73 2e ude "db_records.
02c0: 73 63 6d 22 29 0a 28 69 6e 63 6c 75 64 65 20 22 scm").(include "
02d0: 72 75 6e 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 run_records.scm"
02e0: 29 0a 28 69 6e 63 6c 75 64 65 20 22 74 65 73 74 ).(include "test
02f0: 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 0a _records.scm")..
0300: 3b 3b 20 73 74 75 66 66 20 74 6f 20 62 65 20 64 ;; stuff to be d
0310: 65 70 72 65 63 61 74 65 64 20 74 68 65 6e 20 72 eprecated then r
0320: 65 6d 6f 76 65 64 0a 28 69 6e 63 6c 75 64 65 20 emoved.(include
0330: 22 6f 6c 64 2d 72 75 6e 73 2e 73 63 6d 22 29 0a "old-runs.scm").
0340: 0a 0a 3b 3b 20 72 75 6e 73 3a 67 65 74 2d 72 75 ..;; runs:get-ru
0350: 6e 73 2d 62 79 2d 70 61 74 74 0a 3b 3b 20 67 65 ns-by-patt.;; ge
0360: 74 20 72 75 6e 73 20 62 79 20 6c 69 73 74 20 6f t runs by list o
0370: 66 20 63 72 69 74 65 72 69 61 0a 3b 3b 20 72 65 f criteria.;; re
0380: 67 69 73 74 65 72 20 61 20 74 65 73 74 20 72 75 gister a test ru
0390: 6e 20 77 69 74 68 20 74 68 65 20 64 62 0a 3b 3b n with the db.;;
03a0: 0a 3b 3b 20 55 73 65 3a 20 28 64 62 2d 67 65 74 .;; Use: (db-get
03b0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 -value-by-header
03c0: 20 28 64 62 3a 67 65 74 2d 68 65 61 64 65 72 20 (db:get-header
03d0: 72 75 6e 69 6e 66 6f 29 28 64 62 3a 67 65 74 2d runinfo)(db:get-
03e0: 72 6f 77 20 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b row runinfo)).;;
03f0: 20 20 74 6f 20 65 78 74 72 61 63 74 20 69 6e 66 to extract inf
0400: 6f 20 66 72 6f 6d 20 74 68 65 20 73 74 72 75 63 o from the struc
0410: 74 75 72 65 20 72 65 74 75 72 6e 65 64 0a 3b 3b ture returned.;;
0420: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 .(define (runs:g
0430: 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 et-runs-by-patt
0440: 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 db keys runnamep
0450: 61 74 74 20 2e 20 70 61 72 61 6d 73 29 20 3b 3b att . params) ;;
0460: 20 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 28 6c test-name). (l
0470: 65 74 2a 20 28 28 6b 65 79 76 61 6c 6c 73 74 20 et* ((keyvallst
0480: 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b (keys->vallist k
0490: 65 79 73 29 29 0a 09 20 28 74 6d 70 20 20 20 20 eys)).. (tmp
04a0: 20 20 28 72 75 6e 73 3a 67 65 74 2d 73 74 64 2d (runs:get-std-
04b0: 72 75 6e 2d 66 69 65 6c 64 73 20 6b 65 79 73 20 run-fields keys
04c0: 27 28 22 69 64 22 20 22 72 75 6e 6e 61 6d 65 22 '("id" "runname"
04d0: 20 22 73 74 61 74 65 22 20 22 73 74 61 74 75 73 "state" "status
04e0: 22 20 22 6f 77 6e 65 72 22 20 22 65 76 65 6e 74 " "owner" "event
04f0: 5f 74 69 6d 65 22 29 29 29 0a 09 20 28 6b 65 79 _time"))).. (key
0500: 73 74 72 20 20 20 28 63 61 72 20 74 6d 70 29 29 str (car tmp))
0510: 0a 09 20 28 68 65 61 64 65 72 20 20 20 28 63 61 .. (header (ca
0520: 64 72 20 74 6d 70 29 29 0a 09 20 28 72 65 73 20 dr tmp)).. (res
0530: 20 20 20 20 27 28 29 29 0a 09 20 28 6b 65 79 2d '()).. (key-
0540: 70 61 74 74 20 22 22 29 29 0a 20 20 20 20 28 66 patt "")). (f
0550: 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 or-each (lambda
0560: 28 6b 65 79 76 61 6c 29 0a 09 09 28 6c 65 74 2a (keyval)...(let*
0570: 20 28 28 6b 65 79 20 20 20 20 28 76 65 63 74 6f ((key (vecto
0580: 72 2d 72 65 66 20 6b 65 79 76 61 6c 20 30 29 29 r-ref keyval 0))
0590: 0a 09 09 20 20 20 20 20 20 20 28 66 75 6c 6b 65 ... (fulke
05a0: 79 20 28 63 6f 6e 63 20 22 3a 22 20 6b 65 79 29 y (conc ":" key)
05b0: 29 0a 09 09 20 20 20 20 20 20 20 28 70 61 74 74 )... (patt
05c0: 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 (args:get-arg
05d0: 20 66 75 6c 6b 65 79 29 29 29 0a 09 09 20 20 28 fulkey)))... (
05e0: 69 66 20 70 61 74 74 0a 09 09 20 20 20 20 20 20 if patt...
05f0: 28 73 65 74 21 20 6b 65 79 2d 70 61 74 74 20 28 (set! key-patt (
0600: 63 6f 6e 63 20 6b 65 79 2d 70 61 74 74 20 22 20 conc key-patt "
0610: 41 4e 44 20 22 20 6b 65 79 20 22 20 6c 69 6b 65 AND " key " like
0620: 20 27 22 20 70 61 74 74 20 22 27 22 29 29 0a 09 '" patt "'"))..
0630: 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 . (begin...
0640: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 .(debug:print 0
0650: 22 45 52 52 4f 52 3a 20 73 65 61 72 63 68 69 6e "ERROR: searchin
0660: 67 20 66 6f 72 20 72 75 6e 73 20 77 69 74 68 20 g for runs with
0670: 6e 6f 20 70 61 74 74 65 72 6e 20 73 65 74 20 66 no pattern set f
0680: 6f 72 20 22 20 66 75 6c 6b 65 79 29 0a 09 09 09 or " fulkey)....
0690: 28 65 78 69 74 20 36 29 29 29 29 29 0a 09 20 20 (exit 6)))))..
06a0: 20 20 20 20 6b 65 79 73 29 0a 20 20 20 20 28 73 keys). (s
06b0: 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d qlite3:for-each-
06c0: 72 6f 77 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 row . (lambd
06d0: 61 20 28 61 20 2e 20 72 29 0a 20 20 20 20 20 20 a (a . r).
06e0: 20 28 73 65 74 21 20 72 65 73 20 28 63 6f 6e 73 (set! res (cons
06f0: 20 28 6c 69 73 74 2d 3e 76 65 63 74 6f 72 20 28 (list->vector (
0700: 63 6f 6e 73 20 61 20 72 29 29 20 72 65 73 29 29 cons a r)) res))
0710: 29 0a 20 20 20 20 20 64 62 20 0a 20 20 20 20 20 ). db .
0720: 28 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 20 (conc "SELECT "
0730: 6b 65 79 73 74 72 20 22 20 46 52 4f 4d 20 72 75 keystr " FROM ru
0740: 6e 73 20 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 ns WHERE runname
0750: 20 6c 69 6b 65 20 3f 20 22 20 6b 65 79 2d 70 61 like ? " key-pa
0760: 74 74 20 22 3b 22 29 0a 20 20 20 20 20 72 75 6e tt ";"). run
0770: 6e 61 6d 65 70 61 74 74 29 0a 20 20 20 20 28 76 namepatt). (v
0780: 65 63 74 6f 72 20 68 65 61 64 65 72 20 72 65 73 ector header res
0790: 29 29 29 0a 0a 3b 3b 20 3b 3b 20 54 4f 44 4f 3a )))..;; ;; TODO:
07a0: 20 43 6f 6e 76 65 72 67 65 20 74 68 69 73 20 77 Converge this w
07b0: 69 74 68 20 64 62 3a 67 65 74 2d 74 65 73 74 2d ith db:get-test-
07c0: 69 6e 66 6f 0a 3b 3b 20 28 64 65 66 69 6e 65 20 info.;; (define
07d0: 28 72 75 6e 73 3a 67 65 74 2d 74 65 73 74 2d 69 (runs:get-test-i
07e0: 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 nfo db run-id te
07f0: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 st-name item-pat
0800: 68 29 0a 3b 3b 20 20 20 28 6c 65 74 20 28 28 72 h).;; (let ((r
0810: 65 73 20 23 66 29 29 20 3b 3b 20 28 76 65 63 74 es #f)) ;; (vect
0820: 6f 72 20 23 66 20 23 66 20 23 66 20 23 66 20 23 or #f #f #f #f #
0830: 66 20 23 66 29 29 29 0a 3b 3b 20 20 20 20 20 28 f #f))).;; (
0840: 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 sqlite3:for-each
0850: 2d 72 6f 77 20 0a 3b 3b 20 20 20 20 20 20 28 6c -row .;; (l
0860: 61 6d 62 64 61 20 28 69 64 20 72 75 6e 2d 69 64 ambda (id run-id
0870: 20 74 65 73 74 2d 6e 61 6d 65 20 73 74 61 74 65 test-name state
0880: 20 73 74 61 74 75 73 29 0a 3b 3b 20 20 20 20 20 status).;;
0890: 20 20 20 28 73 65 74 21 20 72 65 73 20 28 76 65 (set! res (ve
08a0: 63 74 6f 72 20 69 64 20 72 75 6e 2d 69 64 20 74 ctor id run-id t
08b0: 65 73 74 2d 6e 61 6d 65 20 73 74 61 74 65 20 73 est-name state s
08c0: 74 61 74 75 73 20 69 74 65 6d 2d 70 61 74 68 29 tatus item-path)
08d0: 29 29 0a 3b 3b 20 20 20 20 20 20 64 62 20 22 53 )).;; db "S
08e0: 45 4c 45 43 54 20 69 64 2c 72 75 6e 5f 69 64 2c ELECT id,run_id,
08f0: 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 testname,state,s
0900: 74 61 74 75 73 20 46 52 4f 4d 20 74 65 73 74 73 tatus FROM tests
0910: 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 WHERE run_id=?
0920: 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 AND testname=? A
0930: 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b 22 ND item_path=?;"
0940: 0a 3b 3b 20 20 20 20 20 20 72 75 6e 2d 69 64 20 .;; run-id
0950: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 test-name item-p
0960: 61 74 68 29 0a 3b 3b 20 20 20 20 20 72 65 73 29 ath).;; res)
0970: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 )..(define (runs
0980: 3a 74 65 73 74 2d 67 65 74 2d 66 75 6c 6c 2d 70 :test-get-full-p
0990: 61 74 68 20 74 65 73 74 29 0a 20 20 28 6c 65 74 ath test). (let
09a0: 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 28 64 62 * ((testname (db
09b0: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 :test-get-testna
09c0: 6d 65 20 20 20 74 65 73 74 29 29 0a 09 20 28 69 me test)).. (i
09d0: 74 65 6d 70 61 74 68 20 28 64 62 3a 74 65 73 74 tempath (db:test
09e0: 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 -get-item-path t
09f0: 65 73 74 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 est))). (conc
0a00: 20 74 65 73 74 6e 61 6d 65 20 28 69 66 20 28 65 testname (if (e
0a10: 71 75 61 6c 3f 20 69 74 65 6d 70 61 74 68 20 22 qual? itempath "
0a20: 22 29 20 22 22 20 28 63 6f 6e 63 20 22 28 22 20 ") "" (conc "("
0a30: 69 74 65 6d 70 61 74 68 20 22 29 22 29 29 29 29 itempath ")"))))
0a40: 29 0a 0a 0a 28 64 65 66 69 6e 65 20 28 73 65 74 )...(define (set
0a50: 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 -megatest-env-va
0a60: 72 73 20 64 62 20 72 75 6e 2d 69 64 29 0a 20 20 rs db run-id).
0a70: 28 6c 65 74 20 28 28 6b 65 79 73 20 28 64 62 2d (let ((keys (db-
0a80: 67 65 74 2d 6b 65 79 73 20 64 62 29 29 29 0a 20 get-keys db))).
0a90: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 (for-each (la
0aa0: 6d 62 64 61 20 28 6b 65 79 29 0a 09 09 28 73 71 mbda (key)...(sq
0ab0: 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 lite3:for-each-r
0ac0: 6f 77 0a 09 09 20 28 6c 61 6d 62 64 61 20 28 76 ow... (lambda (v
0ad0: 61 6c 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a al)... (debug:
0ae0: 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e 76 20 print 2 "setenv
0af0: 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 " (key:get-field
0b00: 6e 61 6d 65 20 6b 65 79 29 20 22 20 22 20 76 61 name key) " " va
0b10: 6c 29 0a 09 09 20 20 20 28 73 65 74 65 6e 76 20 l)... (setenv
0b20: 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 (key:get-fieldna
0b30: 6d 65 20 6b 65 79 29 20 76 61 6c 29 29 0a 09 09 me key) val))...
0b40: 20 64 62 20 0a 09 09 20 28 63 6f 6e 63 20 22 53 db ... (conc "S
0b50: 45 4c 45 43 54 20 22 20 28 6b 65 79 3a 67 65 74 ELECT " (key:get
0b60: 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 -fieldname key)
0b70: 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 " FROM runs WHER
0b80: 45 20 69 64 3d 3f 3b 22 29 0a 09 09 20 72 75 6e E id=?;")... run
0b90: 2d 69 64 29 29 0a 09 20 20 20 20 20 20 6b 65 79 -id)).. key
0ba0: 73 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 73 s)))..(define (s
0bb0: 65 74 2d 69 74 65 6d 2d 65 6e 76 2d 76 61 72 73 et-item-env-vars
0bc0: 20 69 74 65 6d 64 61 74 29 0a 20 20 28 66 6f 72 itemdat). (for
0bd0: 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 69 -each (lambda (i
0be0: 74 65 6d 29 0a 09 20 20 20 20 20 20 28 64 65 62 tem).. (deb
0bf0: 75 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65 ug:print 2 "sete
0c00: 6e 76 20 22 20 28 63 61 72 20 69 74 65 6d 29 20 nv " (car item)
0c10: 22 20 22 20 28 63 61 64 72 20 69 74 65 6d 29 29 " " (cadr item))
0c20: 0a 09 20 20 20 20 20 20 28 73 65 74 65 6e 76 20 .. (setenv
0c30: 28 63 61 72 20 69 74 65 6d 29 20 28 63 61 64 72 (car item) (cadr
0c40: 20 69 74 65 6d 29 29 29 0a 09 20 20 20 20 69 74 item))).. it
0c50: 65 6d 64 61 74 29 29 0a 0a 28 64 65 66 69 6e 65 emdat))..(define
0c60: 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d (runs:can-run-m
0c70: 6f 72 65 2d 74 65 73 74 73 20 64 62 20 74 65 73 ore-tests db tes
0c80: 74 2d 72 65 63 6f 72 64 29 0a 20 20 28 6c 65 74 t-record). (let
0c90: 2a 20 28 28 74 63 6f 6e 66 69 67 20 20 20 20 20 * ((tconfig
0ca0: 20 20 20 20 20 20 20 20 20 20 20 20 28 74 65 73 (tes
0cb0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
0cc0: 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 -testconfig test
0cd0: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 6a 6f 62 -record)).. (job
0ce0: 67 72 6f 75 70 20 20 20 20 20 20 20 20 20 20 20 group
0cf0: 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f (config-loo
0d00: 6b 75 70 20 74 63 6f 6e 66 69 67 20 22 72 65 71 kup tconfig "req
0d10: 75 69 72 65 6d 65 6e 74 73 22 20 22 6a 6f 62 67 uirements" "jobg
0d20: 72 6f 75 70 22 29 29 0a 09 20 28 6e 75 6d 2d 72 roup")).. (num-r
0d30: 75 6e 6e 69 6e 67 20 20 20 20 20 20 20 20 20 20 unning
0d40: 20 20 20 28 64 62 3a 67 65 74 2d 63 6f 75 6e 74 (db:get-count
0d50: 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67 20 64 -tests-running d
0d60: 62 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 b)).. (num-runni
0d70: 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 ng-in-jobgroup (
0d80: 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 db:get-count-tes
0d90: 74 73 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f ts-running-in-jo
0da0: 62 67 72 6f 75 70 20 64 62 20 6a 6f 62 67 72 6f bgroup db jobgro
0db0: 75 70 29 29 0a 09 20 28 6d 61 78 2d 63 6f 6e 63 up)).. (max-conc
0dc0: 75 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20 urrent-jobs
0dd0: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a (config-lookup *
0de0: 63 6f 6e 66 69 67 64 61 74 2a 20 22 73 65 74 75 configdat* "setu
0df0: 70 22 20 20 20 20 20 22 6d 61 78 5f 63 6f 6e 63 p" "max_conc
0e00: 75 72 72 65 6e 74 5f 6a 6f 62 73 22 29 29 0a 09 urrent_jobs"))..
0e10: 20 28 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 (job-group-limi
0e20: 74 20 20 20 20 20 20 20 20 20 28 63 6f 6e 66 69 t (confi
0e30: 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 g-lookup *config
0e40: 64 61 74 2a 20 22 6a 6f 62 67 72 6f 75 70 73 22 dat* "jobgroups"
0e50: 20 6a 6f 62 67 72 6f 75 70 29 29 29 0a 20 20 20 jobgroup))).
0e60: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
0e70: 22 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d "max-concurrent-
0e80: 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 jobs: " max-conc
0e90: 75 72 72 65 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e urrent-jobs ", n
0ea0: 75 6d 2d 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 um-running: " nu
0eb0: 6d 2d 72 75 6e 6e 69 6e 67 29 0a 20 20 20 20 28 m-running). (
0ec0: 69 66 20 28 6e 6f 74 20 28 65 71 3f 20 30 20 2a if (not (eq? 0 *
0ed0: 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 globalexitstatus
0ee0: 2a 29 29 0a 09 23 66 0a 09 28 6c 65 74 20 28 28 *))..#f..(let ((
0ef0: 63 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 can-not-run-more
0f00: 20 28 63 6f 6e 64 0a 09 09 09 09 20 3b 3b 20 69 (cond..... ;; i
0f10: 66 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 f max-concurrent
0f20: 2d 6a 6f 62 73 20 69 73 20 73 65 74 20 61 6e 64 -jobs is set and
0f30: 20 74 68 65 20 6e 75 6d 62 65 72 20 72 75 6e 6e the number runn
0f40: 69 6e 67 20 69 73 20 67 72 65 61 74 65 72 20 0a ing is greater .
0f50: 09 09 09 09 20 3b 3b 20 74 68 61 6e 20 69 74 20 .... ;; than it
0f60: 74 68 61 6e 20 63 61 6e 6e 6f 74 20 72 75 6e 20 than cannot run
0f70: 6d 6f 72 65 20 6a 6f 62 73 0a 09 09 09 09 20 28 more jobs..... (
0f80: 28 61 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 72 72 (and max-concurr
0f90: 65 6e 74 2d 6a 6f 62 73 0a 09 09 09 09 20 20 20 ent-jobs.....
0fa0: 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d (string->num
0fb0: 62 65 72 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 ber max-concurre
0fc0: 6e 74 2d 6a 6f 62 73 29 0a 09 09 09 09 20 20 20 nt-jobs).....
0fd0: 20 20 20 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e (>= num-runn
0fe0: 69 6e 67 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d ing (string->num
0ff0: 62 65 72 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 ber max-concurre
1000: 6e 74 2d 6a 6f 62 73 29 29 29 0a 09 09 09 09 20 nt-jobs))).....
1010: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
1020: 22 57 41 52 4e 49 4e 47 3a 20 4d 61 78 20 72 75 "WARNING: Max ru
1030: 6e 6e 69 6e 67 20 6a 6f 62 73 20 65 78 63 65 65 nning jobs excee
1040: 64 65 64 2c 20 63 75 72 72 65 6e 74 20 6e 75 6d ded, current num
1050: 62 65 72 20 72 75 6e 6e 69 6e 67 3a 20 22 20 6e ber running: " n
1060: 75 6d 2d 72 75 6e 6e 69 6e 67 20 0a 09 09 09 09 um-running .....
1070: 09 20 20 20 20 20 20 20 22 2c 20 6d 61 78 5f 63 . ", max_c
1080: 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 oncurrent_jobs:
1090: 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 " max-concurrent
10a0: 2d 6a 6f 62 73 29 0a 09 09 09 09 20 20 23 74 29 -jobs)..... #t)
10b0: 0a 09 09 09 09 20 3b 3b 20 69 66 20 6a 6f 62 2d ..... ;; if job-
10c0: 67 72 6f 75 70 2d 6c 69 6d 69 74 20 69 73 20 73 group-limit is s
10d0: 65 74 20 61 6e 64 20 6e 75 6d 62 65 72 20 6f 66 et and number of
10e0: 20 6a 6f 62 73 20 69 6e 20 74 68 65 20 67 72 6f jobs in the gro
10f0: 75 70 20 69 73 20 67 72 65 61 74 65 72 0a 09 09 up is greater...
1100: 09 09 20 3b 3b 20 74 68 61 6e 20 74 68 65 20 6c .. ;; than the l
1110: 69 6d 69 74 20 74 68 65 6e 20 63 61 6e 6e 6f 74 imit then cannot
1120: 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 20 6f run more jobs o
1130: 66 20 74 68 69 73 20 6b 69 6e 64 0a 09 09 09 09 f this kind.....
1140: 20 28 28 61 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 ((and job-group
1150: 2d 6c 69 6d 69 74 0a 09 09 09 09 20 20 20 20 20 -limit.....
1160: 20 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e (>= num-runnin
1170: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f g-in-jobgroup jo
1180: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 0a b-group-limit)).
1190: 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 .... (debug:pri
11a0: 6e 74 20 31 20 22 57 41 52 4e 49 4e 47 3a 20 6e nt 1 "WARNING: n
11b0: 75 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 22 20 umber of jobs "
11c0: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a num-running-in-j
11d0: 6f 62 67 72 6f 75 70 20 0a 09 09 09 09 09 20 20 obgroup ......
11e0: 20 20 20 20 20 22 20 69 6e 20 22 20 6a 6f 62 67 " in " jobg
11f0: 72 6f 75 70 20 22 20 65 78 63 65 65 64 65 64 2c roup " exceeded,
1200: 20 77 69 6c 6c 20 6e 6f 74 20 72 75 6e 20 22 20 will not run "
1210: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
1220: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 -get-testname te
1230: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 09 09 st-record)).....
1240: 20 20 23 74 29 0a 09 09 09 09 20 28 65 6c 73 65 #t)..... (else
1250: 20 23 66 29 29 29 29 0a 09 20 20 28 6e 6f 74 20 #f)))).. (not
1260: 63 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 can-not-run-more
1270: 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d )))))..;;=======
1280: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1290: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
12a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
12b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a ===============.
12c0: 3b 3b 20 4e 65 77 20 6d 65 74 68 6f 64 6f 6c 6f ;; New methodolo
12d0: 67 79 2e 20 54 68 65 73 65 20 72 6f 75 74 69 6e gy. These routin
12e0: 65 73 20 77 69 6c 6c 20 72 65 70 6c 61 63 65 20 es will replace
12f0: 74 68 65 20 61 62 6f 76 65 20 69 6e 20 74 69 6d the above in tim
1300: 65 2e 20 46 6f 72 0a 3b 3b 20 6e 6f 77 20 74 68 e. For.;; now th
1310: 65 20 63 6f 64 65 20 69 73 20 64 75 70 6c 69 63 e code is duplic
1320: 61 74 65 64 2e 20 54 68 69 73 20 73 74 75 66 66 ated. This stuff
1330: 20 69 73 20 69 6e 69 74 69 61 6c 6c 79 20 75 73 is initially us
1340: 65 64 20 69 6e 20 74 68 65 20 6d 6f 6e 69 74 6f ed in the monito
1350: 72 0a 3b 3b 20 62 61 73 65 64 20 63 6f 64 65 2e r.;; based code.
1360: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d .;;=============
1370: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1380: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1390: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
13a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 72 65 =========..;; re
13b0: 67 69 73 74 65 72 20 61 20 74 65 73 74 20 72 75 gister a test ru
13c0: 6e 20 77 69 74 68 20 74 68 65 20 64 62 0a 28 64 n with the db.(d
13d0: 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 65 67 69 efine (runs:regi
13e0: 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 ster-run db keys
13f0: 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 keyvallst runna
1400: 6d 65 20 73 74 61 74 65 20 73 74 61 74 75 73 20 me state status
1410: 75 73 65 72 29 0a 20 20 28 64 65 62 75 67 3a 70 user). (debug:p
1420: 72 69 6e 74 20 33 20 22 72 75 6e 73 3a 72 65 67 rint 3 "runs:reg
1430: 69 73 74 65 72 2d 72 75 6e 2c 20 6b 65 79 73 3a ister-run, keys:
1440: 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c " keys " keyval
1450: 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 lst: " keyvallst
1460: 20 22 20 72 75 6e 6e 61 6d 65 3a 20 22 20 72 75 " runname: " ru
1470: 6e 6e 61 6d 65 20 22 20 73 74 61 74 65 3a 20 22 nname " state: "
1480: 20 73 74 61 74 65 20 22 20 73 74 61 74 75 73 3a state " status:
1490: 20 22 20 73 74 61 74 75 73 20 22 20 75 73 65 72 " status " user
14a0: 3a 20 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74 : " user). (let
14b0: 2a 20 28 28 6b 65 79 73 74 72 20 20 20 20 28 6b * ((keystr (k
14c0: 65 79 73 2d 3e 6b 65 79 73 74 72 20 6b 65 79 73 eys->keystr keys
14d0: 29 29 0a 09 20 28 63 6f 6d 6d 61 20 20 20 20 20 )).. (comma
14e0: 28 69 66 20 28 3e 20 28 6c 65 6e 67 74 68 20 6b (if (> (length k
14f0: 65 79 73 29 20 30 29 20 22 2c 22 20 22 22 29 29 eys) 0) "," ""))
1500: 0a 09 20 28 61 6e 64 73 74 72 20 20 20 20 28 69 .. (andstr (i
1510: 66 20 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79 f (> (length key
1520: 73 29 20 30 29 20 22 20 41 4e 44 20 22 20 22 22 s) 0) " AND " ""
1530: 29 29 0a 09 20 28 76 61 6c 73 6c 6f 74 73 20 20 )).. (valslots
1540: 28 6b 65 79 73 2d 3e 76 61 6c 73 6c 6f 74 73 20 (keys->valslots
1550: 6b 65 79 73 29 29 20 3b 3b 20 3f 2c 3f 2c 3f 20 keys)) ;; ?,?,?
1560: 2e 2e 2e 0a 09 20 28 6b 65 79 76 61 6c 73 20 20 ..... (keyvals
1570: 20 28 6d 61 70 20 63 61 64 72 20 6b 65 79 76 61 (map cadr keyva
1580: 6c 6c 73 74 29 29 0a 09 20 28 61 6c 6c 76 61 6c llst)).. (allval
1590: 73 20 20 20 28 61 70 70 65 6e 64 20 28 6c 69 73 s (append (lis
15a0: 74 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 65 20 t runname state
15b0: 73 74 61 74 75 73 20 75 73 65 72 29 20 6b 65 79 status user) key
15c0: 76 61 6c 73 29 29 0a 09 20 28 71 72 79 76 61 6c vals)).. (qryval
15d0: 73 20 20 20 28 61 70 70 65 6e 64 20 28 6c 69 73 s (append (lis
15e0: 74 20 72 75 6e 6e 61 6d 65 29 20 6b 65 79 76 61 t runname) keyva
15f0: 6c 73 29 29 0a 09 20 28 6b 65 79 3d 3f 73 74 72 ls)).. (key=?str
1600: 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 (string-inters
1610: 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 perse (map (lamb
1620: 64 61 20 28 6b 29 28 63 6f 6e 63 20 28 6b 65 79 da (k)(conc (key
1630: 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b :get-fieldname k
1640: 29 20 22 3d 3f 22 29 29 20 6b 65 79 73 29 20 22 ) "=?")) keys) "
1650: 20 41 4e 44 20 22 29 29 29 0a 20 20 20 20 28 64 AND "))). (d
1660: 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 6b 65 ebug:print 3 "ke
1670: 79 73 3a 20 22 20 6b 65 79 73 20 22 20 61 6c 6c ys: " keys " all
1680: 76 61 6c 73 3a 20 22 20 61 6c 6c 76 61 6c 73 20 vals: " allvals
1690: 22 20 6b 65 79 76 61 6c 73 3a 20 22 20 6b 65 79 " keyvals: " key
16a0: 76 61 6c 73 29 0a 20 20 20 20 28 64 65 62 75 67 vals). (debug
16b0: 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 :print 2 "NOTE:
16c0: 75 73 69 6e 67 20 74 61 72 67 65 74 20 22 20 28 using target " (
16d0: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
16e0: 73 65 20 6b 65 79 76 61 6c 73 20 22 2f 22 29 20 se keyvals "/")
16f0: 22 20 66 6f 72 20 74 68 69 73 20 72 75 6e 22 29 " for this run")
1700: 0a 20 20 20 20 28 69 66 20 28 61 6e 64 20 72 75 . (if (and ru
1710: 6e 6e 61 6d 65 20 28 6e 75 6c 6c 3f 20 28 66 69 nname (null? (fi
1720: 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 lter (lambda (x)
1730: 28 6e 6f 74 20 78 29 29 20 6b 65 79 76 61 6c 73 (not x)) keyvals
1740: 29 29 29 20 3b 3b 20 74 68 65 72 65 20 6d 75 73 ))) ;; there mus
1750: 74 20 62 65 20 61 20 62 65 74 74 65 72 20 77 61 t be a better wa
1760: 79 20 74 6f 20 22 61 70 70 6c 79 20 61 6e 64 22 y to "apply and"
1770: 0a 09 28 6c 65 74 20 28 28 72 65 73 20 23 66 29 ..(let ((res #f)
1780: 29 0a 09 20 20 28 61 70 70 6c 79 20 73 71 6c 69 ).. (apply sqli
1790: 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 28 te3:execute db (
17a0: 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 conc "INSERT OR
17b0: 49 47 4e 4f 52 45 20 49 4e 54 4f 20 72 75 6e 73 IGNORE INTO runs
17c0: 20 28 72 75 6e 6e 61 6d 65 2c 73 74 61 74 65 2c (runname,state,
17d0: 73 74 61 74 75 73 2c 6f 77 6e 65 72 2c 65 76 65 status,owner,eve
17e0: 6e 74 5f 74 69 6d 65 22 20 63 6f 6d 6d 61 20 6b nt_time" comma k
17f0: 65 79 73 74 72 20 22 29 20 56 41 4c 55 45 53 20 eystr ") VALUES
1800: 28 3f 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d (?,?,?,?,strftim
1810: 65 28 27 25 73 27 2c 27 6e 6f 77 27 29 22 20 63 e('%s','now')" c
1820: 6f 6d 6d 61 20 76 61 6c 73 6c 6f 74 73 20 22 29 omma valslots ")
1830: 3b 22 29 0a 09 09 20 61 6c 6c 76 61 6c 73 29 0a ;")... allvals).
1840: 09 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 . (apply sqlite
1850: 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 3:for-each-row .
1860: 09 20 20 20 28 6c 61 6d 62 64 61 20 28 69 64 29 . (lambda (id)
1870: 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 65 73 .. (set! res
1880: 20 69 64 29 29 0a 09 20 20 20 64 62 0a 09 20 20 id)).. db..
1890: 20 28 6c 65 74 20 28 28 71 72 79 20 28 63 6f 6e (let ((qry (con
18a0: 63 20 22 53 45 4c 45 43 54 20 69 64 20 46 52 4f c "SELECT id FRO
18b0: 4d 20 72 75 6e 73 20 57 48 45 52 45 20 28 72 75 M runs WHERE (ru
18c0: 6e 6e 61 6d 65 3d 3f 20 22 20 61 6e 64 73 74 72 nname=? " andstr
18d0: 20 6b 65 79 3d 3f 73 74 72 20 22 29 3b 22 29 29 key=?str ");"))
18e0: 29 0a 09 20 20 20 20 20 3b 28 64 65 62 75 67 3a ).. ;(debug:
18f0: 70 72 69 6e 74 20 34 20 22 71 72 79 3a 20 22 20 print 4 "qry: "
1900: 71 72 79 29 20 0a 09 20 20 20 20 20 71 72 79 29 qry) .. qry)
1910: 0a 09 20 20 20 71 72 79 76 61 6c 73 29 0a 09 20 .. qryvals)..
1920: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 (sqlite3:execut
1930: 65 20 64 62 20 22 55 50 44 41 54 45 20 72 75 6e e db "UPDATE run
1940: 73 20 53 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 s SET state=?,st
1950: 61 74 75 73 3d 3f 20 57 48 45 52 45 20 69 64 3d atus=? WHERE id=
1960: 3f 3b 22 20 73 74 61 74 65 20 73 74 61 74 75 73 ?;" state status
1970: 20 72 65 73 29 0a 09 20 20 72 65 73 29 20 0a 09 res).. res) ..
1980: 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 (begin.. (debug
1990: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
19a0: 20 43 61 6c 6c 65 64 20 77 69 74 68 6f 75 74 20 Called without
19b0: 61 6c 6c 20 6e 65 63 65 73 73 61 72 79 20 6b 65 all necessary ke
19c0: 79 73 22 29 0a 09 20 20 23 66 29 29 29 29 0a 0a ys").. #f))))..
19d0: 3b 3b 20 54 68 69 73 20 69 73 20 61 20 64 75 70 ;; This is a dup
19e0: 6c 69 63 61 74 65 20 6f 66 20 72 75 6e 2d 74 65 licate of run-te
19f0: 73 74 73 20 28 77 68 69 63 68 20 68 61 73 20 62 sts (which has b
1a00: 65 65 6e 20 64 65 70 72 65 63 61 74 65 64 29 2e een deprecated).
1a10: 20 55 73 65 20 74 68 69 73 20 6f 6e 65 20 69 6e Use this one in
1a20: 73 74 65 61 64 20 6f 66 20 72 75 6e 20 74 65 73 stead of run tes
1a30: 74 73 2e 0a 3b 3b 20 6b 65 79 76 61 6c 73 0a 28 ts..;; keyvals.(
1a40: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e define (runs:run
1a50: 2d 74 65 73 74 73 20 64 62 20 74 61 72 67 65 74 -tests db target
1a60: 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 70 61 runname test-pa
1a70: 74 74 73 20 69 74 65 6d 2d 70 61 74 74 73 20 75 tts item-patts u
1a80: 73 65 72 20 66 6c 61 67 73 29 0a 20 20 28 6c 65 ser flags). (le
1a90: 74 2a 20 28 28 6b 65 79 73 20 20 20 20 20 20 20 t* ((keys
1aa0: 20 28 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 (db-get-keys db
1ab0: 29 29 0a 09 20 28 6b 65 79 76 61 6c 6c 73 74 20 )).. (keyvallst
1ac0: 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e (keys:target->
1ad0: 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67 keyval keys targ
1ae0: 65 74 29 29 0a 09 20 28 72 75 6e 2d 69 64 20 20 et)).. (run-id
1af0: 20 20 20 20 28 72 75 6e 73 3a 72 65 67 69 73 74 (runs:regist
1b00: 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b er-run db keys k
1b10: 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 eyvallst runname
1b20: 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 "new" "n/a" use
1b30: 72 29 29 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 r)) ;; test-na
1b40: 6d 65 29 29 29 0a 09 20 28 64 65 66 65 72 72 65 me))).. (deferre
1b50: 64 20 20 20 20 27 28 29 29 20 3b 3b 20 64 65 6c d '()) ;; del
1b60: 61 79 20 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 ay running these
1b70: 20 73 69 6e 63 65 20 74 68 65 79 20 68 61 76 65 since they have
1b80: 20 61 20 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 a waiton clause
1b90: 0a 09 20 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 .. ;; keepgoing
1ba0: 69 73 20 74 68 65 20 64 65 66 61 63 74 6f 20 6d is the defacto m
1bb0: 6f 64 61 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c odality now, wil
1bc0: 6c 20 61 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 l add hit-n-run
1bd0: 61 20 62 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b a bit later.. ;;
1be0: 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 28 68 (keepgoing (h
1bf0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
1c00: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 fault flags "-ke
1c10: 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 epgoing" #f))..
1c20: 28 74 65 73 74 2d 6e 61 6d 65 73 20 20 27 28 29 (test-names '()
1c30: 29 0a 09 20 28 72 75 6e 63 6f 6e 66 69 67 66 20 ).. (runconfigf
1c40: 20 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 (conc *toppat
1c50: 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e h* "/runconfigs.
1c60: 63 6f 6e 66 69 67 22 29 29 0a 09 20 28 72 65 71 config")).. (req
1c70: 75 69 72 65 64 2d 74 65 73 74 73 20 27 28 29 29 uired-tests '())
1c80: 0a 09 20 28 74 65 73 74 2d 72 65 63 6f 72 64 73 .. (test-records
1c90: 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c (make-hash-tabl
1ca0: 65 29 29 29 0a 0a 20 20 20 20 28 73 65 74 2d 6d e))).. (set-m
1cb0: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 egatest-env-vars
1cc0: 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 db run-id) ;; t
1cd0: 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 hese may be need
1ce0: 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 ed by the launch
1cf0: 69 6e 67 20 70 72 6f 63 65 73 73 0a 0a 20 20 20 ing process..
1d00: 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 (if (file-exist
1d10: 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 s? runconfigf)..
1d20: 28 73 65 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 (setup-env-defau
1d30: 6c 74 73 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 lts db runconfig
1d40: 66 20 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 f run-id *alread
1d50: 79 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 y-seen-runconfig
1d60: 2d 69 6e 66 6f 2a 20 22 70 72 65 2d 6c 61 75 6e -info* "pre-laun
1d70: 63 68 2d 65 6e 76 2d 76 61 72 73 22 29 0a 09 28 ch-env-vars")..(
1d80: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 debug:print 0 "W
1d90: 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e ARNING: You do n
1da0: 6f 74 20 68 61 76 65 20 61 20 72 75 6e 20 63 6f ot have a run co
1db0: 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 72 75 6e nfig file: " run
1dc0: 63 6f 6e 66 69 67 66 29 29 0a 20 20 20 20 0a 20 configf)). .
1dd0: 20 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c ;; look up al
1de0: 6c 20 74 65 73 74 73 20 6d 61 74 63 68 69 6e 67 l tests matching
1df0: 20 74 68 65 20 63 6f 6d 6d 61 20 73 65 70 61 72 the comma separ
1e00: 61 74 65 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f ated list of glo
1e10: 62 73 20 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73 bs in. ;; tes
1e20: 74 2d 70 61 74 74 73 20 28 75 73 69 6e 67 20 25 t-patts (using %
1e30: 20 61 73 20 77 69 6c 64 63 61 72 64 29 0a 20 20 as wildcard).
1e40: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 (for-each .
1e50: 20 20 28 6c 61 6d 62 64 61 20 28 70 61 74 74 29 (lambda (patt)
1e60: 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 . (let ((t
1e70: 65 73 74 73 20 28 67 6c 6f 62 20 28 63 6f 6e 63 ests (glob (conc
1e80: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 *toppath* "/tes
1e90: 74 73 2f 22 20 28 73 74 72 69 6e 67 2d 74 72 61 ts/" (string-tra
1ea0: 6e 73 6c 61 74 65 20 70 61 74 74 20 22 25 22 20 nslate patt "%"
1eb0: 22 2a 22 29 29 29 29 29 0a 09 20 28 73 65 74 21 "*"))))).. (set!
1ec0: 20 74 65 73 74 73 20 28 66 69 6c 74 65 72 20 28 tests (filter (
1ed0: 6c 61 6d 62 64 61 20 28 74 65 73 74 29 28 66 69 lambda (test)(fi
1ee0: 6c 65 2d 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 le-exists? (conc
1ef0: 20 74 65 73 74 20 22 2f 74 65 73 74 63 6f 6e 66 test "/testconf
1f00: 69 67 22 29 29 29 20 74 65 73 74 73 29 29 0a 09 ig"))) tests))..
1f10: 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 (set! test-name
1f20: 73 20 28 61 70 70 65 6e 64 20 74 65 73 74 2d 6e s (append test-n
1f30: 61 6d 65 73 20 0a 09 09 09 09 20 20 28 6d 61 70 ames ..... (map
1f40: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 70 29 (lambda (testp)
1f50: 0a 09 09 09 09 09 20 28 6c 61 73 74 20 28 73 74 ...... (last (st
1f60: 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 73 74 70 ring-split testp
1f70: 20 22 2f 22 29 29 29 0a 09 09 09 09 20 20 20 20 "/"))).....
1f80: 20 20 20 74 65 73 74 73 29 29 29 29 29 0a 20 20 tests))))).
1f90: 20 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 (string-split
1fa0: 20 74 65 73 74 2d 70 61 74 74 73 20 22 2c 22 29 test-patts ",")
1fb0: 29 0a 0a 20 20 20 20 20 3b 3b 20 6e 6f 77 20 72 ).. ;; now r
1fc0: 65 6d 6f 76 65 20 64 75 70 6c 69 63 61 74 65 73 emove duplicates
1fd0: 0a 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d . (set! test-
1fe0: 6e 61 6d 65 73 20 28 64 65 6c 65 74 65 2d 64 75 names (delete-du
1ff0: 70 6c 69 63 61 74 65 73 20 74 65 73 74 2d 6e 61 plicates test-na
2000: 6d 65 73 29 29 0a 0a 20 20 20 20 28 64 65 62 75 mes)).. (debu
2010: 67 3a 70 72 69 6e 74 20 30 20 22 49 4e 46 4f 3a g:print 0 "INFO:
2020: 20 74 65 73 74 20 6e 61 6d 65 73 20 22 20 74 65 test names " te
2030: 73 74 2d 6e 61 6d 65 73 29 0a 0a 20 20 20 20 3b st-names).. ;
2040: 3b 20 6f 6e 20 74 68 65 20 66 69 72 73 74 20 70 ; on the first p
2050: 61 73 73 20 6f 72 20 63 61 6c 6c 20 74 6f 20 72 ass or call to r
2060: 75 6e 2d 74 65 73 74 73 20 73 65 74 20 46 41 49 un-tests set FAI
2070: 4c 53 20 74 6f 20 4e 4f 54 5f 53 54 41 52 54 45 LS to NOT_STARTE
2080: 44 20 69 66 0a 20 20 20 20 3b 3b 20 2d 6b 65 65 D if. ;; -kee
2090: 70 67 6f 69 6e 67 20 69 73 20 73 70 65 63 69 66 pgoing is specif
20a0: 69 65 64 0a 20 20 20 20 28 69 66 20 28 65 71 3f ied. (if (eq?
20b0: 20 2a 70 61 73 73 6e 75 6d 2a 20 30 29 0a 09 28 *passnum* 0)..(
20c0: 62 65 67 69 6e 0a 09 20 20 3b 3b 20 68 61 76 65 begin.. ;; have
20d0: 20 74 6f 20 64 65 6c 65 74 65 20 74 65 73 74 20 to delete test
20e0: 72 65 63 6f 72 64 73 20 77 68 65 72 65 20 4e 4f records where NO
20f0: 54 5f 53 54 41 52 54 45 44 20 73 69 6e 63 65 20 T_STARTED since
2100: 74 68 65 79 20 63 61 6e 20 63 61 75 73 65 20 2d they can cause -
2110: 6b 65 65 70 67 6f 69 6e 67 20 74 6f 20 0a 09 20 keepgoing to ..
2120: 20 3b 3b 20 67 65 74 20 73 74 75 63 6b 20 64 75 ;; get stuck du
2130: 65 20 74 6f 20 62 65 63 6f 6d 69 6e 67 20 69 6e e to becoming in
2140: 61 63 63 65 73 73 69 62 6c 65 20 66 72 6f 6d 20 accessible from
2150: 61 20 66 61 69 6c 65 64 20 74 65 73 74 2e 20 49 a failed test. I
2160: 2e 65 2e 20 69 66 20 74 65 73 74 20 42 20 64 65 .e. if test B de
2170: 70 65 6e 64 73 20 0a 09 20 20 3b 3b 20 6f 6e 20 pends .. ;; on
2180: 74 65 73 74 20 41 20 62 75 74 20 74 65 73 74 20 test A but test
2190: 42 20 72 65 61 63 68 65 64 20 74 68 65 20 70 6f B reached the po
21a0: 69 6e 74 20 6f 6e 20 62 65 69 6e 67 20 72 65 67 int on being reg
21b0: 69 73 74 65 72 65 64 20 61 73 20 4e 4f 54 5f 53 istered as NOT_S
21c0: 54 41 52 54 45 44 20 61 6e 64 20 74 65 73 74 0a TARTED and test.
21d0: 09 20 20 3b 3b 20 41 20 66 61 69 6c 65 64 20 66 . ;; A failed f
21e0: 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e 20 74 or some reason t
21f0: 68 65 6e 20 6f 6e 20 72 65 2d 72 75 6e 20 75 73 hen on re-run us
2200: 69 6e 67 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 ing -keepgoing t
2210: 68 65 20 72 75 6e 20 63 61 6e 20 6e 65 76 65 72 he run can never
2220: 20 63 6f 6d 70 6c 65 74 65 2e 0a 09 20 20 28 64 complete... (d
2230: 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73 2d 69 b:delete-tests-i
2240: 6e 2d 73 74 61 74 65 20 64 62 20 72 75 6e 2d 69 n-state db run-i
2250: 64 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 d "NOT_STARTED")
2260: 0a 09 20 20 28 64 62 3a 73 65 74 2d 74 65 73 74 .. (db:set-test
2270: 73 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 64 s-state-status d
2280: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
2290: 6d 65 73 20 23 66 20 22 46 41 49 4c 22 20 22 4e mes #f "FAIL" "N
22a0: 4f 54 5f 53 54 41 52 54 45 44 22 20 22 46 41 49 OT_STARTED" "FAI
22b0: 4c 22 29 29 29 0a 0a 20 20 20 20 3b 3b 20 6e 6f L"))).. ;; no
22c0: 77 20 61 64 64 20 6e 6f 6e 2d 64 69 72 65 63 74 w add non-direct
22d0: 6c 79 20 72 65 66 65 72 65 6e 63 65 64 20 64 65 ly referenced de
22e0: 70 65 6e 64 65 6e 63 69 65 73 20 28 69 2e 65 2e pendencies (i.e.
22f0: 20 77 61 69 74 6f 6e 29 0a 20 20 20 20 28 69 66 waiton). (if
2300: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 (not (null? tes
2310: 74 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65 74 20 t-names))..(let
2320: 6c 6f 6f 70 20 28 28 68 65 64 20 28 63 61 72 20 loop ((hed (car
2330: 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20 test-names))...
2340: 20 20 28 74 61 6c 20 28 63 64 72 20 74 65 73 74 (tal (cdr test
2350: 2d 6e 61 6d 65 73 29 29 29 20 20 20 20 20 20 20 -names)))
2360: 20 20 3b 3b 20 27 72 65 74 75 72 6e 2d 70 72 6f ;; 'return-pro
2370: 63 73 20 74 65 6c 6c 73 20 74 68 65 20 63 6f 6e cs tells the con
2380: 66 69 67 20 72 65 61 64 65 72 20 74 6f 20 70 72 fig reader to pr
2390: 65 70 20 72 75 6e 6e 69 6e 67 20 73 79 73 74 65 ep running syste
23a0: 6d 20 62 75 74 20 72 65 74 75 72 6e 20 61 20 70 m but return a p
23b0: 72 6f 63 0a 09 20 20 28 6c 65 74 2a 20 28 28 63 roc.. (let* ((c
23c0: 6f 6e 66 69 67 20 20 28 74 65 73 74 3a 67 65 74 onfig (test:get
23d0: 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65 64 20 -testconfig hed
23e0: 27 72 65 74 75 72 6e 2d 70 72 6f 63 73 29 29 0a 'return-procs)).
23f0: 09 09 20 28 77 61 69 74 6f 6e 73 20 28 73 74 72 .. (waitons (str
2400: 69 6e 67 2d 73 70 6c 69 74 20 28 6c 65 74 20 28 ing-split (let (
2410: 28 77 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 (w (config-looku
2420: 70 20 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 p config "requir
2430: 65 6d 65 6e 74 73 22 20 22 77 61 69 74 6f 6e 22 ements" "waiton"
2440: 29 29 29 0a 09 09 09 09 09 20 20 28 69 66 20 77 )))...... (if w
2450: 20 77 20 22 22 29 29 29 29 29 0a 3b 3b 09 09 20 w ""))))).;;..
2460: 28 69 74 65 6d 73 20 20 20 28 69 74 65 6d 73 3a (items (items:
2470: 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 get-items-from-c
2480: 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 29 0a onfig config))).
2490: 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 . (if (not (h
24a0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
24b0: 66 61 75 6c 74 20 74 65 73 74 2d 72 65 63 6f 72 fault test-recor
24c0: 64 73 20 68 65 64 20 23 66 29 29 0a 09 09 28 68 ds hed #f))...(h
24d0: 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 ash-table-set! t
24e0: 65 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 20 est-records hed
24f0: 28 76 65 63 74 6f 72 20 68 65 64 20 63 6f 6e 66 (vector hed conf
2500: 69 67 20 77 61 69 74 6f 6e 73 20 28 63 6f 6e 66 ig waitons (conf
2510: 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 ig-lookup config
2520: 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 "requirements"
2530: 22 70 72 69 6f 72 69 74 79 22 29 20 23 66 29 29 "priority") #f))
2540: 29 0a 09 20 20 20 20 28 66 6f 72 2d 65 61 63 68 ).. (for-each
2550: 20 0a 09 20 20 20 20 20 28 6c 61 6d 62 64 61 20 .. (lambda
2560: 28 77 61 69 74 6f 6e 29 0a 09 20 20 20 20 20 20 (waiton)..
2570: 20 28 69 66 20 28 61 6e 64 20 77 61 69 74 6f 6e (if (and waiton
2580: 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20 77 61 (not (member wa
2590: 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 iton test-names)
25a0: 29 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 ))... (begin..
25b0: 09 20 20 20 20 20 28 73 65 74 21 20 72 65 71 75 . (set! requ
25c0: 69 72 65 64 2d 74 65 73 74 73 20 28 63 6f 6e 73 ired-tests (cons
25d0: 20 77 61 69 74 6f 6e 20 72 65 71 75 69 72 65 64 waiton required
25e0: 2d 74 65 73 74 73 29 29 0a 09 09 20 20 20 20 20 -tests))...
25f0: 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 (set! test-names
2600: 20 28 61 70 70 65 6e 64 20 74 65 73 74 2d 6e 61 (append test-na
2610: 6d 65 73 20 28 6c 69 73 74 20 77 61 69 74 6f 6e mes (list waiton
2620: 29 29 29 29 29 29 0a 09 20 20 20 20 20 77 61 69 )))))).. wai
2630: 74 6f 6e 73 29 0a 09 20 20 20 20 28 6c 65 74 20 tons).. (let
2640: 28 28 72 65 6d 74 65 73 74 73 20 28 64 65 6c 65 ((remtests (dele
2650: 74 65 2d 64 75 70 6c 69 63 61 74 65 73 20 28 61 te-duplicates (a
2660: 70 70 65 6e 64 20 77 61 69 74 6f 6e 73 20 74 61 ppend waitons ta
2670: 6c 29 29 29 29 0a 09 20 20 20 20 20 20 28 69 66 l)))).. (if
2680: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 6d (not (null? rem
2690: 74 65 73 74 73 29 29 0a 09 09 20 20 28 6c 6f 6f tests))... (loo
26a0: 70 20 28 63 61 72 20 72 65 6d 74 65 73 74 73 29 p (car remtests)
26b0: 28 63 64 72 20 72 65 6d 74 65 73 74 73 29 29 29 (cdr remtests)))
26c0: 29 29 29 29 0a 0a 20 20 20 20 28 69 66 20 28 6e )))).. (if (n
26d0: 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 71 75 69 72 ot (null? requir
26e0: 65 64 2d 74 65 73 74 73 29 29 0a 09 28 64 65 62 ed-tests))..(deb
26f0: 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f ug:print 1 "INFO
2700: 3a 20 41 64 64 69 6e 67 20 22 20 72 65 71 75 69 : Adding " requi
2710: 72 65 64 2d 74 65 73 74 73 20 22 20 74 6f 20 74 red-tests " to t
2720: 68 65 20 72 75 6e 20 71 75 65 75 65 22 29 29 0a he run queue")).
2730: 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 74 68 65 ;; NOTE: the
2740: 73 65 20 61 72 65 20 61 6c 6c 20 70 61 72 65 6e se are all paren
2750: 74 20 74 65 73 74 73 2c 20 69 74 65 6d 73 20 61 t tests, items a
2760: 72 65 20 6e 6f 74 20 65 78 70 61 6e 64 65 64 20 re not expanded
2770: 79 65 74 2e 0a 20 20 20 20 28 72 75 6e 73 3a 72 yet.. (runs:r
2780: 75 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 20 74 un-tests-queue t
2790: 65 73 74 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 est-records keyv
27a0: 61 6c 6c 69 73 74 29 29 29 0a 0a 28 64 65 66 69 allist)))..(defi
27b0: 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 ne (runs:run-tes
27c0: 74 73 2d 71 75 65 75 65 20 20 74 65 73 74 2d 72 ts-queue test-r
27d0: 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c 69 73 ecords keyvallis
27e0: 74 29 0a 20 20 20 20 3b 3b 20 41 74 20 74 68 69 t). ;; At thi
27f0: 73 20 70 6f 69 6e 74 20 74 68 65 20 6c 69 73 74 s point the list
2800: 20 6f 66 20 70 61 72 65 6e 74 20 74 65 73 74 73 of parent tests
2810: 20 69 73 20 65 78 70 61 6e 64 65 64 20 0a 20 20 is expanded .
2820: 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 6c 64 ;; NB// Should
2830: 20 65 78 70 61 6e 64 20 69 74 65 6d 73 20 68 65 expand items he
2840: 72 65 20 61 6e 64 20 74 68 65 6e 20 69 6e 73 65 re and then inse
2850: 72 74 20 69 6e 74 6f 20 74 68 65 20 72 75 6e 20 rt into the run
2860: 71 75 65 75 65 2e 0a 20 20 20 20 28 6c 65 74 20 queue.. (let
2870: 28 28 73 6f 72 74 65 64 2d 74 65 73 74 6e 61 6d ((sorted-testnam
2880: 65 73 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62 es (tests:sort-b
2890: 79 2d 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77 y-priority-and-w
28a0: 61 69 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72 aiton test-recor
28b0: 64 73 29 29 29 0a 20 20 20 20 20 20 28 6c 65 74 ds))). (let
28c0: 20 6c 6f 6f 70 20 28 3b 20 28 6e 75 6d 74 69 6d loop (; (numtim
28d0: 65 73 20 30 29 20 3b 3b 20 73 68 6f 75 6c 64 6e es 0) ;; shouldn
28e0: 27 74 20 6e 65 65 64 20 74 68 69 73 0a 09 09 20 't need this...
28f0: 28 68 65 64 20 20 20 20 20 20 20 20 20 28 63 61 (hed (ca
2900: 72 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 r sorted-test-na
2910: 6d 65 73 29 29 0a 09 09 20 28 74 61 6c 20 20 20 mes))... (tal
2920: 20 20 20 20 20 20 28 63 64 72 20 73 6f 72 74 65 (cdr sorte
2930: 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a d-test-names))).
2940: 09 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 72 65 .(let* ((test-re
2950: 63 6f 72 64 20 28 68 61 73 68 2d 74 61 62 6c 65 cord (hash-table
2960: 2d 72 65 66 20 74 65 73 74 2d 72 65 63 6f 72 64 -ref test-record
2970: 73 20 68 65 64 29 29 0a 09 20 20 20 20 20 20 20 s hed))..
2980: 28 74 63 6f 6e 66 69 67 20 20 20 20 20 28 74 65 (tconfig (te
2990: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
29a0: 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 t-testconfig tes
29b0: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 20 20 20 t-record))..
29c0: 20 20 20 28 77 61 69 74 6f 6e 73 20 20 20 20 20 (waitons
29d0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
29e0: 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 20 -get-waitons
29f0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 test-record))..
2a00: 20 20 20 20 20 20 28 70 72 69 6f 72 69 74 79 20 (priority
2a10: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 (tests:testqu
2a20: 65 75 65 2d 67 65 74 2d 70 72 69 6f 72 69 74 79 eue-get-priority
2a30: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 test-record))
2a40: 0a 09 20 20 20 20 20 20 20 28 69 74 65 6d 64 61 .. (itemda
2a50: 74 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 t (tests:tes
2a60: 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 tqueue-get-itemd
2a70: 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 at test-recor
2a80: 64 29 29 0a 09 20 20 20 20 20 20 20 28 69 74 65 d)).. (ite
2a90: 6d 73 20 20 20 20 20 20 20 28 74 65 73 74 73 3a ms (tests:
2aa0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 testqueue-get-it
2ab0: 65 6d 73 20 20 20 20 20 20 74 65 73 74 2d 72 65 ems test-re
2ac0: 63 6f 72 64 29 29 0a 09 20 20 20 20 20 20 20 28 cord)).. (
2ad0: 69 74 65 6d 2d 70 61 74 68 20 20 20 28 69 74 65 item-path (ite
2ae0: 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 m-list->path ite
2af0: 6d 64 61 74 29 29 29 0a 09 20 20 28 64 65 62 75 mdat))).. (debu
2b00: 67 3a 70 72 69 6e 74 20 30 20 22 57 48 45 52 45 g:print 0 "WHERE
2b10: 20 54 4f 20 44 4f 3a 20 28 69 74 65 6d 73 3a 67 TO DO: (items:g
2b20: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f et-items-from-co
2b30: 6e 66 69 67 20 63 6f 6e 66 69 67 29 22 29 0a 09 nfig config)")..
2b40: 20 20 28 63 6f 6e 64 0a 09 20 20 20 28 28 6e 6f (cond.. ((no
2b50: 74 20 69 74 65 6d 73 29 20 3b 3b 20 77 68 65 6e t items) ;; when
2b60: 20 66 61 6c 73 65 20 74 68 65 20 74 65 73 74 20 false the test
2b70: 69 73 20 6f 6b 20 74 6f 20 62 65 20 68 61 6e 64 is ok to be hand
2b80: 65 64 20 6f 66 66 20 74 6f 20 6c 61 75 6e 63 68 ed off to launch
2b90: 0a 09 20 20 20 20 28 6c 65 74 20 28 28 68 61 76 .. (let ((hav
2ba0: 65 2d 72 65 73 6f 75 72 63 65 73 20 20 28 72 75 e-resources (ru
2bb0: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d ns:can-run-more-
2bc0: 74 65 73 74 73 20 64 62 20 74 65 73 74 2d 72 65 tests db test-re
2bd0: 63 6f 72 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20 61 cord)) ;; look a
2be0: 74 20 74 68 65 20 74 65 73 74 20 6a 6f 62 67 72 t the test jobgr
2bf0: 6f 75 70 20 61 6e 64 20 74 6f 74 20 6a 6f 62 73 oup and tot jobs
2c00: 20 72 75 6e 6e 69 6e 67 0a 09 09 20 20 28 70 72 running... (pr
2c10: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 64 ereqs-not-met (d
2c20: 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f b:get-prereqs-no
2c30: 74 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 20 t-met db run-id
2c40: 77 61 69 74 6f 6e 20 69 74 65 6d 2d 70 61 74 68 waiton item-path
2c50: 29 29 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 ))).. (if (
2c60: 61 6e 64 20 68 61 76 65 2d 72 65 73 6f 75 72 63 and have-resourc
2c70: 65 73 0a 09 09 20 20 20 20 20 20 20 28 6e 75 6c es... (nul
2c80: 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d l? prereqs-not-m
2c90: 65 74 29 29 0a 09 09 20 20 3b 3b 20 6e 6f 20 6c et))... ;; no l
2ca0: 6f 6f 70 20 2d 20 64 72 6f 70 20 74 68 6f 75 67 oop - drop thoug
2cb0: 68 20 61 6e 64 20 75 73 65 20 74 68 65 20 6c 6f h and use the lo
2cc0: 6f 70 20 61 74 20 74 68 65 20 62 6f 74 74 6f 6d op at the bottom
2cd0: 20 0a 09 09 20 20 28 72 75 6e 3a 74 65 73 74 20 ... (run:test
2ce0: 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d db run-id runnam
2cf0: 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 e keyvallst test
2d00: 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 29 0a 09 -record flags)..
2d10: 09 20 20 3b 3b 20 65 6c 73 65 20 74 68 65 20 72 . ;; else the r
2d20: 75 6e 20 69 73 20 73 74 75 63 6b 2c 20 74 65 6d un is stuck, tem
2d30: 70 6f 72 61 72 69 6c 79 20 6f 72 20 70 65 72 6d porarily or perm
2d40: 61 6e 65 6e 74 6c 79 0a 09 09 20 20 28 6c 65 74 anently... (let
2d50: 20 28 28 6e 65 77 74 61 6c 20 28 61 70 70 65 6e ((newtal (appen
2d60: 64 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64 29 d tal (list hed)
2d70: 29 29 29 0a 09 09 20 20 20 20 3b 3b 20 63 6f 75 )))... ;; cou
2d80: 6c 64 6e 27 74 20 72 75 6e 2c 20 74 61 6b 65 20 ldn't run, take
2d90: 61 20 62 72 65 61 74 68 65 72 0a 09 09 20 20 20 a breather...
2da0: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 (thread-sleep!
2db0: 31 29 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 1)... (loop (
2dc0: 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c car tal)(cdr tal
2dd0: 29 29 29 29 29 29 0a 09 20 20 20 0a 09 20 20 20 )))))).. ..
2de0: 3b 3b 20 63 61 73 65 20 77 68 65 72 65 20 61 6e ;; case where an
2df0: 20 69 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 items came in a
2e00: 73 20 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72 s a list been pr
2e10: 6f 63 65 73 73 65 64 0a 09 20 20 20 28 28 61 6e ocessed.. ((an
2e20: 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 d (list? items)
2e30: 20 20 20 20 3b 3b 20 74 68 75 73 20 77 65 20 6b ;; thus we k
2e40: 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 20 61 72 now our items ar
2e50: 65 20 61 6c 72 65 61 64 79 20 63 61 6c 63 75 6c e already calcul
2e60: 61 74 65 64 0a 09 09 20 28 6e 6f 74 20 20 20 69 ated... (not i
2e70: 74 65 6d 64 61 74 29 29 20 3b 3b 20 61 6e 64 20 temdat)) ;; and
2e80: 6e 6f 74 20 79 65 74 20 65 78 70 61 6e 64 65 64 not yet expanded
2e90: 20 69 6e 74 6f 20 74 68 65 20 6c 69 73 74 20 6f into the list o
2ea0: 66 20 74 68 69 6e 67 73 20 74 6f 20 62 65 20 64 f things to be d
2eb0: 6f 6e 65 0a 09 20 20 20 20 28 69 66 20 28 3e 3d one.. (if (>=
2ec0: 20 2a 76 65 72 62 6f 73 69 74 79 2a 20 31 29 28 *verbosity* 1)(
2ed0: 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20 pp items))..
2ee0: 3b 3b 20 28 69 66 20 28 3e 3d 20 2a 76 65 72 62 ;; (if (>= *verb
2ef0: 6f 73 69 74 79 2a 20 35 29 0a 09 20 20 20 20 3b osity* 5).. ;
2f00: 3b 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 ; (begin..
2f10: 20 20 3b 3b 20 20 20 20 20 20 20 28 70 72 69 6e ;; (prin
2f20: 74 20 22 69 74 65 6d 73 3a 20 22 29 20 20 20 20 t "items: ")
2f30: 20 28 70 70 20 28 69 74 65 6d 2d 61 73 73 6f 63 (pp (item-assoc
2f40: 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d ->item-list item
2f50: 73 29 29 0a 09 20 20 20 20 3b 3b 20 20 20 20 20 s)).. ;;
2f60: 20 20 28 70 72 69 6e 74 20 22 69 74 65 6d 73 74 (print "itemst
2f70: 61 62 6c 65 3a 20 22 29 28 70 70 20 28 69 74 65 able: ")(pp (ite
2f80: 6d 2d 74 61 62 6c 65 2d 3e 69 74 65 6d 2d 6c 69 m-table->item-li
2f90: 73 74 20 69 74 65 6d 73 74 61 62 6c 65 29 29 29 st itemstable)))
2fa0: 29 0a 09 20 20 20 20 28 66 6f 72 2d 65 61 63 68 ).. (for-each
2fb0: 0a 09 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 .. (lambda (
2fc0: 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 20 20 20 my-itemdat)..
2fd0: 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d (let* ((new-
2fe0: 74 65 73 74 2d 72 65 63 6f 72 64 20 28 76 65 63 test-record (vec
2ff0: 74 6f 72 2d 63 6f 70 79 21 20 74 65 73 74 2d 72 tor-copy! test-r
3000: 65 63 6f 72 64 20 28 6d 61 6b 65 2d 74 65 73 74 ecord (make-test
3010: 73 3a 74 65 73 74 71 75 65 75 65 29 29 29 0a 09 s:testqueue)))..
3020: 09 20 20 20 20 20 20 28 6d 79 2d 69 74 65 6d 2d . (my-item-
3030: 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d path (item-list-
3040: 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d 64 61 74 >path my-itemdat
3050: 29 29 0a 09 09 20 20 20 20 20 20 28 69 74 65 6d ))... (item
3060: 2d 6d 61 74 63 68 65 73 20 28 69 66 20 69 74 65 -matches (if ite
3070: 6d 2d 70 61 74 74 73 20 20 20 20 20 20 20 3b 3b m-patts ;;
3080: 20 68 65 72 65 20 77 65 20 61 72 65 20 66 69 6c here we are fil
3090: 74 65 72 69 6e 67 20 66 6f 72 20 6d 61 74 63 68 tering for match
30a0: 65 73 20 77 69 74 68 20 2d 69 74 65 6d 70 61 74 es with -itempat
30b0: 74 0a 09 09 09 09 09 28 6c 65 74 20 28 28 72 65 t......(let ((re
30c0: 73 20 23 66 29 29 09 20 3b 3b 20 6c 6f 6f 6b 20 s #f)). ;; look
30d0: 74 68 72 6f 75 67 68 20 61 6c 6c 20 74 68 65 20 through all the
30e0: 69 74 65 6d 2d 70 61 74 74 73 20 69 66 20 64 65 item-patts if de
30f0: 66 69 6e 65 64 2c 20 66 6f 72 6d 61 74 20 69 73 fined, format is
3100: 20 70 61 74 74 31 2c 70 61 74 74 32 2c 70 61 74 patt1,patt2,pat
3110: 74 33 20 2e 2e 2e 20 77 69 6c 64 63 61 72 64 20 t3 ... wildcard
3120: 69 73 20 25 0a 09 09 09 09 09 20 20 28 66 6f 72 is %...... (for
3130: 2d 65 61 63 68 20 0a 09 09 09 09 09 20 20 20 28 -each ...... (
3140: 6c 61 6d 62 64 61 20 28 70 61 74 74 29 0a 09 09 lambda (patt)...
3150: 09 09 09 20 20 20 20 20 28 69 66 20 28 73 74 72 ... (if (str
3160: 69 6e 67 2d 73 65 61 72 63 68 20 28 67 6c 6f 62 ing-search (glob
3170: 2d 3e 72 65 67 65 78 70 0a 09 09 09 09 09 09 09 ->regexp........
3180: 09 20 28 73 74 72 69 6e 67 2d 74 72 61 6e 73 6c . (string-transl
3190: 61 74 65 20 70 61 74 74 20 22 25 22 20 22 2a 22 ate patt "%" "*"
31a0: 29 29 0a 09 09 09 09 09 09 09 09 69 74 65 6d 2d )).........item-
31b0: 70 61 74 68 29 0a 09 09 09 09 09 09 20 28 73 65 path)....... (se
31c0: 74 21 20 72 65 73 20 23 74 29 29 29 0a 09 09 09 t! res #t)))....
31d0: 09 09 20 20 20 28 73 74 72 69 6e 67 2d 73 70 6c .. (string-spl
31e0: 69 74 20 69 74 65 6d 2d 70 61 74 74 73 20 22 2c it item-patts ",
31f0: 22 29 29 0a 09 09 09 09 09 20 20 72 65 73 29 0a "))...... res).
3200: 09 09 09 09 09 23 74 29 29 29 0a 09 09 20 28 69 .....#t)))... (i
3210: 66 20 69 74 65 6d 2d 6d 61 74 63 68 65 73 20 3b f item-matches ;
3220: 3b 20 79 65 73 2c 20 77 65 20 77 61 6e 74 20 74 ; yes, we want t
3230: 6f 20 70 72 6f 63 65 73 73 20 74 68 69 73 20 69 o process this i
3240: 74 65 6d 0a 09 09 20 20 20 20 20 28 62 65 67 69 tem... (begi
3250: 6e 0a 09 09 20 20 20 20 20 20 20 28 74 65 73 74 n... (test
3260: 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d s:testqueue-set-
3270: 69 74 65 6d 73 21 20 20 20 6e 65 77 2d 74 65 73 items! new-tes
3280: 74 2d 72 65 63 6f 72 64 20 23 66 29 0a 09 09 20 t-record #f)...
3290: 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 (tests:tes
32a0: 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 tqueue-set-itemd
32b0: 61 74 21 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 at! new-test-rec
32c0: 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 29 0a ord my-itemdat).
32d0: 09 09 20 20 20 20 20 20 20 28 73 65 74 21 20 74 .. (set! t
32e0: 61 6c 20 28 63 6f 6e 73 20 28 63 6f 6e 63 20 68 al (cons (conc h
32f0: 65 64 20 22 2f 22 20 6d 79 2d 69 74 65 6d 2d 70 ed "/" my-item-p
3300: 61 74 68 29 20 74 61 6c 29 29 29 29 29 29 20 3b ath) tal)))))) ;
3310: 3b 20 73 69 6e 63 65 20 74 68 65 73 65 20 61 72 ; since these ar
3320: 65 20 69 74 65 6d 69 7a 65 64 20 63 72 65 61 74 e itemized creat
3330: 65 20 6e 65 77 20 74 65 73 74 20 6e 61 6d 65 73 e new test names
3340: 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61 testname/itempa
3350: 74 68 0a 09 20 20 20 20 20 69 74 65 6d 73 29 0a th.. items).
3360: 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 . (loop (car
3370: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 0a tal)(cdr tal))).
3380: 0a 09 20 20 20 3b 3b 20 69 66 20 69 74 65 6d 73 .. ;; if items
3390: 20 69 73 20 61 20 70 72 6f 63 20 74 68 65 6e 20 is a proc then
33a0: 6e 65 65 64 20 74 6f 20 65 76 61 6c 75 61 74 65 need to evaluate
33b0: 2c 20 67 65 74 20 74 68 65 20 6c 69 73 74 20 61 , get the list a
33c0: 6e 64 20 6c 6f 6f 70 20 2d 20 62 75 74 20 6f 6e nd loop - but on
33d0: 6c 79 20 64 6f 20 74 68 61 74 20 69 66 20 0a 09 ly do that if ..
33e0: 20 20 20 3b 3b 20 72 65 73 6f 75 72 63 65 73 20 ;; resources
33f0: 65 78 69 73 74 20 74 6f 20 6b 69 63 6b 20 6f 66 exist to kick of
3400: 66 20 74 68 65 20 6a 6f 62 0a 09 20 20 20 28 28 f the job.. ((
3410: 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 procedure? items
3420: 29 0a 09 20 20 20 20 28 69 66 20 28 72 75 6e 73 ).. (if (runs
3430: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 :can-run-more-te
3440: 73 74 73 20 64 62 20 74 65 73 74 2d 72 65 63 6f sts db test-reco
3450: 72 64 29 0a 09 09 28 6c 65 74 20 28 28 69 74 65 rd)...(let ((ite
3460: 6d 73 2d 6c 69 73 74 20 28 69 74 65 6d 73 29 29 ms-list (items))
3470: 29 0a 09 09 20 20 20 20 20 20 0a 09 09 20 20 28 )... ... (
3480: 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 2d if (list? items-
3490: 6c 69 73 74 29 0a 09 09 20 20 20 20 20 20 28 62 list)... (b
34a0: 65 67 69 6e 0a 09 09 09 28 74 65 73 74 73 3a 74 egin....(tests:t
34b0: 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 estqueue-set-ite
34c0: 6d 73 20 74 65 73 74 2d 72 65 63 6f 72 64 20 69 ms test-record i
34d0: 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 28 6c tems-list)....(l
34e0: 6f 6f 70 20 68 65 64 20 74 61 6c 29 29 0a 09 09 oop hed tal))...
34f0: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 (begin....
3500: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
3510: 45 52 52 4f 52 3a 20 54 68 65 20 70 72 6f 63 20 ERROR: The proc
3520: 66 72 6f 6d 20 72 65 61 64 69 6e 67 20 74 68 65 from reading the
3530: 20 73 65 74 75 70 20 64 69 64 20 6e 6f 74 20 79 setup did not y
3540: 69 65 6c 64 20 61 20 6c 69 73 74 20 2d 20 70 6c ield a list - pl
3550: 65 61 73 65 20 72 65 70 6f 72 74 20 74 68 69 73 ease report this
3560: 22 29 0a 09 09 09 28 65 78 69 74 20 31 29 29 29 ")....(exit 1)))
3570: 29 0a 09 09 28 6c 65 74 20 28 28 6e 65 77 74 61 )...(let ((newta
3580: 6c 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28 6c l (append tal (l
3590: 69 73 74 20 68 65 64 29 29 29 29 0a 09 09 20 20 ist hed))))...
35a0: 3b 3b 20 69 66 20 63 61 6e 27 74 20 72 75 6e 20 ;; if can't run
35b0: 6d 6f 72 65 20 74 65 73 74 73 2c 20 6c 65 74 73 more tests, lets
35c0: 20 74 61 6b 65 20 61 20 62 72 65 61 74 68 65 72 take a breather
35d0: 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 ... (thread-sle
35e0: 65 70 21 20 31 29 0a 09 09 20 20 28 6c 6f 6f 70 ep! 1)... (loop
35f0: 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 (car newtal)(cd
3600: 72 20 6e 65 77 74 61 6c 29 29 29 29 29 0a 0a 09 r newtal)))))...
3610: 20 20 20 3b 3b 20 74 68 69 73 20 63 61 73 65 20 ;; this case
3620: 73 68 6f 75 6c 64 20 6e 6f 74 20 68 61 70 70 65 should not happe
3630: 6e 2c 20 61 64 64 65 64 20 74 6f 20 68 65 6c 70 n, added to help
3640: 20 63 61 74 63 68 20 61 6e 79 20 62 75 67 73 0a catch any bugs.
3650: 09 20 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f . ((and (list?
3660: 20 69 74 65 6d 73 29 20 69 74 65 6d 64 61 74 29 items) itemdat)
3670: 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 .. (debug:pri
3680: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 53 68 6f nt 0 "ERROR: Sho
3690: 75 6c 64 20 6e 6f 74 20 68 61 76 65 20 61 20 6c uld not have a l
36a0: 69 73 74 20 6f 66 20 69 74 65 6d 73 20 69 6e 20 ist of items in
36b0: 61 20 74 65 73 74 20 61 6e 64 20 74 68 65 20 69 a test and the i
36c0: 74 65 6d 73 70 61 74 68 20 73 65 74 20 2d 20 70 temspath set - p
36d0: 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 68 69 lease report thi
36e0: 73 22 29 0a 09 20 20 20 20 28 65 78 69 74 20 31 s").. (exit 1
36f0: 29 29 29 0a 09 20 20 0a 09 20 20 3b 3b 20 77 65 ))).. .. ;; we
3700: 20 67 65 74 20 68 65 72 65 20 6f 6e 20 22 64 72 get here on "dr
3710: 6f 70 20 74 68 72 6f 75 67 68 22 20 2d 20 6c 6f op through" - lo
3720: 6f 70 20 66 6f 72 20 6e 65 78 74 20 74 65 73 74 op for next test
3730: 20 69 6e 20 71 75 65 75 65 0a 09 20 20 28 69 66 in queue.. (if
3740: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 0a 09 20 20 (null? tal)..
3750: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
3760: 20 31 20 22 49 4e 46 4f 3a 20 41 6c 6c 20 74 65 1 "INFO: All te
3770: 73 74 73 20 6c 61 75 6e 63 68 65 64 22 29 0a 09 sts launched")..
3780: 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 (loop (car
3790: 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 tal)(cdr tal)))
37a0: 29 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 ))))..(define (r
37b0: 75 6e 3a 74 65 73 74 20 64 62 20 72 75 6e 2d 69 un:test db run-i
37c0: 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c d runname keyval
37d0: 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 lst test-record
37e0: 66 6c 61 67 73 29 0a 20 20 28 64 65 62 75 67 3a flags). (debug:
37f0: 70 72 69 6e 74 20 31 20 22 4c 61 75 6e 63 68 69 print 1 "Launchi
3800: 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e ng test " test-n
3810: 61 6d 65 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 ame). ;; All th
3820: 65 73 65 20 76 61 72 73 20 6d 69 67 68 74 20 62 ese vars might b
3830: 65 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 e referenced by
3840: 74 68 65 20 74 65 73 74 63 6f 6e 66 69 67 20 66 the testconfig f
3850: 69 6c 65 20 72 65 61 64 65 72 0a 20 20 28 73 65 ile reader. (se
3860: 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 tenv "MT_TEST_NA
3870: 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b ME" test-name) ;
3880: 3b 20 0a 20 20 28 73 65 74 65 6e 76 20 22 4d 54 ; . (setenv "MT
3890: 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e _RUNNAME" runn
38a0: 61 6d 65 29 0a 20 20 28 73 65 74 2d 6d 65 67 61 ame). (set-mega
38b0: 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 test-env-vars db
38c0: 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 run-id) ;; thes
38d0: 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 e may be needed
38e0: 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 by the launching
38f0: 20 70 72 6f 63 65 73 73 0a 20 20 28 63 68 61 6e process. (chan
3900: 67 65 2d 64 69 72 65 63 74 6f 72 79 20 2a 74 6f ge-directory *to
3910: 70 70 61 74 68 2a 29 0a 20 20 28 6c 65 74 2a 20 ppath*). (let*
3920: 28 28 74 65 73 74 2d 6e 61 6d 65 20 20 20 20 28 ((test-name (
3930: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
3940: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 get-testname tes
3950: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 t-record)).. (te
3960: 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 st-path (conc
3970: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 *toppath* "/tes
3980: 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 ts/" test-name))
3990: 20 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20 74 65 ;; could use te
39a0: 73 74 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 st:get-testconfi
39b0: 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28 74 65 g here ..... (te
39c0: 73 74 2d 63 6f 6e 66 20 20 20 20 28 74 65 73 74 st-conf (test
39d0: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
39e0: 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d testconfig test-
39f0: 72 65 63 6f 72 64 29 29 0a 09 20 28 69 74 65 6d record)).. (item
3a00: 64 61 74 20 20 20 20 20 20 28 74 65 73 74 73 3a dat (tests:
3a10: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 testqueue-get-it
3a20: 65 6d 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 emdat test-re
3a30: 63 6f 72 64 29 29 0a 09 20 28 66 6f 72 63 65 20 cord)).. (force
3a40: 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 (hash-tab
3a50: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 le-ref/default f
3a60: 6c 61 67 73 20 22 2d 66 6f 72 63 65 22 20 23 66 lags "-force" #f
3a70: 29 29 0a 09 20 28 72 65 72 75 6e 20 20 20 20 20 )).. (rerun
3a80: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 (hash-table-r
3a90: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 ef/default flags
3aa0: 20 22 2d 72 65 72 75 6e 22 20 23 66 29 29 0a 09 "-rerun" #f))..
3ab0: 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 28 (keepgoing (
3ac0: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
3ad0: 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b efault flags "-k
3ae0: 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29 29 0a eepgoing" #f))).
3af0: 0a 20 20 20 20 3b 3b 20 48 65 72 65 20 69 73 20 . ;; Here is
3b00: 77 68 65 72 65 20 74 68 65 20 74 65 73 74 5f 6d where the test_m
3b10: 65 74 61 20 74 61 62 6c 65 20 69 73 20 62 65 73 eta table is bes
3b20: 74 20 75 70 64 61 74 65 64 0a 20 20 20 20 28 72 t updated. (r
3b30: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f uns:update-test_
3b40: 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d meta db test-nam
3b50: 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 20 e test-conf).
3b60: 20 0a 20 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61 . ;; (lambda
3b70: 20 28 69 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28 (itemdat) ;;; (
3b80: 28 72 69 70 65 6e 65 73 73 20 22 6f 76 65 72 72 (ripeness "overr
3b90: 69 70 65 22 29 20 28 74 65 6d 70 65 72 61 74 75 ipe") (temperatu
3ba0: 72 65 20 22 63 6f 6f 6c 22 29 20 28 73 65 61 73 re "cool") (seas
3bb0: 6f 6e 20 22 73 75 6d 6d 65 72 22 29 29 0a 20 20 on "summer")).
3bc0: 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 (let* ((item-p
3bd0: 61 74 68 20 20 20 20 20 28 69 74 65 6d 2d 6c 69 ath (item-li
3be0: 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 st->path itemdat
3bf0: 29 29 20 3b 3b 20 28 73 74 72 69 6e 67 2d 69 6e )) ;; (string-in
3c00: 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 63 tersperse (map c
3c10: 61 64 72 20 69 74 65 6d 64 61 74 29 20 22 2f 22 adr itemdat) "/"
3c20: 29 29 0a 09 20 20 20 28 6e 65 77 2d 74 65 73 74 )).. (new-test
3c30: 2d 70 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e -path (string-in
3c40: 74 65 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20 tersperse (cons
3c50: 74 65 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63 test-path (map c
3c60: 61 64 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f adr itemdat)) "/
3c70: 22 29 29 0a 09 20 20 20 28 6e 65 77 2d 74 65 73 ")).. (new-tes
3c80: 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 t-name (if (equa
3c90: 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 l? item-path "")
3ca0: 20 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 test-name (conc
3cb0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 test-name "/" i
3cc0: 74 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a tem-path))) ;; j
3cd0: 75 73 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62 ust need it to b
3ce0: 65 20 75 6e 69 71 75 65 0a 09 20 20 20 28 74 65 e unique.. (te
3cf0: 73 74 64 61 74 20 20 20 20 20 20 20 23 66 29 0a stdat #f).
3d00: 09 20 20 20 28 74 65 73 74 2d 69 6e 66 6f 20 28 . (test-info (
3d10: 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f db:get-test-info
3d20: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d db run-id test-
3d30: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 name item-path))
3d40: 29 0a 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 ). (if (not
3d50: 20 74 65 73 74 2d 69 6e 66 6f 29 28 72 65 67 69 test-info)(regi
3d60: 73 74 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e ster-test db run
3d70: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
3d80: 65 6d 2d 70 61 74 68 29 29 0a 20 20 20 20 20 20 em-path)).
3d90: 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 (change-director
3da0: 79 20 74 65 73 74 2d 70 61 74 68 29 0a 20 20 20 y test-path).
3db0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
3dc0: 34 20 22 72 75 6e 2d 69 64 3a 20 22 20 72 75 6e 4 "run-id: " run
3dd0: 2d 69 64 20 22 20 74 65 73 74 2d 6e 61 6d 65 3a -id " test-name:
3de0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 " test-name " i
3df0: 74 65 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 6d tem-path: " item
3e00: 2d 70 61 74 68 20 22 20 74 65 73 74 64 61 74 3a -path " testdat:
3e10: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 " (test:get-sta
3e20: 74 75 73 20 74 65 73 74 64 61 74 29 20 22 20 74 tus testdat) " t
3e30: 65 73 74 2d 73 74 61 74 65 3a 20 22 20 28 74 65 est-state: " (te
3e40: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
3e50: 74 64 61 74 29 29 0a 20 20 20 20 20 20 28 63 61 tdat)). (ca
3e60: 73 65 20 28 69 66 20 66 6f 72 63 65 20 3b 3b 20 se (if force ;;
3e70: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
3e80: 66 6f 72 63 65 22 29 0a 09 09 27 4e 4f 54 5f 53 force")...'NOT_S
3e90: 54 41 52 54 45 44 0a 09 09 28 69 66 20 74 65 73 TARTED...(if tes
3ea0: 74 64 61 74 0a 09 09 20 20 20 20 28 73 74 72 69 tdat... (stri
3eb0: 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 74 65 73 74 ng->symbol (test
3ec0: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 :get-state testd
3ed0: 61 74 29 29 0a 09 09 20 20 20 20 27 66 61 69 6c at))... 'fail
3ee0: 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 29 0a 09 ed-to-insert))..
3ef0: 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 ((failed-to-inse
3f00: 72 74 29 0a 09 20 28 64 65 62 75 67 3a 70 72 69 rt).. (debug:pri
3f10: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69 nt 0 "ERROR: Fai
3f20: 6c 65 64 20 74 6f 20 69 6e 73 65 72 74 20 74 68 led to insert th
3f30: 65 20 72 65 63 6f 72 64 20 69 6e 74 6f 20 74 68 e record into th
3f40: 65 20 64 62 22 29 29 0a 09 28 28 4e 4f 54 5f 53 e db"))..((NOT_S
3f50: 54 41 52 54 45 44 20 43 4f 4d 50 4c 45 54 45 44 TARTED COMPLETED
3f60: 29 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ).. (debug:print
3f70: 20 36 20 22 47 6f 74 20 68 65 72 65 2c 20 22 20 6 "Got here, "
3f80: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 (test:get-state
3f90: 74 65 73 74 64 61 74 29 29 0a 09 20 28 6c 65 74 testdat)).. (let
3fa0: 20 28 28 72 75 6e 66 6c 61 67 20 23 66 29 29 0a ((runflag #f)).
3fb0: 09 20 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 3b . (cond.. ;
3fc0: 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f ; -force, run no
3fd0: 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 matter what..
3fe0: 20 20 28 66 6f 72 63 65 20 28 73 65 74 21 20 72 (force (set! r
3ff0: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 unflag #t))..
4000: 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c ;; NOT_STARTED,
4010: 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 run no matter w
4020: 68 61 74 0a 09 20 20 20 20 28 28 65 71 75 61 6c hat.. ((equal
4030: 3f 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 ? (test:get-stat
4040: 65 20 74 65 73 74 64 61 74 29 20 22 4e 4f 54 5f e testdat) "NOT_
4050: 53 54 41 52 54 45 44 22 29 28 73 65 74 21 20 72 STARTED")(set! r
4060: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 unflag #t))..
4070: 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 ;; not -rerun a
4080: 6e 64 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 nd PASS, WARN or
4090: 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 CHECK, do no ru
40a0: 6e 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6f 72 n.. ((and (or
40b0: 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 (not rerun)...
40c0: 20 20 20 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a keepgoing).
40d0: 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 .. (member (tes
40e0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
40f0: 74 64 61 74 29 20 27 28 22 50 41 53 53 22 20 22 tdat) '("PASS" "
4100: 57 41 52 4e 22 20 22 43 48 45 43 4b 22 29 29 29 WARN" "CHECK")))
4110: 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e .. (set! run
4120: 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 3b flag #f)).. ;
4130: 3b 20 2d 72 65 72 75 6e 20 61 6e 64 20 73 74 61 ; -rerun and sta
4140: 74 75 73 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 tus is one of th
4150: 65 20 73 70 65 63 69 66 65 64 2c 20 72 75 6e 20 e specifed, run
4160: 69 74 0a 09 20 20 20 20 28 28 61 6e 64 20 72 65 it.. ((and re
4170: 72 75 6e 0a 09 09 20 20 28 6c 65 74 20 28 28 72 run... (let ((r
4180: 65 72 75 6e 6c 73 74 20 28 73 74 72 69 6e 67 2d erunlst (string-
4190: 73 70 6c 69 74 20 72 65 72 75 6e 20 22 2c 22 29 split rerun ",")
41a0: 29 29 20 3b 3b 20 46 41 49 4c 2c 0a 09 09 20 20 )) ;; FAIL,...
41b0: 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a (member (test:
41c0: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
41d0: 61 74 29 20 72 65 72 75 6e 6c 73 74 29 29 29 0a at) rerunlst))).
41e0: 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 . (set! runf
41f0: 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b lag #t)).. ;;
4200: 20 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20 -keepgoing, do
4210: 6e 6f 74 20 72 65 72 75 6e 20 46 41 49 4c 0a 09 not rerun FAIL..
4220: 20 20 20 20 28 28 61 6e 64 20 6b 65 65 70 67 6f ((and keepgo
4230: 69 6e 67 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 ing... (member
4240: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
4250: 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 testdat) '("FAI
4260: 4c 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 74 L"))).. (set
4270: 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 ! runflag #f))..
4280: 20 20 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 72 ((and (not r
4290: 65 72 75 6e 29 0a 09 09 20 20 28 6d 65 6d 62 65 erun)... (membe
42a0: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 r (test:get-stat
42b0: 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 46 us testdat) '("F
42c0: 41 49 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09 20 AIL" "n/a")))..
42d0: 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 (set! runfla
42e0: 67 20 23 74 29 29 0a 09 20 20 20 20 28 65 6c 73 g #t)).. (els
42f0: 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 e (set! runflag
4300: 23 66 29 29 29 0a 09 20 20 20 28 64 65 62 75 67 #f))).. (debug
4310: 3a 70 72 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e :print 6 "RUNNIN
4320: 47 20 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 G => runflag: "
4330: 72 75 6e 66 6c 61 67 20 22 20 53 54 41 54 45 3a runflag " STATE:
4340: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 " (test:get-sta
4350: 74 65 20 74 65 73 74 64 61 74 29 20 22 20 53 54 te testdat) " ST
4360: 41 54 55 53 3a 20 22 20 28 74 65 73 74 3a 67 65 ATUS: " (test:ge
4370: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
4380: 29 29 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 )).. (if (not
4390: 72 75 6e 66 6c 61 67 29 0a 09 20 20 20 20 20 20 runflag)..
43a0: 20 28 69 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 (if (not parent
43b0: 2d 74 65 73 74 29 0a 09 09 20 20 20 28 64 65 62 -test)... (deb
43c0: 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 ug:print 1 "NOTE
43d0: 3a 20 4e 6f 74 20 73 74 61 72 74 69 6e 67 20 74 : Not starting t
43e0: 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e est " new-test-n
43f0: 61 6d 65 20 22 20 61 73 20 69 74 20 69 73 20 73 ame " as it is s
4400: 74 61 74 65 20 5c 22 43 4f 4d 50 4c 45 54 45 44 tate \"COMPLETED
4410: 5c 22 20 61 6e 64 20 73 74 61 74 75 73 20 5c 22 \" and status \"
4420: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
4430: 75 73 20 74 65 73 74 64 61 74 29 20 22 5c 22 2c us testdat) "\",
4440: 20 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6f use -force to o
4450: 76 65 72 72 69 64 65 22 29 29 0a 09 20 20 20 20 verride"))..
4460: 20 20 20 28 6c 65 74 2a 20 28 28 67 65 74 2d 70 (let* ((get-p
4470: 72 65 72 65 71 73 2d 63 6d 64 20 28 6c 61 6d 62 rereqs-cmd (lamb
4480: 64 61 20 28 29 0a 09 09 09 09 09 20 28 64 62 2d da ()...... (db-
4490: 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d get-prereqs-not-
44a0: 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 20 77 61 met db run-id wa
44b0: 69 74 6f 6e 29 29 29 20 3b 3b 20 63 68 65 63 6b iton))) ;; check
44c0: 20 62 65 66 6f 72 65 20 72 75 6e 6e 69 6e 67 20 before running
44d0: 2e 2e 2e 2e 0a 09 09 20 20 20 20 20 20 28 6c 61 ....... (la
44e0: 75 6e 63 68 2d 63 6d 64 20 20 20 20 20 20 28 6c unch-cmd (l
44f0: 61 6d 62 64 61 20 28 29 0a 09 09 09 09 09 20 28 ambda ()...... (
4500: 6c 61 75 6e 63 68 2d 74 65 73 74 20 64 62 20 72 launch-test db r
4510: 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 un-id runname te
4520: 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 st-conf keyvalls
4530: 74 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 t test-name test
4540: 2d 70 61 74 68 20 69 74 65 6d 64 61 74 20 66 6c -path itemdat fl
4550: 61 67 73 29 29 29 0a 09 09 20 20 20 20 20 20 28 ags)))... (
4560: 74 65 73 74 72 75 6e 64 61 74 20 20 20 20 20 20 testrundat
4570: 28 6c 69 73 74 20 67 65 74 2d 70 72 65 72 65 71 (list get-prereq
4580: 73 2d 63 6d 64 20 6c 61 75 6e 63 68 2d 63 6d 64 s-cmd launch-cmd
4590: 29 29 29 0a 09 09 20 28 69 66 20 28 6f 72 20 66 )))... (if (or f
45a0: 6f 72 63 65 0a 09 09 09 20 28 6c 65 74 20 28 28 orce.... (let ((
45b0: 70 72 65 71 73 2d 6e 6f 74 2d 79 65 74 2d 6d 65 preqs-not-yet-me
45c0: 74 20 28 28 63 61 72 20 74 65 73 74 72 75 6e 64 t ((car testrund
45d0: 61 74 29 29 29 29 0a 09 09 09 20 20 20 28 64 65 at)))).... (de
45e0: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 50 72 65 bug:print 2 "Pre
45f0: 71 72 65 71 75 65 73 69 74 65 73 20 66 6f 72 20 qrequesites for
4600: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 3a 20 22 " test-name ": "
4610: 20 70 72 65 71 73 2d 6e 6f 74 2d 79 65 74 2d 6d preqs-not-yet-m
4620: 65 74 29 0a 09 09 09 20 20 20 28 6e 75 6c 6c 3f et).... (null?
4630: 20 70 72 65 71 73 2d 6e 6f 74 2d 79 65 74 2d 6d preqs-not-yet-m
4640: 65 74 29 29 29 20 3b 3b 20 61 72 65 20 74 68 65 et))) ;; are the
4650: 72 65 20 61 6e 79 20 74 65 73 74 73 20 74 68 61 re any tests tha
4660: 74 20 6d 75 73 74 20 62 65 20 72 75 6e 20 62 65 t must be run be
4670: 66 6f 72 65 20 74 68 69 73 20 6f 6e 65 2e 2e 2e fore this one...
4680: 0a 09 09 20 20 20 20 20 28 69 66 20 28 6e 6f 74 ... (if (not
4690: 20 28 28 63 61 64 72 20 74 65 73 74 72 75 6e 64 ((cadr testrund
46a0: 61 74 29 29 29 20 3b 3b 20 74 68 69 73 20 69 73 at))) ;; this is
46b0: 20 74 68 65 20 6c 69 6e 65 20 74 68 61 74 20 6c the line that l
46c0: 61 75 6e 63 68 65 73 20 74 68 65 20 74 65 73 74 aunches the test
46d0: 20 74 6f 20 74 68 65 20 72 65 6d 6f 74 65 20 68 to the remote h
46e0: 6f 73 74 0a 09 09 09 20 28 62 65 67 69 6e 0a 09 ost.... (begin..
46f0: 09 09 20 20 20 28 70 72 69 6e 74 20 22 45 52 52 .. (print "ERR
4700: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 OR: Failed to la
4710: 75 6e 63 68 20 74 68 65 20 74 65 73 74 2e 20 45 unch the test. E
4720: 78 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 xiting as soon a
4730: 73 20 70 6f 73 73 69 62 6c 65 22 29 0a 09 09 09 s possible")....
4740: 20 20 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c (set! *global
4750: 65 78 69 74 73 74 61 74 75 73 2a 20 31 29 20 3b exitstatus* 1) ;
4760: 3b 20 0a 09 09 09 20 20 20 28 70 72 6f 63 65 73 ; .... (proces
4770: 73 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 65 6e s-signal (curren
4780: 74 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 73 69 t-process-id) si
4790: 67 6e 61 6c 2f 6b 69 6c 6c 29 0a 09 09 09 09 09 gnal/kill)......
47a0: 3b 28 65 78 69 74 20 31 29 0a 09 09 09 20 20 20 ;(exit 1)....
47b0: 29 29 0a 09 09 20 20 20 20 20 28 69 66 20 28 6e ))... (if (n
47c0: 6f 74 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 09 ot keepgoing)...
47d0: 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 . (hash-table-se
47e0: 74 21 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 t! *waiting-queu
47f0: 65 2a 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 e* new-test-name
4800: 20 74 65 73 74 72 75 6e 64 61 74 29 29 29 29 29 testrundat)))))
4810: 29 29 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a 09 ))..((KILLED) ..
4820: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
4830: 22 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 73 "NOTE: " new-tes
4840: 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 t-name " is alre
4850: 61 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 77 ady running or w
4860: 61 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 6c as explictly kil
4870: 6c 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 20 led, use -force
4880: 74 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 29 to launch it."))
4890: 0a 09 28 28 4c 41 55 4e 43 48 45 44 20 52 45 4d ..((LAUNCHED REM
48a0: 4f 54 45 48 4f 53 54 53 54 41 52 54 20 52 55 4e OTEHOSTSTART RUN
48b0: 4e 49 4e 47 29 20 20 0a 09 20 28 69 66 20 28 3e NING) .. (if (>
48c0: 20 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 65 63 (- (current-sec
48d0: 6f 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 73 74 onds)(+ (db:test
48e0: 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65 20 -get-event_time
48f0: 74 65 73 74 64 61 74 29 0a 09 09 09 09 20 20 20 testdat).....
4900: 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 (db:test-get
4910: 2d 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74 65 -run_duration te
4920: 73 74 64 61 74 29 29 29 0a 09 09 36 30 30 29 20 stdat)))...600)
4930: 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 74 ;; i.e. no updat
4940: 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e 20 e for more than
4950: 36 30 30 20 73 65 63 6f 6e 64 73 0a 09 20 20 20 600 seconds..
4960: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 (begin..
4970: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
4980: 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 22 "WARNING: Test "
4990: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 70 test-name " app
49a0: 65 61 72 73 20 74 6f 20 62 65 20 64 65 61 64 2e ears to be dead.
49b0: 20 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 73 Forcing it to s
49c0: 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 20 tate INCOMPLETE
49d0: 61 6e 64 20 73 74 61 74 75 73 20 53 54 55 43 4b and status STUCK
49e0: 2f 44 45 41 44 22 29 0a 09 20 20 20 20 20 20 20 /DEAD")..
49f0: 28 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 (test-set-status
4a00: 21 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 ! db run-id test
4a10: 2d 6e 61 6d 65 20 22 49 4e 43 4f 4d 50 4c 45 54 -name "INCOMPLET
4a20: 45 22 20 22 53 54 55 43 4b 2f 44 45 41 44 22 20 E" "STUCK/DEAD"
4a30: 69 74 65 6d 64 61 74 20 22 54 65 73 74 20 69 73 itemdat "Test is
4a40: 20 73 74 75 63 6b 20 6f 72 20 64 65 61 64 22 20 stuck or dead"
4a50: 23 66 29 29 0a 09 20 20 20 20 20 28 64 65 62 75 #f)).. (debu
4a60: 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a g:print 2 "NOTE:
4a70: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 " test-name " i
4a80: 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e s already runnin
4a90: 67 22 29 29 29 0a 09 28 65 6c 73 65 20 20 20 20 g")))..(else
4aa0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
4ab0: 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 0 "ERROR: Failed
4ac0: 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 20 to launch test
4ad0: 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 " new-test-name
4ae0: 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73 65 64 20 ". Unrecognised
4af0: 73 74 61 74 65 20 22 20 28 74 65 73 74 3a 67 65 state " (test:ge
4b00: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 t-state testdat)
4b10: 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d ))))))..;;======
4b20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4b30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4b40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4b60: 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20 53 .;; END OF NEW S
4b70: 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d TUFF.;;=========
4b80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4b90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4ba0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4bb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 =============..(
4bc0: 64 65 66 69 6e 65 20 28 67 65 74 2d 64 69 72 2d define (get-dir-
4bd0: 75 70 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 6d up-n dir . param
4be0: 73 29 20 0a 20 20 28 6c 65 74 20 28 28 64 70 61 s) . (let ((dpa
4bf0: 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c rts (string-spl
4c00: 69 74 20 64 69 72 20 22 2f 22 29 29 0a 09 28 63 it dir "/"))..(c
4c10: 6f 75 6e 74 20 20 20 28 69 66 20 28 6e 75 6c 6c ount (if (null
4c20: 3f 20 70 61 72 61 6d 73 29 20 31 20 28 63 61 72 ? params) 1 (car
4c30: 20 70 61 72 61 6d 73 29 29 29 29 0a 20 20 20 20 params)))).
4c40: 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e (conc "/" (strin
4c50: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 g-intersperse ..
4c60: 20 20 20 20 20 20 20 28 74 61 6b 65 20 64 70 61 (take dpa
4c70: 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 rts (- (length d
4c80: 70 61 72 74 73 29 20 63 6f 75 6e 74 29 29 0a 09 parts) count))..
4c90: 20 20 20 20 20 20 20 22 2f 22 29 29 29 29 0a 3b "/")))).;
4ca0: 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b ; Remove runs.;;
4cb0: 20 66 69 65 6c 64 73 20 61 72 65 20 70 61 73 73 fields are pass
4cc0: 69 6e 67 20 69 6e 20 74 68 72 6f 75 67 68 20 0a ing in through .
4cd0: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 65 (define (runs:re
4ce0: 6d 6f 76 65 2d 72 75 6e 73 20 64 62 20 72 75 6e move-runs db run
4cf0: 6e 61 6d 65 70 61 74 74 20 74 65 73 74 70 61 74 namepatt testpat
4d00: 74 20 69 74 65 6d 70 61 74 74 29 0a 20 20 28 6c t itempatt). (l
4d10: 65 74 2a 20 28 28 6b 65 79 73 20 20 20 20 20 20 et* ((keys
4d20: 20 20 28 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 (db-get-keys d
4d30: 62 29 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 b)).. (rundat
4d40: 20 20 20 28 72 75 6e 73 3a 67 65 74 2d 72 75 6e (runs:get-run
4d50: 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 s-by-patt db key
4d60: 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a s runnamepatt)).
4d70: 09 20 28 68 65 61 64 65 72 20 20 20 20 20 20 28 . (header (
4d80: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 vector-ref runda
4d90: 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20 t 0)).. (runs
4da0: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 (vector-ref
4db0: 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20 20 20 rundat 1))).
4dc0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
4dd0: 22 48 65 61 64 65 72 3a 20 22 20 68 65 61 64 65 "Header: " heade
4de0: 72 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 r). (for-each
4df0: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 . (lambda (r
4e00: 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 un). (let
4e10: 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 ((runkey (string
4e20: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 -intersperse (ma
4e30: 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 p (lambda (k)...
4e40: 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 ....(db:get-valu
4e50: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
4e60: 68 65 61 64 65 72 20 28 76 65 63 74 6f 72 2d 72 header (vector-r
4e70: 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73 29 20 ef k 0))) keys)
4e80: 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64 69 72 "/")).. (dir
4e90: 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b s-to-remove (mak
4ea0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a e-hash-table))).
4eb0: 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 . (let* ((run-id
4ec0: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 (db:get-value-b
4ed0: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 y-header run hea
4ee0: 64 65 72 20 22 69 64 22 29 20 29 0a 09 09 28 74 der "id") )...(t
4ef0: 65 73 74 73 20 20 28 64 62 2d 67 65 74 2d 74 65 ests (db-get-te
4f00: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 sts-for-run db (
4f10: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
4f20: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
4f30: 72 20 22 69 64 22 29 20 74 65 73 74 70 61 74 74 r "id") testpatt
4f40: 20 69 74 65 6d 70 61 74 74 20 27 28 29 20 27 28 itempatt '() '(
4f50: 29 29 29 0a 09 09 28 6c 61 73 74 74 70 61 74 68 )))...(lasttpath
4f60: 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 "/does/not/exis
4f70: 74 2f 49 2f 68 6f 70 65 22 29 29 0a 0a 09 20 20 t/I/hope"))...
4f80: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (if (not (null?
4f90: 20 74 65 73 74 73 29 29 0a 09 20 20 20 20 20 20 tests))..
4fa0: 20 28 62 65 67 69 6e 0a 09 09 20 28 64 65 62 75 (begin... (debu
4fb0: 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 g:print 1 "Remov
4fc0: 69 6e 67 20 74 65 73 74 73 20 66 6f 72 20 72 75 ing tests for ru
4fd0: 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 n: " runkey " "
4fe0: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 (db:get-value-by
4ff0: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 -header run head
5000: 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 0a 09 er "runname"))..
5010: 09 20 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 . (for-each...
5020: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 (lambda (test)..
5030: 09 20 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 . (let* ((ite
5040: 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d m-path (db:test-
5050: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 get-item-path te
5060: 73 74 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 st)).... (test
5070: 2d 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 -name (db:test-g
5080: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 et-testname test
5090: 29 29 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 69 )).... (run-di
50a0: 72 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 r (db:test-get
50b0: 2d 72 75 6e 64 69 72 20 74 65 73 74 29 29 29 0a -rundir test))).
50c0: 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 .. (debug:p
50d0: 72 69 6e 74 20 31 20 22 20 20 22 20 28 64 62 3a rint 1 " " (db:
50e0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
50f0: 65 20 74 65 73 74 29 20 22 20 69 64 3a 20 22 20 e test) " id: "
5100: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
5110: 74 65 73 74 29 20 22 20 22 20 69 74 65 6d 2d 70 test) " " item-p
5120: 61 74 68 29 0a 09 09 20 20 20 20 20 20 28 64 62 ath)... (db
5130: 3a 64 65 6c 65 74 65 2d 74 65 73 74 2d 72 65 63 :delete-test-rec
5140: 6f 72 64 73 20 64 62 20 28 64 62 3a 74 65 73 74 ords db (db:test
5150: 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29 0a 09 -get-id test))..
5160: 09 20 20 20 20 20 20 28 69 66 20 28 3e 20 28 73 . (if (> (s
5170: 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 72 75 6e tring-length run
5180: 2d 64 69 72 29 20 35 29 20 3b 3b 20 62 61 64 20 -dir) 5) ;; bad
5190: 68 65 75 72 69 73 74 69 63 20 62 75 74 20 73 68 heuristic but sh
51a0: 6f 75 6c 64 20 70 72 65 76 65 6e 74 20 2f 74 6d ould prevent /tm
51b0: 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09 09 p /home etc.....
51c0: 20 20 28 6c 65 74 20 28 28 66 75 6c 6c 70 61 74 (let ((fullpat
51d0: 68 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 22 h run-dir)) ;; "
51e0: 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d /" (db:test-get-
51f0: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 item-path test))
5200: 29 29 0a 09 09 09 20 20 20 20 28 73 65 74 21 20 )).... (set!
5210: 6c 61 73 74 74 70 61 74 68 20 66 75 6c 6c 70 61 lasttpath fullpa
5220: 74 68 29 0a 09 09 09 20 20 20 20 28 68 61 73 68 th).... (hash
5230: 2d 74 61 62 6c 65 2d 73 65 74 21 20 64 69 72 73 -table-set! dirs
5240: 2d 74 6f 2d 72 65 6d 6f 76 65 20 66 75 6c 6c 70 -to-remove fullp
5250: 61 74 68 20 23 74 29 0a 09 09 09 20 20 20 20 3b ath #t).... ;
5260: 3b 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 ; The following
5270: 77 61 73 20 74 68 65 20 73 61 66 65 20 64 65 6c was the safe del
5280: 65 74 65 20 63 6f 64 65 20 62 75 74 20 69 74 20 ete code but it
5290: 77 61 73 20 6e 6f 74 20 62 65 69 6e 67 20 65 78 was not being ex
52a0: 65 63 74 75 74 65 64 2e 0a 09 09 09 20 20 20 20 ectuted.....
52b0: 3b 3b 20 28 6c 65 74 2a 20 28 28 64 69 72 73 2d ;; (let* ((dirs-
52c0: 63 6f 75 6e 74 20 28 2b 20 31 20 28 6c 65 6e 67 count (+ 1 (leng
52d0: 74 68 20 6b 65 79 73 29 28 6c 65 6e 67 74 68 20 th keys)(length
52e0: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 69 74 (string-split it
52f0: 65 6d 2d 70 61 74 68 20 22 2f 22 29 29 29 29 0a em-path "/")))).
5300: 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 ... ;;
5310: 20 28 64 69 72 2d 74 6f 2d 72 65 6d 20 28 67 65 (dir-to-rem (ge
5320: 74 2d 64 69 72 2d 75 70 2d 6e 20 66 75 6c 6c 70 t-dir-up-n fullp
5330: 61 74 68 20 64 69 72 73 2d 63 6f 75 6e 74 29 29 ath dirs-count))
5340: 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 .... ;;
5350: 20 20 28 72 65 6d 61 69 6e 69 6e 67 64 20 28 73 (remainingd (s
5360: 74 72 69 6e 67 2d 73 75 62 73 74 69 74 75 74 65 tring-substitute
5370: 20 28 72 65 67 65 78 70 20 28 63 6f 6e 63 20 22 (regexp (conc "
5380: 5e 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 2f ^" dir-to-rem "/
5390: 22 29 29 20 22 22 20 66 75 6c 6c 70 61 74 68 29 ")) "" fullpath)
53a0: 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 ).... ;;
53b0: 20 20 20 28 63 6d 64 20 28 63 6f 6e 63 20 22 63 (cmd (conc "c
53c0: 64 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 d " dir-to-rem "
53d0: 3b 20 72 6d 64 69 72 20 2d 70 20 22 20 72 65 6d ; rmdir -p " rem
53e0: 61 69 6e 69 6e 67 64 20 29 29 29 0a 09 09 09 20 ainingd )))....
53f0: 20 20 20 3b 3b 20 20 20 28 69 66 20 28 66 69 6c ;; (if (fil
5400: 65 2d 65 78 69 73 74 73 3f 20 66 75 6c 6c 70 61 e-exists? fullpa
5410: 74 68 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 th).... ;;
5420: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 (begin....
5430: 20 20 3b 3b 20 20 20 20 20 20 20 20 20 28 64 65 ;; (de
5440: 62 75 67 3a 70 72 69 6e 74 20 31 20 63 6d 64 29 bug:print 1 cmd)
5450: 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 .... ;;
5460: 20 20 20 28 73 79 73 74 65 6d 20 63 6d 64 29 29 (system cmd))
5470: 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 29 29 ).... ;; ))
5480: 0a 09 09 09 20 20 20 20 29 29 29 29 0a 09 09 20 .... ))))...
5490: 20 20 20 74 65 73 74 73 29 29 29 0a 0a 09 20 20 tests)))...
54a0: 20 3b 3b 20 6c 6f 6f 6b 20 74 68 6f 75 67 68 20 ;; look though
54b0: 74 68 65 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f the dirs-to-remo
54c0: 76 65 20 66 6f 72 20 63 61 6e 64 69 64 61 74 65 ve for candidate
54d0: 73 20 66 6f 72 20 72 65 6d 6f 76 61 6c 2e 20 44 s for removal. D
54e0: 6f 20 74 68 69 73 20 61 66 74 65 72 20 64 65 6c o this after del
54f0: 65 74 69 6e 67 20 74 68 65 20 72 65 63 6f 72 64 eting the record
5500: 73 0a 09 20 20 20 3b 3b 20 66 6f 72 20 65 61 63 s.. ;; for eac
5510: 68 20 74 65 73 74 20 69 6e 20 63 61 73 65 20 77 h test in case w
5520: 65 20 67 65 74 20 6b 69 6c 6c 65 64 2e 20 54 68 e get killed. Th
5530: 61 74 20 73 68 6f 75 6c 64 20 6d 69 6e 69 6d 69 at should minimi
5540: 7a 65 20 74 68 65 20 64 65 74 72 69 74 75 73 20 ze the detritus
5550: 6c 65 66 74 20 6f 6e 20 64 69 73 6b 0a 09 20 20 left on disk..
5560: 20 3b 3b 20 70 72 6f 63 65 73 73 20 74 68 65 20 ;; process the
5570: 64 69 72 73 20 66 72 6f 6d 20 6c 6f 6e 67 65 73 dirs from longes
5580: 74 20 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 t string length
5590: 74 6f 20 73 68 6f 72 74 65 73 74 0a 09 20 20 20 to shortest..
55a0: 28 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 20 (for-each ..
55b0: 28 6c 61 6d 62 64 61 20 28 64 69 72 2d 74 6f 2d (lambda (dir-to-
55c0: 72 65 6d 6f 76 65 29 0a 09 20 20 20 20 20 20 28 remove).. (
55d0: 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f if (file-exists?
55e0: 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a dir-to-remove).
55f0: 09 09 20 20 28 6c 65 74 20 28 28 64 69 72 2d 69 .. (let ((dir-i
5600: 6e 2d 64 62 20 27 28 29 29 29 0a 09 09 20 20 20 n-db '()))...
5610: 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 (sqlite3:for-ea
5620: 63 68 2d 72 6f 77 0a 09 09 20 20 20 20 20 28 6c ch-row... (l
5630: 61 6d 62 64 61 20 28 64 69 72 29 0a 09 09 20 20 ambda (dir)...
5640: 20 20 20 20 20 28 73 65 74 21 20 64 69 72 2d 69 (set! dir-i
5650: 6e 2d 64 62 20 28 63 6f 6e 73 20 64 69 72 20 64 n-db (cons dir d
5660: 69 72 2d 69 6e 2d 64 62 29 29 29 0a 09 09 20 20 ir-in-db)))...
5670: 20 20 20 64 62 20 22 53 45 4c 45 43 54 20 72 75 db "SELECT ru
5680: 6e 64 69 72 20 46 52 4f 4d 20 74 65 73 74 73 20 ndir FROM tests
5690: 57 48 45 52 45 20 72 75 6e 64 69 72 20 4c 49 4b WHERE rundir LIK
56a0: 45 20 3f 3b 22 20 0a 09 09 20 20 20 20 20 28 63 E ?;" ... (c
56b0: 6f 6e 63 20 22 25 22 20 64 69 72 2d 74 6f 2d 72 onc "%" dir-to-r
56c0: 65 6d 6f 76 65 20 22 25 22 29 29 20 3b 3b 20 79 emove "%")) ;; y
56d0: 65 73 2c 20 49 27 6d 20 67 6f 69 6e 67 20 74 6f es, I'm going to
56e0: 20 62 61 69 6c 20 69 66 20 74 68 65 72 65 20 69 bail if there i
56f0: 73 20 61 6e 79 74 68 69 6e 67 20 6c 69 6b 65 20 s anything like
5700: 74 68 69 73 20 64 69 72 20 69 6e 20 74 68 65 20 this dir in the
5710: 64 62 0a 09 09 20 20 20 20 28 69 66 20 28 6e 75 db... (if (nu
5720: 6c 6c 3f 20 64 69 72 2d 69 6e 2d 64 62 29 0a 09 ll? dir-in-db)..
5730: 09 09 28 62 65 67 69 6e 0a 09 09 09 20 20 28 64 ..(begin.... (d
5740: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 52 65 ebug:print 2 "Re
5750: 6d 6f 76 69 6e 67 20 64 69 72 65 63 74 6f 72 79 moving directory
5760: 20 77 69 74 68 20 7a 65 72 6f 20 64 62 20 72 65 with zero db re
5770: 66 65 72 65 6e 63 65 73 3a 20 22 20 64 69 72 2d ferences: " dir-
5780: 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 09 09 20 20 to-remove)....
5790: 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 (system (conc "r
57a0: 6d 20 2d 72 66 20 22 20 64 69 72 2d 74 6f 2d 72 m -rf " dir-to-r
57b0: 65 6d 6f 76 65 29 29 0a 09 09 09 20 20 28 68 61 emove)).... (ha
57c0: 73 68 2d 74 61 62 6c 65 2d 64 65 6c 65 74 65 21 sh-table-delete!
57d0: 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 dirs-to-remove
57e0: 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 29 0a dir-to-remove)).
57f0: 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 ...(debug:print
5800: 32 20 22 53 6b 69 70 70 69 6e 67 20 72 65 6d 6f 2 "Skipping remo
5810: 76 61 6c 20 6f 66 20 22 20 64 69 72 2d 74 6f 2d val of " dir-to-
5820: 72 65 6d 6f 76 65 20 22 20 66 6f 72 20 6e 6f 77 remove " for now
5830: 20 61 73 20 69 74 20 73 74 69 6c 6c 20 68 61 73 as it still has
5840: 20 72 65 66 65 72 65 6e 63 65 73 20 69 6e 20 74 references in t
5850: 68 65 20 64 61 74 61 62 61 73 65 22 29 29 29 29 he database"))))
5860: 29 0a 09 20 20 20 20 28 73 6f 72 74 20 28 68 61 ).. (sort (ha
5870: 73 68 2d 74 61 62 6c 65 2d 6b 65 79 73 20 64 69 sh-table-keys di
5880: 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 29 20 28 6c rs-to-remove) (l
5890: 61 6d 62 64 61 20 28 61 20 62 29 28 3e 20 28 73 ambda (a b)(> (s
58a0: 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 61 29 28 tring-length a)(
58b0: 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 62 29 string-length b)
58c0: 29 29 29 29 0a 0a 09 20 20 20 3b 3b 20 72 65 6d ))))... ;; rem
58d0: 6f 76 65 20 74 68 65 20 72 75 6e 20 69 66 20 7a ove the run if z
58e0: 65 72 6f 20 74 65 73 74 73 20 72 65 6d 61 69 6e ero tests remain
58f0: 0a 09 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 .. (let ((remt
5900: 65 73 74 73 20 28 64 62 2d 67 65 74 2d 74 65 73 ests (db-get-tes
5910: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 ts-for-run db (d
5920: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 b:get-value-by-h
5930: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 eader run header
5940: 20 22 69 64 22 29 20 23 66 20 23 66 20 27 28 29 "id") #f #f '()
5950: 20 27 28 29 29 29 29 0a 09 20 20 20 20 20 28 69 '()))).. (i
5960: 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 f (null? remtest
5970: 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 s) ;; no more te
5980: 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 sts remaining...
5990: 20 28 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 (let* ((dparts
59a0: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c (string-split l
59b0: 61 73 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 asttpath "/"))..
59c0: 09 09 28 72 75 6e 70 61 74 68 20 28 63 6f 6e 63 ..(runpath (conc
59d0: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 "/" (string-int
59e0: 65 72 73 70 65 72 73 65 20 0a 09 09 09 09 09 20 ersperse ......
59f0: 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 (take dparts
5a00: 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 (- (length dpart
5a10: 73 29 20 31 29 29 0a 09 09 09 09 09 20 20 20 20 s) 1))......
5a20: 22 2f 22 29 29 29 29 0a 09 09 20 20 20 28 64 65 "/"))))... (de
5a30: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d bug:print 1 "Rem
5a40: 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e oving run: " run
5a50: 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d key " " (db:get-
5a60: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 value-by-header
5a70: 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e run header "runn
5a80: 61 6d 65 22 29 29 0a 09 09 20 20 20 28 64 62 3a ame"))... (db:
5a90: 64 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 delete-run db ru
5aa0: 6e 2d 69 64 29 0a 09 09 20 20 20 3b 3b 20 6e 65 n-id)... ;; ne
5ab0: 65 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74 ed to figure out
5ac0: 20 74 68 65 20 70 61 74 68 20 74 6f 20 74 68 65 the path to the
5ad0: 20 72 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d run dir and rem
5ae0: 6f 76 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a ove it if empty.
5af0: 09 09 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28 .. ;; (if (
5b00: 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e null? (glob (con
5b10: 63 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 c runpath "/*"))
5b20: 29 0a 09 09 20 20 20 3b 3b 20 20 20 20 20 20 20 )... ;;
5b30: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 3b 3b 20 (begin... ;;
5b40: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 . (debug:print 1
5b50: 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 "Removing run d
5b60: 69 72 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09 ir " runpath)...
5b70: 20 20 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 ;; . (system
5b80: 28 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 (conc "rmdir -p
5b90: 22 20 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09 " runpath))))...
5ba0: 20 20 20 29 29 29 29 0a 09 20 29 29 0a 20 20 20 )))).. )).
5bb0: 20 20 72 75 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d runs)))..;;===
5bc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5bd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5be0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5bf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5c00: 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 ===.;; Routines
5c10: 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 for manipulating
5c20: 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d runs.;;========
5c30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5c40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5c50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5c60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a ==============..
5c70: 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 ;; Since many ca
5c80: 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71 lls to a run req
5c90: 75 69 72 65 20 70 72 65 74 74 79 20 6d 75 63 68 uire pretty much
5ca0: 20 74 68 65 20 73 61 6d 65 20 73 65 74 75 70 20 the same setup
5cb0: 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 70 65 72 .;; this wrapper
5cc0: 20 69 73 20 75 73 65 64 20 74 6f 20 72 65 64 75 is used to redu
5cd0: 63 65 20 74 68 65 20 72 65 70 6c 69 63 61 74 69 ce the replicati
5ce0: 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 on of code.(defi
5cf0: 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d ne (general-run-
5d00: 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 call switchname
5d10: 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 action-desc proc
5d20: 29 0a 20 20 28 69 66 20 28 6e 6f 74 20 28 61 72 ). (if (not (ar
5d30: 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72 75 6e gs:get-arg ":run
5d40: 6e 61 6d 65 22 29 29 0a 20 20 20 20 20 20 28 62 name")). (b
5d50: 65 67 69 6e 0a 09 28 64 65 62 75 67 3a 70 72 69 egin..(debug:pri
5d60: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 nt 0 "ERROR: Mis
5d70: 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 sing required pa
5d80: 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 rameter for " sw
5d90: 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 itchname ", you
5da0: 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65 must specify the
5db0: 20 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a run name with :
5dc0: 72 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 runname runname"
5dd0: 29 0a 09 28 65 78 69 74 20 32 29 29 0a 20 20 20 )..(exit 2)).
5de0: 20 20 20 28 6c 65 74 20 28 28 64 62 20 20 20 23 (let ((db #
5df0: 66 29 0a 09 20 20 20 20 28 6b 65 79 73 20 23 66 f).. (keys #f
5e00: 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 65 ))..(if (not (se
5e10: 74 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 tup-for-run))..
5e20: 20 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 20 (begin ..
5e30: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
5e40: 20 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74 75 "Failed to setu
5e50: 70 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20 20 p, exiting")..
5e60: 20 20 20 20 28 65 78 69 74 20 31 29 29 29 0a 09 (exit 1)))..
5e70: 28 73 65 74 21 20 64 62 20 20 20 28 6f 70 65 6e (set! db (open
5e80: 2d 64 62 29 29 0a 09 28 73 65 74 21 20 6b 65 79 -db))..(set! key
5e90: 73 20 28 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 s (db-get-keys d
5ea0: 62 29 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f b))..;; have eno
5eb0: 75 67 68 20 74 6f 20 70 72 6f 63 65 73 73 20 2d ugh to process -
5ec0: 74 61 72 67 65 74 20 6f 72 20 2d 72 65 71 74 61 target or -reqta
5ed0: 72 67 20 68 65 72 65 0a 09 28 69 66 20 28 61 72 rg here..(if (ar
5ee0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 gs:get-arg "-req
5ef0: 74 61 72 67 22 29 0a 09 20 20 20 20 28 6c 65 74 targ").. (let
5f00: 2a 20 28 28 72 75 6e 63 6f 6e 66 69 67 66 20 28 * ((runconfigf (
5f10: 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 conc *toppath*
5f20: 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e "/runconfigs.con
5f30: 66 69 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 fig")) ;; DO NOT
5f40: 20 45 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09 EVALUATE ALL ..
5f50: 09 20 20 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 . (runconfig
5f60: 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e (read-config run
5f70: 63 6f 6e 66 69 67 66 20 23 66 20 23 66 20 65 6e configf #f #f en
5f80: 76 69 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29 viron-patt: #f))
5f90: 29 20 0a 09 20 20 20 20 20 20 28 69 66 20 28 68 ) .. (if (h
5fa0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
5fb0: 66 61 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20 fault runconfig
5fc0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
5fd0: 72 65 71 74 61 72 67 22 29 20 23 66 29 0a 09 09 reqtarg") #f)...
5fe0: 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 (keys:target-s
5ff0: 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 et-args keys (ar
6000: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 gs:get-arg "-req
6010: 74 61 72 67 22 29 20 61 72 67 73 3a 61 72 67 2d targ") args:arg-
6020: 68 61 73 68 29 0a 09 09 20 20 28 62 65 67 69 6e hash)... (begin
6030: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 ... (debug:pr
6040: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 5b 22 int 0 "ERROR: ["
6050: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6060: 2d 72 65 71 74 61 72 67 22 29 20 22 5d 20 6e 6f -reqtarg") "] no
6070: 74 20 66 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e t found in " run
6080: 63 6f 6e 66 69 67 66 29 0a 09 09 20 20 20 20 28 configf)... (
6090: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 sqlite3:finalize
60a0: 21 20 64 62 29 0a 09 09 20 20 20 20 28 65 78 69 ! db)... (exi
60b0: 74 20 31 29 29 29 29 0a 09 20 20 20 20 28 69 66 t 1)))).. (if
60c0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
60d0: 2d 74 61 72 67 65 74 22 29 0a 09 09 28 6b 65 79 -target")...(key
60e0: 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 s:target-set-arg
60f0: 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 s keys (args:get
6100: 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 20 61 -arg "-target" a
6110: 72 67 73 3a 61 72 67 2d 68 61 73 68 29 20 61 72 rgs:arg-hash) ar
6120: 67 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a 09 gs:arg-hash)))..
6130: 28 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 (if (not (car *c
6140: 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 onfiginfo*))..
6150: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 (begin..
6160: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
6170: 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 ERROR: Attempted
6180: 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 to " action-des
6190: 63 20 22 20 62 75 74 20 72 75 6e 20 61 72 65 61 c " but run area
61a0: 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 config file not
61b0: 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 20 found")..
61c0: 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 3b (exit 1)).. ;
61d0: 3b 20 45 78 74 72 61 63 74 20 6f 75 74 20 73 74 ; Extract out st
61e0: 75 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f uff needed in mo
61f0: 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 st or many calls
6200: 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74 68 .. ;; here th
6210: 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 en call proc..
6220: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d (let* ((keynam
6230: 65 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 es (map key:ge
6240: 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 t-fieldname keys
6250: 29 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c 6c ))... (keyvall
6260: 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 st (keys->valli
6270: 73 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09 20 st keys #t)))..
6280: 20 20 20 20 20 28 70 72 6f 63 20 64 62 20 6b 65 (proc db ke
6290: 79 73 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 ys keynames keyv
62a0: 61 6c 6c 73 74 29 29 29 0a 09 28 73 71 6c 69 74 allst)))..(sqlit
62b0: 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 e3:finalize! db)
62c0: 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f 6d 65 ..(set! *didsome
62d0: 74 68 69 6e 67 2a 20 23 74 29 29 29 29 0a 0a 3b thing* #t))))..;
62e0: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;===============
62f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6300: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6310: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6320: 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 =======.;; Rollu
6330: 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d p runs.;;=======
6340: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6350: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6360: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6370: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a ===============.
6380: 0a 3b 3b 20 55 70 64 61 74 65 20 74 68 65 20 74 .;; Update the t
6390: 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 66 est_meta table f
63a0: 6f 72 20 74 68 69 73 20 74 65 73 74 0a 28 64 65 or this test.(de
63b0: 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 fine (runs:updat
63c0: 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 e-test_meta db t
63d0: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f est-name test-co
63e0: 6e 66 29 0a 20 20 28 6c 65 74 20 28 28 63 75 72 nf). (let ((cur
63f0: 72 72 65 63 6f 72 64 20 28 64 62 3a 74 65 73 74 rrecord (db:test
6400: 6d 65 74 61 2d 67 65 74 2d 72 65 63 6f 72 64 20 meta-get-record
6410: 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a db test-name))).
6420: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 63 75 72 (if (not cur
6430: 72 72 65 63 6f 72 64 29 0a 09 28 62 65 67 69 6e rrecord)..(begin
6440: 0a 09 20 20 28 73 65 74 21 20 63 75 72 72 72 65 .. (set! currre
6450: 63 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63 74 6f cord (make-vecto
6460: 72 20 31 30 20 23 66 29 29 0a 09 20 20 28 64 62 r 10 #f)).. (db
6470: 3a 74 65 73 74 6d 65 74 61 2d 61 64 64 2d 72 65 :testmeta-add-re
6480: 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d cord db test-nam
6490: 65 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 e))). (for-ea
64a0: 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 ch . (lambda
64b0: 20 28 6b 65 79 29 0a 20 20 20 20 20 20 20 28 6c (key). (l
64c0: 65 74 2a 20 28 28 69 64 78 20 28 63 61 64 72 20 et* ((idx (cadr
64d0: 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 66 6c key)).. (fl
64e0: 64 20 28 63 61 72 20 20 6b 65 79 29 29 0a 09 20 d (car key))..
64f0: 20 20 20 20 20 28 76 61 6c 20 28 63 6f 6e 66 69 (val (confi
6500: 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f g-lookup test-co
6510: 6e 66 20 22 74 65 73 74 5f 6d 65 74 61 22 20 66 nf "test_meta" f
6520: 6c 64 29 29 29 0a 09 20 28 69 66 20 28 61 6e 64 ld))).. (if (and
6530: 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 75 61 6c val (not (equal
6540: 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 20 63 75 ? (vector-ref cu
6550: 72 72 72 65 63 6f 72 64 20 69 64 78 29 20 76 61 rrrecord idx) va
6560: 6c 29 29 29 0a 09 20 20 20 20 20 28 62 65 67 69 l))).. (begi
6570: 6e 0a 09 20 20 20 20 20 20 20 28 70 72 69 6e 74 n.. (print
6580: 20 22 55 70 64 61 74 69 6e 67 20 22 20 74 65 73 "Updating " tes
6590: 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64 20 22 t-name " " fld "
65a0: 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 20 20 20 to " val)..
65b0: 20 20 20 28 64 62 3a 74 65 73 74 6d 65 74 61 2d (db:testmeta-
65c0: 75 70 64 61 74 65 2d 66 69 65 6c 64 20 64 62 20 update-field db
65d0: 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76 61 test-name fld va
65e0: 6c 29 29 29 29 29 0a 20 20 20 20 20 27 28 28 22 l))))). '(("
65f0: 61 75 74 68 6f 72 22 20 32 29 28 22 6f 77 6e 65 author" 2)("owne
6600: 72 22 20 33 29 28 22 64 65 73 63 72 69 70 74 69 r" 3)("descripti
6610: 6f 6e 22 20 34 29 28 22 72 65 76 69 65 77 65 64 on" 4)("reviewed
6620: 22 20 35 29 28 22 74 61 67 73 22 20 39 29 29 29 " 5)("tags" 9)))
6630: 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 65 ))..;; Update te
6640: 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c 20 st_meta for all
6650: 74 65 73 74 73 0a 28 64 65 66 69 6e 65 20 28 72 tests.(define (r
6660: 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d 74 uns:update-all-t
6670: 65 73 74 5f 6d 65 74 61 20 64 62 29 0a 20 20 28 est_meta db). (
6680: 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 73 let ((test-names
6690: 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d (get-all-legal-
66a0: 74 65 73 74 73 29 29 29 0a 20 20 20 20 28 66 6f tests))). (fo
66b0: 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 r-each . (la
66c0: 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65 29 mbda (test-name)
66d0: 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 . (let* ((
66e0: 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f test-path (co
66f0: 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 nc *toppath* "/t
6700: 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 ests/" test-name
6710: 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d )).. (test-
6720: 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 65 configf (conc te
6730: 73 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63 6f st-path "/testco
6740: 6e 66 69 67 22 29 29 0a 09 20 20 20 20 20 20 28 nfig")).. (
6750: 74 65 73 74 65 78 69 73 74 73 20 20 20 28 61 6e testexists (an
6760: 64 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 d (file-exists?
6770: 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 66 69 test-configf)(fi
6780: 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 73 3f 20 le-read-access?
6790: 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 29 0a test-configf))).
67a0: 09 20 20 20 20 20 20 3b 3b 20 72 65 61 64 20 63 . ;; read c
67b0: 6f 6e 66 69 67 73 20 77 69 74 68 20 74 72 69 63 onfigs with tric
67c0: 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 20 28 69 ks turned off (i
67d0: 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a 09 .e. no system)..
67e0: 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 (test-conf
67f0: 20 20 20 20 28 69 66 20 74 65 73 74 65 78 69 73 (if testexis
6800: 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 ts (read-config
6810: 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 66 20 test-configf #f
6820: 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 #f)(make-hash-ta
6830: 62 6c 65 29 29 29 29 0a 09 20 28 72 75 6e 73 3a ble)))).. (runs:
6840: 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 update-test_meta
6850: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 db test-name te
6860: 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 20 st-conf))).
6870: 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b test-names)))..;
6880: 3b 20 54 68 69 73 20 63 6f 75 6c 64 20 70 72 6f ; This could pro
6890: 62 61 62 6c 79 20 62 65 20 72 65 66 61 63 74 6f bably be refacto
68a0: 72 65 64 20 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d red into one com
68b0: 70 6c 65 78 20 71 75 65 72 79 20 2e 2e 2e 0a 28 plex query ....(
68c0: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 6f 6c define (runs:rol
68d0: 6c 75 70 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 lup-run db keys
68e0: 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d keyvallst runnam
68f0: 65 20 75 73 65 72 29 20 3b 3b 20 77 61 73 20 74 e user) ;; was t
6900: 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65 79 76 61 arget, now keyva
6910: 6c 6c 73 74 0a 20 20 28 64 65 62 75 67 3a 70 72 llst. (debug:pr
6920: 69 6e 74 20 34 20 22 72 75 6e 73 3a 72 6f 6c 6c int 4 "runs:roll
6930: 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 up-run, keys: "
6940: 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 keys " keyvallst
6950: 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 : " keyvallst "
6960: 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75 6e 6e 61 :runname " runna
6970: 6d 65 20 22 20 75 73 65 72 3a 20 22 20 75 73 65 me " user: " use
6980: 72 29 0a 20 20 28 6c 65 74 2a 20 28 3b 20 28 6b r). (let* (; (k
6990: 65 79 76 61 6c 6c 6c 73 74 20 20 20 20 20 20 28 eyvalllst (
69a0: 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 keys:target->key
69b0: 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29 val keys target)
69c0: 29 0a 09 20 28 6e 65 77 2d 72 75 6e 2d 69 64 20 ).. (new-run-id
69d0: 20 20 20 20 20 28 72 75 6e 73 3a 72 65 67 69 73 (runs:regis
69e0: 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 ter-run db keys
69f0: 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d keyvallst runnam
6a00: 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 e "new" "n/a" us
6a10: 65 72 29 29 0a 09 20 28 70 72 65 76 2d 74 65 73 er)).. (prev-tes
6a20: 74 73 20 20 20 20 20 20 28 74 65 73 74 3a 67 65 ts (test:ge
6a30: 74 2d 6d 61 74 63 68 69 6e 67 2d 70 72 65 76 69 t-matching-previ
6a40: 6f 75 73 2d 74 65 73 74 2d 72 75 6e 2d 72 65 63 ous-test-run-rec
6a50: 6f 72 64 73 20 64 62 20 6e 65 77 2d 72 75 6e 2d ords db new-run-
6a60: 69 64 20 22 25 22 20 22 25 22 29 29 0a 09 20 28 id "%" "%")).. (
6a70: 63 75 72 72 2d 74 65 73 74 73 20 20 20 20 20 20 curr-tests
6a80: 28 64 62 2d 67 65 74 2d 74 65 73 74 73 2d 66 6f (db-get-tests-fo
6a90: 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e r-run db new-run
6aa0: 2d 69 64 20 22 25 22 20 22 25 22 20 27 28 29 20 -id "%" "%" '()
6ab0: 27 28 29 29 29 0a 09 20 28 63 75 72 72 2d 74 65 '())).. (curr-te
6ac0: 73 74 73 2d 68 61 73 68 20 28 6d 61 6b 65 2d 68 sts-hash (make-h
6ad0: 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 20 20 20 ash-table))).
6ae0: 20 28 64 62 3a 75 70 64 61 74 65 2d 72 75 6e 2d (db:update-run-
6af0: 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20 6e 65 event_time db ne
6b00: 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20 3b 3b w-run-id). ;;
6b10: 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72 65 61 index the alrea
6b20: 64 79 20 73 61 76 65 64 20 74 65 73 74 73 20 62 dy saved tests b
6b30: 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64 20 69 y testname and i
6b40: 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72 2d 74 temdat in curr-t
6b50: 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20 28 66 ests-hash. (f
6b60: 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61 or-each. (la
6b70: 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a 20 mbda (testdat).
6b80: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 (let* ((te
6b90: 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 74 stname (db:test
6ba0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 -get-testname te
6bb0: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 stdat)).. (
6bc0: 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 item-path (db:te
6bd0: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 st-get-item-path
6be0: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 testdat))..
6bf0: 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f (full-name (co
6c00: 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 nc testname "/"
6c10: 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20 28 item-path))).. (
6c20: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 hash-table-set!
6c30: 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 curr-tests-hash
6c40: 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 64 61 full-name testda
6c50: 74 29 29 29 0a 20 20 20 20 20 63 75 72 72 2d 74 t))). curr-t
6c60: 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 ests). ;; NOP
6c70: 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 E: Non-optimal a
6c80: 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74 68 69 pproach. Try thi
6c90: 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20 20 3b s instead.. ;
6ca0: 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61 72 65 ; 1. tests are
6cb0: 20 72 65 63 65 69 76 65 64 20 69 6e 20 61 20 6c received in a l
6cc0: 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65 6e 74 ist, most recent
6cd0: 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20 20 20 first. ;;
6ce0: 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65 20 72 2. replace the r
6cf0: 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74 68 20 ollup test with
6d00: 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79 73 2a the new *always*
6d10: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a . (for-each .
6d20: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 (lambda (te
6d30: 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28 6c stdat). (l
6d40: 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 20 et* ((testname
6d50: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 (db:test-get-tes
6d60: 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 0a tname testdat)).
6d70: 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61 74 . (item-pat
6d80: 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 h (db:test-get-i
6d90: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61 74 tem-path testdat
6da0: 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c 2d )).. (full-
6db0: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e name (conc testn
6dc0: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 ame "/" item-pat
6dd0: 68 29 29 0a 09 20 20 20 20 20 20 28 70 72 65 76 h)).. (prev
6de0: 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73 68 2d -test-dat (hash-
6df0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
6e00: 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 t curr-tests-has
6e10: 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 h full-name #f))
6e20: 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 73 74 .. (test-st
6e30: 65 70 73 20 20 20 20 20 20 28 64 62 3a 67 65 74 eps (db:get
6e40: 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 74 20 -steps-for-test
6e50: 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d db (db:test-get-
6e60: 69 64 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 id testdat)))..
6e70: 20 20 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 72 (new-test-r
6e80: 65 63 6f 72 64 20 23 66 29 29 0a 09 20 3b 3b 20 ecord #f)).. ;;
6e90: 72 65 70 6c 61 63 65 20 74 68 65 73 65 20 77 69 replace these wi
6ea0: 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65 th insert ... se
6eb0: 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 20 73 71 lect.. (apply sq
6ec0: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 lite3:execute ..
6ed0: 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e .db ...(conc "IN
6ee0: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 SERT OR REPLACE
6ef0: 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75 6e 5f INTO tests (run_
6f00: 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 id,testname,stat
6f10: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 e,status,event_t
6f20: 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64 ime,host,cpuload
6f30: 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c ,diskfree,uname,
6f40: 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 74 68 rundir,item_path
6f50: 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69 ,run_duration,fi
6f60: 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 nal_logf,comment
6f70: 29 20 22 0a 09 09 20 20 20 20 20 20 22 56 41 4c ) "... "VAL
6f80: 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f UES (?,?,?,?,?,?
6f90: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f ,?,?,?,?,?,?,?,?
6fa0: 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69 );")...new-run-i
6fb0: 64 20 28 63 64 64 72 20 28 76 65 63 74 6f 72 2d d (cddr (vector-
6fc0: 3e 6c 69 73 74 20 74 65 73 74 64 61 74 29 29 29 >list testdat)))
6fd0: 0a 09 20 28 73 65 74 21 20 6e 65 77 2d 74 65 73 .. (set! new-tes
6fe0: 74 64 61 74 20 28 63 61 72 20 28 64 62 2d 67 65 tdat (car (db-ge
6ff0: 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 t-tests-for-run
7000: 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 74 65 db new-run-id te
7010: 73 74 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 stname item-path
7020: 20 27 28 29 20 27 28 29 29 29 29 0a 09 20 28 68 '() '()))).. (h
7030: 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 ash-table-set! c
7040: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 urr-tests-hash f
7050: 75 6c 6c 2d 6e 61 6d 65 20 6e 65 77 2d 74 65 73 ull-name new-tes
7060: 74 64 61 74 29 20 3b 3b 20 74 68 69 73 20 63 6f tdat) ;; this co
7070: 75 6c 64 20 62 65 20 63 6f 6e 66 75 73 69 6e 67 uld be confusing
7080: 2c 20 77 68 69 63 68 20 72 65 63 6f 72 64 20 73 , which record s
7090: 68 6f 75 6c 64 20 67 6f 20 69 6e 74 6f 20 74 68 hould go into th
70a0: 65 20 6c 6f 6f 6b 75 70 20 74 61 62 6c 65 3f 0a e lookup table?.
70b0: 09 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 . ;; Now duplica
70c0: 74 65 20 74 68 65 20 74 65 73 74 20 73 74 65 70 te the test step
70d0: 73 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 s.. (debug:print
70e0: 20 34 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 4 "Copying reco
70f0: 72 64 73 20 69 6e 20 74 65 73 74 5f 73 74 65 70 rds in test_step
7100: 73 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 s from test_id="
7110: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
7120: 20 74 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 testdat) " to "
7130: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
7140: 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 new-testdat))..
7150: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 (sqlite3:execut
7160: 65 20 0a 09 20 20 64 62 20 0a 09 20 20 28 63 6f e .. db .. (co
7170: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 nc "INSERT OR RE
7180: 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f PLACE INTO test_
7190: 73 74 65 70 73 20 28 74 65 73 74 5f 69 64 2c 73 steps (test_id,s
71a0: 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 tepname,state,st
71b0: 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c atus,event_time,
71c0: 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 22 53 45 comment) "..."SE
71d0: 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d LECT " (db:test-
71e0: 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 get-id new-testd
71f0: 61 74 29 20 22 2c 73 74 65 70 6e 61 6d 65 2c 73 at) ",stepname,s
7200: 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e tate,status,even
7210: 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 t_time,comment F
7220: 52 4f 4d 20 74 65 73 74 5f 73 74 65 70 73 20 57 ROM test_steps W
7230: 48 45 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 HERE test_id=?;"
7240: 29 0a 09 20 20 28 64 62 3a 74 65 73 74 2d 67 65 ).. (db:test-ge
7250: 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 0a 09 t-id testdat))..
7260: 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 ;; Now duplicat
7270: 65 20 74 68 65 20 74 65 73 74 20 64 61 74 61 0a e the test data.
7280: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 . (debug:print 4
7290: 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 "Copying record
72a0: 73 20 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66 s in test_data f
72b0: 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 rom test_id=" (d
72c0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
72d0: 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 stdat) " to " (d
72e0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 b:test-get-id ne
72f0: 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 73 w-testdat)).. (s
7300: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a qlite3:execute .
7310: 09 20 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 . db .. (conc
7320: 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 "INSERT OR REPLA
7330: 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 64 61 74 CE INTO test_dat
7340: 61 20 28 74 65 73 74 5f 69 64 2c 63 61 74 65 67 a (test_id,categ
7350: 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c ory,variable,val
7360: 75 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c ue,expected,tol,
7370: 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 units,comment) "
7380: 0a 09 09 22 53 45 4c 45 43 54 20 22 20 28 64 62 ..."SELECT " (db
7390: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 :test-get-id new
73a0: 2d 74 65 73 74 64 61 74 29 20 22 2c 63 61 74 65 -testdat) ",cate
73b0: 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 gory,variable,va
73c0: 6c 75 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c lue,expected,tol
73d0: 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 ,units,comment F
73e0: 52 4f 4d 20 74 65 73 74 5f 64 61 74 61 20 57 48 ROM test_data WH
73f0: 45 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 ERE test_id=?;")
7400: 0a 09 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 .. (db:test-get
7410: 2d 69 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 -id testdat))..
7420: 29 29 0a 20 20 20 20 20 70 72 65 76 2d 74 65 73 )). prev-tes
7430: 74 73 29 29 29 0a 09 20 0a 20 20 20 20 20 0a ts))).. . .