ms: Make the total test duration configurable

Change-Id: I5598d5dfd51e224e13835307ad20d108a5aa3935
diff --git a/src/osmo_ms_driver/__main__.py b/src/osmo_ms_driver/__main__.py
index 5314d71..1573084 100644
--- a/src/osmo_ms_driver/__main__.py
+++ b/src/osmo_ms_driver/__main__.py
@@ -23,6 +23,8 @@
 from osmo_gsm_tester import log
 
 # System modules
+from datetime import timedelta
+
 import argparse
 import atexit
 import datetime
@@ -39,6 +41,9 @@
     parser.add_argument('-i', '--launch-interval', dest='launch_interval',
             default=100, type=int,
             help="Time between launching in milliseconds")
+    parser.add_argument('-t', '--test-duration', dest="test_duration",
+            default=120, type=int,
+            help="Time of the test duration in seconds")
     parser.add_argument('-d', '--distribution', dest="cdf_name",
             choices=cdfs.keys(), default="ease_in_out",
             help="Curve to use for starting within launch duration")
@@ -81,7 +86,7 @@
     atexit.register(test.stop_all)
 
     # Run until everything has been launched
-    test.run_test(loop)
+    test.run_test(loop, timedelta(seconds=args.test_duration))
 
     # Print stats
     test.print_stats()
diff --git a/src/osmo_ms_driver/location_update_test.py b/src/osmo_ms_driver/location_update_test.py
index 848d8da..2c59d97 100644
--- a/src/osmo_ms_driver/location_update_test.py
+++ b/src/osmo_ms_driver/location_update_test.py
@@ -55,7 +55,6 @@
 
     TEMPLATE_LUA = "osmo-mobile-lu.lua"
     TEMPLATE_CFG = "osmo-mobile.cfg"
-    TEST_TIME = timedelta(seconds=120)
 
     def __init__(self, name, number_of_ms, cdf_function, event_server, tmp_dir):
         super().__init__(log.C_RUN, name)
@@ -144,10 +143,10 @@
 
         return current_time + step_size, sleep_time
 
-    def run_test(self, loop):
+    def run_test(self, loop, test_duration):
         self.prepare(loop)
 
-        to_complete_time = self._start_time + self.TEST_TIME.total_seconds()
+        to_complete_time = self._start_time + test_duration.total_seconds()
         tick_time = self._start_time
 
         while not self.all_completed():