[tor-commits] [ooni-probe/master] Fix logic of daphn3 for loading inputs via inputProcessor

art at torproject.org art at torproject.org
Thu Nov 15 10:39:18 UTC 2012


commit 2b54d130b280c4f937ac2a0c2dd09f84a1a8025e
Author: Arturo Filastò <art at fuffa.org>
Date:   Thu Nov 15 11:38:02 2012 +0100

    Fix logic of daphn3 for loading inputs via inputProcessor
---
 nettests/core/daphn3.py |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/nettests/core/daphn3.py b/nettests/core/daphn3.py
index b40d38a..09279fa 100644
--- a/nettests/core/daphn3.py
+++ b/nettests/core/daphn3.py
@@ -71,7 +71,7 @@ class daphn3Test(nettest.NetTestCase):
 
     steps = None
 
-    def inputProcessor(self, fp):
+    def inputProcessor(self, filename):
         """
         step_idx is the step in the packet exchange
         ex.
@@ -84,11 +84,11 @@ class daphn3Test(nettest.NetTestCase):
         packet at the step_idx that is to be mutated
 
         """
-        if self.localOptions['yaml']:
-            daphn3Steps = daphn3.read_yaml(self.localOptions['yaml'])
+        if self.localOptions['pcap']:
+            daphn3Steps = daphn3.read_pcap(filename)
         else:
-            daphn3Steps = daphn3.read_pcap(self.localOptions['pcap'])
-
+            daphn3Steps = daphn3.read_yaml(filename)
+        log.debug("Loaded these steps %s" % daphn3Steps)
         yield daphn3Steps
 
     def test_daphn3(self):
@@ -99,6 +99,8 @@ class daphn3Test(nettest.NetTestCase):
             log.msg("Failed to connect")
             self.report['censored'] = True
             self.report['mutation'] = 0
+            raise Exception("Error in connection, perhaps the backend is censored")
+            return
 
         def success(protocol):
             log.msg("Successfully connected")





More information about the tor-commits mailing list