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 29 0a 20 20 ore-tests db).
0c80: 28 6c 65 74 20 28 28 6e 75 6d 2d 72 75 6e 6e 69 (let ((num-runni
0c90: 6e 67 20 28 64 62 3a 67 65 74 2d 63 6f 75 6e 74 ng (db:get-count
0ca0: 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67 20 64 -tests-running d
0cb0: 62 29 29 0a 09 28 6d 61 78 2d 63 6f 6e 63 75 72 b))..(max-concur
0cc0: 72 65 6e 74 2d 6a 6f 62 73 20 28 63 6f 6e 66 69 rent-jobs (confi
0cd0: 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 g-lookup *config
0ce0: 64 61 74 2a 20 22 73 65 74 75 70 22 20 22 6d 61 dat* "setup" "ma
0cf0: 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 x_concurrent_job
0d00: 73 22 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 s"))). (debug
0d10: 3a 70 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 6f :print 2 "max-co
0d20: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 ncurrent-jobs: "
0d30: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
0d40: 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e jobs ", num-runn
0d50: 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 ing: " num-runni
0d60: 6e 67 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 ng). (if (not
0d70: 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c 65 (eq? 0 *globale
0d80: 78 69 74 73 74 61 74 75 73 2a 29 29 0a 09 23 66 xitstatus*))..#f
0d90: 0a 09 28 69 66 20 28 6f 72 20 28 6e 6f 74 20 6d ..(if (or (not m
0da0: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
0db0: 62 73 29 0a 09 09 28 61 6e 64 20 6d 61 78 2d 63 bs)...(and max-c
0dc0: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 0a 09 oncurrent-jobs..
0dd0: 09 20 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 6e . (string->n
0de0: 75 6d 62 65 72 20 6d 61 78 2d 63 6f 6e 63 75 72 umber max-concur
0df0: 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 09 20 20 20 rent-jobs)...
0e00: 20 20 28 6e 6f 74 20 28 3e 3d 20 6e 75 6d 2d 72 (not (>= num-r
0e10: 75 6e 6e 69 6e 67 20 28 73 74 72 69 6e 67 2d 3e unning (string->
0e20: 6e 75 6d 62 65 72 20 6d 61 78 2d 63 6f 6e 63 75 number max-concu
0e30: 72 72 65 6e 74 2d 6a 6f 62 73 29 29 29 29 29 0a rrent-jobs))))).
0e40: 09 20 20 20 20 23 74 0a 09 20 20 20 20 28 62 65 . #t.. (be
0e50: 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64 65 62 gin .. (deb
0e60: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e ug:print 0 "WARN
0e70: 49 4e 47 3a 20 4d 61 78 20 72 75 6e 6e 69 6e 67 ING: Max running
0e80: 20 6a 6f 62 73 20 65 78 63 65 65 64 65 64 2c 20 jobs exceeded,
0e90: 63 75 72 72 65 6e 74 20 6e 75 6d 62 65 72 20 72 current number r
0ea0: 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 unning: " num-ru
0eb0: 6e 6e 69 6e 67 20 0a 09 09 09 20 20 20 22 2c 20 nning .... ",
0ec0: 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a max_concurrent_j
0ed0: 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 obs: " max-concu
0ee0: 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 20 20 20 rrent-jobs)..
0ef0: 20 20 20 23 66 29 29 29 29 29 0a 0a 0a 3b 3b 3d #f)))))...;;=
0f00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0f10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0f20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0f30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0f40: 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65 77 20 6d 65 74 =====.;; New met
0f50: 68 6f 64 6f 6c 6f 67 79 2e 20 54 68 65 73 65 20 hodology. These
0f60: 72 6f 75 74 69 6e 65 73 20 77 69 6c 6c 20 72 65 routines will re
0f70: 70 6c 61 63 65 20 74 68 65 20 61 62 6f 76 65 20 place the above
0f80: 69 6e 20 74 69 6d 65 2e 20 46 6f 72 0a 3b 3b 20 in time. For.;;
0f90: 6e 6f 77 20 74 68 65 20 63 6f 64 65 20 69 73 20 now the code is
0fa0: 64 75 70 6c 69 63 61 74 65 64 2e 20 54 68 69 73 duplicated. This
0fb0: 20 73 74 75 66 66 20 69 73 20 69 6e 69 74 69 61 stuff is initia
0fc0: 6c 6c 79 20 75 73 65 64 20 69 6e 20 74 68 65 20 lly used in the
0fd0: 6d 6f 6e 69 74 6f 72 0a 3b 3b 20 62 61 73 65 64 monitor.;; based
0fe0: 20 63 6f 64 65 2e 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d code..;;=======
0ff0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1000: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1010: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1020: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a ===============.
1030: 0a 3b 3b 20 72 65 67 69 73 74 65 72 20 61 20 74 .;; register a t
1040: 65 73 74 20 72 75 6e 20 77 69 74 68 20 74 68 65 est run with the
1050: 20 64 62 0a 28 64 65 66 69 6e 65 20 28 72 75 6e db.(define (run
1060: 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 s:register-run d
1070: 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 b keys keyvallst
1080: 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 65 20 73 runname state s
1090: 74 61 74 75 73 20 75 73 65 72 29 0a 20 20 28 64 tatus user). (d
10a0: 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 72 75 ebug:print 3 "ru
10b0: 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 2c ns:register-run,
10c0: 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22 20 keys: " keys "
10d0: 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 keyvallst: " key
10e0: 76 61 6c 6c 73 74 20 22 20 72 75 6e 6e 61 6d 65 vallst " runname
10f0: 3a 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 73 74 : " runname " st
1100: 61 74 65 3a 20 22 20 73 74 61 74 65 20 22 20 73 ate: " state " s
1110: 74 61 74 75 73 3a 20 22 20 73 74 61 74 75 73 20 tatus: " status
1120: 22 20 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a " user: " user).
1130: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 74 72 (let* ((keystr
1140: 20 20 20 20 28 6b 65 79 73 2d 3e 6b 65 79 73 74 (keys->keyst
1150: 72 20 6b 65 79 73 29 29 0a 09 20 28 63 6f 6d 6d r keys)).. (comm
1160: 61 20 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 a (if (> (le
1170: 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 2c ngth keys) 0) ",
1180: 22 20 22 22 29 29 0a 09 20 28 61 6e 64 73 74 72 " "")).. (andstr
1190: 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 6e 67 (if (> (leng
11a0: 74 68 20 6b 65 79 73 29 20 30 29 20 22 20 41 4e th keys) 0) " AN
11b0: 44 20 22 20 22 22 29 29 0a 09 20 28 76 61 6c 73 D " "")).. (vals
11c0: 6c 6f 74 73 20 20 28 6b 65 79 73 2d 3e 76 61 6c lots (keys->val
11d0: 73 6c 6f 74 73 20 6b 65 79 73 29 29 20 3b 3b 20 slots keys)) ;;
11e0: 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 28 6b 65 79 ?,?,? ..... (key
11f0: 76 61 6c 73 20 20 20 28 6d 61 70 20 63 61 64 72 vals (map cadr
1200: 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20 28 keyvallst)).. (
1210: 61 6c 6c 76 61 6c 73 20 20 20 28 61 70 70 65 6e allvals (appen
1220: 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 20 d (list runname
1230: 73 74 61 74 65 20 73 74 61 74 75 73 20 75 73 65 state status use
1240: 72 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 20 28 r) keyvals)).. (
1250: 71 72 79 76 61 6c 73 20 20 20 28 61 70 70 65 6e qryvals (appen
1260: 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 29 d (list runname)
1270: 20 6b 65 79 76 61 6c 73 29 29 0a 09 20 28 6b 65 keyvals)).. (ke
1280: 79 3d 3f 73 74 72 20 20 28 73 74 72 69 6e 67 2d y=?str (string-
1290: 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 intersperse (map
12a0: 20 28 6c 61 6d 62 64 61 20 28 6b 29 28 63 6f 6e (lambda (k)(con
12b0: 63 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 c (key:get-field
12c0: 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 29 29 20 6b name k) "=?")) k
12d0: 65 79 73 29 20 22 20 41 4e 44 20 22 29 29 29 0a eys) " AND "))).
12e0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
12f0: 20 33 20 22 6b 65 79 73 3a 20 22 20 6b 65 79 73 3 "keys: " keys
1300: 20 22 20 61 6c 6c 76 61 6c 73 3a 20 22 20 61 6c " allvals: " al
1310: 6c 76 61 6c 73 20 22 20 6b 65 79 76 61 6c 73 3a lvals " keyvals:
1320: 20 22 20 6b 65 79 76 61 6c 73 29 0a 20 20 20 20 " keyvals).
1330: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 (debug:print 2 "
1340: 4e 4f 54 45 3a 20 75 73 69 6e 67 20 74 61 72 67 NOTE: using targ
1350: 65 74 20 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 et " (string-int
1360: 65 72 73 70 65 72 73 65 20 6b 65 79 76 61 6c 73 ersperse keyvals
1370: 20 22 2f 22 29 20 22 20 66 6f 72 20 74 68 69 73 "/") " for this
1380: 20 72 75 6e 22 29 0a 20 20 20 20 28 69 66 20 28 run"). (if (
1390: 61 6e 64 20 72 75 6e 6e 61 6d 65 20 28 6e 75 6c and runname (nul
13a0: 6c 3f 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 l? (filter (lamb
13b0: 64 61 20 28 78 29 28 6e 6f 74 20 78 29 29 20 6b da (x)(not x)) k
13c0: 65 79 76 61 6c 73 29 29 29 20 3b 3b 20 74 68 65 eyvals))) ;; the
13d0: 72 65 20 6d 75 73 74 20 62 65 20 61 20 62 65 74 re must be a bet
13e0: 74 65 72 20 77 61 79 20 74 6f 20 22 61 70 70 6c ter way to "appl
13f0: 79 20 61 6e 64 22 0a 09 28 6c 65 74 20 28 28 72 y and"..(let ((r
1400: 65 73 20 23 66 29 29 0a 09 20 20 28 61 70 70 6c es #f)).. (appl
1410: 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 y sqlite3:execut
1420: 65 20 64 62 20 28 63 6f 6e 63 20 22 49 4e 53 45 e db (conc "INSE
1430: 52 54 20 4f 52 20 49 47 4e 4f 52 45 20 49 4e 54 RT OR IGNORE INT
1440: 4f 20 72 75 6e 73 20 28 72 75 6e 6e 61 6d 65 2c O runs (runname,
1450: 73 74 61 74 65 2c 73 74 61 74 75 73 2c 6f 77 6e state,status,own
1460: 65 72 2c 65 76 65 6e 74 5f 74 69 6d 65 22 20 63 er,event_time" c
1470: 6f 6d 6d 61 20 6b 65 79 73 74 72 20 22 29 20 56 omma keystr ") V
1480: 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 73 ALUES (?,?,?,?,s
1490: 74 72 66 74 69 6d 65 28 27 25 73 27 2c 27 6e 6f trftime('%s','no
14a0: 77 27 29 22 20 63 6f 6d 6d 61 20 76 61 6c 73 6c w')" comma valsl
14b0: 6f 74 73 20 22 29 3b 22 29 0a 09 09 20 61 6c 6c ots ");")... all
14c0: 76 61 6c 73 29 0a 09 20 20 28 61 70 70 6c 79 20 vals).. (apply
14d0: 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 sqlite3:for-each
14e0: 2d 72 6f 77 20 0a 09 20 20 20 28 6c 61 6d 62 64 -row .. (lambd
14f0: 61 20 28 69 64 29 0a 09 20 20 20 20 20 28 73 65 a (id).. (se
1500: 74 21 20 72 65 73 20 69 64 29 29 0a 09 20 20 20 t! res id))..
1510: 64 62 0a 09 20 20 20 28 6c 65 74 20 28 28 71 72 db.. (let ((qr
1520: 79 20 28 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 y (conc "SELECT
1530: 69 64 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 id FROM runs WHE
1540: 52 45 20 28 72 75 6e 6e 61 6d 65 3d 3f 20 22 20 RE (runname=? "
1550: 61 6e 64 73 74 72 20 6b 65 79 3d 3f 73 74 72 20 andstr key=?str
1560: 22 29 3b 22 29 29 29 0a 09 20 20 20 20 20 3b 28 ");"))).. ;(
1570: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 71 debug:print 4 "q
1580: 72 79 3a 20 22 20 71 72 79 29 20 0a 09 20 20 20 ry: " qry) ..
1590: 20 20 71 72 79 29 0a 09 20 20 20 71 72 79 76 61 qry).. qryva
15a0: 6c 73 29 0a 09 20 20 28 73 71 6c 69 74 65 33 3a ls).. (sqlite3:
15b0: 65 78 65 63 75 74 65 20 64 62 20 22 55 50 44 41 execute db "UPDA
15c0: 54 45 20 72 75 6e 73 20 53 45 54 20 73 74 61 74 TE runs SET stat
15d0: 65 3d 3f 2c 73 74 61 74 75 73 3d 3f 20 57 48 45 e=?,status=? WHE
15e0: 52 45 20 69 64 3d 3f 3b 22 20 73 74 61 74 65 20 RE id=?;" state
15f0: 73 74 61 74 75 73 20 72 65 73 29 0a 09 20 20 72 status res).. r
1600: 65 73 29 20 0a 09 28 62 65 67 69 6e 0a 09 20 20 es) ..(begin..
1610: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
1620: 45 52 52 4f 52 3a 20 43 61 6c 6c 65 64 20 77 69 ERROR: Called wi
1630: 74 68 6f 75 74 20 61 6c 6c 20 6e 65 63 65 73 73 thout all necess
1640: 61 72 79 20 6b 65 79 73 22 29 0a 09 20 20 23 66 ary keys").. #f
1650: 29 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 69 73 ))))..;; This is
1660: 20 61 20 64 75 70 6c 69 63 61 74 65 20 6f 66 20 a duplicate of
1670: 72 75 6e 2d 74 65 73 74 73 20 28 77 68 69 63 68 run-tests (which
1680: 20 68 61 73 20 62 65 65 6e 20 64 65 70 72 65 63 has been deprec
1690: 61 74 65 64 29 2e 20 55 73 65 20 74 68 69 73 20 ated). Use this
16a0: 6f 6e 65 20 69 6e 73 74 65 61 64 20 6f 66 20 72 one instead of r
16b0: 75 6e 20 74 65 73 74 73 2e 0a 3b 3b 20 6b 65 79 un tests..;; key
16c0: 76 61 6c 73 0a 28 64 65 66 69 6e 65 20 28 72 75 vals.(define (ru
16d0: 6e 73 3a 72 75 6e 2d 74 65 73 74 73 20 64 62 20 ns:run-tests db
16e0: 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 74 target runname t
16f0: 65 73 74 2d 70 61 74 74 73 20 69 74 65 6d 2d 70 est-patts item-p
1700: 61 74 74 73 20 75 73 65 72 20 66 6c 61 67 73 29 atts user flags)
1710: 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 20 . (let* ((keys
1720: 20 20 20 20 20 20 20 28 64 62 2d 67 65 74 2d 6b (db-get-k
1730: 65 79 73 20 64 62 29 29 0a 09 20 28 6b 65 79 76 eys db)).. (keyv
1740: 61 6c 6c 73 74 20 20 20 28 6b 65 79 73 3a 74 61 allst (keys:ta
1750: 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 rget->keyval key
1760: 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 72 75 s target)).. (ru
1770: 6e 2d 69 64 20 20 20 20 20 20 28 72 75 6e 73 3a n-id (runs:
1780: 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 register-run db
1790: 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 keys keyvallst r
17a0: 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f unname "new" "n/
17b0: 61 22 20 75 73 65 72 29 29 20 20 3b 3b 20 20 74 a" user)) ;; t
17c0: 65 73 74 2d 6e 61 6d 65 29 29 29 0a 09 20 28 64 est-name))).. (d
17d0: 65 66 65 72 72 65 64 20 20 20 20 27 28 29 29 20 eferred '())
17e0: 3b 3b 20 64 65 6c 61 79 20 72 75 6e 6e 69 6e 67 ;; delay running
17f0: 20 74 68 65 73 65 20 73 69 6e 63 65 20 74 68 65 these since the
1800: 79 20 68 61 76 65 20 61 20 77 61 69 74 6f 6e 20 y have a waiton
1810: 63 6c 61 75 73 65 0a 09 20 28 6b 65 65 70 67 6f clause.. (keepgo
1820: 69 6e 67 20 20 20 28 68 61 73 68 2d 74 61 62 6c ing (hash-tabl
1830: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c e-ref/default fl
1840: 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 ags "-keepgoing"
1850: 20 23 66 29 29 0a 09 20 28 74 65 73 74 2d 6e 61 #f)).. (test-na
1860: 6d 65 73 20 20 27 28 29 29 0a 09 20 28 72 75 6e mes '()).. (run
1870: 63 6f 6e 66 69 67 66 20 20 20 28 63 6f 6e 63 20 configf (conc
1880: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e *toppath* "/run
1890: 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 configs.config")
18a0: 29 0a 09 20 28 72 65 71 75 69 72 65 64 2d 74 65 ).. (required-te
18b0: 73 74 73 20 27 28 29 29 0a 09 20 28 74 65 73 74 sts '()).. (test
18c0: 2d 72 65 63 6f 72 64 73 20 28 6d 61 6b 65 2d 68 -records (make-h
18d0: 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 0a 20 20 ash-table)))..
18e0: 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d (set-megatest-
18f0: 65 6e 76 2d 76 61 72 73 20 64 62 20 72 75 6e 2d env-vars db run-
1900: 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 id) ;; these may
1910: 20 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 be needed by th
1920: 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 e launching proc
1930: 65 73 73 0a 0a 20 20 20 20 28 69 66 20 28 66 69 ess.. (if (fi
1940: 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 63 6f le-exists? runco
1950: 6e 66 69 67 66 29 0a 09 28 73 65 74 75 70 2d 65 nfigf)..(setup-e
1960: 6e 76 2d 64 65 66 61 75 6c 74 73 20 64 62 20 72 nv-defaults db r
1970: 75 6e 63 6f 6e 66 69 67 66 20 72 75 6e 2d 69 64 unconfigf run-id
1980: 20 2a 61 6c 72 65 61 64 79 2d 73 65 65 6e 2d 72 *already-seen-r
1990: 75 6e 63 6f 6e 66 69 67 2d 69 6e 66 6f 2a 20 22 unconfig-info* "
19a0: 70 72 65 2d 6c 61 75 6e 63 68 2d 65 6e 76 2d 76 pre-launch-env-v
19b0: 61 72 73 22 29 0a 09 28 64 65 62 75 67 3a 70 72 ars")..(debug:pr
19c0: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 int 0 "WARNING:
19d0: 59 6f 75 20 64 6f 20 6e 6f 74 20 68 61 76 65 20 You do not have
19e0: 61 20 72 75 6e 20 63 6f 6e 66 69 67 20 66 69 6c a run config fil
19f0: 65 3a 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 e: " runconfigf)
1a00: 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 6c 6f ). . ;; lo
1a10: 6f 6b 20 75 70 20 61 6c 6c 20 74 65 73 74 73 20 ok up all tests
1a20: 6d 61 74 63 68 69 6e 67 20 74 68 65 20 63 6f 6d matching the com
1a30: 6d 61 20 73 65 70 61 72 61 74 65 64 20 6c 69 73 ma separated lis
1a40: 74 20 6f 66 20 67 6c 6f 62 73 20 69 6e 0a 20 20 t of globs in.
1a50: 20 20 3b 3b 20 74 65 73 74 2d 70 61 74 74 73 20 ;; test-patts
1a60: 28 75 73 69 6e 67 20 25 20 61 73 20 77 69 6c 64 (using % as wild
1a70: 63 61 72 64 29 0a 20 20 20 20 28 66 6f 72 2d 65 card). (for-e
1a80: 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 ach . (lambd
1a90: 61 20 28 70 61 74 74 29 0a 20 20 20 20 20 20 20 a (patt).
1aa0: 28 6c 65 74 20 28 28 74 65 73 74 73 20 28 67 6c (let ((tests (gl
1ab0: 6f 62 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 ob (conc *toppat
1ac0: 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 28 73 74 h* "/tests/" (st
1ad0: 72 69 6e 67 2d 74 72 61 6e 73 6c 61 74 65 20 70 ring-translate p
1ae0: 61 74 74 20 22 25 22 20 22 2a 22 29 29 29 29 29 att "%" "*")))))
1af0: 0a 09 20 28 73 65 74 21 20 74 65 73 74 73 20 28 .. (set! tests (
1b00: 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 filter (lambda (
1b10: 74 65 73 74 29 28 66 69 6c 65 2d 65 78 69 73 74 test)(file-exist
1b20: 73 3f 20 28 63 6f 6e 63 20 74 65 73 74 20 22 2f s? (conc test "/
1b30: 74 65 73 74 63 6f 6e 66 69 67 22 29 29 29 20 74 testconfig"))) t
1b40: 65 73 74 73 29 29 0a 09 20 28 73 65 74 21 20 74 ests)).. (set! t
1b50: 65 73 74 2d 6e 61 6d 65 73 20 28 61 70 70 65 6e est-names (appen
1b60: 64 20 74 65 73 74 2d 6e 61 6d 65 73 20 0a 09 09 d test-names ...
1b70: 09 09 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 .. (map (lambda
1b80: 20 28 74 65 73 74 70 29 0a 09 09 09 09 09 20 28 (testp)...... (
1b90: 6c 61 73 74 20 28 73 74 72 69 6e 67 2d 73 70 6c last (string-spl
1ba0: 69 74 20 74 65 73 74 70 20 22 2f 22 29 29 29 0a it testp "/"))).
1bb0: 09 09 09 09 20 20 20 20 20 20 20 74 65 73 74 73 .... tests
1bc0: 29 29 29 29 29 0a 20 20 20 20 20 28 73 74 72 69 ))))). (stri
1bd0: 6e 67 2d 73 70 6c 69 74 20 74 65 73 74 2d 70 61 ng-split test-pa
1be0: 74 74 73 20 22 2c 22 29 29 0a 0a 20 20 20 20 20 tts ","))..
1bf0: 3b 3b 20 6e 6f 77 20 72 65 6d 6f 76 65 20 64 75 ;; now remove du
1c00: 70 6c 69 63 61 74 65 73 0a 20 20 20 20 28 73 65 plicates. (se
1c10: 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 64 t! test-names (d
1c20: 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 elete-duplicates
1c30: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 0a 20 test-names))..
1c40: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
1c50: 30 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 6e 61 0 "INFO: test na
1c60: 6d 65 73 20 22 20 74 65 73 74 2d 6e 61 6d 65 73 mes " test-names
1c70: 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65 ).. ;; on the
1c80: 20 66 69 72 73 74 20 70 61 73 73 20 6f 72 20 63 first pass or c
1c90: 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 73 all to run-tests
1ca0: 20 73 65 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f set FAILS to NO
1cb0: 54 5f 53 54 41 52 54 45 44 20 69 66 0a 20 20 20 T_STARTED if.
1cc0: 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69 ;; -keepgoing i
1cd0: 73 20 73 70 65 63 69 66 69 65 64 0a 20 20 20 20 s specified.
1ce0: 28 69 66 20 28 61 6e 64 20 28 65 71 3f 20 2a 70 (if (and (eq? *p
1cf0: 61 73 73 6e 75 6d 2a 20 30 29 0a 09 20 20 20 20 assnum* 0)..
1d00: 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 28 62 65 keepgoing)..(be
1d10: 67 69 6e 0a 09 20 20 3b 3b 20 68 61 76 65 20 74 gin.. ;; have t
1d20: 6f 20 64 65 6c 65 74 65 20 74 65 73 74 20 72 65 o delete test re
1d30: 63 6f 72 64 73 20 77 68 65 72 65 20 4e 4f 54 5f cords where NOT_
1d40: 53 54 41 52 54 45 44 20 73 69 6e 63 65 20 74 68 STARTED since th
1d50: 65 79 20 63 61 6e 20 63 61 75 73 65 20 2d 6b 65 ey can cause -ke
1d60: 65 70 67 6f 69 6e 67 20 74 6f 20 0a 09 20 20 3b epgoing to .. ;
1d70: 3b 20 67 65 74 20 73 74 75 63 6b 20 64 75 65 20 ; get stuck due
1d80: 74 6f 20 62 65 63 6f 6d 69 6e 67 20 69 6e 61 63 to becoming inac
1d90: 63 65 73 73 69 62 6c 65 20 66 72 6f 6d 20 61 20 cessible from a
1da0: 66 61 69 6c 65 64 20 74 65 73 74 2e 20 49 2e 65 failed test. I.e
1db0: 2e 20 69 66 20 74 65 73 74 20 42 20 64 65 70 65 . if test B depe
1dc0: 6e 64 73 20 0a 09 20 20 3b 3b 20 6f 6e 20 74 65 nds .. ;; on te
1dd0: 73 74 20 41 20 62 75 74 20 74 65 73 74 20 42 20 st A but test B
1de0: 72 65 61 63 68 65 64 20 74 68 65 20 70 6f 69 6e reached the poin
1df0: 74 20 6f 6e 20 62 65 69 6e 67 20 72 65 67 69 73 t on being regis
1e00: 74 65 72 65 64 20 61 73 20 4e 4f 54 5f 53 54 41 tered as NOT_STA
1e10: 52 54 45 44 20 61 6e 64 20 74 65 73 74 0a 09 20 RTED and test..
1e20: 20 3b 3b 20 41 20 66 61 69 6c 65 64 20 66 6f 72 ;; A failed for
1e30: 20 73 6f 6d 65 20 72 65 61 73 6f 6e 20 74 68 65 some reason the
1e40: 6e 20 6f 6e 20 72 65 2d 72 75 6e 20 75 73 69 6e n on re-run usin
1e50: 67 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 68 65 g -keepgoing the
1e60: 20 72 75 6e 20 63 61 6e 20 6e 65 76 65 72 20 63 run can never c
1e70: 6f 6d 70 6c 65 74 65 2e 0a 09 20 20 28 64 62 3a omplete... (db:
1e80: 64 65 6c 65 74 65 2d 74 65 73 74 73 2d 69 6e 2d delete-tests-in-
1e90: 73 74 61 74 65 20 64 62 20 72 75 6e 2d 69 64 20 state db run-id
1ea0: 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 0a 09 "NOT_STARTED")..
1eb0: 20 20 28 64 62 3a 73 65 74 2d 74 65 73 74 73 2d (db:set-tests-
1ec0: 73 74 61 74 65 2d 73 74 61 74 75 73 20 64 62 20 state-status db
1ed0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
1ee0: 73 20 23 66 20 22 46 41 49 4c 22 20 22 4e 4f 54 s #f "FAIL" "NOT
1ef0: 5f 53 54 41 52 54 45 44 22 20 22 46 41 49 4c 22 _STARTED" "FAIL"
1f00: 29 29 29 0a 0a 20 20 20 20 28 73 65 74 21 20 2a ))).. (set! *
1f10: 70 61 73 73 6e 75 6d 2a 20 28 2b 20 2a 70 61 73 passnum* (+ *pas
1f20: 73 6e 75 6d 2a 20 31 29 29 0a 0a 20 20 20 20 3b snum* 1)).. ;
1f30: 3b 20 6e 6f 77 20 61 64 64 20 6e 6f 6e 2d 64 69 ; now add non-di
1f40: 72 65 63 74 6c 79 20 72 65 66 65 72 65 6e 63 65 rectly reference
1f50: 64 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 28 d dependencies (
1f60: 69 2e 65 2e 20 77 61 69 74 6f 6e 29 0a 20 20 20 i.e. waiton).
1f70: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (if (not (null?
1f80: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 28 test-names))..(
1f90: 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 28 let loop ((hed (
1fa0: 63 61 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 car test-names))
1fb0: 0a 09 09 20 20 20 28 74 61 6c 20 28 63 64 72 20 ... (tal (cdr
1fc0: 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09 20 test-names)))..
1fd0: 20 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 (let* ((config
1fe0: 20 28 74 65 73 74 3a 67 65 74 2d 74 65 73 74 63 (test:get-testc
1ff0: 6f 6e 66 69 67 20 68 65 64 20 23 66 29 29 0a 09 onfig hed #f))..
2000: 09 20 28 77 61 69 74 6f 6e 73 20 28 73 74 72 69 . (waitons (stri
2010: 6e 67 2d 73 70 6c 69 74 20 28 6c 65 74 20 28 28 ng-split (let ((
2020: 77 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 w (config-lookup
2030: 20 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 config "require
2040: 6d 65 6e 74 73 22 20 22 77 61 69 74 6f 6e 22 29 ments" "waiton")
2050: 29 29 0a 09 09 09 09 09 20 20 28 69 66 20 77 20 ))...... (if w
2060: 77 20 22 22 29 29 29 29 29 0a 09 20 20 20 20 28 w ""))))).. (
2070: 69 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 if (not (hash-ta
2080: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
2090: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 test-records hed
20a0: 20 23 66 29 29 0a 09 09 28 68 61 73 68 2d 74 61 #f))...(hash-ta
20b0: 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 ble-set! test-re
20c0: 63 6f 72 64 73 20 68 65 64 20 28 76 65 63 74 6f cords hed (vecto
20d0: 72 20 68 65 64 20 63 6f 6e 66 69 67 20 77 61 69 r hed config wai
20e0: 74 6f 6e 73 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f tons (config-loo
20f0: 6b 75 70 20 22 72 65 71 75 69 72 65 6d 65 6e 74 kup "requirement
2100: 73 22 20 22 70 72 69 6f 72 69 74 79 22 29 20 23 s" "priority") #
2110: 66 29 29 29 0a 09 20 20 20 20 28 66 6f 72 2d 65 f))).. (for-e
2120: 61 63 68 20 0a 09 20 20 20 20 20 28 6c 61 6d 62 ach .. (lamb
2130: 64 61 20 28 77 61 69 74 6f 6e 29 0a 09 20 20 20 da (waiton)..
2140: 20 20 20 20 28 69 66 20 28 61 6e 64 20 77 61 69 (if (and wai
2150: 74 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72 ton (not (member
2160: 20 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d waiton test-nam
2170: 65 73 29 29 29 0a 09 09 20 20 20 28 62 65 67 69 es)))... (begi
2180: 6e 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 72 n... (set! r
2190: 65 71 75 69 72 65 64 2d 74 65 73 74 73 20 28 63 equired-tests (c
21a0: 6f 6e 73 20 77 61 69 74 6f 6e 20 72 65 71 75 69 ons waiton requi
21b0: 72 65 64 2d 74 65 73 74 73 29 29 0a 09 09 20 20 red-tests))...
21c0: 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 (set! test-na
21d0: 6d 65 73 20 28 61 70 70 65 6e 64 20 74 65 73 74 mes (append test
21e0: 2d 6e 61 6d 65 73 20 28 6c 69 73 74 20 77 61 69 -names (list wai
21f0: 74 6f 6e 29 29 29 29 29 29 0a 09 20 20 20 20 20 ton))))))..
2200: 77 61 69 74 6f 6e 73 29 0a 09 20 20 20 20 28 6c waitons).. (l
2210: 65 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 64 et ((remtests (d
2220: 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 elete-duplicates
2230: 20 28 61 70 70 65 6e 64 20 77 61 69 74 6f 6e 73 (append waitons
2240: 20 74 61 6c 29 29 29 29 0a 09 20 20 20 20 20 20 tal))))..
2250: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 (if (not (null?
2260: 72 65 6d 74 65 73 74 73 29 29 0a 09 09 20 20 28 remtests))... (
2270: 6c 6f 6f 70 20 28 63 61 72 20 72 65 6d 74 65 73 loop (car remtes
2280: 74 73 29 28 63 64 72 20 72 65 6d 74 65 73 74 73 ts)(cdr remtests
2290: 29 29 29 29 29 29 29 0a 0a 20 20 20 20 28 69 66 ))))))).. (if
22a0: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 71 (not (null? req
22b0: 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09 28 uired-tests))..(
22c0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 debug:print 1 "I
22d0: 4e 46 4f 3a 20 41 64 64 69 6e 67 20 22 20 72 65 NFO: Adding " re
22e0: 71 75 69 72 65 64 2d 74 65 73 74 73 20 22 20 74 quired-tests " t
22f0: 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65 22 o the run queue"
2300: 29 29 0a 0a 20 20 20 20 3b 3b 20 41 74 20 74 68 )).. ;; At th
2310: 69 73 20 70 6f 69 6e 74 20 74 68 65 20 6c 69 73 is point the lis
2320: 74 20 6f 66 20 70 61 72 65 6e 74 20 74 65 73 74 t of parent test
2330: 73 20 69 73 20 65 78 70 61 6e 64 65 64 20 0a 20 s is expanded .
2340: 20 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 6c ;; NB// Shoul
2350: 64 20 65 78 70 61 6e 64 20 69 74 65 6d 73 20 68 d expand items h
2360: 65 72 65 20 61 6e 64 20 74 68 65 6e 20 69 6e 73 ere and then ins
2370: 65 72 74 20 69 6e 74 6f 20 74 68 65 20 72 75 6e ert into the run
2380: 20 71 75 65 75 65 2e 0a 20 20 20 20 28 6c 65 74 queue.. (let
2390: 20 6c 6f 6f 70 20 28 28 6e 75 6d 74 69 6d 65 73 loop ((numtimes
23a0: 20 30 29 29 0a 20 20 20 20 20 20 28 66 6f 72 2d 0)). (for-
23b0: 65 61 63 68 20 0a 20 20 20 20 20 20 20 28 6c 61 each . (la
23c0: 6d 62 64 61 20 28 74 65 73 74 2d 72 65 63 6f 72 mbda (test-recor
23d0: 64 29 0a 09 20 3b 3b 20 6e 65 65 64 20 74 6f 20 d).. ;; need to
23e0: 69 6e 73 70 65 63 74 20 74 68 65 20 69 74 65 6d inspect the item
23f0: 73 20 66 69 65 6c 64 20 74 65 73 74 73 3a 74 65 s field tests:te
2400: 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d stqueue-get-item
2410: 73 0a 09 20 3b 3b 0a 09 20 3b 3b 20 20 69 66 20 s.. ;;.. ;; if
2420: 23 66 20 74 68 65 6e 20 6e 6f 20 69 74 65 6d 73 #f then no items
2430: 20 66 6f 72 20 74 68 69 73 20 74 65 73 74 2c 20 for this test,
2440: 63 68 65 63 6b 20 70 72 65 72 65 71 73 20 61 6e check prereqs an
2450: 64 20 6c 61 75 6e 63 68 0a 09 20 3b 3b 20 0a 09 d launch.. ;; ..
2460: 20 3b 3b 20 20 65 6c 73 65 20 69 66 20 6c 69 73 ;; else if lis
2470: 74 2c 20 74 68 65 6e 20 68 61 76 65 20 69 74 65 t, then have ite
2480: 6d 73 0a 09 20 3b 3b 0a 09 20 3b 3b 20 69 66 20 ms.. ;;.. ;; if
2490: 70 72 6f 63 20 74 68 65 6e 20 65 76 61 6c 20 69 proc then eval i
24a0: 74 2e 0a 09 20 3b 3b 0a 09 20 28 6c 65 74 20 28 t... ;;.. (let (
24b0: 28 69 74 65 6d 73 20 28 69 74 65 6d 73 3a 67 65 (items (items:ge
24c0: 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e t-items-from-con
24d0: 66 69 67 20 74 63 6f 6e 66 69 67 29 29 29 0a 09 fig tconfig)))..
24e0: 20 28 69 66 20 28 72 75 6e 73 3a 63 61 6e 2d 72 (if (runs:can-r
24f0: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 un-more-tests db
2500: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20 3b 3b test-record) ;;
2510: 20 6e 6f 77 20 6e 65 65 64 73 20 74 6f 20 6c 6f now needs to lo
2520: 6f 6b 20 61 74 20 74 68 65 20 74 65 73 74 20 67 ok at the test g
2530: 72 6f 75 70 0a 09 20 20 20 20 20 28 72 75 6e 3a roup.. (run:
2540: 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 test db run-id r
2550: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 unname test-name
2560: 20 6b 65 79 76 61 6c 6c 73 74 20 69 74 65 6d 2d keyvallst item-
2570: 70 61 74 74 73 20 66 6c 61 67 73 29 0a 09 20 20 patts flags)..
2580: 20 20 20 29 29 0a 20 20 20 20 20 20 20 28 74 65 )). (te
2590: 73 74 73 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f sts:sort-by-prio
25a0: 72 69 74 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 rity-and-waiton
25b0: 74 65 73 74 2d 72 65 63 6f 72 64 73 29 29 0a 20 test-records)).
25c0: 20 20 20 20 20 3b 3b 20 28 72 75 6e 2d 77 61 69 ;; (run-wai
25d0: 74 69 6e 67 2d 74 65 73 74 73 20 64 62 29 0a 20 ting-tests db).
25e0: 20 20 20 20 20 28 69 66 20 6b 65 65 70 67 6f 69 (if keepgoi
25f0: 6e 67 0a 09 20 20 28 6c 65 74 20 28 28 65 73 74 ng.. (let ((est
2600: 72 65 6d 20 28 64 62 3a 65 73 74 69 6d 61 74 65 rem (db:estimate
2610: 64 2d 74 65 73 74 73 2d 72 65 6d 61 69 6e 69 6e d-tests-remainin
2620: 67 20 64 62 20 72 75 6e 2d 69 64 29 29 29 0a 09 g db run-id)))..
2630: 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 3e 20 (if (and (>
2640: 65 73 74 72 65 6d 20 30 29 0a 09 09 20 20 20 20 estrem 0)...
2650: 20 28 65 71 3f 20 2a 67 6c 6f 62 61 6c 65 78 69 (eq? *globalexi
2660: 74 73 74 61 74 75 73 2a 20 30 29 29 0a 09 09 28 tstatus* 0))...(
2670: 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 begin... (debug
2680: 3a 70 72 69 6e 74 20 31 20 22 4b 65 65 70 20 67 :print 1 "Keep g
2690: 6f 69 6e 67 2c 20 65 73 74 69 6d 61 74 65 64 20 oing, estimated
26a0: 22 20 65 73 74 72 65 6d 20 22 20 74 65 73 74 73 " estrem " tests
26b0: 20 72 65 6d 61 69 6e 69 6e 67 20 74 6f 20 72 75 remaining to ru
26c0: 6e 2c 20 77 69 6c 6c 20 63 6f 6e 74 69 6e 75 65 n, will continue
26d0: 20 69 6e 20 33 20 73 65 63 6f 6e 64 73 20 2e 2e in 3 seconds ..
26e0: 2e 22 29 0a 09 09 20 20 28 74 68 72 65 61 64 2d .")... (thread-
26f0: 73 6c 65 65 70 21 20 33 29 0a 09 09 20 20 28 72 sleep! 3)... (r
2700: 75 6e 2d 77 61 69 74 69 6e 67 2d 74 65 73 74 73 un-waiting-tests
2710: 20 64 62 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 db)... (loop (
2720: 2b 20 6e 75 6d 74 69 6d 65 73 20 31 29 29 29 29 + numtimes 1))))
2730: 29 29 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 )))))..(define (
2740: 72 75 6e 3a 74 65 73 74 20 64 62 20 72 75 6e 2d run:test db run-
2750: 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d id runname test-
2760: 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 69 name keyvallst i
2770: 74 65 6d 2d 70 61 74 74 73 20 66 6c 61 67 73 29 tem-patts flags)
2780: 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
2790: 31 20 22 4c 61 75 6e 63 68 69 6e 67 20 74 65 73 1 "Launching tes
27a0: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 29 0a 20 t " test-name).
27b0: 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 20 76 61 ;; All these va
27c0: 72 73 20 6d 69 67 68 74 20 62 65 20 72 65 66 65 rs might be refe
27d0: 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 74 65 renced by the te
27e0: 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 20 72 65 stconfig file re
27f0: 61 64 65 72 0a 20 20 28 73 65 74 65 6e 76 20 22 ader. (setenv "
2800: 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 MT_TEST_NAME" te
2810: 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 20 20 28 st-name) ;; . (
2820: 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 setenv "MT_RUNNA
2830: 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a 20 ME" runname).
2840: 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 (set-megatest-e
2850: 6e 76 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 nv-vars db run-i
2860: 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 d) ;; these may
2870: 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 be needed by the
2880: 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 launching proce
2890: 73 73 0a 20 20 28 63 68 61 6e 67 65 2d 64 69 72 ss. (change-dir
28a0: 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a ectory *toppath*
28b0: 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 ). (let* ((test
28c0: 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a -path (conc *
28d0: 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 toppath* "/tests
28e0: 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 20 3b /" test-name)) ;
28f0: 3b 20 63 6f 75 6c 64 20 75 73 65 20 74 65 73 74 ; could use test
2900: 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 :get-testconfig
2910: 68 65 72 65 20 2e 2e 2e 0a 09 20 28 74 65 73 74 here ..... (test
2920: 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 -configf (conc t
2930: 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63 est-path "/testc
2940: 6f 6e 66 69 67 22 29 29 0a 09 20 28 74 65 73 74 onfig")).. (test
2950: 65 78 69 73 74 73 20 20 20 28 61 6e 64 20 28 66 exists (and (f
2960: 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74 ile-exists? test
2970: 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 -configf)(file-r
2980: 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74 ead-access? test
2990: 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 28 74 -configf))).. (t
29a0: 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 20 est-conf (if
29b0: 74 65 73 74 65 78 69 73 74 73 20 28 72 65 61 64 testexists (read
29c0: 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e -config test-con
29d0: 66 69 67 66 20 23 66 20 23 74 29 20 28 6d 61 6b figf #f #t) (mak
29e0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a e-hash-table))).
29f0: 09 20 28 77 61 69 74 6f 6e 20 20 20 20 20 20 20 . (waiton
2a00: 28 6c 65 74 20 28 28 77 20 28 63 6f 6e 66 69 67 (let ((w (config
2a10: 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e -lookup test-con
2a20: 66 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 f "requirements"
2a30: 20 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09 "waiton")))....
2a40: 20 28 69 66 20 28 73 74 72 69 6e 67 3f 20 77 29 (if (string? w)
2a50: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 77 29 (string-split w)
2a60: 27 28 29 29 29 29 0a 09 20 28 66 6f 72 63 65 20 '()))).. (force
2a70: 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 (hash-tab
2a80: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 le-ref/default f
2a90: 6c 61 67 73 20 22 2d 66 6f 72 63 65 22 20 23 66 lags "-force" #f
2aa0: 29 29 0a 09 20 28 72 65 72 75 6e 20 20 20 20 20 )).. (rerun
2ab0: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 (hash-table-r
2ac0: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 ef/default flags
2ad0: 20 22 2d 72 65 72 75 6e 22 20 23 66 29 29 0a 09 "-rerun" #f))..
2ae0: 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 28 (keepgoing (
2af0: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
2b00: 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b efault flags "-k
2b10: 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 eepgoing" #f))..
2b20: 20 3b 3b 20 41 72 65 20 74 68 65 73 65 20 74 61 ;; Are these ta
2b30: 67 73 20 73 74 69 6c 6c 20 75 73 65 64 3f 20 49 gs still used? I
2b40: 20 64 6f 6e 27 74 20 74 68 69 6e 6b 20 73 6f 2e don't think so.
2b50: 2e 2e 0a 09 20 3b 3b 28 74 61 67 73 20 20 20 20 .... ;;(tags
2b60: 20 20 20 20 20 28 6c 65 74 20 28 28 74 20 28 63 (let ((t (c
2b70: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 onfig-lookup tes
2b80: 74 2d 63 6f 6e 66 20 22 73 65 74 75 70 22 20 22 t-conf "setup" "
2b90: 74 61 67 73 22 29 29 29 0a 09 20 3b 3b 20 20 20 tags"))).. ;;
2ba0: 20 20 20 20 09 20 3b 3b 20 77 65 20 77 61 6e 74 . ;; we want
2bb0: 20 6f 75 72 20 74 61 67 73 20 74 6f 20 62 65 20 our tags to be
2bc0: 73 65 70 61 72 61 74 65 64 20 62 79 20 63 6f 6d separated by com
2bd0: 6d 61 73 20 61 6e 64 20 66 75 6c 6c 79 20 64 65 mas and fully de
2be0: 6c 69 6d 69 74 65 64 20 62 79 20 63 6f 6d 6d 61 limited by comma
2bf0: 73 0a 09 20 3b 3b 20 20 20 20 20 20 20 09 20 3b s.. ;; . ;
2c00: 3b 20 73 6f 20 74 68 61 74 20 71 75 65 72 69 65 ; so that querie
2c10: 73 20 77 69 74 68 20 22 6c 69 6b 65 22 20 63 61 s with "like" ca
2c20: 6e 20 74 69 65 20 74 6f 20 74 68 65 20 63 6f 6d n tie to the com
2c30: 6d 61 73 20 61 74 20 65 69 74 68 65 72 20 65 6e mas at either en
2c40: 64 20 6f 66 20 65 61 63 68 20 74 61 67 0a 09 20 d of each tag..
2c50: 3b 3b 20 20 20 20 20 20 20 09 20 3b 3b 20 77 68 ;; . ;; wh
2c60: 69 6c 65 20 61 6c 73 6f 20 61 6c 6c 6f 77 69 6e ile also allowin
2c70: 67 20 74 68 65 20 65 6e 64 20 75 73 65 72 20 74 g the end user t
2c80: 6f 20 66 72 65 65 6c 79 20 75 73 65 20 73 70 61 o freely use spa
2c90: 63 65 73 20 61 6e 64 20 63 6f 6d 6d 61 73 20 74 ces and commas t
2ca0: 6f 20 73 65 70 61 72 61 74 65 20 74 61 67 73 0a o separate tags.
2cb0: 09 20 3b 3b 20 20 20 20 20 20 20 09 20 28 69 66 . ;; . (if
2cc0: 20 28 73 74 72 69 6e 67 3f 20 74 29 28 73 74 72 (string? t)(str
2cd0: 69 6e 67 2d 73 75 62 73 74 69 74 75 74 65 20 28 ing-substitute (
2ce0: 72 65 67 65 78 70 20 22 5b 2c 5c 5c 73 5d 2b 22 regexp "[,\\s]+"
2cf0: 29 20 22 2c 22 20 28 63 6f 6e 63 20 22 2c 22 20 ) "," (conc ","
2d00: 74 20 22 2c 22 29 20 23 74 29 0a 09 20 3b 3b 20 t ",") #t).. ;;
2d10: 20 20 20 20 20 20 09 20 20 20 20 20 27 28 29 29 . '())
2d20: 29 29 29 0a 09 20 29 0a 20 20 20 20 28 69 66 20 ))).. ). (if
2d30: 28 6e 6f 74 20 74 65 73 74 65 78 69 73 74 73 29 (not testexists)
2d40: 0a 09 3b 3b 20 69 66 20 74 68 65 20 74 65 73 74 ..;; if the test
2d50: 20 69 73 20 69 6c 6c 20 64 65 66 69 6e 65 64 20 is ill defined
2d60: 73 70 69 74 20 6f 75 74 20 61 6e 20 65 72 72 6f spit out an erro
2d70: 72 20 62 75 74 20 6b 65 65 70 20 67 6f 69 6e 67 r but keep going
2d80: 20 28 64 69 66 66 65 72 65 6e 74 20 66 72 6f 6d (different from
2d90: 20 68 6f 77 20 64 6f 6e 65 20 70 72 65 76 69 6f how done previo
2da0: 75 73 6c 79 0a 09 28 64 65 62 75 67 3a 70 72 69 usly..(debug:pri
2db0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6e nt 0 "ERROR: Can
2dc0: 27 74 20 66 69 6e 64 20 63 6f 6e 66 69 67 20 66 't find config f
2dd0: 69 6c 65 20 22 20 74 65 73 74 2d 63 6f 6e 66 69 ile " test-confi
2de0: 67 66 29 0a 09 3b 3b 20 70 75 74 20 74 6f 70 20 gf)..;; put top
2df0: 76 61 72 73 20 69 6e 74 6f 20 63 6f 6e 76 65 6e vars into conven
2e00: 69 65 6e 74 20 76 61 72 69 61 62 6c 65 73 20 61 ient variables a
2e10: 6e 64 20 6f 70 65 6e 20 74 68 65 20 64 62 0a 09 nd open the db..
2e20: 28 6c 65 74 2a 20 28 3b 3b 20 64 62 20 69 73 20 (let* (;; db is
2e30: 61 6c 77 61 79 73 20 61 74 20 2a 74 6f 70 70 61 always at *toppa
2e40: 74 68 2a 2f 64 62 2f 6d 65 67 61 74 65 73 74 2e th*/db/megatest.
2e50: 64 62 0a 09 20 20 20 20 20 20 20 28 69 74 65 6d db.. (item
2e60: 73 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 s (hash-ta
2e70: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
2e80: 74 65 73 74 2d 63 6f 6e 66 20 22 69 74 65 6d 73 test-conf "items
2e90: 22 20 27 28 29 29 29 0a 09 20 20 20 20 20 20 20 " '()))..
2ea0: 28 69 74 65 6d 73 74 61 62 6c 65 20 20 28 68 61 (itemstable (ha
2eb0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
2ec0: 61 75 6c 74 20 74 65 73 74 2d 63 6f 6e 66 20 22 ault test-conf "
2ed0: 69 74 65 6d 73 74 61 62 6c 65 22 20 27 28 29 29 itemstable" '())
2ee0: 29 0a 09 20 20 20 20 20 20 20 28 61 6c 6c 69 74 ).. (allit
2ef0: 65 6d 73 20 20 20 20 28 69 66 20 28 6f 72 20 28 ems (if (or (
2f00: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 not (null? items
2f10: 29 29 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 69 74 ))(not (null? it
2f20: 65 6d 73 74 61 62 6c 65 29 29 29 0a 09 09 09 09 emstable))).....
2f30: 28 61 70 70 65 6e 64 20 28 69 74 65 6d 2d 61 73 (append (item-as
2f40: 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 soc->item-list i
2f50: 74 65 6d 73 29 0a 09 09 09 09 09 28 69 74 65 6d tems)......(item
2f60: 2d 74 61 62 6c 65 2d 3e 69 74 65 6d 2d 6c 69 73 -table->item-lis
2f70: 74 20 69 74 65 6d 73 74 61 62 6c 65 29 29 0a 09 t itemstable))..
2f80: 09 09 09 27 28 28 29 29 29 29 29 20 3b 3b 20 61 ...'(())))) ;; a
2f90: 20 6c 69 73 74 20 77 69 74 68 20 6f 6e 65 20 6e list with one n
2fa0: 75 6c 6c 20 6c 69 73 74 20 69 73 20 61 20 74 65 ull list is a te
2fb0: 73 74 20 77 69 74 68 20 6e 6f 20 69 74 65 6d 73 st with no items
2fc0: 0a 09 20 20 3b 3b 20 28 72 75 6e 63 6f 6e 66 69 .. ;; (runconfi
2fd0: 67 66 20 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 gf (conc *topp
2fe0: 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 ath* "/runconfig
2ff0: 73 2e 63 6f 6e 66 69 67 22 29 29 29 0a 09 20 20 s.config")))..
3000: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
3010: 69 74 65 6d 73 3a 20 22 29 0a 09 20 20 28 69 66 items: ").. (if
3020: 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a (>= *verbosity*
3030: 20 31 29 28 70 70 20 61 6c 6c 69 74 65 6d 73 29 1)(pp allitems)
3040: 29 0a 09 20 20 28 69 66 20 28 3e 3d 20 2a 76 65 ).. (if (>= *ve
3050: 72 62 6f 73 69 74 79 2a 20 35 29 0a 09 20 20 20 rbosity* 5)..
3060: 20 20 20 28 62 65 67 69 6e 0a 09 09 28 70 72 69 (begin...(pri
3070: 6e 74 20 22 69 74 65 6d 73 3a 20 22 29 28 70 70 nt "items: ")(pp
3080: 20 28 69 74 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 (item-assoc->it
3090: 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 29 29 0a em-list items)).
30a0: 09 09 28 70 72 69 6e 74 20 22 69 74 65 6d 73 74 ..(print "itemst
30b0: 61 62 6c 65 3a 20 22 29 28 70 70 20 28 69 74 65 able: ")(pp (ite
30c0: 6d 2d 74 61 62 6c 65 2d 3e 69 74 65 6d 2d 6c 69 m-table->item-li
30d0: 73 74 20 69 74 65 6d 73 74 61 62 6c 65 29 29 29 st itemstable)))
30e0: 29 0a 0a 09 20 20 3b 3b 20 43 6f 6d 6d 65 6e 74 )... ;; Comment
30f0: 73 20 61 72 65 20 6c 6f 61 64 65 64 20 62 79 20 s are loaded by
3100: 74 68 65 20 74 65 73 74 20 72 75 6e 2c 20 6e 6f the test run, no
3110: 74 20 61 74 20 6c 61 75 6e 63 68 20 74 69 6d 65 t at launch time
3120: 20 28 69 6e 20 67 65 6e 65 72 61 6c 29 0a 09 20 (in general)..
3130: 20 3b 3b 28 69 66 20 28 61 72 67 73 3a 67 65 74 ;;(if (args:get
3140: 2d 61 72 67 20 22 2d 6d 22 29 0a 09 20 20 3b 3b -arg "-m").. ;;
3150: 20 20 20 20 28 64 62 3a 73 65 74 2d 63 6f 6d 6d (db:set-comm
3160: 65 6e 74 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 ent-for-run db r
3170: 75 6e 2d 69 64 20 28 61 72 67 73 3a 67 65 74 2d un-id (args:get-
3180: 61 72 67 20 22 2d 6d 22 29 29 29 0a 0a 09 20 20 arg "-m")))...
3190: 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65 72 65 ;; Here is where
31a0: 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74 the test_meta t
31b0: 61 62 6c 65 20 69 73 20 62 65 73 74 20 75 70 64 able is best upd
31c0: 61 74 65 64 0a 09 20 20 28 72 75 6e 73 3a 75 70 ated.. (runs:up
31d0: 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 date-test_meta d
31e0: 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 b test-name test
31f0: 2d 63 6f 6e 66 29 0a 0a 09 20 20 3b 3b 20 62 72 -conf)... ;; br
3200: 61 69 6e 64 65 61 64 20 77 6f 72 6b 2d 61 72 6f aindead work-aro
3210: 75 6e 64 20 66 6f 72 20 70 6f 6f 72 6c 79 20 73 und for poorly s
3220: 70 65 63 69 66 69 65 64 20 61 6c 6c 69 74 65 6d pecified allitem
3230: 73 20 6c 69 73 74 20 42 55 47 21 21 21 20 46 49 s list BUG!!! FI
3240: 58 4d 45 0a 09 20 20 28 69 66 20 28 6e 75 6c 6c XME.. (if (null
3250: 3f 20 61 6c 6c 69 74 65 6d 73 29 28 73 65 74 21 ? allitems)(set!
3260: 20 61 6c 6c 69 74 65 6d 73 20 27 28 28 29 29 29 allitems '(()))
3270: 29 0a 09 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 ).. (let loop (
3280: 28 69 74 65 6d 64 61 74 20 28 63 61 72 20 61 6c (itemdat (car al
3290: 6c 69 74 65 6d 73 29 29 0a 09 09 20 20 20 20 20 litems))...
32a0: 28 74 61 6c 20 20 20 20 20 28 63 64 72 20 61 6c (tal (cdr al
32b0: 6c 69 74 65 6d 73 29 29 29 0a 09 20 20 20 20 3b litems))).. ;
32c0: 3b 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 ; (lambda (itemd
32d0: 61 74 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 at) ;;; ((ripene
32e0: 73 73 20 22 6f 76 65 72 72 69 70 65 22 29 20 28 ss "overripe") (
32f0: 74 65 6d 70 65 72 61 74 75 72 65 20 22 63 6f 6f temperature "coo
3300: 6c 22 29 20 28 73 65 61 73 6f 6e 20 22 73 75 6d l") (season "sum
3310: 6d 65 72 22 29 29 0a 09 20 20 20 20 3b 3b 20 48 mer")).. ;; H
3320: 61 6e 64 6c 65 20 6c 69 73 74 73 20 6f 66 20 69 andle lists of i
3330: 74 65 6d 73 0a 09 20 20 20 20 28 6c 65 74 2a 20 tems.. (let*
3340: 28 28 69 74 65 6d 2d 70 61 74 68 20 20 20 20 20 ((item-path
3350: 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 (item-list->path
3360: 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 28 73 itemdat)) ;; (s
3370: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 tring-interspers
3380: 65 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d e (map cadr item
3390: 64 61 74 29 20 22 2f 22 29 29 0a 09 09 20 20 20 dat) "/"))...
33a0: 28 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20 28 (new-test-path (
33b0: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
33c0: 73 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 se (cons test-pa
33d0: 74 68 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 th (map cadr ite
33e0: 6d 64 61 74 29 29 20 22 2f 22 29 29 0a 09 09 20 mdat)) "/"))...
33f0: 20 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 (new-test-name
3400: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 (if (equal? ite
3410: 6d 2d 70 61 74 68 20 22 22 29 20 74 65 73 74 2d m-path "") test-
3420: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d name (conc test-
3430: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 name "/" item-pa
3440: 74 68 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 th))) ;; just ne
3450: 65 64 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71 ed it to be uniq
3460: 75 65 0a 09 09 20 20 20 28 74 65 73 74 64 61 74 ue... (testdat
3470: 20 20 20 23 66 29 0a 09 09 20 20 20 28 6e 75 6d #f)... (num
3480: 2d 72 75 6e 6e 69 6e 67 20 28 64 62 3a 67 65 74 -running (db:get
3490: 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75 6e -count-tests-run
34a0: 6e 69 6e 67 20 64 62 29 29 0a 09 09 20 20 20 28 ning db))... (
34b0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
34c0: 6f 62 73 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b obs (config-look
34d0: 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 up *configdat* "
34e0: 73 65 74 75 70 22 20 22 6d 61 78 5f 63 6f 6e 63 setup" "max_conc
34f0: 75 72 72 65 6e 74 5f 6a 6f 62 73 22 29 29 0a 09 urrent_jobs"))..
3500: 09 20 20 20 28 70 61 72 65 6e 74 2d 74 65 73 74 . (parent-test
3510: 20 28 61 6e 64 20 28 6e 6f 74 20 28 6e 75 6c 6c (and (not (null
3520: 3f 20 69 74 65 6d 73 29 29 28 65 71 75 61 6c 3f ? items))(equal?
3530: 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 29 29 item-path "")))
3540: 0a 09 09 20 20 20 28 73 69 6e 67 6c 65 2d 74 65 ... (single-te
3550: 73 74 20 28 61 6e 64 20 28 6e 75 6c 6c 3f 20 69 st (and (null? i
3560: 74 65 6d 73 29 20 28 65 71 75 61 6c 3f 20 69 74 tems) (equal? it
3570: 65 6d 2d 70 61 74 68 20 22 22 29 29 29 0a 09 09 em-path "")))...
3580: 20 20 20 28 69 74 65 6d 2d 74 65 73 74 20 20 20 (item-test
3590: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 69 74 65 (not (equal? ite
35a0: 6d 2d 70 61 74 68 20 22 22 29 29 29 0a 09 09 20 m-path "")))...
35b0: 20 20 3b 3b 20 6c 6f 6f 6b 20 74 68 72 6f 75 67 ;; look throug
35c0: 68 20 61 6c 6c 20 74 68 65 20 69 74 65 6d 2d 70 h all the item-p
35d0: 61 74 74 73 20 69 66 20 64 65 66 69 6e 65 64 2c atts if defined,
35e0: 20 66 6f 72 6d 61 74 20 69 73 20 70 61 74 74 31 format is patt1
35f0: 2c 70 61 74 74 32 2c 70 61 74 74 33 20 2e 2e 2e ,patt2,patt3 ...
3600: 20 77 69 6c 64 63 61 72 64 20 69 73 20 25 0a 09 wildcard is %..
3610: 09 20 20 20 28 69 74 65 6d 2d 6d 61 74 63 68 65 . (item-matche
3620: 73 20 28 69 66 20 69 74 65 6d 2d 70 61 74 74 73 s (if item-patts
3630: 0a 09 09 09 09 20 20 20 20 20 28 6c 65 74 20 28 ..... (let (
3640: 28 72 65 73 20 23 66 29 29 0a 09 09 09 09 20 20 (res #f)).....
3650: 20 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a (for-each .
3660: 09 09 09 09 09 28 6c 61 6d 62 64 61 20 28 70 61 .....(lambda (pa
3670: 74 74 29 0a 09 09 09 09 09 20 20 28 69 66 20 28 tt)...... (if (
3680: 73 74 72 69 6e 67 2d 73 65 61 72 63 68 20 28 67 string-search (g
3690: 6c 6f 62 2d 3e 72 65 67 65 78 70 0a 09 09 09 09 lob->regexp.....
36a0: 09 09 09 20 20 20 20 20 20 28 73 74 72 69 6e 67 ... (string
36b0: 2d 74 72 61 6e 73 6c 61 74 65 20 70 61 74 74 20 -translate patt
36c0: 22 25 22 20 22 2a 22 29 29 0a 09 09 09 09 09 09 "%" "*")).......
36d0: 09 20 20 20 20 20 69 74 65 6d 2d 70 61 74 68 29 . item-path)
36e0: 0a 09 09 09 09 09 20 20 20 20 20 20 28 73 65 74 ...... (set
36f0: 21 20 72 65 73 20 23 74 29 29 29 0a 09 09 09 09 ! res #t))).....
3700: 09 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 69 .(string-split i
3710: 74 65 6d 2d 70 61 74 74 73 20 22 2c 22 29 29 0a tem-patts ",")).
3720: 09 09 09 09 20 20 20 20 20 20 20 72 65 73 29 0a .... res).
3730: 09 09 09 09 20 20 20 20 20 23 74 29 29 29 0a 09 .... #t)))..
3740: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
3750: 6e 74 20 33 20 22 6d 61 78 2d 63 6f 6e 63 75 72 nt 3 "max-concur
3760: 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d 61 78 rent-jobs: " max
3770: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 -concurrent-jobs
3780: 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 3a ", num-running:
3790: 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 0a " num-running).
37a0: 09 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 . (if (and
37b0: 69 74 65 6d 2d 6d 61 74 63 68 65 73 20 28 72 75 item-matches (ru
37c0: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d ns:can-run-more-
37d0: 74 65 73 74 73 20 64 62 29 29 0a 09 09 20 20 28 tests db))... (
37e0: 62 65 67 69 6e 0a 09 09 20 20 20 20 28 6c 65 74 begin... (let
37f0: 20 6c 6f 6f 70 32 20 28 28 74 73 20 28 64 62 3a loop2 ((ts (db:
3800: 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 get-test-info db
3810: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
3820: 65 20 69 74 65 6d 2d 70 61 74 68 29 29 20 3b 3b e item-path)) ;;
3830: 20 23 66 29 0a 09 09 09 09 28 63 74 20 30 29 29 #f).....(ct 0))
3840: 0a 09 09 20 20 20 20 20 20 28 69 66 20 28 61 6e ... (if (an
3850: 64 20 28 6e 6f 74 20 74 73 29 0a 09 09 09 20 20 d (not ts)....
3860: 20 20 20 20 20 28 3c 20 63 74 20 31 30 29 29 0a (< ct 10)).
3870: 09 09 09 20 20 28 62 65 67 69 6e 0a 09 09 09 20 ... (begin....
3880: 20 20 20 28 72 65 67 69 73 74 65 72 2d 74 65 73 (register-tes
3890: 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 t db run-id test
38a0: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 -name item-path)
38b0: 0a 09 09 09 20 20 20 20 3b 3b 20 57 68 79 20 64 .... ;; Why d
38c0: 69 64 20 49 20 73 65 74 20 74 68 65 20 63 6f 6d id I set the com
38d0: 6d 65 6e 74 20 68 65 72 65 3f 21 3f 20 50 4f 53 ment here?!? POS
38e0: 53 49 42 4c 45 20 42 55 47 20 42 55 54 20 49 27 SIBLE BUG BUT I'
38f0: 4d 20 52 45 4d 4f 56 49 4e 47 20 49 54 20 46 4f M REMOVING IT FO
3900: 52 20 4e 4f 57 20 31 30 2f 32 33 2f 32 30 31 31 R NOW 10/23/2011
3910: 0a 09 09 09 20 20 20 20 3b 3b 20 28 64 62 3a 74 .... ;; (db:t
3920: 65 73 74 2d 73 65 74 2d 63 6f 6d 6d 65 6e 74 20 est-set-comment
3930: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e db run-id test-n
3940: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 22 22 ame item-path ""
3950: 29 0a 09 09 09 20 20 20 20 28 6c 6f 6f 70 32 20 ).... (loop2
3960: 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 (db:get-test-inf
3970: 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 o db run-id test
3980: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 -name item-path)
3990: 0a 09 09 09 09 20 20 20 28 2b 20 63 74 20 31 29 ..... (+ ct 1)
39a0: 29 29 0a 09 09 09 20 20 28 69 66 20 74 73 0a 09 )).... (if ts..
39b0: 09 09 20 20 20 20 20 20 28 73 65 74 21 20 74 65 .. (set! te
39c0: 73 74 64 61 74 20 74 73 29 0a 09 09 09 20 20 20 stdat ts)....
39d0: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09 28 64 (begin.....(d
39e0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 ebug:print 0 "WA
39f0: 52 4e 49 4e 47 3a 20 43 6f 75 6c 64 6e 27 74 20 RNING: Couldn't
3a00: 72 65 67 69 73 74 65 72 20 74 65 73 74 20 22 20 register test "
3a10: 74 65 73 74 2d 6e 61 6d 65 20 22 20 77 69 74 68 test-name " with
3a20: 20 69 74 65 6d 20 70 61 74 68 20 22 20 69 74 65 item path " ite
3a30: 6d 2d 70 61 74 68 20 22 2c 20 73 6b 69 70 70 69 m-path ", skippi
3a40: 6e 67 22 29 0a 09 09 09 09 28 69 66 20 28 6e 6f ng").....(if (no
3a50: 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 t (null? tal))..
3a60: 09 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 ... (loop (ca
3a70: 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 r tal)(cdr tal))
3a80: 29 29 29 29 29 0a 09 09 20 20 20 20 28 63 68 61 )))))... (cha
3a90: 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 74 65 nge-directory te
3aa0: 73 74 2d 70 61 74 68 29 0a 09 09 20 20 20 20 3b st-path)... ;
3ab0: 3b 20 74 68 69 73 20 62 6c 6f 63 6b 20 69 73 20 ; this block is
3ac0: 68 65 72 65 20 6f 6e 6c 79 20 74 6f 20 69 6e 66 here only to inf
3ad0: 6f 72 6d 20 74 68 65 20 75 73 65 72 20 65 61 72 orm the user ear
3ae0: 6c 79 20 6f 6e 0a 09 09 20 20 20 20 0a 09 09 20 ly on... ...
3af0: 20 20 20 3b 3b 20 4d 6f 76 69 6e 67 20 74 68 69 ;; Moving thi
3b00: 73 20 74 6f 20 74 68 65 20 72 75 6e 20 63 61 6c s to the run cal
3b10: 6c 69 6e 67 20 62 6c 6f 63 6b 0a 0a 09 09 20 20 ling block....
3b20: 20 20 3b 3b 20 28 69 66 20 28 66 69 6c 65 2d 65 ;; (if (file-e
3b30: 78 69 73 74 73 3f 20 72 75 6e 63 6f 6e 66 69 67 xists? runconfig
3b40: 66 29 0a 09 09 20 20 20 20 3b 3b 20 20 20 20 20 f)... ;;
3b50: 28 73 65 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 (setup-env-defau
3b60: 6c 74 73 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 lts db runconfig
3b70: 66 20 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 f run-id *alread
3b80: 79 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 y-seen-runconfig
3b90: 2d 69 6e 66 6f 2a 29 0a 09 09 20 20 20 20 3b 3b -info*)... ;;
3ba0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
3bb0: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 59 6f t 0 "WARNING: Yo
3bc0: 75 20 64 6f 20 6e 6f 74 20 68 61 76 65 20 61 20 u do not have a
3bd0: 72 75 6e 20 63 6f 6e 66 69 67 20 66 69 6c 65 3a run config file:
3be0: 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 29 0a " runconfigf)).
3bf0: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 .. (debug:pri
3c00: 6e 74 20 34 20 22 72 75 6e 2d 69 64 3a 20 22 20 nt 4 "run-id: "
3c10: 72 75 6e 2d 69 64 20 22 20 74 65 73 74 2d 6e 61 run-id " test-na
3c20: 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 me: " test-name
3c30: 22 20 69 74 65 6d 2d 70 61 74 68 3a 20 22 20 69 " item-path: " i
3c40: 74 65 6d 2d 70 61 74 68 20 22 20 74 65 73 74 64 tem-path " testd
3c50: 61 74 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d at: " (test:get-
3c60: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 status testdat)
3c70: 22 20 74 65 73 74 2d 73 74 61 74 65 3a 20 22 20 " test-state: "
3c80: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 (test:get-state
3c90: 74 65 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 testdat))...
3ca0: 28 63 61 73 65 20 28 69 66 20 66 6f 72 63 65 20 (case (if force
3cb0: 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 ;; (args:get-arg
3cc0: 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 09 20 20 "-force")....
3cd0: 20 20 20 20 27 4e 4f 54 5f 53 54 41 52 54 45 44 'NOT_STARTED
3ce0: 0a 09 09 09 20 20 20 20 20 20 28 69 66 20 74 65 .... (if te
3cf0: 73 74 64 61 74 0a 09 09 09 09 20 20 28 73 74 72 stdat..... (str
3d00: 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 74 65 73 ing->symbol (tes
3d10: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
3d20: 64 61 74 29 29 0a 09 09 09 09 20 20 27 66 61 69 dat))..... 'fai
3d30: 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 29 0a led-to-insert)).
3d40: 09 09 20 20 20 20 20 20 28 28 66 61 69 6c 65 64 .. ((failed
3d50: 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 09 20 20 -to-insert)...
3d60: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
3d70: 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c t 0 "ERROR: Fail
3d80: 65 64 20 74 6f 20 69 6e 73 65 72 74 20 74 68 65 ed to insert the
3d90: 20 72 65 63 6f 72 64 20 69 6e 74 6f 20 74 68 65 record into the
3da0: 20 64 62 22 29 29 0a 09 09 20 20 20 20 20 20 28 db"))... (
3db0: 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 43 4f 4d (NOT_STARTED COM
3dc0: 50 4c 45 54 45 44 29 0a 09 09 20 20 20 20 20 20 PLETED)...
3dd0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 20 (debug:print 6
3de0: 22 47 6f 74 20 68 65 72 65 2c 20 22 20 28 74 65 "Got here, " (te
3df0: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
3e00: 74 64 61 74 29 29 0a 09 09 20 20 20 20 20 20 20 tdat))...
3e10: 28 6c 65 74 20 28 28 72 75 6e 66 6c 61 67 20 23 (let ((runflag #
3e20: 66 29 29 0a 09 09 09 20 28 63 6f 6e 64 0a 09 09 f)).... (cond...
3e30: 09 20 20 3b 3b 20 69 2e 65 2e 20 74 68 69 73 20 . ;; i.e. this
3e40: 69 73 20 74 68 65 20 70 61 72 65 6e 74 20 74 65 is the parent te
3e50: 73 74 20 74 6f 20 61 20 73 75 69 74 65 20 6f 66 st to a suite of
3e60: 20 69 74 65 6d 73 2c 20 6e 65 76 65 72 20 22 72 items, never "r
3e70: 75 6e 22 20 69 74 0a 09 09 09 20 20 28 70 61 72 un" it.... (par
3e80: 65 6e 74 2d 74 65 73 74 0a 09 09 09 20 20 20 28 ent-test.... (
3e90: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 set! runflag #f)
3ea0: 29 0a 09 09 09 20 20 3b 3b 20 2d 66 6f 72 63 65 ).... ;; -force
3eb0: 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 , run no matter
3ec0: 77 68 61 74 0a 09 09 09 20 20 28 66 6f 72 63 65 what.... (force
3ed0: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
3ee0: 74 29 29 0a 09 09 09 20 20 3b 3b 20 4e 4f 54 5f t)).... ;; NOT_
3ef0: 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f 20 STARTED, run no
3f00: 6d 61 74 74 65 72 20 77 68 61 74 0a 09 09 09 20 matter what....
3f10: 20 28 28 65 71 75 61 6c 3f 20 28 74 65 73 74 3a ((equal? (test:
3f20: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 get-state testda
3f30: 74 29 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 t) "NOT_STARTED"
3f40: 29 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 )(set! runflag #
3f50: 74 29 29 0a 09 09 09 20 20 3b 3b 20 6e 6f 74 20 t)).... ;; not
3f60: 2d 72 65 72 75 6e 20 61 6e 64 20 50 41 53 53 2c -rerun and PASS,
3f70: 20 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c 20 WARN or CHECK,
3f80: 64 6f 20 6e 6f 20 72 75 6e 0a 09 09 09 20 20 28 do no run.... (
3f90: 28 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72 65 (and (or (not re
3fa0: 72 75 6e 29 0a 09 09 09 09 20 20 20 20 6b 65 65 run)..... kee
3fb0: 70 67 6f 69 6e 67 29 0a 09 09 09 09 28 6d 65 6d pgoing).....(mem
3fc0: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 ber (test:get-st
3fd0: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28 atus testdat) '(
3fe0: 22 50 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 "PASS" "WARN" "C
3ff0: 48 45 43 4b 22 29 29 29 0a 09 09 09 20 20 20 28 HECK"))).... (
4000: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 set! runflag #f)
4010: 29 0a 09 09 09 20 20 3b 3b 20 2d 72 65 72 75 6e ).... ;; -rerun
4020: 20 61 6e 64 20 73 74 61 74 75 73 20 69 73 20 6f and status is o
4030: 6e 65 20 6f 66 20 74 68 65 20 73 70 65 63 69 66 ne of the specif
4040: 65 64 2c 20 72 75 6e 20 69 74 0a 09 09 09 20 20 ed, run it....
4050: 28 28 61 6e 64 20 72 65 72 75 6e 0a 09 09 09 09 ((and rerun.....
4060: 28 6c 65 74 20 28 28 72 65 72 75 6e 6c 73 74 20 (let ((rerunlst
4070: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 72 65 (string-split re
4080: 72 75 6e 20 22 2c 22 29 29 29 20 3b 3b 20 46 41 run ","))) ;; FA
4090: 49 4c 2c 0a 09 09 09 09 20 20 28 6d 65 6d 62 65 IL,..... (membe
40a0: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 r (test:get-stat
40b0: 75 73 20 74 65 73 74 64 61 74 29 20 72 65 72 75 us testdat) reru
40c0: 6e 6c 73 74 29 29 29 0a 09 09 09 20 20 20 28 73 nlst))).... (s
40d0: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 et! runflag #t))
40e0: 0a 09 09 09 20 20 3b 3b 20 2d 6b 65 65 70 67 6f .... ;; -keepgo
40f0: 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75 ing, do not reru
4100: 6e 20 46 41 49 4c 0a 09 09 09 20 20 28 28 61 6e n FAIL.... ((an
4110: 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09 09 09 d keepgoing.....
4120: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 (member (test:ge
4130: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
4140: 29 20 27 28 22 46 41 49 4c 22 29 29 29 0a 09 09 ) '("FAIL")))...
4150: 09 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 . (set! runfla
4160: 67 20 23 66 29 29 0a 09 09 09 20 20 28 28 61 6e g #f)).... ((an
4170: 64 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 d (not rerun)...
4180: 09 09 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a ..(member (test:
4190: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
41a0: 61 74 29 20 27 28 22 46 41 49 4c 22 20 22 6e 2f at) '("FAIL" "n/
41b0: 61 22 29 29 29 0a 09 09 09 20 20 20 28 73 65 74 a"))).... (set
41c0: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 ! runflag #t))..
41d0: 09 09 20 20 28 65 6c 73 65 20 28 73 65 74 21 20 .. (else (set!
41e0: 72 75 6e 66 6c 61 67 20 23 66 29 29 29 0a 09 09 runflag #f)))...
41f0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 . (debug:print 6
4200: 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e "RUNNING => run
4210: 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 67 20 flag: " runflag
4220: 22 20 53 54 41 54 45 3a 20 22 20 28 74 65 73 74 " STATE: " (test
4230: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 :get-state testd
4240: 61 74 29 20 22 20 53 54 41 54 55 53 3a 20 22 20 at) " STATUS: "
4250: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
4260: 20 74 65 73 74 64 61 74 29 29 0a 09 09 09 20 28 testdat)).... (
4270: 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 67 29 if (not runflag)
4280: 0a 09 09 09 20 20 20 20 20 28 69 66 20 28 6e 6f .... (if (no
4290: 74 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 09 t parent-test)..
42a0: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ... (debug:print
42b0: 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 1 "NOTE: Not st
42c0: 61 72 74 69 6e 67 20 74 65 73 74 20 22 20 6e 65 arting test " ne
42d0: 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 73 w-test-name " as
42e0: 20 69 74 20 69 73 20 73 74 61 74 65 20 5c 22 43 it is state \"C
42f0: 4f 4d 50 4c 45 54 45 44 5c 22 20 61 6e 64 20 73 OMPLETED\" and s
4300: 74 61 74 75 73 20 5c 22 22 20 28 74 65 73 74 3a tatus \"" (test:
4310: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
4320: 61 74 29 20 22 5c 22 2c 20 75 73 65 20 2d 66 6f at) "\", use -fo
4330: 72 63 65 20 74 6f 20 6f 76 65 72 72 69 64 65 22 rce to override"
4340: 29 29 0a 09 09 09 20 20 20 20 20 28 6c 65 74 2a )).... (let*
4350: 20 28 28 67 65 74 2d 70 72 65 72 65 71 73 2d 63 ((get-prereqs-c
4360: 6d 64 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 09 md (lambda ()...
4370: 09 09 09 09 20 20 20 20 20 20 20 28 64 62 2d 67 .... (db-g
4380: 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d et-prereqs-not-m
4390: 65 74 20 64 62 20 72 75 6e 2d 69 64 20 77 61 69 et db run-id wai
43a0: 74 6f 6e 29 29 29 20 3b 3b 20 63 68 65 63 6b 20 ton))) ;; check
43b0: 62 65 66 6f 72 65 20 72 75 6e 6e 69 6e 67 20 2e before running .
43c0: 2e 2e 2e 0a 09 09 09 09 20 20 20 20 28 6c 61 75 ........ (lau
43d0: 6e 63 68 2d 63 6d 64 20 20 20 20 20 20 28 6c 61 nch-cmd (la
43e0: 6d 62 64 61 20 28 29 0a 09 09 09 09 09 09 20 20 mbda ().......
43f0: 20 20 20 20 20 28 6c 61 75 6e 63 68 2d 74 65 73 (launch-tes
4400: 74 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e t db run-id runn
4410: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 ame test-conf ke
4420: 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d yvallst test-nam
4430: 65 20 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d e test-path item
4440: 64 61 74 20 66 6c 61 67 73 29 29 29 0a 09 09 09 dat flags)))....
4450: 09 20 20 20 20 28 74 65 73 74 72 75 6e 64 61 74 . (testrundat
4460: 20 20 20 20 20 20 28 6c 69 73 74 20 67 65 74 2d (list get-
4470: 70 72 65 72 65 71 73 2d 63 6d 64 20 6c 61 75 6e prereqs-cmd laun
4480: 63 68 2d 63 6d 64 29 29 29 0a 09 09 09 20 20 20 ch-cmd)))....
4490: 20 20 20 20 28 69 66 20 28 6f 72 20 66 6f 72 63 (if (or forc
44a0: 65 0a 09 09 09 09 20 20 20 20 20 20 20 28 6c 65 e..... (le
44b0: 74 20 28 28 70 72 65 71 73 2d 6e 6f 74 2d 79 65 t ((preqs-not-ye
44c0: 74 2d 6d 65 74 20 28 28 63 61 72 20 74 65 73 74 t-met ((car test
44d0: 72 75 6e 64 61 74 29 29 29 29 0a 09 09 09 09 09 rundat))))......
44e0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
44f0: 22 50 72 65 71 72 65 71 75 65 73 69 74 65 73 20 "Preqrequesites
4500: 66 6f 72 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 for " test-name
4510: 22 3a 20 22 20 70 72 65 71 73 2d 6e 6f 74 2d 79 ": " preqs-not-y
4520: 65 74 2d 6d 65 74 29 0a 09 09 09 09 09 20 28 6e et-met)...... (n
4530: 75 6c 6c 3f 20 70 72 65 71 73 2d 6e 6f 74 2d 79 ull? preqs-not-y
4540: 65 74 2d 6d 65 74 29 29 29 20 3b 3b 20 61 72 65 et-met))) ;; are
4550: 20 74 68 65 72 65 20 61 6e 79 20 74 65 73 74 73 there any tests
4560: 20 74 68 61 74 20 6d 75 73 74 20 62 65 20 72 75 that must be ru
4570: 6e 20 62 65 66 6f 72 65 20 74 68 69 73 20 6f 6e n before this on
4580: 65 2e 2e 2e 0a 09 09 09 09 20 20 20 28 69 66 20 e........ (if
4590: 28 6e 6f 74 20 28 28 63 61 64 72 20 74 65 73 74 (not ((cadr test
45a0: 72 75 6e 64 61 74 29 29 29 20 3b 3b 20 74 68 69 rundat))) ;; thi
45b0: 73 20 69 73 20 74 68 65 20 6c 69 6e 65 20 74 68 s is the line th
45c0: 61 74 20 6c 61 75 6e 63 68 65 73 20 74 68 65 20 at launches the
45d0: 74 65 73 74 20 74 6f 20 74 68 65 20 72 65 6d 6f test to the remo
45e0: 74 65 20 68 6f 73 74 0a 09 09 09 09 20 20 20 20 te host.....
45f0: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09 09 20 (begin......
4600: 28 70 72 69 6e 74 20 22 45 52 52 4f 52 3a 20 46 (print "ERROR: F
4610: 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 ailed to launch
4620: 74 68 65 20 74 65 73 74 2e 20 45 78 69 74 69 6e the test. Exitin
4630: 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73 g as soon as pos
4640: 73 69 62 6c 65 22 29 0a 09 09 09 09 09 20 28 73 sible")...... (s
4650: 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 et! *globalexits
4660: 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09 tatus* 1) ;; ...
4670: 09 09 09 20 28 70 72 6f 63 65 73 73 2d 73 69 67 ... (process-sig
4680: 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 6f nal (current-pro
4690: 63 65 73 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f cess-id) signal/
46a0: 6b 69 6c 6c 29 0a 09 09 09 09 09 20 3b 28 65 78 kill)...... ;(ex
46b0: 69 74 20 31 29 0a 09 09 09 09 09 20 29 29 0a 09 it 1)...... ))..
46c0: 09 09 09 20 20 20 28 69 66 20 28 6e 6f 74 20 6b ... (if (not k
46d0: 65 65 70 67 6f 69 6e 67 29 0a 09 09 09 09 20 20 eepgoing).....
46e0: 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 (hash-table
46f0: 2d 73 65 74 21 20 2a 77 61 69 74 69 6e 67 2d 71 -set! *waiting-q
4700: 75 65 75 65 2a 20 6e 65 77 2d 74 65 73 74 2d 6e ueue* new-test-n
4710: 61 6d 65 20 74 65 73 74 72 75 6e 64 61 74 29 29 ame testrundat))
4720: 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 28 28 )))))... ((
4730: 4b 49 4c 4c 45 44 29 20 0a 09 09 20 20 20 20 20 KILLED) ...
4740: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
4750: 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 "NOTE: " new-te
4760: 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 st-name " is alr
4770: 65 61 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 eady running or
4780: 77 61 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 was explictly ki
4790: 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 lled, use -force
47a0: 20 74 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 to launch it.")
47b0: 29 0a 09 09 20 20 20 20 20 20 28 28 4c 41 55 4e )... ((LAUN
47c0: 43 48 45 44 20 52 45 4d 4f 54 45 48 4f 53 54 53 CHED REMOTEHOSTS
47d0: 54 41 52 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a TART RUNNING) .
47e0: 09 09 20 20 20 20 20 20 20 28 69 66 20 28 3e 20 .. (if (>
47f0: 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f (- (current-seco
4800: 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 73 74 2d nds)(+ (db:test-
4810: 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 get-event_time t
4820: 65 73 74 64 61 74 29 0a 09 09 09 09 09 09 20 20 estdat).......
4830: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d (db:test-get-
4840: 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 run_duration tes
4850: 74 64 61 74 29 29 29 0a 09 09 09 20 20 20 20 20 tdat)))....
4860: 20 31 30 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 100) ;; i.e. no
4870: 20 75 70 64 61 74 65 20 66 6f 72 20 6d 6f 72 65 update for more
4880: 20 74 68 61 6e 20 31 30 30 20 73 65 63 6f 6e 64 than 100 second
4890: 73 0a 09 09 09 20 20 20 28 62 65 67 69 6e 0a 09 s.... (begin..
48a0: 09 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 .. (debug:pr
48b0: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 int 0 "WARNING:
48c0: 54 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 Test " test-name
48d0: 20 22 20 61 70 70 65 61 72 73 20 74 6f 20 62 65 " appears to be
48e0: 20 64 65 61 64 2e 20 46 6f 72 63 69 6e 67 20 69 dead. Forcing i
48f0: 74 20 74 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d t to state INCOM
4900: 50 4c 45 54 45 20 61 6e 64 20 73 74 61 74 75 73 PLETE and status
4910: 20 53 54 55 43 4b 2f 44 45 41 44 22 29 0a 09 09 STUCK/DEAD")...
4920: 09 20 20 20 20 20 28 74 65 73 74 2d 73 65 74 2d . (test-set-
4930: 73 74 61 74 75 73 21 20 64 62 20 72 75 6e 2d 69 status! db run-i
4940: 64 20 74 65 73 74 2d 6e 61 6d 65 20 22 49 4e 43 d test-name "INC
4950: 4f 4d 50 4c 45 54 45 22 20 22 53 54 55 43 4b 2f OMPLETE" "STUCK/
4960: 44 45 41 44 22 20 69 74 65 6d 64 61 74 20 22 54 DEAD" itemdat "T
4970: 65 73 74 20 69 73 20 73 74 75 63 6b 20 6f 72 20 est is stuck or
4980: 64 65 61 64 22 20 23 66 29 29 0a 09 09 09 20 20 dead" #f))....
4990: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
49a0: 22 4e 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e 61 "NOTE: " test-na
49b0: 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 me " is already
49c0: 72 75 6e 6e 69 6e 67 22 29 29 29 0a 09 09 20 20 running")))...
49d0: 20 20 20 20 28 65 6c 73 65 20 20 20 20 20 20 20 (else
49e0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
49f0: 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f ERROR: Failed to
4a00: 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e launch test " n
4a10: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 ew-test-name ".
4a20: 55 6e 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61 Unrecognised sta
4a30: 74 65 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 te " (test:get-s
4a40: 74 61 74 65 20 74 65 73 74 64 61 74 29 29 29 29 tate testdat))))
4a50: 29 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e )).. (if (n
4a60: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a ot (null? tal)).
4a70: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 .. (loop (car t
4a80: 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29 29 al)(cdr tal)))))
4a90: 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d ))))..;;========
4aa0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4ab0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4ac0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4ad0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b ==============.;
4ae0: 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 ; END OF NEW STU
4af0: 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d FF.;;===========
4b00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4b10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 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 0a 0a 28 64 65 ===========..(de
4b40: 66 69 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 70 fine (get-dir-up
4b50: 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 6d 73 29 -n dir . params)
4b60: 20 0a 20 20 28 6c 65 74 20 28 28 64 70 61 72 74 . (let ((dpart
4b70: 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 s (string-split
4b80: 20 64 69 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 dir "/"))..(cou
4b90: 6e 74 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 nt (if (null?
4ba0: 70 61 72 61 6d 73 29 20 31 20 28 63 61 72 20 70 params) 1 (car p
4bb0: 61 72 61 6d 73 29 29 29 29 0a 20 20 20 20 28 63 arams)))). (c
4bc0: 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d onc "/" (string-
4bd0: 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 20 20 intersperse ..
4be0: 20 20 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 (take dpart
4bf0: 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 s (- (length dpa
4c00: 72 74 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 rts) count))..
4c10: 20 20 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 "/")))).;;
4c20: 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 Remove runs.;; f
4c30: 69 65 6c 64 73 20 61 72 65 20 70 61 73 73 69 6e ields are passin
4c40: 67 20 69 6e 20 74 68 72 6f 75 67 68 20 0a 28 64 g in through .(d
4c50: 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 65 6d 6f efine (runs:remo
4c60: 76 65 2d 72 75 6e 73 20 64 62 20 72 75 6e 6e 61 ve-runs db runna
4c70: 6d 65 70 61 74 74 20 74 65 73 74 70 61 74 74 20 mepatt testpatt
4c80: 69 74 65 6d 70 61 74 74 29 0a 20 20 28 6c 65 74 itempatt). (let
4c90: 2a 20 28 28 6b 65 79 73 20 20 20 20 20 20 20 20 * ((keys
4ca0: 28 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 (db-get-keys db)
4cb0: 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 20 20 ).. (rundat
4cc0: 20 28 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d (runs:get-runs-
4cd0: 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 by-patt db keys
4ce0: 72 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 runnamepatt))..
4cf0: 28 68 65 61 64 65 72 20 20 20 20 20 20 28 76 65 (header (ve
4d00: 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 ctor-ref rundat
4d10: 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 0)).. (runs
4d20: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 (vector-ref r
4d30: 75 6e 64 61 74 20 31 29 29 29 0a 20 20 20 20 28 undat 1))). (
4d40: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 48 debug:print 1 "H
4d50: 65 61 64 65 72 3a 20 22 20 68 65 61 64 65 72 29 eader: " header)
4d60: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 . (for-each.
4d70: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e (lambda (run
4d80: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 ). (let ((
4d90: 72 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 runkey (string-i
4da0: 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 ntersperse (map
4db0: 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 (lambda (k).....
4dc0: 09 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d ..(db:get-value-
4dd0: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
4de0: 61 64 65 72 20 28 76 65 63 74 6f 72 2d 72 65 66 ader (vector-ref
4df0: 20 6b 20 30 29 29 29 20 6b 65 79 73 29 20 22 2f k 0))) keys) "/
4e00: 22 29 29 0a 09 20 20 20 20 20 28 64 69 72 73 2d ")).. (dirs-
4e10: 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b 65 2d to-remove (make-
4e20: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 hash-table)))..
4e30: 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 20 28 (let* ((run-id (
4e40: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
4e50: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
4e60: 72 20 22 69 64 22 29 20 29 0a 09 09 28 74 65 73 r "id") )...(tes
4e70: 74 73 20 20 28 64 62 2d 67 65 74 2d 74 65 73 74 ts (db-get-test
4e80: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 s-for-run db (db
4e90: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
4ea0: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
4eb0: 22 69 64 22 29 20 74 65 73 74 70 61 74 74 20 69 "id") testpatt i
4ec0: 74 65 6d 70 61 74 74 20 27 28 29 20 27 28 29 29 tempatt '() '())
4ed0: 29 0a 09 09 28 6c 61 73 74 74 70 61 74 68 20 22 )...(lasttpath "
4ee0: 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f /does/not/exist/
4ef0: 49 2f 68 6f 70 65 22 29 29 0a 0a 09 20 20 20 28 I/hope"))... (
4f00: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 if (not (null? t
4f10: 65 73 74 73 29 29 0a 09 20 20 20 20 20 20 20 28 ests)).. (
4f20: 62 65 67 69 6e 0a 09 09 20 28 64 65 62 75 67 3a begin... (debug:
4f30: 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e print 1 "Removin
4f40: 67 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a g tests for run:
4f50: 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 " runkey " " (d
4f60: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 b:get-value-by-h
4f70: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 eader run header
4f80: 20 22 72 75 6e 6e 61 6d 65 22 29 29 0a 09 09 20 "runname"))...
4f90: 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c (for-each... (l
4fa0: 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 09 20 ambda (test)...
4fb0: 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d (let* ((item-
4fc0: 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 path (db:test-ge
4fd0: 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 t-item-path test
4fe0: 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e )).... (test-n
4ff0: 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74 ame (db:test-get
5000: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29 -testname test))
5010: 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20 .... (run-dir
5020: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 (db:test-get-r
5030: 75 6e 64 69 72 20 74 65 73 74 29 29 29 0a 09 09 undir test)))...
5040: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
5050: 6e 74 20 31 20 22 20 20 22 20 28 64 62 3a 74 65 nt 1 " " (db:te
5060: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 st-get-testname
5070: 74 65 73 74 29 20 22 20 69 64 3a 20 22 20 28 64 test) " id: " (d
5080: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
5090: 73 74 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74 st) " " item-pat
50a0: 68 29 0a 09 09 20 20 20 20 20 20 28 64 62 3a 64 h)... (db:d
50b0: 65 6c 65 74 65 2d 74 65 73 74 2d 72 65 63 6f 72 elete-test-recor
50c0: 64 73 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 ds db (db:test-g
50d0: 65 74 2d 69 64 20 74 65 73 74 29 29 0a 09 09 20 et-id test))...
50e0: 20 20 20 20 20 28 69 66 20 28 3e 20 28 73 74 72 (if (> (str
50f0: 69 6e 67 2d 6c 65 6e 67 74 68 20 72 75 6e 2d 64 ing-length run-d
5100: 69 72 29 20 35 29 20 3b 3b 20 62 61 64 20 68 65 ir) 5) ;; bad he
5110: 75 72 69 73 74 69 63 20 62 75 74 20 73 68 6f 75 uristic but shou
5120: 6c 64 20 70 72 65 76 65 6e 74 20 2f 74 6d 70 20 ld prevent /tmp
5130: 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20 20 /home etc.....
5140: 28 6c 65 74 20 28 28 66 75 6c 6c 70 61 74 68 20 (let ((fullpath
5150: 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 22 2f 22 run-dir)) ;; "/"
5160: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 (db:test-get-it
5170: 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 29 29 em-path test))))
5180: 0a 09 09 09 20 20 20 20 28 73 65 74 21 20 6c 61 .... (set! la
5190: 73 74 74 70 61 74 68 20 66 75 6c 6c 70 61 74 68 sttpath fullpath
51a0: 29 0a 09 09 09 20 20 20 20 28 68 61 73 68 2d 74 ).... (hash-t
51b0: 61 62 6c 65 2d 73 65 74 21 20 64 69 72 73 2d 74 able-set! dirs-t
51c0: 6f 2d 72 65 6d 6f 76 65 20 66 75 6c 6c 70 61 74 o-remove fullpat
51d0: 68 20 23 74 29 0a 09 09 09 20 20 20 20 3b 3b 20 h #t).... ;;
51e0: 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 77 61 The following wa
51f0: 73 20 74 68 65 20 73 61 66 65 20 64 65 6c 65 74 s the safe delet
5200: 65 20 63 6f 64 65 20 62 75 74 20 69 74 20 77 61 e code but it wa
5210: 73 20 6e 6f 74 20 62 65 69 6e 67 20 65 78 65 63 s not being exec
5220: 74 75 74 65 64 2e 0a 09 09 09 20 20 20 20 3b 3b tuted..... ;;
5230: 20 28 6c 65 74 2a 20 28 28 64 69 72 73 2d 63 6f (let* ((dirs-co
5240: 75 6e 74 20 28 2b 20 31 20 28 6c 65 6e 67 74 68 unt (+ 1 (length
5250: 20 6b 65 79 73 29 28 6c 65 6e 67 74 68 20 28 73 keys)(length (s
5260: 74 72 69 6e 67 2d 73 70 6c 69 74 20 69 74 65 6d tring-split item
5270: 2d 70 61 74 68 20 22 2f 22 29 29 29 29 0a 09 09 -path "/"))))...
5280: 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 . ;; (
5290: 64 69 72 2d 74 6f 2d 72 65 6d 20 28 67 65 74 2d dir-to-rem (get-
52a0: 64 69 72 2d 75 70 2d 6e 20 66 75 6c 6c 70 61 74 dir-up-n fullpat
52b0: 68 20 64 69 72 73 2d 63 6f 75 6e 74 29 29 0a 09 h dirs-count))..
52c0: 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 .. ;;
52d0: 28 72 65 6d 61 69 6e 69 6e 67 64 20 28 73 74 72 (remainingd (str
52e0: 69 6e 67 2d 73 75 62 73 74 69 74 75 74 65 20 28 ing-substitute (
52f0: 72 65 67 65 78 70 20 28 63 6f 6e 63 20 22 5e 22 regexp (conc "^"
5300: 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 2f 22 29 dir-to-rem "/")
5310: 29 20 22 22 20 66 75 6c 6c 70 61 74 68 29 29 0a ) "" fullpath)).
5320: 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 ... ;;
5330: 20 28 63 6d 64 20 28 63 6f 6e 63 20 22 63 64 20 (cmd (conc "cd
5340: 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 3b 20 " dir-to-rem ";
5350: 72 6d 64 69 72 20 2d 70 20 22 20 72 65 6d 61 69 rmdir -p " remai
5360: 6e 69 6e 67 64 20 29 29 29 0a 09 09 09 20 20 20 ningd )))....
5370: 20 3b 3b 20 20 20 28 69 66 20 28 66 69 6c 65 2d ;; (if (file-
5380: 65 78 69 73 74 73 3f 20 66 75 6c 6c 70 61 74 68 exists? fullpath
5390: 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 ).... ;;
53a0: 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 (begin....
53b0: 3b 3b 20 20 20 20 20 20 20 20 20 28 64 65 62 75 ;; (debu
53c0: 67 3a 70 72 69 6e 74 20 31 20 63 6d 64 29 0a 09 g:print 1 cmd)..
53d0: 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 .. ;;
53e0: 20 28 73 79 73 74 65 6d 20 63 6d 64 29 29 29 0a (system cmd))).
53f0: 09 09 09 20 20 20 20 3b 3b 20 20 20 29 29 0a 09 ... ;; ))..
5400: 09 09 20 20 20 20 29 29 29 29 0a 09 09 20 20 20 .. ))))...
5410: 20 74 65 73 74 73 29 29 29 0a 0a 09 20 20 20 3b tests)))... ;
5420: 3b 20 6c 6f 6f 6b 20 74 68 6f 75 67 68 20 74 68 ; look though th
5430: 65 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 e dirs-to-remove
5440: 20 66 6f 72 20 63 61 6e 64 69 64 61 74 65 73 20 for candidates
5450: 66 6f 72 20 72 65 6d 6f 76 61 6c 2e 20 44 6f 20 for removal. Do
5460: 74 68 69 73 20 61 66 74 65 72 20 64 65 6c 65 74 this after delet
5470: 69 6e 67 20 74 68 65 20 72 65 63 6f 72 64 73 0a ing the records.
5480: 09 20 20 20 3b 3b 20 66 6f 72 20 65 61 63 68 20 . ;; for each
5490: 74 65 73 74 20 69 6e 20 63 61 73 65 20 77 65 20 test in case we
54a0: 67 65 74 20 6b 69 6c 6c 65 64 2e 20 54 68 61 74 get killed. That
54b0: 20 73 68 6f 75 6c 64 20 6d 69 6e 69 6d 69 7a 65 should minimize
54c0: 20 74 68 65 20 64 65 74 72 69 74 75 73 20 6c 65 the detritus le
54d0: 66 74 20 6f 6e 20 64 69 73 6b 0a 09 20 20 20 3b ft on disk.. ;
54e0: 3b 20 70 72 6f 63 65 73 73 20 74 68 65 20 64 69 ; process the di
54f0: 72 73 20 66 72 6f 6d 20 6c 6f 6e 67 65 73 74 20 rs from longest
5500: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 74 6f string length to
5510: 20 73 68 6f 72 74 65 73 74 0a 09 20 20 20 28 66 shortest.. (f
5520: 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 20 28 6c or-each .. (l
5530: 61 6d 62 64 61 20 28 64 69 72 2d 74 6f 2d 72 65 ambda (dir-to-re
5540: 6d 6f 76 65 29 0a 09 20 20 20 20 20 20 28 69 66 move).. (if
5550: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 64 (file-exists? d
5560: 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 09 ir-to-remove)...
5570: 20 20 28 6c 65 74 20 28 28 64 69 72 2d 69 6e 2d (let ((dir-in-
5580: 64 62 20 27 28 29 29 29 0a 09 09 20 20 20 20 28 db '()))... (
5590: 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 sqlite3:for-each
55a0: 2d 72 6f 77 0a 09 09 20 20 20 20 20 28 6c 61 6d -row... (lam
55b0: 62 64 61 20 28 64 69 72 29 0a 09 09 20 20 20 20 bda (dir)...
55c0: 20 20 20 28 73 65 74 21 20 64 69 72 2d 69 6e 2d (set! dir-in-
55d0: 64 62 20 28 63 6f 6e 73 20 64 69 72 20 64 69 72 db (cons dir dir
55e0: 2d 69 6e 2d 64 62 29 29 29 0a 09 09 20 20 20 20 -in-db)))...
55f0: 20 64 62 20 22 53 45 4c 45 43 54 20 72 75 6e 64 db "SELECT rund
5600: 69 72 20 46 52 4f 4d 20 74 65 73 74 73 20 57 48 ir FROM tests WH
5610: 45 52 45 20 72 75 6e 64 69 72 20 4c 49 4b 45 20 ERE rundir LIKE
5620: 3f 3b 22 20 0a 09 09 20 20 20 20 20 28 63 6f 6e ?;" ... (con
5630: 63 20 22 25 22 20 64 69 72 2d 74 6f 2d 72 65 6d c "%" dir-to-rem
5640: 6f 76 65 20 22 25 22 29 29 20 3b 3b 20 79 65 73 ove "%")) ;; yes
5650: 2c 20 49 27 6d 20 67 6f 69 6e 67 20 74 6f 20 62 , I'm going to b
5660: 61 69 6c 20 69 66 20 74 68 65 72 65 20 69 73 20 ail if there is
5670: 61 6e 79 74 68 69 6e 67 20 6c 69 6b 65 20 74 68 anything like th
5680: 69 73 20 64 69 72 20 69 6e 20 74 68 65 20 64 62 is dir in the db
5690: 0a 09 09 20 20 20 20 28 69 66 20 28 6e 75 6c 6c ... (if (null
56a0: 3f 20 64 69 72 2d 69 6e 2d 64 62 29 0a 09 09 09 ? dir-in-db)....
56b0: 28 62 65 67 69 6e 0a 09 09 09 20 20 28 64 65 62 (begin.... (deb
56c0: 75 67 3a 70 72 69 6e 74 20 32 20 22 52 65 6d 6f ug:print 2 "Remo
56d0: 76 69 6e 67 20 64 69 72 65 63 74 6f 72 79 20 77 ving directory w
56e0: 69 74 68 20 7a 65 72 6f 20 64 62 20 72 65 66 65 ith zero db refe
56f0: 72 65 6e 63 65 73 3a 20 22 20 64 69 72 2d 74 6f rences: " dir-to
5700: 2d 72 65 6d 6f 76 65 29 0a 09 09 09 20 20 28 73 -remove).... (s
5710: 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 ystem (conc "rm
5720: 2d 72 66 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d -rf " dir-to-rem
5730: 6f 76 65 29 29 0a 09 09 09 20 20 28 68 61 73 68 ove)).... (hash
5740: 2d 74 61 62 6c 65 2d 64 65 6c 65 74 65 21 20 64 -table-delete! d
5750: 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 64 69 irs-to-remove di
5760: 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 29 0a 09 09 r-to-remove))...
5770: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 .(debug:print 2
5780: 22 53 6b 69 70 70 69 6e 67 20 72 65 6d 6f 76 61 "Skipping remova
5790: 6c 20 6f 66 20 22 20 64 69 72 2d 74 6f 2d 72 65 l of " dir-to-re
57a0: 6d 6f 76 65 20 22 20 66 6f 72 20 6e 6f 77 20 61 move " for now a
57b0: 73 20 69 74 20 73 74 69 6c 6c 20 68 61 73 20 72 s it still has r
57c0: 65 66 65 72 65 6e 63 65 73 20 69 6e 20 74 68 65 eferences in the
57d0: 20 64 61 74 61 62 61 73 65 22 29 29 29 29 29 0a database"))))).
57e0: 09 20 20 20 20 28 73 6f 72 74 20 28 68 61 73 68 . (sort (hash
57f0: 2d 74 61 62 6c 65 2d 6b 65 79 73 20 64 69 72 73 -table-keys dirs
5800: 2d 74 6f 2d 72 65 6d 6f 76 65 29 20 28 6c 61 6d -to-remove) (lam
5810: 62 64 61 20 28 61 20 62 29 28 3e 20 28 73 74 72 bda (a b)(> (str
5820: 69 6e 67 2d 6c 65 6e 67 74 68 20 61 29 28 73 74 ing-length a)(st
5830: 72 69 6e 67 2d 6c 65 6e 67 74 68 20 62 29 29 29 ring-length b)))
5840: 29 29 0a 0a 09 20 20 20 3b 3b 20 72 65 6d 6f 76 ))... ;; remov
5850: 65 20 74 68 65 20 72 75 6e 20 69 66 20 7a 65 72 e the run if zer
5860: 6f 20 74 65 73 74 73 20 72 65 6d 61 69 6e 0a 09 o tests remain..
5870: 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 (let ((remtes
5880: 74 73 20 28 64 62 2d 67 65 74 2d 74 65 73 74 73 ts (db-get-tests
5890: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a -for-run db (db:
58a0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 get-value-by-hea
58b0: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 der run header "
58c0: 69 64 22 29 20 23 66 20 23 66 20 27 28 29 20 27 id") #f #f '() '
58d0: 28 29 29 29 29 0a 09 20 20 20 20 20 28 69 66 20 ()))).. (if
58e0: 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 (null? remtests)
58f0: 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74 ;; no more test
5900: 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 28 s remaining... (
5910: 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 28 let* ((dparts (
5920: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73 string-split las
5930: 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09 ttpath "/"))....
5940: 28 72 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 22 (runpath (conc "
5950: 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 /" (string-inter
5960: 73 70 65 72 73 65 20 0a 09 09 09 09 09 20 20 20 sperse ......
5970: 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d (take dparts (-
5980: 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 (length dparts)
5990: 20 31 29 29 0a 09 09 09 09 09 20 20 20 20 22 2f 1))...... "/
59a0: 22 29 29 29 29 0a 09 09 20 20 20 28 64 65 62 75 "))))... (debu
59b0: 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 g:print 1 "Remov
59c0: 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 ing run: " runke
59d0: 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 y " " (db:get-va
59e0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
59f0: 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d n header "runnam
5a00: 65 22 29 29 0a 09 09 20 20 20 28 64 62 3a 64 65 e"))... (db:de
5a10: 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 6e 2d lete-run db run-
5a20: 69 64 29 0a 09 09 20 20 20 3b 3b 20 6e 65 65 64 id)... ;; need
5a30: 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74 20 74 to figure out t
5a40: 68 65 20 70 61 74 68 20 74 6f 20 74 68 65 20 72 he path to the r
5a50: 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 un dir and remov
5a60: 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a 09 09 e it if empty...
5a70: 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28 6e 75 ;; (if (nu
5a80: 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 ll? (glob (conc
5a90: 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 0a runpath "/*"))).
5aa0: 09 09 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 .. ;; (
5ab0: 62 65 67 69 6e 0a 09 09 20 20 20 3b 3b 20 09 20 begin... ;; .
5ac0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
5ad0: 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 72 Removing run dir
5ae0: 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09 20 20 " runpath)...
5af0: 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 28 63 ;; . (system (c
5b00: 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 22 20 onc "rmdir -p "
5b10: 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09 20 20 runpath))))...
5b20: 20 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20 20 )))).. )).
5b30: 72 75 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d runs)))..;;=====
5b40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b80: 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f =.;; Routines fo
5b90: 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 72 r manipulating r
5ba0: 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d uns.;;==========
5bb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
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 0a 0a 3b 3b ============..;;
5bf0: 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c Since many call
5c00: 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71 75 69 s to a run requi
5c10: 72 65 20 70 72 65 74 74 79 20 6d 75 63 68 20 74 re pretty much t
5c20: 68 65 20 73 61 6d 65 20 73 65 74 75 70 20 0a 3b he same setup .;
5c30: 3b 20 74 68 69 73 20 77 72 61 70 70 65 72 20 69 ; this wrapper i
5c40: 73 20 75 73 65 64 20 74 6f 20 72 65 64 75 63 65 s used to reduce
5c50: 20 74 68 65 20 72 65 70 6c 69 63 61 74 69 6f 6e the replication
5c60: 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 6e 65 of code.(define
5c70: 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 (general-run-ca
5c80: 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 61 63 ll switchname ac
5c90: 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a tion-desc proc).
5ca0: 20 20 28 69 66 20 28 6e 6f 74 20 28 61 72 67 73 (if (not (args
5cb0: 3a 67 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 :get-arg ":runna
5cc0: 6d 65 22 29 29 0a 20 20 20 20 20 20 28 62 65 67 me")). (beg
5cd0: 69 6e 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 in..(debug:print
5ce0: 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 0 "ERROR: Missi
5cf0: 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 72 61 ng required para
5d00: 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 meter for " swit
5d10: 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 chname ", you mu
5d20: 73 74 20 73 70 65 63 69 66 79 20 74 68 65 20 72 st specify the r
5d30: 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 75 un name with :ru
5d40: 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a nname runname").
5d50: 09 28 65 78 69 74 20 32 29 29 0a 20 20 20 20 20 .(exit 2)).
5d60: 20 28 6c 65 74 20 28 28 64 62 20 20 20 23 66 29 (let ((db #f)
5d70: 0a 09 20 20 20 20 28 6b 65 79 73 20 23 66 29 29 .. (keys #f))
5d80: 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 65 74 75 ..(if (not (setu
5d90: 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 p-for-run))..
5da0: 20 28 62 65 67 69 6e 20 0a 09 20 20 20 20 20 20 (begin ..
5db0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
5dc0: 46 61 69 6c 65 64 20 74 6f 20 73 65 74 75 70 2c Failed to setup,
5dd0: 20 65 78 69 74 69 6e 67 22 29 0a 09 20 20 20 20 exiting")..
5de0: 20 20 28 65 78 69 74 20 31 29 29 29 0a 09 28 73 (exit 1)))..(s
5df0: 65 74 21 20 64 62 20 20 20 28 6f 70 65 6e 2d 64 et! db (open-d
5e00: 62 29 29 0a 09 28 73 65 74 21 20 6b 65 79 73 20 b))..(set! keys
5e10: 28 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 (db-get-keys db)
5e20: 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f 75 67 )..;; have enoug
5e30: 68 20 74 6f 20 70 72 6f 63 65 73 73 20 2d 74 61 h to process -ta
5e40: 72 67 65 74 20 6f 72 20 2d 72 65 71 74 61 72 67 rget or -reqtarg
5e50: 20 68 65 72 65 0a 09 28 69 66 20 28 61 72 67 73 here..(if (args
5e60: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 :get-arg "-reqta
5e70: 72 67 22 29 0a 09 20 20 20 20 28 6c 65 74 2a 20 rg").. (let*
5e80: 28 28 72 75 6e 63 6f 6e 66 69 67 66 20 28 63 6f ((runconfigf (co
5e90: 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f nc *toppath* "/
5ea0: 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 runconfigs.confi
5eb0: 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 g")) ;; DO NOT E
5ec0: 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09 09 20 VALUATE ALL ...
5ed0: 20 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 28 72 (runconfig (r
5ee0: 65 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f ead-config runco
5ef0: 6e 66 69 67 66 20 23 66 20 23 66 20 65 6e 76 69 nfigf #f #f envi
5f00: 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29 29 20 ron-patt: #f)))
5f10: 0a 09 20 20 20 20 20 20 28 69 66 20 28 68 61 73 .. (if (has
5f20: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
5f30: 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20 28 61 ult runconfig (a
5f40: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 rgs:get-arg "-re
5f50: 71 74 61 72 67 22 29 20 23 66 29 0a 09 09 20 20 qtarg") #f)...
5f60: 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 (keys:target-set
5f70: 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 -args keys (args
5f80: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 :get-arg "-reqta
5f90: 72 67 22 29 20 61 72 67 73 3a 61 72 67 2d 68 61 rg") args:arg-ha
5fa0: 73 68 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 sh)... (begin..
5fb0: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
5fc0: 74 20 30 20 22 45 52 52 4f 52 3a 20 5b 22 20 28 t 0 "ERROR: [" (
5fd0: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 args:get-arg "-r
5fe0: 65 71 74 61 72 67 22 29 20 22 5d 20 6e 6f 74 20 eqtarg") "] not
5ff0: 66 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f found in " runco
6000: 6e 66 69 67 66 29 0a 09 09 20 20 20 20 28 73 71 nfigf)... (sq
6010: 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 lite3:finalize!
6020: 64 62 29 0a 09 09 20 20 20 20 28 65 78 69 74 20 db)... (exit
6030: 31 29 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 1)))).. (if (
6040: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 args:get-arg "-t
6050: 61 72 67 65 74 22 29 0a 09 09 28 6b 65 79 73 3a arget")...(keys:
6060: 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 target-set-args
6070: 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 keys (args:get-a
6080: 72 67 20 22 2d 74 61 72 67 65 74 22 20 61 72 67 rg "-target" arg
6090: 73 3a 61 72 67 2d 68 61 73 68 29 20 61 72 67 73 s:arg-hash) args
60a0: 3a 61 72 67 2d 68 61 73 68 29 29 29 0a 09 28 69 :arg-hash)))..(i
60b0: 66 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e f (not (car *con
60c0: 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20 figinfo*))..
60d0: 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 28 64 (begin.. (d
60e0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
60f0: 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 20 74 ROR: Attempted t
6100: 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 o " action-desc
6110: 22 20 62 75 74 20 72 75 6e 20 61 72 65 61 20 63 " but run area c
6120: 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 20 66 onfig file not f
6130: 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 20 28 65 ound").. (e
6140: 78 69 74 20 31 29 29 0a 09 20 20 20 20 3b 3b 20 xit 1)).. ;;
6150: 45 78 74 72 61 63 74 20 6f 75 74 20 73 74 75 66 Extract out stuf
6160: 66 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73 74 f needed in most
6170: 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09 or many calls..
6180: 20 20 20 20 3b 3b 20 68 65 72 65 20 74 68 65 6e ;; here then
6190: 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20 call proc..
61a0: 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65 73 (let* ((keynames
61b0: 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 74 2d (map key:get-
61c0: 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29 29 fieldname keys))
61d0: 0a 09 09 20 20 20 28 6b 65 79 76 61 6c 6c 73 74 ... (keyvallst
61e0: 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 (keys->vallist
61f0: 20 6b 65 79 73 20 23 74 29 29 29 0a 09 20 20 20 keys #t)))..
6200: 20 20 20 28 70 72 6f 63 20 64 62 20 6b 65 79 73 (proc db keys
6210: 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c keynames keyval
6220: 6c 73 74 29 29 29 0a 09 28 73 71 6c 69 74 65 33 lst)))..(sqlite3
6230: 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09 :finalize! db)..
6240: 28 73 65 74 21 20 2a 64 69 64 73 6f 6d 65 74 68 (set! *didsometh
6250: 69 6e 67 2a 20 23 74 29 29 29 29 0a 0a 3b 3b 3d ing* #t))))..;;=
6260: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6270: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6280: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6290: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
62a0: 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 =====.;; Rollup
62b0: 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d runs.;;=========
62c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
62d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
62e0: 3d 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 0a 0a 3b =============..;
6300: 3b 20 55 70 64 61 74 65 20 74 68 65 20 74 65 73 ; Update the tes
6310: 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 66 6f 72 t_meta table for
6320: 20 74 68 69 73 20 74 65 73 74 0a 28 64 65 66 69 this test.(defi
6330: 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d ne (runs:update-
6340: 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 test_meta db tes
6350: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 t-name test-conf
6360: 29 0a 20 20 28 6c 65 74 20 28 28 63 75 72 72 72 ). (let ((currr
6370: 65 63 6f 72 64 20 28 64 62 3a 74 65 73 74 6d 65 ecord (db:testme
6380: 74 61 2d 67 65 74 2d 72 65 63 6f 72 64 20 64 62 ta-get-record db
6390: 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 test-name))).
63a0: 20 20 28 69 66 20 28 6e 6f 74 20 63 75 72 72 72 (if (not currr
63b0: 65 63 6f 72 64 29 0a 09 28 62 65 67 69 6e 0a 09 ecord)..(begin..
63c0: 20 20 28 73 65 74 21 20 63 75 72 72 72 65 63 6f (set! currreco
63d0: 72 64 20 28 6d 61 6b 65 2d 76 65 63 74 6f 72 20 rd (make-vector
63e0: 31 30 20 23 66 29 29 0a 09 20 20 28 64 62 3a 74 10 #f)).. (db:t
63f0: 65 73 74 6d 65 74 61 2d 61 64 64 2d 72 65 63 6f estmeta-add-reco
6400: 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 rd db test-name)
6410: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 )). (for-each
6420: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 . (lambda (
6430: 6b 65 79 29 0a 20 20 20 20 20 20 20 28 6c 65 74 key). (let
6440: 2a 20 28 28 69 64 78 20 28 63 61 64 72 20 6b 65 * ((idx (cadr ke
6450: 79 29 29 0a 09 20 20 20 20 20 20 28 66 6c 64 20 y)).. (fld
6460: 28 63 61 72 20 20 6b 65 79 29 29 0a 09 20 20 20 (car key))..
6470: 20 20 20 28 76 61 6c 20 28 63 6f 6e 66 69 67 2d (val (config-
6480: 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 lookup test-conf
6490: 20 22 74 65 73 74 5f 6d 65 74 61 22 20 66 6c 64 "test_meta" fld
64a0: 29 29 29 0a 09 20 28 69 66 20 28 61 6e 64 20 76 ))).. (if (and v
64b0: 61 6c 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 al (not (equal?
64c0: 28 76 65 63 74 6f 72 2d 72 65 66 20 63 75 72 72 (vector-ref curr
64d0: 72 65 63 6f 72 64 20 69 64 78 29 20 76 61 6c 29 record idx) val)
64e0: 29 29 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a )).. (begin.
64f0: 09 20 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 . (print "
6500: 55 70 64 61 74 69 6e 67 20 22 20 74 65 73 74 2d Updating " test-
6510: 6e 61 6d 65 20 22 20 22 20 66 6c 64 20 22 20 74 name " " fld " t
6520: 6f 20 22 20 76 61 6c 29 0a 09 20 20 20 20 20 20 o " val)..
6530: 20 28 64 62 3a 74 65 73 74 6d 65 74 61 2d 75 70 (db:testmeta-up
6540: 64 61 74 65 2d 66 69 65 6c 64 20 64 62 20 74 65 date-field db te
6550: 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c 29 st-name fld val)
6560: 29 29 29 29 0a 20 20 20 20 20 27 28 28 22 61 75 )))). '(("au
6570: 74 68 6f 72 22 20 32 29 28 22 6f 77 6e 65 72 22 thor" 2)("owner"
6580: 20 33 29 28 22 64 65 73 63 72 69 70 74 69 6f 6e 3)("description
6590: 22 20 34 29 28 22 72 65 76 69 65 77 65 64 22 20 " 4)("reviewed"
65a0: 35 29 28 22 74 61 67 73 22 20 39 29 29 29 29 29 5)("tags" 9)))))
65b0: 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 65 73 74 ..;; Update test
65c0: 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c 20 74 65 _meta for all te
65d0: 73 74 73 0a 28 64 65 66 69 6e 65 20 28 72 75 6e sts.(define (run
65e0: 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65 73 s:update-all-tes
65f0: 74 5f 6d 65 74 61 20 64 62 29 0a 20 20 28 6c 65 t_meta db). (le
6600: 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 73 20 28 t ((test-names (
6610: 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 get-all-legal-te
6620: 73 74 73 29 29 29 0a 20 20 20 20 28 66 6f 72 2d sts))). (for-
6630: 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 each . (lamb
6640: 64 61 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a 20 da (test-name).
6650: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 (let* ((te
6660: 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 st-path (conc
6670: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 *toppath* "/tes
6680: 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 ts/" test-name))
6690: 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f .. (test-co
66a0: 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 65 73 74 nfigf (conc test
66b0: 2d 70 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 -path "/testconf
66c0: 69 67 22 29 29 0a 09 20 20 20 20 20 20 28 74 65 ig")).. (te
66d0: 73 74 65 78 69 73 74 73 20 20 20 28 61 6e 64 20 stexists (and
66e0: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 (file-exists? te
66f0: 73 74 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 st-configf)(file
6700: 2d 72 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65 -read-access? te
6710: 73 74 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 st-configf)))..
6720: 20 20 20 20 20 3b 3b 20 72 65 61 64 20 63 6f 6e ;; read con
6730: 66 69 67 73 20 77 69 74 68 20 74 72 69 63 6b 73 figs with tricks
6740: 20 74 75 72 6e 65 64 20 6f 66 66 20 28 69 2e 65 turned off (i.e
6750: 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20 20 . no system)..
6760: 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 (test-conf
6770: 20 20 28 69 66 20 74 65 73 74 65 78 69 73 74 73 (if testexists
6780: 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 (read-config te
6790: 73 74 2d 63 6f 6e 66 69 67 66 20 23 66 20 23 66 st-configf #f #f
67a0: 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c )(make-hash-tabl
67b0: 65 29 29 29 29 0a 09 20 28 72 75 6e 73 3a 75 70 e)))).. (runs:up
67c0: 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 date-test_meta d
67d0: 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 b test-name test
67e0: 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 20 74 65 -conf))). te
67f0: 73 74 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 st-names)))..;;
6800: 54 68 69 73 20 63 6f 75 6c 64 20 70 72 6f 62 61 This could proba
6810: 62 6c 79 20 62 65 20 72 65 66 61 63 74 6f 72 65 bly be refactore
6820: 64 20 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c d into one compl
6830: 65 78 20 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65 ex query ....(de
6840: 66 69 6e 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 fine (runs:rollu
6850: 70 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 p-run db keys ke
6860: 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 yvallst runname
6870: 75 73 65 72 29 20 3b 3b 20 77 61 73 20 74 61 72 user) ;; was tar
6880: 67 65 74 2c 20 6e 6f 77 20 6b 65 79 76 61 6c 6c get, now keyvall
6890: 73 74 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e st. (debug:prin
68a0: 74 20 34 20 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 t 4 "runs:rollup
68b0: 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 -run, keys: " ke
68c0: 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 ys " keyvallst:
68d0: 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 3a 72 " keyvallst " :r
68e0: 75 6e 6e 61 6d 65 20 22 20 72 75 6e 6e 61 6d 65 unname " runname
68f0: 20 22 20 75 73 65 72 3a 20 22 20 75 73 65 72 29 " user: " user)
6900: 0a 20 20 28 6c 65 74 2a 20 28 3b 20 28 6b 65 79 . (let* (; (key
6910: 76 61 6c 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 valllst (ke
6920: 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 ys:target->keyva
6930: 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29 29 0a l keys target)).
6940: 09 20 28 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 . (new-run-id
6950: 20 20 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 (runs:registe
6960: 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 r-run db keys ke
6970: 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 yvallst runname
6980: 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 "new" "n/a" user
6990: 29 29 0a 09 20 28 70 72 65 76 2d 74 65 73 74 73 )).. (prev-tests
69a0: 20 20 20 20 20 20 28 74 65 73 74 3a 67 65 74 2d (test:get-
69b0: 6d 61 74 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 matching-previou
69c0: 73 2d 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 s-test-run-recor
69d0: 64 73 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 ds db new-run-id
69e0: 20 22 25 22 20 22 25 22 29 29 0a 09 20 28 63 75 "%" "%")).. (cu
69f0: 72 72 2d 74 65 73 74 73 20 20 20 20 20 20 28 64 rr-tests (d
6a00: 62 2d 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d b-get-tests-for-
6a10: 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 run db new-run-i
6a20: 64 20 22 25 22 20 22 25 22 20 27 28 29 20 27 28 d "%" "%" '() '(
6a30: 29 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 ))).. (curr-test
6a40: 73 2d 68 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 s-hash (make-has
6a50: 68 2d 74 61 62 6c 65 29 29 29 0a 20 20 20 20 28 h-table))). (
6a60: 64 62 3a 75 70 64 61 74 65 2d 72 75 6e 2d 65 76 db:update-run-ev
6a70: 65 6e 74 5f 74 69 6d 65 20 64 62 20 6e 65 77 2d ent_time db new-
6a80: 72 75 6e 2d 69 64 29 0a 20 20 20 20 3b 3b 20 69 run-id). ;; i
6a90: 6e 64 65 78 20 74 68 65 20 61 6c 72 65 61 64 79 ndex the already
6aa0: 20 73 61 76 65 64 20 74 65 73 74 73 20 62 79 20 saved tests by
6ab0: 74 65 73 74 6e 61 6d 65 20 61 6e 64 20 69 74 65 testname and ite
6ac0: 6d 70 61 74 68 20 69 6e 20 63 75 72 72 2d 74 65 mpath in curr-te
6ad0: 73 74 73 2d 68 61 73 68 0a 20 20 20 20 28 66 6f sts-hash. (fo
6ae0: 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d r-each. (lam
6af0: 62 64 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 bda (testdat).
6b00: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 (let* ((tes
6b10: 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d tname (db:test-
6b20: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 get-testname tes
6b30: 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 tdat)).. (i
6b40: 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 tem-path (db:tes
6b50: 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 t-get-item-path
6b60: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 testdat))..
6b70: 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e (full-name (con
6b80: 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 c testname "/" i
6b90: 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20 28 68 tem-path))).. (h
6ba0: 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 ash-table-set! c
6bb0: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 urr-tests-hash f
6bc0: 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 64 61 74 ull-name testdat
6bd0: 29 29 29 0a 20 20 20 20 20 63 75 72 72 2d 74 65 ))). curr-te
6be0: 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 sts). ;; NOPE
6bf0: 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 : Non-optimal ap
6c00: 70 72 6f 61 63 68 2e 20 54 72 79 20 74 68 69 73 proach. Try this
6c10: 20 69 6e 73 74 65 61 64 2e 0a 20 20 20 20 3b 3b instead.. ;;
6c20: 20 20 20 31 2e 20 74 65 73 74 73 20 61 72 65 20 1. tests are
6c30: 72 65 63 65 69 76 65 64 20 69 6e 20 61 20 6c 69 received in a li
6c40: 73 74 2c 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 st, most recent
6c50: 66 69 72 73 74 0a 20 20 20 20 3b 3b 20 20 20 32 first. ;; 2
6c60: 2e 20 72 65 70 6c 61 63 65 20 74 68 65 20 72 6f . replace the ro
6c70: 6c 6c 75 70 20 74 65 73 74 20 77 69 74 68 20 74 llup test with t
6c80: 68 65 20 6e 65 77 20 2a 61 6c 77 61 79 73 2a 0a he new *always*.
6c90: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 (for-each .
6ca0: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 (lambda (tes
6cb0: 74 64 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 tdat). (le
6cc0: 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 t* ((testname (
6cd0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 db:test-get-test
6ce0: 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 name testdat))..
6cf0: 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 (item-path
6d00: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 (db:test-get-it
6d10: 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 em-path testdat)
6d20: 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e ).. (full-n
6d30: 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 ame (conc testna
6d40: 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 me "/" item-path
6d50: 29 29 0a 09 20 20 20 20 20 20 28 70 72 65 76 2d )).. (prev-
6d60: 74 65 73 74 2d 64 61 74 20 28 68 61 73 68 2d 74 test-dat (hash-t
6d70: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
6d80: 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 curr-tests-hash
6d90: 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 0a full-name #f)).
6da0: 09 20 20 20 20 20 20 28 74 65 73 74 2d 73 74 65 . (test-ste
6db0: 70 73 20 20 20 20 20 20 28 64 62 3a 67 65 74 2d ps (db:get-
6dc0: 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 74 20 64 steps-for-test d
6dd0: 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 b (db:test-get-i
6de0: 64 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 20 d testdat)))..
6df0: 20 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 72 65 (new-test-re
6e00: 63 6f 72 64 20 23 66 29 29 0a 09 20 3b 3b 20 72 cord #f)).. ;; r
6e10: 65 70 6c 61 63 65 20 74 68 65 73 65 20 77 69 74 eplace these wit
6e20: 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65 6c h insert ... sel
6e30: 65 63 74 0a 09 20 28 61 70 70 6c 79 20 73 71 6c ect.. (apply sql
6e40: 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 09 ite3:execute ...
6e50: 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e 53 db ...(conc "INS
6e60: 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 ERT OR REPLACE I
6e70: 4e 54 4f 20 74 65 73 74 73 20 28 72 75 6e 5f 69 NTO tests (run_i
6e80: 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 d,testname,state
6e90: 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 ,status,event_ti
6ea0: 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64 2c me,host,cpuload,
6eb0: 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c 72 diskfree,uname,r
6ec0: 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 74 68 2c undir,item_path,
6ed0: 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e run_duration,fin
6ee0: 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 al_logf,comment)
6ef0: 20 22 0a 09 09 20 20 20 20 20 20 22 56 41 4c 55 "... "VALU
6f00: 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c ES (?,?,?,?,?,?,
6f10: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 ?,?,?,?,?,?,?,?)
6f20: 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69 64 ;")...new-run-id
6f30: 20 28 63 64 64 72 20 28 76 65 63 74 6f 72 2d 3e (cddr (vector->
6f40: 6c 69 73 74 20 74 65 73 74 64 61 74 29 29 29 0a list testdat))).
6f50: 09 20 28 73 65 74 21 20 6e 65 77 2d 74 65 73 74 . (set! new-test
6f60: 64 61 74 20 28 63 61 72 20 28 64 62 2d 67 65 74 dat (car (db-get
6f70: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 -tests-for-run d
6f80: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 74 65 73 b new-run-id tes
6f90: 74 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 tname item-path
6fa0: 27 28 29 20 27 28 29 29 29 29 0a 09 20 28 68 61 '() '()))).. (ha
6fb0: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 sh-table-set! cu
6fc0: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 rr-tests-hash fu
6fd0: 6c 6c 2d 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 ll-name new-test
6fe0: 64 61 74 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 dat) ;; this cou
6ff0: 6c 64 20 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c ld be confusing,
7000: 20 77 68 69 63 68 20 72 65 63 6f 72 64 20 73 68 which record sh
7010: 6f 75 6c 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 ould go into the
7020: 20 6c 6f 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 lookup table?..
7030: 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 ;; Now duplicat
7040: 65 20 74 68 65 20 74 65 73 74 20 73 74 65 70 73 e the test steps
7050: 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 .. (debug:print
7060: 34 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 4 "Copying recor
7070: 64 73 20 69 6e 20 74 65 73 74 5f 73 74 65 70 73 ds in test_steps
7080: 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 from test_id="
7090: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
70a0: 74 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 testdat) " to "
70b0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
70c0: 6e 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 new-testdat))..
70d0: 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 (sqlite3:execute
70e0: 20 0a 09 20 20 64 62 20 0a 09 20 20 28 63 6f 6e .. db .. (con
70f0: 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 c "INSERT OR REP
7100: 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 LACE INTO test_s
7110: 74 65 70 73 20 28 74 65 73 74 5f 69 64 2c 73 74 teps (test_id,st
7120: 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 epname,state,sta
7130: 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 tus,event_time,c
7140: 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 22 53 45 4c omment) "..."SEL
7150: 45 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 ECT " (db:test-g
7160: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 et-id new-testda
7170: 74 29 20 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74 t) ",stepname,st
7180: 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 ate,status,event
7190: 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 _time,comment FR
71a0: 4f 4d 20 74 65 73 74 5f 73 74 65 70 73 20 57 48 OM test_steps WH
71b0: 45 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 ERE test_id=?;")
71c0: 0a 09 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 .. (db:test-get
71d0: 2d 69 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 -id testdat))..
71e0: 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 ;; Now duplicate
71f0: 20 74 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 the test data..
7200: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 (debug:print 4
7210: 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 "Copying records
7220: 20 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66 72 in test_data fr
7230: 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 om test_id=" (db
7240: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 :test-get-id tes
7250: 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 tdat) " to " (db
7260: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 :test-get-id new
7270: 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 73 71 -testdat)).. (sq
7280: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 lite3:execute ..
7290: 20 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 db .. (conc "
72a0: 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 INSERT OR REPLAC
72b0: 45 20 49 4e 54 4f 20 74 65 73 74 5f 64 61 74 61 E INTO test_data
72c0: 20 28 74 65 73 74 5f 69 64 2c 63 61 74 65 67 6f (test_id,catego
72d0: 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 ry,variable,valu
72e0: 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 e,expected,tol,u
72f0: 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a nits,comment) ".
7300: 09 09 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a .."SELECT " (db:
7310: 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d test-get-id new-
7320: 74 65 73 74 64 61 74 29 20 22 2c 63 61 74 65 67 testdat) ",categ
7330: 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c ory,variable,val
7340: 75 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c ue,expected,tol,
7350: 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 units,comment FR
7360: 4f 4d 20 74 65 73 74 5f 64 61 74 61 20 57 48 45 OM test_data WHE
7370: 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a RE test_id=?;").
7380: 09 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d . (db:test-get-
7390: 69 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 29 id testdat)).. )
73a0: 29 0a 20 20 20 20 20 70 72 65 76 2d 74 65 73 74 ). prev-test
73b0: 73 29 29 29 0a 09 20 0a 20 20 20 20 20 0a s))).. . .