[asterisk-commits] runtests.py: Add parameter --random-order. (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 2 12:01:16 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: runtests.py: Add parameter --random-order.
......................................................................


runtests.py: Add parameter --random-order.

This adds a parameter to runtests.py that allows the tests to be run
in a randomized order instead of alphabetically.  This can be useful
when testing a change to the Asterisk that requires running the full
testsuite.  For example if the change breaks rest_api, you will not
have to wait for 80% of the testsuite to run before those tests start
to produce failures.

Change-Id: I002c6fa2c7a05e44673cb56b11d4e4c381f3eba0
---
M runtests.py
1 file changed, 8 insertions(+), 2 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Matt Jordan: Looks good to me, approved; Verified



diff --git a/runtests.py b/runtests.py
index 17d7ff7..a8a84c9 100755
--- a/runtests.py
+++ b/runtests.py
@@ -341,8 +341,11 @@
 
         self.tests = []
         self.global_config = self._parse_global_config()
-        self.tests = sorted(self._parse_test_yaml("tests", ast_version),
-                            key=lambda test: test.test_name)
+        self.tests = self._parse_test_yaml("tests", ast_version)
+        if self.options.randomorder:
+            random.shuffle(self.tests)
+        else:
+            self.tests = sorted(self.tests, key=lambda test: test.test_name)
         self.total_time = 0.0
         self.total_count = 0
         self.total_failures = 0
@@ -609,6 +612,9 @@
     parser.add_option("-c", "--cleanup", action="store_true",
                       dest="cleanup", default=False,
                       help="Cleanup tmp directory after each successful test")
+    parser.add_option("--random-order", action="store_true",
+                      dest="randomorder", default=False,
+                      help="Shuffle the tests so they are run in random order")
     (options, args) = parser.parse_args(argv)
 
     ast_version = AsteriskVersion(options.version)

-- 
To view, visit https://gerrit.asterisk.org/550
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I002c6fa2c7a05e44673cb56b11d4e4c381f3eba0
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list