Browse Source

Fixed constructors_models.py tests: increased timeout in test

Yentl Van Tendeloo 8 years ago
parent
commit
04cb5d2683
3 changed files with 17 additions and 11 deletions
  1. 4 4
      bootstrap/transform.alc
  2. 4 0
      integration/test_powerwindow.py
  3. 9 7
      integration/utils.py

+ 4 - 4
bootstrap/transform.alc

@@ -287,7 +287,7 @@ Element function match(host_model : Element, schedule_model : Element, LHS : Str
 	set_add(mappings, initial_mapping)
 	while (read_nr_out(schedule) > 0):
 		current_element = list_pop(schedule, read_nr_out(schedule) - 1)
-		log("Binding element with label " + cast_v2s(read_attribute(schedule_model, current_element, "label")))
+		//log("Binding element with label " + cast_v2s(read_attribute(schedule_model, current_element, "label")))
 		new_mappings = create_node()
 
 		while (read_nr_out(mappings) > 0):
@@ -301,7 +301,7 @@ Element function match(host_model : Element, schedule_model : Element, LHS : Str
 				set_add(new_mappings, new_map)
 
 		mappings = new_mappings
-		log("Remaining options: " + cast_v2s(read_nr_out(mappings)))
+		//log("Remaining options: " + cast_v2s(read_nr_out(mappings)))
 
 		if (read_nr_out(mappings) == 0):
 			// Stop because we have no more options remaining!
@@ -480,7 +480,7 @@ Boolean function transform_composite(host_model : Element, schedule_model : Elem
 
 	current = set_pop(allAssociationDestinations(schedule_model, composite, "Initial"))
 	while (is_nominal_instance(schedule_model, current, "Rule")):
-		log("Executing " + current)
+		//log("Executing " + current)
 		// Still a rule that we must execute
 		typename = read_type(schedule_model, current)
 		if (typename == "Atomic"):
@@ -533,7 +533,7 @@ Boolean function transform_forall(host_model : Element, schedule_model : Element
 	else:
 		result = False
 
-	log("Matches in forall: " + cast_v2s(read_nr_out(mappings)))
+	//log("Matches in forall: " + cast_v2s(read_nr_out(mappings)))
 	while (read_nr_out(mappings) > 0):
 		mapping = set_pop(mappings)
 		// TODO check if there are actually no deletions happening in the meantime of other matched elements...

+ 4 - 0
integration/test_powerwindow.py

@@ -35,6 +35,7 @@ all_files = [   "core/mini_modify.alc",
             ]
 
 class TestPowerWindow(unittest.TestCase):
+    @slow
     def test_process_powerwindow_fast(self):
         self.assertTrue(run_file(all_files,
             [ "root", "root", "root", 
@@ -516,6 +517,7 @@ class TestPowerWindow(unittest.TestCase):
                 "Ready for command...",
             ]))
 
+    @slow
     def test_process_powerwindow_slow(self):
         self.assertTrue(run_file(all_files,
             [ "root", "root", "root", 
@@ -1043,6 +1045,8 @@ class TestPowerWindow(unittest.TestCase):
                 # Finished, so we go back to the start
                 "Ready for command...",
             ]))
+
+    @slow
     def test_process_powerwindow_debug(self):
         self.assertTrue(run_file(all_files,
             [ "root", "root", "root", 

+ 9 - 7
integration/utils.py

@@ -19,6 +19,7 @@ from check_objects import to_recompile
 
 taskname = "test_task"
 parallel_push = True
+INIT_TIMEOUT = 30
 TIMEOUT = 2000
 
 slow = pytest.mark.skipif(
@@ -58,7 +59,7 @@ def kill(process):
 
 def flush_data(address, data):
     if data:
-        urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "set_input", "data": json.dumps(data), "taskname": taskname})), timeout=10).read()
+        urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "set_input", "data": json.dumps(data), "taskname": taskname})), timeout=INIT_TIMEOUT).read()
     return []
 
 def compile_file(address, mod_filename, filename, mode, proc):
@@ -200,7 +201,7 @@ def run_barebone(parameters, expected, interface="0", timeout=False, wait=False,
         proc = execute("run_local_modelverse", [str(port)], wait=False)
 
         # Create task and set interface
-        timeout_val = 15
+        timeout_val = INIT_TIMEOUT
         start = time.time()
         while 1:
             proc.poll()
@@ -209,9 +210,9 @@ def run_barebone(parameters, expected, interface="0", timeout=False, wait=False,
                 return False
 
             try:
-                urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "set_input", "element_type": "V", "value": '"%s"' % taskname, "taskname": "task_manager"})), timeout=1).read()
+                urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "set_input", "value": '"%s"' % taskname, "taskname": "task_manager"})), timeout=INIT_TIMEOUT).read()
                 if interface is not None:
-                    urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "set_input", "element_type": "V", "value": interface, "taskname": taskname})), timeout=1).read()
+                    urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "set_input", "value": interface, "taskname": taskname})), timeout=INIT_TIMEOUT).read()
                 break
             except:
                 time.sleep(0.01)
@@ -220,12 +221,13 @@ def run_barebone(parameters, expected, interface="0", timeout=False, wait=False,
                     raise
 
         # Send the request
+        print("Sending data: " + str(parameters))
         flush_data(address, parameters)
 
         # Now do linking and loading
         if link is not None:
             # Execute linker
-            timeout_val = 10
+            timeout_val = INIT_TIMEOUT
             proc2 = execute("link_and_load", [address, taskname] + link, wait=False)
 
             while proc2.returncode is None:
@@ -241,7 +243,7 @@ def run_barebone(parameters, expected, interface="0", timeout=False, wait=False,
                     return False
 
         for inp in inputs:
-            urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "set_input", "element_type": "V", "value": inp, "taskname": taskname})), timeout=1).read()
+            urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "set_input", "value": inp, "taskname": taskname})), timeout=INIT_TIMEOUT).read()
             proc.poll()
             if proc.returncode is not None:
                 # Modelverse has already terminated, which isn't a good sign!
@@ -257,7 +259,7 @@ def run_barebone(parameters, expected, interface="0", timeout=False, wait=False,
                         # Modelverse has already terminated, which isn't a good sign!
                         return False
 
-                    val = urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "get_output", "taskname": taskname})), timeout=TIMEOUT if not timeout else 20).read()
+                    val = urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "get_output", "taskname": taskname})), timeout=TIMEOUT if not timeout else INIT_TIMEOUT).read()
                     val = json.loads(val)
                 except:
                     if timeout: