[svn-commits] tzafrir: testsuite/asterisk/trunk r5534 - /asterisk/trunk/runtests.py

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Aug 28 22:26:51 CDT 2014


Author: tzafrir
Date: Thu Aug 28 22:26:44 2014
New Revision: 5534

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5534
Log:
runtests.py: -n (--dry-run)

Adds option -n (--dry-run) to runtests.py to just list the tests that
will be run and not actually run them.

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

Modified:
    asterisk/trunk/runtests.py

Modified: asterisk/trunk/runtests.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/runtests.py?view=diff&rev=5534&r1=5533&r2=5534
==============================================================================
--- asterisk/trunk/runtests.py (original)
+++ asterisk/trunk/runtests.py Thu Aug 28 22:26:44 2014
@@ -317,25 +317,28 @@
 
             print "--> Running test '%s' ..." % t.test_name
 
-            # Establish Preconditions
-            print "Making sure Asterisk isn't running ..."
-            if os.system("if pidof asterisk >/dev/null; then killall -9 asterisk >/dev/null 2>&1; "
+            if self.options.dry_run:
+                t.passed = True
+            else:
+                # Establish Preconditions
+                print "Making sure Asterisk isn't running ..."
+                if os.system("if pidof asterisk >/dev/null; then killall -9 asterisk >/dev/null 2>&1; "
                          "sleep 1; ! pidof asterisk >/dev/null; fi"):
                     print "Could not kill asterisk."
                     sys.exit(1)
-            print "Making sure SIPp isn't running..."
-            if os.system("if pidof sipp >/dev/null; then killall -9 sipp >/dev/null 2>&1; "
+                print "Making sure SIPp isn't running..."
+                if os.system("if pidof sipp >/dev/null; then killall -9 sipp >/dev/null 2>&1; "
                          "sleep 1; ! pidof sipp >/dev/null; fi"):
                     print "Could not kill sipp."
                     sys.exit(1)
-            # XXX TODO Hard coded path, gross.
-            os.system("rm -f /var/run/asterisk/asterisk.ctl")
-            os.system("rm -f /var/run/asterisk/asterisk.pid")
-            os.chdir(test_suite_dir)
-
-            # Run Test
-
-            t.run()
+                # XXX TODO Hard coded path, gross.
+                os.system("rm -f /var/run/asterisk/asterisk.ctl")
+                os.system("rm -f /var/run/asterisk/asterisk.pid")
+                os.chdir(test_suite_dir)
+
+                # Run Test
+
+                t.run()
             self.total_count += 1
             self.total_time += t.time
             if t.passed is False:
@@ -381,6 +384,8 @@
         ts.setAttribute("time", "%.2f" % self.total_time)
         ts.setAttribute("failures", str(self.total_failures))
         ts.setAttribute("name", "AsteriskTestSuite")
+        if self.options.dry_run:
+            ts.setAttribute("dry-run", str(self.total_count))
 
         for t in self.tests:
             if t.did_run is False:
@@ -427,6 +432,9 @@
     parser.add_option("-L", "--list-tags", action="store_true",
             dest="list_tags", default=False,
             help="List available tags")
+    parser.add_option("-n", "--dry-run", action="store_true",
+            dest="dry_run", default=False,
+            help="Only show which tests would be run.")
     (options, args) = parser.parse_args(argv)
 
     ast_version = AsteriskVersion(options.version)




More information about the svn-commits mailing list