Megatest

Check-in [3c88ad926f]
Login
Overview
Comment:Added script to run client and a little help to header of rpctest.scm
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.60
Files: files | file ages | folders
SHA1: 3c88ad926f2043602616ca4aa29d57062763f495
User & Date: matt on 2015-12-07 21:32:09
Other Links: branch diff | manifest | tags
Context
2015-12-07
22:26
Switched rcp test to use sql-de-lite check-in: cf97950521 user: matt tags: v1.60
21:32
Added script to run client and a little help to header of rpctest.scm check-in: 3c88ad926f user: matt tags: v1.60
19:54
Initial version of rpctest directly from rpc egg page (plus minor changes to get it to work) check-in: f728a7aa95 user: matt tags: v1.60
Changes

Modified rpctest/rpctest.scm from [5373d511d9] to [9aa9c89e7f].

1
2
3




4
5
6
7



8
9
10
11
12
13
14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21



+
+
+
+




+
+
+







;;;; rpc-demo.scm
;;;; Simple database server / client

;;; start server thusly: ./rpctest server test.db
;;; you will need to init test.db:
;;; sqlite3 test.db "CREATE TABLE foo (id INTEGER PRIMARY KEY, var TEXT, val TEXT);"

(require-extension (srfi 18) extras tcp rpc sqlite3)

;;; Common things

(define total-queries 0)
(define start-time (current-seconds))

(define operation (string->symbol (car (command-line-arguments))))
(define param (cadr (command-line-arguments)))
(print "Operation: " operation ", param: " param)

(define rpc:listener
  (if (eq? operation 'server)
      (tcp-listen (rpc:default-server-port))
31
32
33
34
35
36
37

38
39
40
41



42
43
44
45
46
47
48
38
39
40
41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
56
57
58







+



-
+
+
+







     (rpc:default-server-port port))
   #f)
  (let ((db (open-database param)))
    (set-finalizer! db finalize!)
    (rpc:publish-procedure!
     'query
     (lambda (sql callback)
       (set! total-queries (+ total-queries 1))
       (print "Executing query '" sql "' ...")
       (for-each-row
	callback
	db sql))))
	db sql)
       (print "Query rate: " (/ total-queries (/ (- (current-seconds) start-time) 60)) " per minute")
       )))
  (thread-join! rpc:server))

;;; Client side

(define (callback1 . columns)
  (let loop ((c columns) (i 0))
    (unless (null? c)

Added rpctest/run-client.sh version [9287190e12].













1
2
3
4
5
6
7
8
9
10
11
12
+
+
+
+
+
+
+
+
+
+
+
+
#!/bin/bash


while ./rpctest client "insert into foo (var,val) values ($RANDOM,$RANDOM);";do
    numrows=$(./rpctest client "select * from foo;"|wc -l)
    deletefrom=$RANDOM
    echo "numrows=$numrows, deletefrom=$deletefrom"
    if [[ $numrows -gt 300 ]];then
	echo "numrows=$numrows, deletefrom=$deletefrom"
	./rpctest client "delete from foo where var > $deletefrom;"
    fi
done