oft: add --random-order option

It's sometimes useful to run tests in random order to catch interactions
between tests that don't occur when run in the default sorted order.
diff --git a/oft b/oft
index c34d4e0..b96c009 100755
--- a/oft
+++ b/oft
@@ -92,6 +92,7 @@
     "minsize"            : 0,
     "random_seed"        : None,
     "disable_ipv6"       : False,
+    "random_order"       : False,
 
     # Other configuration
     "port_map"           : {},
@@ -209,6 +210,8 @@
                       help="Random number generator seed")
     group.add_option("--disable-ipv6", action="store_true",
                       help="Disable IPv6 tests")
+    group.add_option("--random-order", action="store_true",
+                      help="Randomize order of tests")
     parser.add_option_group(group)
 
     # Might need this if other parsers want command line
@@ -498,9 +501,16 @@
 #@todo Decide if multiple suites are ever needed
 suite = unittest.TestSuite()
 
+sorted_tests = []
 for (modname, (mod, tests)) in sorted(test_modules.items()):
     for (testname, test) in sorted(tests.items()):
-        suite.addTest(test())
+        sorted_tests.append(test)
+
+if config["random_order"]:
+    random.shuffle(sorted_tests)
+
+for test in sorted_tests:
+    suite.addTest(test())
 
 # Allow platforms to import each other
 sys.path.append(config["platform_dir"])