[tor-commits] [obfsproxy/master] Added integration tests.

nickm at torproject.org nickm at torproject.org
Fri Jun 10 20:17:48 UTC 2011


commit 155dbb59b7aafbf312094cbf7ffc439c43762d33
Author: George Kadianakis <desnacked at gmail.com>
Date:   Thu Jun 9 23:43:24 2011 +0200

    Added integration tests.
---
 src/test/integration_test/alpha       |   21 +++++++++
 src/test/integration_test/int_test.sh |   75 +++++++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+), 0 deletions(-)

diff --git a/src/test/integration_test/alpha b/src/test/integration_test/alpha
new file mode 100644
index 0000000..5d8b67e
--- /dev/null
+++ b/src/test/integration_test/alpha
@@ -0,0 +1,21 @@
+THIS IS A TEST FILE. IT'S USED BY THE INTEGRATION TESTS.
+THIS IS A TEST FILE. IT'S USED BY THE INTEGRATION TESTS.
+THIS IS A TEST FILE. IT'S USED BY THE INTEGRATION TESTS.
+THIS IS A TEST FILE. IT'S USED BY THE INTEGRATION TESTS.
+
+"Can entropy ever be reversed?"
+"THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
+"Can entropy ever be reversed?"
+"THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
+"Can entropy ever be reversed?"
+"THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
+"Can entropy ever be reversed?"
+"THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
+"Can entropy ever be reversed?"
+"THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
+"Can entropy ever be reversed?"
+"THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
+"Can entropy ever be reversed?"
+"THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
+"Can entropy ever be reversed?"
+"THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
diff --git a/src/test/integration_test/int_test.sh b/src/test/integration_test/int_test.sh
new file mode 100644
index 0000000..c1ac908
--- /dev/null
+++ b/src/test/integration_test/int_test.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+
+# replace this with your path to obfsproxy.
+OBFSPROXY="/torland/obfsproxy/obfsproxy"
+# replace this with your path to ncat.
+NCAT="/usr/bin/ncat"
+
+ENTRY_PORT=4999
+SERVER_PORT=5000
+NCAT_PORT=5001
+
+DIR=inttemp_temp
+FILE1=$DIR/test1
+FILE2=$DIR/test2
+
+mkdir $DIR ; :>$FILE1
+
+# TEST 1
+# We open a server and a client and transfer a file. Then we check if the output of the
+# server is the same as the file we sent.
+
+$NCAT -k -l -o $FILE1 -p $NCAT_PORT > /dev/null &
+ncat1_pid=$!
+
+$OBFSPROXY --log-min-severity=warn obfs2 --dest=127.0.0.1:$NCAT_PORT server 127.0.0.1:$SERVER_PORT \
+    + obfs2 --dest=127.0.0.1:$SERVER_PORT client 127.0.0.1:$ENTRY_PORT &
+obfsproxy_pid=$!
+sleep 1
+
+
+$NCAT localhost $ENTRY_PORT < alpha &
+ncat2_pid=$!
+sleep 2
+
+if cmp -s alpha $FILE1
+then echo "GREAT SUCCESS 1!" ; rm $FILE1
+else echo "GREAT FAIL 1!"
+fi 
+
+kill -9 $ncat1_pid
+kill -9 $obfsproxy_pid
+kill -9 $ncat2_pid
+
+sleep 2
+
+# TEST 2
+# We open an obfsproxy SOCKS server on the dummy protocol and an ncat listening.
+# Then we configure another ncat to use SOCKS4 and transfer a file to the other ncat.
+# Finally, we check if the file was sent correctly.
+
+:>$FILE2
+
+$NCAT -k -l -o $FILE2 -p $NCAT_PORT > /dev/null &
+ncat1_pid=$!
+
+$OBFSPROXY --log-min-severity=warn dummy socks 127.0.0.1:$SERVER_PORT &
+obfsproxy_pid=$!
+sleep 1
+
+$NCAT --proxy-type socks4 --proxy 127.0.0.1:$SERVER_PORT \
+    127.0.0.1 $NCAT_PORT < alpha &
+ncat2_pid=$!
+sleep 2
+
+if cmp -s alpha $FILE2
+then echo "GREAT SUCCESS 2!" ; rm $FILE2
+else echo "GREAT FAIL 2!"
+fi 
+
+kill -9 $ncat1_pid
+kill -9 $obfsproxy_pid
+kill -9 $ncat2_pid
+
+rmdir $DIR
+





More information about the tor-commits mailing list