Megatest

Hex Artifact Content
Login

Artifact 0220922ff4bb6d57174e53e641cae480eb8c85cf:


0000: 3b 3b 20 54 68 69 73 20 66 69 6c 65 20 69 73 20  ;; This file is 
0010: 70 61 72 74 20 6f 66 20 4d 65 67 61 74 65 73 74  part of Megatest
0020: 2e 0a 3b 3b 20 0a 3b 3b 20 20 20 20 20 4d 65 67  ..;; .;;     Meg
0030: 61 74 65 73 74 20 69 73 20 66 72 65 65 20 73 6f  atest is free so
0040: 66 74 77 61 72 65 3a 20 79 6f 75 20 63 61 6e 20  ftware: you can 
0050: 72 65 64 69 73 74 72 69 62 75 74 65 20 69 74 20  redistribute it 
0060: 61 6e 64 2f 6f 72 20 6d 6f 64 69 66 79 0a 3b 3b  and/or modify.;;
0070: 20 20 20 20 20 69 74 20 75 6e 64 65 72 20 74 68       it under th
0080: 65 20 74 65 72 6d 73 20 6f 66 20 74 68 65 20 47  e terms of the G
0090: 4e 55 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69  NU General Publi
00a0: 63 20 4c 69 63 65 6e 73 65 20 61 73 20 70 75 62  c License as pub
00b0: 6c 69 73 68 65 64 20 62 79 0a 3b 3b 20 20 20 20  lished by.;;    
00c0: 20 74 68 65 20 46 72 65 65 20 53 6f 66 74 77 61   the Free Softwa
00d0: 72 65 20 46 6f 75 6e 64 61 74 69 6f 6e 2c 20 65  re Foundation, e
00e0: 69 74 68 65 72 20 76 65 72 73 69 6f 6e 20 33 20  ither version 3 
00f0: 6f 66 20 74 68 65 20 4c 69 63 65 6e 73 65 2c 20  of the License, 
0100: 6f 72 0a 3b 3b 20 20 20 20 20 28 61 74 20 79 6f  or.;;     (at yo
0110: 75 72 20 6f 70 74 69 6f 6e 29 20 61 6e 79 20 6c  ur option) any l
0120: 61 74 65 72 20 76 65 72 73 69 6f 6e 2e 0a 3b 3b  ater version..;;
0130: 20 0a 3b 3b 20 20 20 20 20 4d 65 67 61 74 65 73   .;;     Megates
0140: 74 20 69 73 20 64 69 73 74 72 69 62 75 74 65 64  t is distributed
0150: 20 69 6e 20 74 68 65 20 68 6f 70 65 20 74 68 61   in the hope tha
0160: 74 20 69 74 20 77 69 6c 6c 20 62 65 20 75 73 65  t it will be use
0170: 66 75 6c 2c 0a 3b 3b 20 20 20 20 20 62 75 74 20  ful,.;;     but 
0180: 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41 52 52  WITHOUT ANY WARR
0190: 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20 65 76  ANTY; without ev
01a0: 65 6e 20 74 68 65 20 69 6d 70 6c 69 65 64 20 77  en the implied w
01b0: 61 72 72 61 6e 74 79 20 6f 66 0a 3b 3b 20 20 20  arranty of.;;   
01c0: 20 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54    MERCHANTABILIT
01d0: 59 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52  Y or FITNESS FOR
01e0: 20 41 20 50 41 52 54 49 43 55 4c 41 52 20 50 55   A PARTICULAR PU
01f0: 52 50 4f 53 45 2e 20 20 53 65 65 20 74 68 65 0a  RPOSE.  See the.
0200: 3b 3b 20 20 20 20 20 47 4e 55 20 47 65 6e 65 72  ;;     GNU Gener
0210: 61 6c 20 50 75 62 6c 69 63 20 4c 69 63 65 6e 73  al Public Licens
0220: 65 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 69  e for more detai
0230: 6c 73 2e 0a 3b 3b 20 0a 3b 3b 20 20 20 20 20 59  ls..;; .;;     Y
0240: 6f 75 20 73 68 6f 75 6c 64 20 68 61 76 65 20 72  ou should have r
0250: 65 63 65 69 76 65 64 20 61 20 63 6f 70 79 20 6f  eceived a copy o
0260: 66 20 74 68 65 20 47 4e 55 20 47 65 6e 65 72 61  f the GNU Genera
0270: 6c 20 50 75 62 6c 69 63 20 4c 69 63 65 6e 73 65  l Public License
0280: 0a 3b 3b 20 20 20 20 20 61 6c 6f 6e 67 20 77 69  .;;     along wi
0290: 74 68 20 4d 65 67 61 74 65 73 74 2e 20 20 49 66  th Megatest.  If
02a0: 20 6e 6f 74 2c 20 73 65 65 20 3c 68 74 74 70 3a   not, see <http:
02b0: 2f 2f 77 77 77 2e 67 6e 75 2e 6f 72 67 2f 6c 69  //www.gnu.org/li
02c0: 63 65 6e 73 65 73 2f 3e 2e 0a 3b 3b 0a 28 75 73  censes/>..;;.(us
02d0: 65 20 70 6f 73 69 78 29 0a 0a 28 69 6e 63 6c 75  e posix)..(inclu
02e0: 64 65 20 22 64 62 2e 73 63 6d 22 29 0a 0a 3b 3b  de "db.scm")..;;
02f0: 20 64 65 66 69 6e 65 20 66 6f 6c 6c 6f 77 69 6e   define followin
0300: 67 20 69 6e 20 73 65 74 75 70 2e 73 63 6d 0a 3b  g in setup.scm.;
0310: 3b 20 20 20 20 2a 72 65 6d 6f 74 65 68 6f 73 74  ;    *remotehost
0320: 2a 20 20 3d 3e 20 68 6f 73 74 20 66 6f 72 20 22  *  => host for "
0330: 74 65 73 74 73 22 0a 3b 3b 20 20 20 20 2a 68 6f  tests".;;    *ho
0340: 6d 65 68 6f 73 74 2a 20 20 20 20 3d 3e 20 68 6f  mehost*    => ho
0350: 73 74 20 66 6f 72 20 73 65 72 76 65 72 73 0a 3b  st for servers.;
0360: 3b 20 20 20 20 2a 68 6f 6d 65 70 61 74 68 2a 20  ;    *homepath* 
0370: 20 20 20 3d 3e 20 64 69 72 65 63 74 6f 72 79 20     => directory 
0380: 66 72 6f 6d 20 77 68 69 63 68 20 74 6f 20 72 75  from which to ru
0390: 6e 0a 3b 3b 20 20 20 20 2a 6e 75 6d 74 65 73 74  n.;;    *numtest
03a0: 73 2a 20 20 20 20 3d 3e 20 68 6f 77 20 6d 61 6e  s*    => how man
03b0: 79 20 74 65 73 74 73 20 74 6f 20 73 69 6d 75 6c  y tests to simul
03c0: 61 74 65 20 66 6f 72 20 65 61 63 68 20 72 75 6e  ate for each run
03d0: 0a 3b 3b 20 20 20 20 2a 6e 75 6d 72 75 6e 73 2a  .;;    *numruns*
03e0: 20 20 20 20 20 3d 3e 20 68 6f 77 20 6d 61 6e 79       => how many
03f0: 20 72 75 6e 73 20 74 6f 20 73 69 6d 75 6c 61 74   runs to simulat
0400: 65 0a 3b 3b 20 20 20 20 0a 28 69 6e 63 6c 75 64  e.;;    .(includ
0410: 65 20 22 73 65 74 75 70 2e 73 63 6d 22 29 0a 0a  e "setup.scm")..
0420: 28 69 6e 63 6c 75 64 65 20 22 64 69 72 65 63 74  (include "direct
0430: 2e 73 63 6d 22 29 20 3b 3b 20 64 69 72 65 63 74  .scm") ;; direct
0440: 20 64 62 20 63 61 6c 6c 73 0a 0a 3b 3b 20 52 55   db calls..;; RU
0450: 4e 20 41 20 54 45 53 54 0a 28 64 65 66 69 6e 65  N A TEST.(define
0460: 20 28 72 75 6e 2d 74 65 73 74 20 64 62 63 6f 6e   (run-test dbcon
0470: 6e 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61  n run-id test-na
0480: 6d 65 29 0a 20 20 28 72 6d 74 3a 63 72 65 61 74  me).  (rmt:creat
0490: 65 2d 74 65 73 74 20 64 62 63 6f 6e 6e 20 72 75  e-test dbconn ru
04a0: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 29 0a  n-id test-name).
04b0: 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 69 64    (let ((test-id
04c0: 20 28 72 6d 74 3a 67 65 74 2d 74 65 73 74 2d 69   (rmt:get-test-i
04d0: 64 20 64 62 63 6f 6e 6e 20 72 75 6e 2d 69 64 20  d dbconn run-id 
04e0: 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20  test-name))).   
04f0: 20 28 72 6d 74 3a 74 65 73 74 2d 73 65 74 2d 73   (rmt:test-set-s
0500: 74 61 74 65 2d 73 74 61 74 75 73 20 64 62 63 6f  tate-status dbco
0510: 6e 6e 20 74 65 73 74 2d 69 64 20 22 4c 41 55 4e  nn test-id "LAUN
0520: 43 48 45 44 22 20 22 6e 61 22 29 0a 20 20 20 20  CHED" "na").    
0530: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a  (thread-sleep! *
0540: 6c 61 75 6e 63 68 64 65 6c 61 79 2a 29 0a 20 20  launchdelay*).  
0550: 20 20 28 72 6d 74 3a 74 65 73 74 2d 73 65 74 2d    (rmt:test-set-
0560: 73 74 61 74 65 2d 73 74 61 74 75 73 20 64 62 63  state-status dbc
0570: 6f 6e 6e 20 74 65 73 74 2d 69 64 20 22 52 55 4e  onn test-id "RUN
0580: 4e 49 4e 47 22 20 22 6e 61 22 29 0a 20 20 20 20  NING" "na").    
0590: 28 6c 65 74 20 6c 6f 6f 70 20 28 28 73 74 65 70  (let loop ((step
05a0: 2d 6e 75 6d 20 30 29 29 0a 20 20 20 20 20 20 28  -num 0)).      (
05b0: 6c 65 74 20 28 28 73 74 65 70 2d 6e 61 6d 65 20  let ((step-name 
05c0: 28 63 6f 6e 63 20 22 73 74 65 70 22 20 73 74 65  (conc "step" ste
05d0: 70 2d 6e 75 6d 29 29 29 0a 20 20 20 20 20 20 20  p-num))).       
05e0: 28 72 6d 74 3a 63 72 65 61 74 65 2d 73 74 65 70  (rmt:create-step
05f0: 20 64 62 63 6f 6e 6e 20 74 65 73 74 2d 69 64 20   dbconn test-id 
0600: 73 74 65 70 2d 6e 61 6d 65 29 0a 20 20 20 20 20  step-name).     
0610: 20 20 28 6c 65 74 20 28 28 73 74 65 70 2d 69 64    (let ((step-id
0620: 20 28 67 65 74 2d 73 74 65 70 2d 69 64 20 64 62   (get-step-id db
0630: 63 6f 6e 6e 20 74 65 73 74 2d 69 64 20 73 74 65  conn test-id ste
0640: 70 2d 6e 61 6d 65 29 29 29 0a 09 20 28 72 6d 74  p-name))).. (rmt
0650: 3a 73 74 65 70 2d 73 65 74 2d 73 74 61 74 65 2d  :step-set-state-
0660: 73 74 61 74 75 73 20 64 62 63 6f 6e 6e 20 73 74  status dbconn st
0670: 65 70 2d 69 64 20 22 53 54 41 52 54 22 20 2d 31  ep-id "START" -1
0680: 29 0a 09 20 28 74 68 72 65 61 64 2d 73 6c 65 65  ).. (thread-slee
0690: 70 21 20 2a 73 74 65 70 64 65 6c 61 79 2a 29 0a  p! *stepdelay*).
06a0: 09 20 28 72 6d 74 3a 73 74 65 70 2d 73 65 74 2d  . (rmt:step-set-
06b0: 73 74 61 74 65 2d 73 74 61 74 75 73 20 64 62 63  state-status dbc
06c0: 6f 6e 6e 20 73 74 65 70 2d 69 64 20 22 45 4e 44  onn step-id "END
06d0: 22 20 30 29 0a 09 20 28 70 72 69 6e 74 22 20 20  " 0).. (print"  
06e0: 20 53 54 45 50 3a 20 22 20 73 74 65 70 2d 6e 61   STEP: " step-na
06f0: 6d 65 20 22 20 64 6f 6e 65 2e 22 29 29 29 0a 20  me " done."))). 
0700: 20 20 20 20 20 28 69 66 20 28 3c 20 73 74 65 70       (if (< step
0710: 2d 6e 75 6d 20 2a 6e 75 6d 73 74 65 70 73 2a 29  -num *numsteps*)
0720: 0a 09 20 20 28 6c 6f 6f 70 20 28 2b 20 73 74 65  ..  (loop (+ ste
0730: 70 2d 6e 75 6d 20 31 29 29 29 29 0a 20 20 20 20  p-num 1)))).    
0740: 3b 3b 20 77 65 20 77 69 6c 6c 20 64 6f 20 61 20  ;; we will do a 
0750: 6c 61 72 67 65 20 62 75 74 20 62 6f 67 75 73 20  large but bogus 
0760: 72 65 61 64 20 74 6f 20 73 69 6d 75 6c 61 74 65  read to simulate
0770: 20 74 68 65 20 6c 6f 67 69 63 20 69 6e 20 4d 65   the logic in Me
0780: 67 61 74 65 73 74 0a 20 20 20 20 28 72 6d 74 3a  gatest.    (rmt:
0790: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 73 20 64  test-get-tests d
07a0: 62 63 6f 6e 6e 20 60 28 2c 72 75 6e 2d 69 64 29  bconn `(,run-id)
07b0: 20 22 25 22 29 0a 20 20 20 20 28 72 6d 74 3a 74   "%").    (rmt:t
07c0: 65 73 74 2d 73 65 74 2d 73 74 61 74 65 2d 73 74  est-set-state-st
07d0: 61 74 75 73 20 64 62 63 6f 6e 6e 20 74 65 73 74  atus dbconn test
07e0: 2d 69 64 20 22 43 4f 4d 50 4c 45 54 45 44 22 20  -id "COMPLETED" 
07f0: 28 69 66 20 28 3e 20 28 72 61 6e 64 6f 6d 20 31  (if (> (random 1
0800: 30 29 20 32 29 20 22 50 41 53 53 22 20 22 46 41  0) 2) "PASS" "FA
0810: 49 4c 22 29 29 0a 20 20 20 20 28 70 72 69 6e 74  IL")).    (print
0820: 20 22 54 45 53 54 3a 20 22 20 74 65 73 74 2d 6e   "TEST: " test-n
0830: 61 6d 65 20 22 20 64 6f 6e 65 2e 22 29 0a 20 20  ame " done.").  
0840: 20 20 28 70 72 69 6e 74 20 22 53 74 61 74 73 3a    (print "Stats:
0850: 22 29 0a 20 20 20 20 28 70 72 69 6e 74 2d 73 74  ").    (print-st
0860: 61 74 73 20 2a 73 74 61 74 73 2a 29 0a 20 20 20  ats *stats*).   
0870: 20 74 65 73 74 2d 69 64 29 29 0a 0a 3b 3b 20 52   test-id))..;; R
0880: 55 4e 20 41 20 52 55 4e 0a 28 64 65 66 69 6e 65  UN A RUN.(define
0890: 20 28 72 75 6e 2d 72 75 6e 20 64 62 63 6f 6e 6e   (run-run dbconn
08a0: 20 74 61 72 67 65 74 20 72 75 6e 2d 6e 61 6d 65   target run-name
08b0: 20 6e 75 6d 2d 74 65 73 74 73 29 0a 20 20 28 72   num-tests).  (r
08c0: 6d 74 3a 63 72 65 61 74 65 2d 72 75 6e 20 64 62  mt:create-run db
08d0: 63 6f 6e 6e 20 74 61 72 67 65 74 20 72 75 6e 2d  conn target run-
08e0: 6e 61 6d 65 29 0a 20 20 28 6c 65 74 20 28 28 72  name).  (let ((r
08f0: 75 6e 2d 69 64 20 28 72 6d 74 3a 67 65 74 2d 72  un-id (rmt:get-r
0900: 75 6e 2d 69 64 20 64 62 63 6f 6e 6e 20 74 61 72  un-id dbconn tar
0910: 67 65 74 20 72 75 6e 2d 6e 61 6d 65 29 29 29 0a  get run-name))).
0920: 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 28      (let loop ((
0930: 74 65 73 74 2d 6e 75 6d 20 30 29 29 0a 20 20 20  test-num 0)).   
0940: 20 20 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63     (system (conc
0950: 20 22 4e 42 46 41 4b 45 5f 4c 4f 47 3d 74 65 73   "NBFAKE_LOG=tes
0960: 74 2d 22 20 74 65 73 74 2d 6e 75 6d 20 22 2d 72  t-" test-num "-r
0970: 75 6e 2d 69 64 2d 22 20 72 75 6e 2d 69 64 20 22  un-id-" run-id "
0980: 2e 6c 6f 67 20 4e 42 46 41 4b 45 5f 48 4f 53 54  .log NBFAKE_HOST
0990: 3d 22 20 2a 72 65 6d 6f 74 65 68 6f 73 74 2a 20  =" *remotehost* 
09a0: 22 20 6e 62 66 61 6b 65 20 6d 69 6e 69 6d 74 20  " nbfake minimt 
09b0: 72 75 6e 74 65 73 74 20 22 20 72 75 6e 2d 69 64  runtest " run-id
09c0: 20 22 20 74 65 73 74 2d 22 20 74 65 73 74 2d 6e   " test-" test-n
09d0: 75 6d 29 29 0a 20 20 20 20 20 20 28 69 66 20 28  um)).      (if (
09e0: 3c 20 74 65 73 74 2d 6e 75 6d 20 6e 75 6d 2d 74  < test-num num-t
09f0: 65 73 74 73 29 0a 09 20 20 28 6c 6f 6f 70 20 28  ests)..  (loop (
0a00: 2b 20 74 65 73 74 2d 6e 75 6d 20 31 29 29 29 29  + test-num 1))))
0a10: 29 29 0a 0a 3b 3b 20 44 6f 20 77 68 61 74 20 69  ))..;; Do what i
0a20: 73 20 61 73 6b 65 64 0a 28 6c 65 74 20 28 28 61  s asked.(let ((a
0a30: 72 67 73 20 28 63 64 72 20 28 61 72 67 76 29 29  rgs (cdr (argv))
0a40: 29 29 0a 20 20 28 69 66 20 28 3c 20 28 6c 65 6e  )).  (if (< (len
0a50: 67 74 68 20 61 72 67 73 29 20 31 29 0a 20 20 20  gth args) 1).   
0a60: 20 20 20 28 70 72 69 6e 74 0a 20 20 20 20 20 20     (print.      
0a70: 20 22 55 73 61 67 65 3a 20 6d 69 6e 69 6d 74 20   "Usage: minimt 
0a80: 5b 6f 70 74 69 6f 6e 73 5d 22 20 22 0a 20 20 72  [options]" ".  r
0a90: 75 6e 74 65 73 74 20 72 75 6e 2d 69 64 20 74 65  untest run-id te
0aa0: 73 74 6e 61 6d 65 0a 20 20 72 75 6e 72 75 6e 20  stname.  runrun 
0ab0: 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 22   target runname"
0ac0: 29 0a 20 20 20 20 20 20 28 6c 65 74 20 28 28 63  ).      (let ((c
0ad0: 6d 64 20 20 20 20 28 63 61 72 20 61 72 67 73 29  md    (car args)
0ae0: 29 0a 09 20 20 20 20 28 64 62 63 6f 6e 6e 20 28  )..    (dbconn (
0af0: 72 6d 74 3a 6f 70 65 6e 2d 63 72 65 61 74 65 2d  rmt:open-create-
0b00: 64 62 20 2a 68 6f 6d 65 70 61 74 68 2a 20 22 6d  db *homepath* "m
0b10: 74 2e 64 62 22 20 69 6e 69 74 2d 64 62 29 29 29  t.db" init-db)))
0b20: 0a 09 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  ..(thread-sleep!
0b30: 20 30 2e 35 29 20 3b 3b 20 62 65 20 73 75 72 65   0.5) ;; be sure
0b40: 20 74 68 65 20 64 62 20 69 73 20 77 72 69 74 74   the db is writt
0b50: 65 6e 20 6f 75 74 20 74 6f 20 64 69 73 6b 3f 20  en out to disk? 
0b60: 53 68 6f 75 6c 64 20 72 65 61 6c 6c 79 20 6e 6f  Should really no
0b70: 74 20 62 65 20 6e 65 65 64 65 64 2e 0a 09 28 63  t be needed...(c
0b80: 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20  hange-directory 
0b90: 2a 68 6f 6d 65 70 61 74 68 2a 29 0a 09 28 63 61  *homepath*)..(ca
0ba0: 73 65 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62  se (string->symb
0bb0: 6f 6c 20 63 6d 64 29 0a 09 20 20 28 28 72 75 6e  ol cmd)..  ((run
0bc0: 74 65 73 74 29 0a 09 20 20 20 28 6c 65 74 20 28  test)..   (let (
0bd0: 28 72 75 6e 2d 69 64 20 20 20 20 28 73 74 72 69  (run-id    (stri
0be0: 6e 67 2d 3e 6e 75 6d 62 65 72 20 28 63 61 64 72  ng->number (cadr
0bf0: 20 61 72 67 73 29 29 29 0a 09 09 20 28 74 65 73   args)))... (tes
0c00: 74 2d 6e 61 6d 65 20 28 63 61 64 64 72 20 61 72  t-name (caddr ar
0c10: 67 73 29 29 29 0a 09 20 20 20 20 20 28 70 72 69  gs)))..     (pri
0c20: 6e 74 20 22 4c 61 75 6e 63 68 69 6e 67 20 74 65  nt "Launching te
0c30: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22  st " test-name "
0c40: 20 66 6f 72 20 72 75 6e 2d 69 64 20 22 20 72 75   for run-id " ru
0c50: 6e 2d 69 64 29 0a 09 20 20 20 20 20 28 72 75 6e  n-id)..     (run
0c60: 2d 74 65 73 74 20 64 62 63 6f 6e 6e 20 72 75 6e  -test dbconn run
0c70: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 29 29 29  -id test-name)))
0c80: 0a 09 20 20 28 28 72 75 6e 72 75 6e 29 0a 09 20  ..  ((runrun).. 
0c90: 20 20 28 6c 65 74 20 28 28 74 61 72 67 65 74 20    (let ((target 
0ca0: 20 20 28 63 61 64 72 20 61 72 67 73 29 29 0a 09    (cadr args))..
0cb0: 09 20 28 72 75 6e 2d 6e 61 6d 65 20 28 63 61 64  . (run-name (cad
0cc0: 64 72 20 61 72 67 73 29 29 29 0a 09 20 20 20 20  dr args)))..    
0cd0: 20 28 72 75 6e 2d 72 75 6e 20 64 62 63 6f 6e 6e   (run-run dbconn
0ce0: 20 74 61 72 67 65 74 20 72 75 6e 2d 6e 61 6d 65   target run-name
0cf0: 20 2a 6e 75 6d 74 65 73 74 73 2a 29 0a 09 20 20   *numtests*)..  
0d00: 20 20 20 28 70 72 69 6e 74 20 22 55 73 65 3a 20     (print "Use: 
0d10: 73 71 6c 69 74 65 33 20 72 75 6e 74 65 73 74 2f  sqlite3 runtest/
0d20: 6d 74 2e 64 62 20 27 73 65 6c 65 63 74 20 6d 61  mt.db 'select ma
0d30: 78 28 65 6e 64 5f 74 69 6d 65 29 2d 6d 69 6e 28  x(end_time)-min(
0d40: 73 74 61 72 74 5f 74 69 6d 65 29 20 66 72 6f 6d  start_time) from
0d50: 20 74 65 73 74 73 3b 27 20 74 6f 20 73 65 65 20   tests;' to see 
0d60: 74 68 65 20 74 6f 74 61 6c 20 72 75 6e 20 74 69  the total run ti
0d70: 6d 65 22 29 0a 09 20 20 20 20 20 29 29 0a 09 20  me")..     )).. 
0d80: 20 28 28 72 75 6e 61 6c 6c 29 0a 09 20 20 20 28   ((runall)..   (
0d90: 66 6f 72 2d 65 61 63 68 0a 09 20 20 20 20 28 6c  for-each..    (l
0da0: 61 6d 62 64 61 20 28 74 61 72 67 65 74 29 0a 09  ambda (target)..
0db0: 20 20 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20        (let loop 
0dc0: 28 28 72 75 6e 2d 6e 75 6d 20 30 29 29 0a 09 09  ((run-num 0))...
0dd0: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a  (thread-sleep! *
0de0: 72 75 6e 64 65 6c 61 79 2a 29 0a 09 09 28 73 79  rundelay*)...(sy
0df0: 73 74 65 6d 20 28 63 6f 6e 63 20 22 4e 42 46 41  stem (conc "NBFA
0e00: 4b 45 5f 4c 4f 47 3d 72 75 6e 2d 22 20 74 61 72  KE_LOG=run-" tar
0e10: 67 65 74 20 22 2d 22 20 72 75 6e 2d 6e 75 6d 20  get "-" run-num 
0e20: 22 2e 6c 6f 67 20 6e 62 66 61 6b 65 20 6d 69 6e  ".log nbfake min
0e30: 69 6d 74 20 72 75 6e 72 75 6e 20 22 20 74 61 72  imt runrun " tar
0e40: 67 65 74 20 22 20 72 75 6e 2d 22 20 72 75 6e 2d  get " run-" run-
0e50: 6e 75 6d 29 29 0a 09 09 28 69 66 20 28 3c 20 72  num))...(if (< r
0e60: 75 6e 2d 6e 75 6d 20 2a 6e 75 6d 72 75 6e 73 2a  un-num *numruns*
0e70: 29 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 2b  )...    (loop (+
0e80: 20 72 75 6e 2d 6e 75 6d 20 31 29 29 29 29 29 0a   run-num 1))))).
0e90: 09 20 20 20 20 2a 74 61 72 67 65 74 73 2a 29 29  .    *targets*))
0ea0: 0a 09 20 20 28 28 73 65 72 76 65 72 29 0a 09 20  ..  ((server).. 
0eb0: 20 20 28 73 74 61 72 74 2d 73 65 72 76 65 72 20    (start-server 
0ec0: 64 62 63 6f 6e 6e 29 29 0a 09 20 20 28 65 6c 73  dbconn))..  (els
0ed0: 65 0a 09 20 20 20 28 70 72 69 6e 74 20 22 43 6f  e..   (print "Co
0ee0: 6d 6d 61 6e 64 3a 20 22 20 63 6d 64 20 22 20 6e  mmand: " cmd " n
0ef0: 6f 74 20 72 65 63 6f 67 6e 69 73 65 64 2e 20 52  ot recognised. R
0f00: 75 6e 20 77 69 74 68 6f 75 74 20 70 61 72 61 6d  un without param
0f10: 73 20 74 6f 20 73 65 65 20 68 65 6c 70 2e 22 29  s to see help.")
0f20: 29 29 0a 09 28 63 6c 6f 73 65 2d 64 61 74 61 62  ))..(close-datab
0f30: 61 73 65 20 28 64 62 63 6f 6e 6e 2d 64 61 74 2d  ase (dbconn-dat-
0f40: 64 62 68 20 64 62 63 6f 6e 6e 29 29 29 29 29 0a  dbh dbconn))))).