aboutsummaryrefslogtreecommitdiffstats
path: root/eth/test/tests
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-06 00:10:42 +0800
committerobscuren <geffobscura@gmail.com>2015-01-06 00:10:42 +0800
commit6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2 (patch)
treeb898711590694cfaa6f10dbc2a4c8591232954ef /eth/test/tests
parentb0854fbff5c3d588134f577918a39d08002235dc (diff)
downloadgo-tangerine-6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2.tar.gz
go-tangerine-6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2.tar.zst
go-tangerine-6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2.zip
Merge
Diffstat (limited to 'eth/test/tests')
l---------eth/test/tests/00.chain1
-rw-r--r--eth/test/tests/00.sh13
l---------eth/test/tests/01.chain1
-rw-r--r--eth/test/tests/01.sh18
l---------eth/test/tests/02.chain1
-rw-r--r--eth/test/tests/02.sh19
l---------eth/test/tests/03.chain1
-rw-r--r--eth/test/tests/03.sh14
-rw-r--r--eth/test/tests/04.sh17
-rw-r--r--eth/test/tests/05.sh20
-rw-r--r--eth/test/tests/common.js9
-rw-r--r--eth/test/tests/common.sh20
12 files changed, 134 insertions, 0 deletions
diff --git a/eth/test/tests/00.chain b/eth/test/tests/00.chain
new file mode 120000
index 000000000..9655cb3df
--- /dev/null
+++ b/eth/test/tests/00.chain
@@ -0,0 +1 @@
+../chains/01.chain \ No newline at end of file
diff --git a/eth/test/tests/00.sh b/eth/test/tests/00.sh
new file mode 100644
index 000000000..9c5077164
--- /dev/null
+++ b/eth/test/tests/00.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+TIMEOUT=4
+
+cat >> $JSFILE <<EOF
+eth.addPeer("localhost:30311");
+sleep(1000)
+eth.export("$CHAIN_TEST");
+EOF
+
+peer 11 01
+test_node $NAME "" -loglevel 5 $JSFILE
+
diff --git a/eth/test/tests/01.chain b/eth/test/tests/01.chain
new file mode 120000
index 000000000..ae65ccb37
--- /dev/null
+++ b/eth/test/tests/01.chain
@@ -0,0 +1 @@
+../chains/02.chain \ No newline at end of file
diff --git a/eth/test/tests/01.sh b/eth/test/tests/01.sh
new file mode 100644
index 000000000..1601e0dfb
--- /dev/null
+++ b/eth/test/tests/01.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+TIMEOUT=5
+
+cat >> $JSFILE <<EOF
+eth.addPeer("localhost:30311");
+log("added peer localhost:30311");
+sleep(1000);
+log("added peer localhost:30312");
+eth.addPeer("localhost:30312");
+sleep(3000);
+eth.export("$CHAIN_TEST");
+EOF
+
+peer 11 01
+peer 12 02
+test_node $NAME "" -loglevel 5 $JSFILE
+
diff --git a/eth/test/tests/02.chain b/eth/test/tests/02.chain
new file mode 120000
index 000000000..9655cb3df
--- /dev/null
+++ b/eth/test/tests/02.chain
@@ -0,0 +1 @@
+../chains/01.chain \ No newline at end of file
diff --git a/eth/test/tests/02.sh b/eth/test/tests/02.sh
new file mode 100644
index 000000000..5231dbd78
--- /dev/null
+++ b/eth/test/tests/02.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+TIMEOUT=6
+
+cat >> $JSFILE <<EOF
+eth.addPeer("localhost:30311");
+sleep(200);
+eth.addPeer("localhost:30312");
+sleep(3000);
+eth.export("$CHAIN_TEST");
+EOF
+
+peer 11 01
+peer 12 02
+P13ID=$PID
+test_node $NAME "" -loglevel 5 $JSFILE
+sleep 0.5
+kill $P13ID
+
diff --git a/eth/test/tests/03.chain b/eth/test/tests/03.chain
new file mode 120000
index 000000000..b07c49a30
--- /dev/null
+++ b/eth/test/tests/03.chain
@@ -0,0 +1 @@
+../chains/12k.chain \ No newline at end of file
diff --git a/eth/test/tests/03.sh b/eth/test/tests/03.sh
new file mode 100644
index 000000000..8c9d6565e
--- /dev/null
+++ b/eth/test/tests/03.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+TIMEOUT=35
+
+cat >> $JSFILE <<EOF
+eth.addPeer("localhost:30311");
+sleep(30000);
+eth.export("$CHAIN_TEST");
+EOF
+
+peer 11 12k
+sleep 2
+test_node $NAME "" -loglevel 5 $JSFILE
+
diff --git a/eth/test/tests/04.sh b/eth/test/tests/04.sh
new file mode 100644
index 000000000..d77c360ba
--- /dev/null
+++ b/eth/test/tests/04.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+TIMEOUT=15
+
+cat >> $JSFILE <<EOF
+eth.addPeer("localhost:30311");
+sleep(200);
+eth.addPeer("localhost:30312");
+sleep(13000);
+eth.export("$CHAIN_TEST");
+EOF
+
+peer 11 01 -mine
+peer 12 02
+test_node $NAME "" -loglevel 5 $JSFILE
+sleep 6
+cat $DIR/$NAME/debug.log | grep 'best peer'
diff --git a/eth/test/tests/05.sh b/eth/test/tests/05.sh
new file mode 100644
index 000000000..0a0f94df5
--- /dev/null
+++ b/eth/test/tests/05.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+TIMEOUT=60
+
+cat >> $JSFILE <<EOF
+eth.addPeer("localhost:30311");
+sleep(200);
+eth.addPeer("localhost:30312");
+eth.addPeer("localhost:30313");
+eth.addPeer("localhost:30314");
+sleep(3000);
+eth.export("$CHAIN_TEST");
+EOF
+
+peer 11 01 -mine
+peer 12 02 -mine
+peer 13 03
+peer 14 04
+test_node $NAME "" -loglevel 5 $JSFILE
+
diff --git a/eth/test/tests/common.js b/eth/test/tests/common.js
new file mode 100644
index 000000000..206ebf145
--- /dev/null
+++ b/eth/test/tests/common.js
@@ -0,0 +1,9 @@
+function log(text) {
+ console.log("[JS TEST SCRIPT] " + text);
+}
+
+function sleep(seconds) {
+ var now = new Date().getTime();
+ while(new Date().getTime() < now + seconds){}
+}
+
diff --git a/eth/test/tests/common.sh b/eth/test/tests/common.sh
new file mode 100644
index 000000000..74db073f7
--- /dev/null
+++ b/eth/test/tests/common.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# launched by run.sh
+function test_node {
+ rm -rf $DIR/$1
+ ARGS="-datadir $DIR/$1 -debug debug -seed=false -shh=false -id test$1"
+ if [ "" != "$2" ]; then
+ chain="chains/$2.chain"
+ echo "import chain $chain"
+ $ETH $ARGS -loglevel 3 -chain $chain | grep CLI |grep import
+ fi
+ echo "starting test node $1 with extra args ${@:3}"
+ $ETH $ARGS -port 303$1 ${@:3} &
+ PID=$!
+ PIDS="$PIDS $PID"
+}
+
+function peer {
+ test_node $@ -loglevel 5 -logfile debug.log -maxpeer 1 -dial=false
+} \ No newline at end of file