From 8a4a9ede75e6b17994dcbdeb3367fd2bad5e4784 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Tue, 6 Aug 2013 16:42:43 -0300 Subject: [PATCH] very simple test script to start and do rpc/json commands --- twister-test.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 twister-test.py diff --git a/twister-test.py b/twister-test.py new file mode 100755 index 00000000..3ad0ab6e --- /dev/null +++ b/twister-test.py @@ -0,0 +1,36 @@ +#!/usr/bin/python + +import os,sys + +twister = "../twister-qt-build-desktop/twisterd" + +cmd = sys.argv[1] +n = int(sys.argv[2]) + +datadir = "/tmp/twister%d" % n +port = "%d" % (30000+n) +rpcport = "%d" % (40000+n) +if (n!=1): + addnode="-addnode=127.0.0.1:30001" +else: + addnode="" + +if cmd == "start": + try: + os.mkdir(datadir) + except: + pass + os.system( twister + " -datadir=" + datadir + + " -port=" + port + " -daemon" + + " -rpcuser=user -rpcpassword=pwd -rpcport=" + rpcport + + " " + addnode ) + +if cmd == "cmd": + if( len(sys.argv) < 4 ): + print "missing command (try help)" + sys.exit(-1) + parms = "" + for i in xrange(3,len(sys.argv)): + parms += ' "' + sys.argv[i] + '"' + os.system( twister + " -rpcuser=user -rpcpassword=pwd -rpcport=" + rpcport + parms ) +