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

[tor-commits] [tor/master] Make test_cmdline_args.py work on Windows



commit f4221a809a71077cacda67fbeaee7cad064db602
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Tue Jan 6 13:26:52 2015 -0500

    Make test_cmdline_args.py work on Windows
    
    Patch from Gisle Vanem on tor-dev ml
---
 changes/fix-test-cmdline-args |    4 ++++
 src/test/test_cmdline_args.py |    6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/changes/fix-test-cmdline-args b/changes/fix-test-cmdline-args
new file mode 100644
index 0000000..6902d19
--- /dev/null
+++ b/changes/fix-test-cmdline-args
@@ -0,0 +1,4 @@
+  o Testing:
+    - Make the test_cmdline_args.py script work correctly on Windows.
+      Patch from Gisle Vanem.
+      
\ No newline at end of file
diff --git a/src/test/test_cmdline_args.py b/src/test/test_cmdline_args.py
index 55d1cdb..c8e68e8 100755
--- a/src/test/test_cmdline_args.py
+++ b/src/test/test_cmdline_args.py
@@ -57,14 +57,14 @@ def run_tor(args, failure=False):
         raise UnexpectedFailure()
     elif not result and failure:
         raise UnexpectedSuccess()
-    return b2s(output)
+    return b2s(output.replace('\r\n','\n'))
 
 def spaceify_fp(fp):
     for i in range(0, len(fp), 4):
         yield fp[i:i+4]
 
 def lines(s):
-    out = s.split("\n")
+    out = s.splitlines()
     if out and out[-1] == '':
         del out[-1]
     return out
@@ -151,7 +151,7 @@ class CmdlineTests(unittest.TestCase):
         if os.stat(TOR).st_mtime < os.stat(main_c).st_mtime:
             self.skipTest(TOR+" not up to date")
         out = run_tor(["--digests"])
-        main_line = [ l for l in lines(out) if l.endswith("/main.c") ]
+        main_line = [ l for l in lines(out) if l.endswith("/main.c") or l.endswith(" main.c") ]
         digest, name = main_line[0].split()
         f = open(main_c, 'rb')
         actual = hashlib.sha1(f.read()).hexdigest()

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