[svn-commits] sgriepentrog: testsuite/asterisk/trunk r5804 - in /asterisk/trunk: ./ lib/pyt...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Oct 30 11:35:20 CDT 2014


Author: sgriepentrog
Date: Thu Oct 30 11:35:09 2014
New Revision: 5804

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5804
Log:
testsuite: avoid lstrip when removing prefix

This fixes a problem where the relative path
to the test would be missing some characters
if they matched t, e, or s. The new value of
test_relpath now provides a correct path for
the rest of the TestRun class.  Also fixed a
similar case in the sipp version check.

Review: https://reviewboard.asterisk.org/r/4083/


Modified:
    asterisk/trunk/lib/python/asterisk/sippversion.py
    asterisk/trunk/runtests.py

Modified: asterisk/trunk/lib/python/asterisk/sippversion.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/sippversion.py?view=diff&rev=5804&r1=5803&r2=5804
==============================================================================
--- asterisk/trunk/lib/python/asterisk/sippversion.py (original)
+++ asterisk/trunk/lib/python/asterisk/sippversion.py Thu Oct 30 11:35:09 2014
@@ -47,8 +47,8 @@
             except OSError:
                 return
             for line in sipp_process.stdout:
-                if line.strip().startswith('SIPp'):
-                    sipp = line.strip().lstrip('SIPp ')
+                if line.strip().startswith('SIPp '):
+                    sipp = line.strip()[5:]
                     sipp = sipp.split(',', 1)
                     sipp = sipp[0].split('-', 1)
                     version = sipp[0]

Modified: asterisk/trunk/runtests.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/runtests.py?view=diff&rev=5804&r1=5803&r2=5804
==============================================================================
--- asterisk/trunk/runtests.py (original)
+++ asterisk/trunk/runtests.py Thu Oct 30 11:35:09 2014
@@ -41,6 +41,9 @@
         self.failure_message = ""
         self.__check_can_run(ast_version)
         self.stdout = ""
+
+        assert self.test_name.startswith('tests/')
+        self.test_relpath = self.test_name[6:]
 
     def run(self):
         self.passed = False
@@ -110,7 +113,7 @@
                 print "Unable to find core dump file %s, skipping" % core
                 continue
             random_num = random.randint(0, 16000)
-            dest_dir = "./logs/%s" % self.test_name.lstrip("tests/")
+            dest_dir = "./logs/%s" % self.test_relpath
             if not os.path.exists(dest_dir):
                 os.makedirs(dest_dir)
             dest_file = open(dest_dir + "/backtrace_%s.txt" % str(random_num), "w")
@@ -136,7 +139,7 @@
 
     def _archive_logs(self):
         test_run_dir = os.path.join(Asterisk.test_suite_root,
-                       self.test_name.lstrip('tests/'))
+                                    self.test_relpath)
 
         i = 1
         # Find the last run
@@ -145,7 +148,7 @@
         run_num = i - 1
         run_dir = os.path.join(test_run_dir, 'run_%d' % run_num)
         archive_dir = os.path.join('./logs',
-                                   self.test_name.lstrip('tests/'),
+                                   self.test_relpath,
                                    'run_%d' % run_num)
         self._archive_ast_logs(run_num, run_dir, archive_dir)
         self._archive_pcap_dump(run_dir, archive_dir)




More information about the svn-commits mailing list