Browse Source

Fix SCCD class deletions

Yentl Van Tendeloo 8 years ago
parent
commit
d858c7589d
4 changed files with 8 additions and 3 deletions
  1. 1 1
      bootstrap/services.alc
  2. 4 0
      models/SCCD_execute.alc
  3. 2 1
      models/dynamic_trafficlight.mvc
  4. 1 1
      scripts/run_tests.py

+ 1 - 1
bootstrap/services.alc

@@ -54,7 +54,7 @@ Void function comm_set(comm : String, value : Element):
 Element function comm_get(comm : String):
 	// Fetch input from the service
 	while (bool_not(comm_hasInput(comm))):
-		sleep(0.01)
+		sleep(0.1)
 
 	// Return the value that we got
 	Element root

+ 4 - 0
models/SCCD_execute.alc

@@ -358,6 +358,10 @@ Boolean function step_class(model : Element, data : Element, class : String):
 	String current_state
 	Boolean found
 
+	if (bool_not(dict_in(data["classes"], class))):
+		// Seems like this class was removed, so stop execution
+		return False!
+
 	// Notify everyone of the current class
 	dict_overwrite(data, "current_class", class)
 

+ 2 - 1
models/dynamic_trafficlight.mvc

@@ -55,7 +55,8 @@ transition (manager_main_start, manager_main_start) {
                 Element function raise(attributes : Element, parameters : Element):
                     Element result
                     result = create_node()
-                    list_append(result, parameters["id"])
+                    dict_overwrite(attributes, "counter", integer_subtraction(attributes["counter"], 1))
+                    list_append(result, attributes["counter"])
                     return result!
             $
     }

+ 1 - 1
scripts/run_tests.py

@@ -15,4 +15,4 @@ flush_all()
 
 subprocess.check_call([sys.executable, "-m", "pytest"], cwd="interface/HUTN")
 
-subprocess.check_call([sys.executable, "-m", "pytest", "integration", "--runslow"])
+subprocess.check_call([sys.executable, "-m", "pytest", "integration", "--runslow", "-s", "-v"])