[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Initial approach to keep track of new Tor capabilities



commit c5acd3043a4a467039ff3377cf9a472b2d24addb
Author: Cristóbal <cristobal.leiva@xxxxxxxx>
Date:   Sat Mar 7 16:12:57 2015 -0300

    Initial approach to keep track of new Tor capabilities
---
 run_tests.py                               |   14 ++++++++++++++
 test/integ/descriptor/server_descriptor.py |    8 +++++++-
 test/util.py                               |   11 +++++++++++
 3 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/run_tests.py b/run_tests.py
index e447866..70e0648 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -287,6 +287,20 @@ def main():
       println('%i TESTS WERE SKIPPED' % skipped_tests, STATUS)
 
     println('TESTING PASSED %s\n' % runtime_label, SUCCESS)
+    
+  new_capabilities = test.util.check_new_capabilities()
+  
+  if new_capabilities:
+    println()
+
+    println('Your version of tor has capabilities stem presently isn\'t taking advantage of. If you\'re running the latest version of stem then please file a ticket on...\n', ERROR)
+    println('https://trac.torproject.org/projects/tor/wiki/doc/stem/bugs', ERROR)
+    println('\nNew capabilities are...\n', ERROR)
+    
+    for item in new_capabilities:
+      println('%s: %s' % (new_capabilities[item], item), ERROR)
+
+    println()
 
   sys.exit(1 if error_tracker.has_errors_occured() else 0)
 
diff --git a/test/integ/descriptor/server_descriptor.py b/test/integ/descriptor/server_descriptor.py
index 6d5d348..74f8afd 100644
--- a/test/integ/descriptor/server_descriptor.py
+++ b/test/integ/descriptor/server_descriptor.py
@@ -11,6 +11,8 @@ import test.runner
 
 from test.runner import only_run_once
 
+import test.util
+
 
 class TestServerDescriptor(unittest.TestCase):
   @only_run_once
@@ -43,5 +45,9 @@ class TestServerDescriptor(unittest.TestCase):
           # (along with new events, getinfo options, and such). For now though
           # there doesn't seem to be anything in practice to trigger this so
           # failing to get our attention if it does.
+          
+          for line in unrecognized_lines:
+            key = line.split()[0]
+            test.util.NEW_CAPABILITIES[key] = 'Extrainfo Descriptor Entry'
 
-          self.fail('Unrecognized descriptor content: %s' % unrecognized_lines)
+          #self.fail('Unrecognized descriptor content: %s' % unrecognized_lines)
diff --git a/test/util.py b/test/util.py
index 5614e4f..a6c6515 100644
--- a/test/util.py
+++ b/test/util.py
@@ -80,6 +80,10 @@ Target = stem.util.enum.UppercaseEnum(
 
 STEM_BASE = os.path.sep.join(__file__.split(os.path.sep)[:-2])
 
+# register new capabilities found
+
+NEW_CAPABILITIES = {}
+
 
 def get_unit_tests(module_prefix = None):
   """
@@ -263,6 +267,13 @@ def check_for_unused_tests(paths):
 
   if unused_tests:
     raise ValueError('Test modules are missing from our test/settings.cfg:\n%s' % '\n'.join(unused_tests))
+    
+
+def check_new_capabilities():
+  """
+  Return list of new capabilities found during tests
+  """
+  return NEW_CAPABILITIES
 
 
 def _is_test_data(path):



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits