diff --git a/src/main/java/cli/Interpreter.java b/src/main/java/cli/Interpreter.java index ae29dea7ab7bae5bdd4da6de0bfa19bb0b456dba..15dfe228df20b0157ae30c0753158dbaa5279327 100644 --- a/src/main/java/cli/Interpreter.java +++ b/src/main/java/cli/Interpreter.java @@ -203,7 +203,10 @@ public class Interpreter implements Runnable, TerminalProviderInterface { if (line.startsWith("#")) { } else { - + int lineContainComment = line.indexOf("#"); + if (lineContainComment > 0) { + line = line.substring(0, lineContainComment); + } formerCommands.add(line); // Replace all double space by one unique space diff --git a/src/main/java/cli/PatternHandling.java b/src/main/java/cli/PatternHandling.java index e9b582645e64997ed0c2e47b69a6430ed2e4bb21..406fcd48e5c936fb5fe67469ef92c6aaf15a366f 100644 --- a/src/main/java/cli/PatternHandling.java +++ b/src/main/java/cli/PatternHandling.java @@ -391,16 +391,16 @@ public class PatternHandling extends Command { + "-cpl \tget list of configured ports\n" + "-tctl \tget list of tasks to be mapped \n" + "-tcm TASK1 TASK2\tmap TASK1 in same CPU as TASK2\n" - + "-tcml\tmap get list of tasks that can be used to map in same CPU\n" + + "-tcml\t get list of tasks that can be used to map in same CPU\n" + "-tcn TASK BUS\tmap TASK in new CPU linked to bus BUS\n" + "-tcr TASK\tremove the mapping of TASK\n" + "-tcl \tget list of mapped tasks\n" - + "-mctl \tmap get list of channels to be mapped\n" + + "-mctl \t get list of channels to be mapped\n" + "-mcm TASK1.CHANNEL1 TASK2.CHANNEL2\tmap CHANNEL1 in same memory and buses as CHANNEL2\n" - + "-mcml\tmap get list of channels that can be used to map in same Memory\n" + + "-mcml \t get list of channels that can be used to map in same Memory\n" + "-mcn TASK.CHANNEL BUS\tmap CHANNEL in new memory linked to bus BUS\n" + "-mcr TASK.CHANNEL\tremove the mapping of CHANNEL\n" - + "-mcl \tmap get list of mapped channels\n" + + "-mcl \t get list of mapped channels\n" + "-ua TASK ATTRIBUTE VALUE \tput the value VALUE of attribute ATTRIBUTE of the task TASK\n" + "-m [PATH]\tmake the json configuration file of the pattern, you can optionally specify the path of this new file\n"; } diff --git a/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/apply-tmr-in-modelWithOneSensor b/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/apply-tmr-in-modelWithOneSensor index 0cb6a393e473d08fb2c2435d3db4529e29b58c69..1f6e8e57e852b14f6bf02108fc92940e860a6161 100644 --- a/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/apply-tmr-in-modelWithOneSensor +++ b/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/apply-tmr-in-modelWithOneSensor @@ -1,4 +1,4 @@ -pa dltmap ../src/test/resources/cli/testPatternHandling/tmr/input/modelsToIntegrateTMR/modelWithOneSensor.tmap -pa a -p resources/test/cli/testPatternHandling/tmr/ -pa a -pc resources/test/cli/testPatternHandling/tmr/modelWithOneSensor-config.json -pa a -g resources/test/cli/testPatternHandling/tmr/modelsAfterIntegratingTMR/ modelWithOneSensorIntegTMR +pa dltmap ../src/test/resources/cli/testPatternHandling/tmr/input/modelsToIntegrateTMR/modelWithOneSensor.tmap # Path of the model in which we will integrate the pattern. +pa a -p resources/test/cli/testPatternHandling/tmr/ # Path of the pattern that we want to integrate. +pa a -pc resources/test/cli/testPatternHandling/tmr/modelWithOneSensor-config.json # Path of the configuration json file. +pa a -g resources/test/cli/testPatternHandling/tmr/modelsAfterIntegratingTMR/ modelWithOneSensorIntegTMR # Generate TMAP file of the model after intergrating the pattern. The generated file will be located in the given path and will have "modelWithOneSensorIntegTMR" as name. diff --git a/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/apply-tmr-in-modelWithThreeSensors b/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/apply-tmr-in-modelWithThreeSensors index 5af221b880609dd97adb2bf5a1728a0785ed4dc8..f35a8cea8359ce9df6cad855b112a3396e92292b 100644 --- a/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/apply-tmr-in-modelWithThreeSensors +++ b/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/apply-tmr-in-modelWithThreeSensors @@ -1,4 +1,4 @@ -pa dltmap ../src/test/resources/cli/testPatternHandling/tmr/input/modelsToIntegrateTMR/modelWithThreeSensors.tmap -pa a -p resources/test/cli/testPatternHandling/tmr/ -pa a -pc resources/test/cli/testPatternHandling/tmr/modelWithThreeSensors-config.json -pa a -g resources/test/cli/testPatternHandling/tmr/modelsAfterIntegratingTMR/ modelWithThreeSensorsIntegTMR +pa dltmap ../src/test/resources/cli/testPatternHandling/tmr/input/modelsToIntegrateTMR/modelWithThreeSensors.tmap # Path of the model in which we will integrate the pattern. +pa a -p resources/test/cli/testPatternHandling/tmr/ # Path of the pattern that we want to integrate. +pa a -pc resources/test/cli/testPatternHandling/tmr/modelWithThreeSensors-config.json # Path of the configuration json file. +pa a -g resources/test/cli/testPatternHandling/tmr/modelsAfterIntegratingTMR/ modelWithThreeSensorsIntegTMR # Generate TMAP file of the model after intergrating the pattern. The generated file will be located in the given path and will have "modelWithThreeSensorsIntegTMR" as name. diff --git a/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/configurate-tmr-for-modelWithOneSensor b/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/configurate-tmr-for-modelWithOneSensor index 3f0a43c53589feb2918972880e2c76ca3707b439..4a8a7119462dead1d9177daf39989f4f0b97e25d 100644 --- a/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/configurate-tmr-for-modelWithOneSensor +++ b/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/configurate-tmr-for-modelWithOneSensor @@ -1,29 +1,29 @@ -pa dltmap ../src/test/resources/cli/testPatternHandling/tmr/input/modelsToIntegrateTMR/modelWithOneSensor.tmap -pa sc -p resources/test/cli/testPatternHandling/tmr/ -pa sc -sp -pa sc -ct SensorClone Sensor -pa sc -ct SensorClone2 Sensor -pa sc -ctl -pa sc -ctr SensorClone -pa sc -ct SensorClone1 Sensor -pa sc -plnc -pa sc -pl InterpreterC.dataC -pa sc -co InterpreterA.dataA Sensor.sensorData -pa sc -co InterpreterB.dataB SensorClone1.sensorData -pa sc -co InterpreterC.dataC SensorClone2.sensorData -pa sc -co Voter.resultData Receiver.sensorData -pa sc -cor InterpreterA.dataA -pa sc -co InterpreterA.dataA Sensor.sensorData -pa sc -co Voter.moveto_FAIL_SAFE Receiver.sensorData NEW -pa sc -col -pa sc -cptl -pa sc -cpd ALL -pa sc -tctl -pa sc -tcn SensorClone1 BusEnvironment -pa sc -tcm SensorClone2 SensorClone1 -pa sc -tcn Voter MainBus -pa sc -mcn SensorClone1.sensorData BusReceiver -pa sc -mcm InterpreterA.resA SensorClone1.sensorData -pa sc -mctl -pa sc -ua Timer dataReceivingTimeout 1000 -pa sc -m resources/test/cli/testPatternHandling/tmr/modelWithOneSensor-config.json +pa dltmap ../src/test/resources/cli/testPatternHandling/tmr/input/modelsToIntegrateTMR/modelWithOneSensor.tmap # Path of the model in which we will integrate the pattern. +pa sc -p resources/test/cli/testPatternHandling/tmr/ # Path of the pattern that we want to integrate. +pa sc -sp # Get the name of the selected pattern. +pa sc -ct SensorClone Sensor # Create a task clone named SensorClone from the task Sensor. +pa sc -ct SensorClone2 Sensor # Create a task clone named SensorClone2 from the task Sensor. +pa sc -ctl # Get list of cloned tasks. +pa sc -ctr SensorClone # Remove the cloned task SensorClone. +pa sc -ct SensorClone1 Sensor # Create a task clone named SensorClone1 from the task Sensor. +pa sc -plnc # Get the list of pattern's ports that should be connected. +pa sc -pl InterpreterC.dataC # Get the list of available ports in model that could be used to connect with InterpreterC.dataC. +pa sc -co InterpreterA.dataA Sensor.sensorData # Connect InterpreterA.dataA (pattern side) with Sensor.sensorData (model side). +pa sc -co InterpreterB.dataB SensorClone1.sensorData # Connect InterpreterB.dataB (pattern side) with SensorClone1.sensorData (model side). +pa sc -co InterpreterC.dataC SensorClone2.sensorData # Connect InterpreterC.dataC (pattern side) with SensorClone2.sensorData (model side). +pa sc -co Voter.resultData Receiver.sensorData # Connect Voter.resultData (pattern side) with Receiver.sensorData (model side). +pa sc -cor InterpreterA.dataA # Remove the connection of InterpreterA.dataA. +pa sc -co InterpreterA.dataA Sensor.sensorData # Connect InterpreterA.dataA (pattern side) with Sensor.sensorData (model side). +pa sc -co Voter.moveto_FAIL_SAFE Receiver.sensorData NEW # Connect Voter.moveto_FAIL_SAFE (pattern side) with a New port. +pa sc -col # get the list of connections already made. +pa sc -cptl # get list of ports to be configured. +pa sc -cpd ALL # Choose to remove all the ports as decision. +pa sc -tctl # Get list of tasks to be mapped. +pa sc -tcn SensorClone1 BusEnvironment # Map task SensorClone1 in a new CPU that will be linked to the bus BusEnvironment. +pa sc -tcm SensorClone2 SensorClone1 # Map task SensorClone2 in the same CPU as SensorClone1. +pa sc -tcn Voter MainBus # Map task Voter in a new CPU that will be linked to the bus MainBus. +pa sc -mcn SensorClone1.sensorData BusReceiver # Map channel SensorClone1.sensorData in a new Memory that will be linked to the bus BusReceiver. +pa sc -mcm InterpreterA.resA SensorClone1.sensorData # Map channel InterpreterA.resA in the same Memory as SensorClone1.sensorData. +pa sc -mctl # Get list of channels to be mapped. +pa sc -ua Timer dataReceivingTimeout 1000 # Change the value of the attribut dataReceivingTimeout to 1000. +pa sc -m resources/test/cli/testPatternHandling/tmr/modelWithOneSensor-config.json # Create the configuration json file by giving a name and a path for this json file. diff --git a/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/configurate-tmr-for-modelWithThreeSensors b/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/configurate-tmr-for-modelWithThreeSensors index dec9cdaa649379bd400d177816113939f24ee78e..525b45a04ae63b7d06bc4fc3fc9fb45b850a50b1 100644 --- a/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/configurate-tmr-for-modelWithThreeSensors +++ b/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/configurate-tmr-for-modelWithThreeSensors @@ -1,16 +1,15 @@ -pa dltmap ../src/test/resources/cli/testPatternHandling/tmr/input/modelsToIntegrateTMR/modelWithThreeSensors.tmap -pa sc -p resources/test/cli/testPatternHandling/tmr/ -pa sc -sp -pa sc -ctl -pa sc -plnc -pa sc -pl InterpreterC.dataC -pa sc -co InterpreterA.dataA Sensor1.sensorData1 -pa sc -co InterpreterB.dataB Sensor2.sensorData2 -pa sc -co InterpreterC.dataC Sensor3.sensorData3 -pa sc -co Voter.resultData Receiver.sensorData1 -pa sc -co Voter.moveto_FAIL_SAFE Receiver.sensorData1 NEW -pa sc -cpd ALL -pa sc -tcn InterpreterB MainBus -pa sc -tcm InterpreterA InterpreterB -pa sc -ua Timer dataReceivingTimeout 500 -pa sc -m resources/test/cli/testPatternHandling/tmr/modelWithThreeSensors-config.json +pa dltmap ../src/test/resources/cli/testPatternHandling/tmr/input/modelsToIntegrateTMR/modelWithThreeSensors.tmap # Path of the model in which we will integrate the pattern. +pa sc -p resources/test/cli/testPatternHandling/tmr/ # Path of the pattern that we want to integrate. +pa sc -sp # Get the name of the selected pattern. +pa sc -plnc # Get the list of pattern's ports that should be connected. +pa sc -pl InterpreterC.dataC # Get the list of available ports in model that could be used to connect with InterpreterC.dataC. +pa sc -co InterpreterA.dataA Sensor1.sensorData1 # Connect InterpreterA.dataA (pattern side) with Sensor1.sensorData1 (model side). +pa sc -co InterpreterB.dataB Sensor2.sensorData2 # Connect InterpreterB.dataB (pattern side) with Sensor2.sensorData2 (model side). +pa sc -co InterpreterC.dataC Sensor3.sensorData3 # Connect InterpreterC.dataC (pattern side) with Sensor3.sensorData3 (model side). +pa sc -co Voter.resultData Receiver.sensorData1 # Connect Voter.resultData (pattern side) with Sensor.sensorData (model side). +pa sc -co Voter.moveto_FAIL_SAFE Receiver.sensorData1 NEW # Connect Voter.moveto_FAIL_SAFE (pattern side) with a New port. +pa sc -cpd ALL # Choose to remove all the ports as decision. +pa sc -tcn InterpreterB MainBus # Map task InterpreterB in a new CPU that will be linked to the bus MainBus. +pa sc -tcm InterpreterA InterpreterB # Map task InterpreterA in the same CPU as InterpreterB. +pa sc -ua Timer dataReceivingTimeout 500 # Change the value of the attribut dataReceivingTimeout to 500. +pa sc -m resources/test/cli/testPatternHandling/tmr/modelWithThreeSensors-config.json # Create the configuration json file by giving a name and a path for this json file. diff --git a/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/create-tmr b/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/create-tmr index 2e16045700f0046a4f188984ee51df856d99cad3..6d4519b91bd04d66e784e1bacb178847b571d0f6 100644 --- a/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/create-tmr +++ b/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/create-tmr @@ -1,9 +1,9 @@ -pa dltmap ../src/test/resources/cli/testPatternHandling/tmr/input/tmrPattern.tmap -pa c -n tmr -pa c -p resources/test/cli/testPatternHandling/ -pa c -t -pa c -a Voter Timer InterpreterA InterpreterB -pa c -r Timer -pa c -a InterpreterC Timer -pa c -l -pa c -m \ No newline at end of file +pa dltmap ../src/test/resources/cli/testPatternHandling/tmr/input/tmrPattern.tmap # Path of the model from which we will create a pattern. +pa c -n tmr # Give a name to the pattern to create. +pa c -p resources/test/cli/testPatternHandling/ # Path where patthern files will be created. +pa c -t # Show the tasks names of the model "tmrPattern". +pa c -a Voter Timer InterpreterA InterpreterB # Select the tasks that will make up the pattern. +pa c -r Timer # Remove the task Timer from the list of tasks that will make up the pattern. +pa c -a InterpreterC Timer # Add new elements in the previous list of tasks. +pa c -l # Get the current tasks that will constitue the pattern. +pa c -m # Make the pattern. diff --git a/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/incomplete-configuration-tmr-for-modelWithOneSensor b/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/incomplete-configuration-tmr-for-modelWithOneSensor new file mode 100644 index 0000000000000000000000000000000000000000..ca4792847bc010136dfa818c454dc70fdba408e0 --- /dev/null +++ b/ttool/src/test/resources/cli/testPatternHandling/tmr/cli/incomplete-configuration-tmr-for-modelWithOneSensor @@ -0,0 +1,26 @@ +pa dltmap ../src/test/resources/cli/testPatternHandling/tmr/input/modelsToIntegrateTMR/modelWithOneSensor.tmap # Path of the model in which we will integrate the pattern. +pa sc -p resources/test/cli/testPatternHandling/tmr/ # Path of the pattern that we want to integrate. +pa sc -sp # Get the name of the selected pattern. +pa sc -ct SensorClone Sensor # Create a task clone named SensorClone from the task Sensor. +pa sc -ct SensorClone2 Sensor # Create a task clone named SensorClone2 from the task Sensor. +pa sc -ctl # Get list of cloned tasks. +pa sc -ctr SensorClone # Remove the cloned task SensorClone. +pa sc -ct SensorClone1 Sensor # Create a task clone named SensorClone1 from the task Sensor. +pa sc -plnc # Get the list of pattern's ports that should be connected. +pa sc -pl InterpreterC.dataC # Get the list of available ports in model that could be used to connect with InterpreterC.dataC. +pa sc -co InterpreterA.dataA Sensor.sensorData # Connect InterpreterA.dataA (pattern side) with Sensor.sensorData (model side). +pa sc -co InterpreterB.dataB SensorClone1.sensorData # Connect InterpreterB.dataB (pattern side) with SensorClone1.sensorData (model side). +pa sc -co InterpreterC.dataC SensorClone2.sensorData # Connect InterpreterC.dataC (pattern side) with SensorClone2.sensorData (model side). +pa sc -co Voter.resultData Receiver.sensorData # Connect Voter.resultData (pattern side) with Receiver.sensorData (model side). +pa sc -col # get the list of connections already made. +pa sc -cptl # get list of ports to be configured. +pa sc -cpd ALL # Choose to remove all the ports as decision. +pa sc -tctl # Get list of tasks to be mapped. +pa sc -tcn SensorClone1 BusEnvironment # Map task SensorClone1 in a new CPU that will be linked to the bus BusEnvironment. +pa sc -tcm SensorClone2 SensorClone1 # Map task SensorClone2 in the same CPU as SensorClone1. +pa sc -tcn Voter MainBus # Map task Voter in a new CPU that will be linked to the bus MainBus. +pa sc -mcn SensorClone1.sensorData BusReceiver # Map channel SensorClone1.sensorData in a new Memory that will be linked to the bus BusReceiver. +pa sc -mcm InterpreterA.resA SensorClone1.sensorData # Map channel InterpreterA.resA in the same Memory as SensorClone1.sensorData. +pa sc -mctl # Get list of channels to be mapped. +pa sc -ua Timer dataReceivingTimeout 1000 # Change the value of the attribut dataReceivingTimeout to 1000. +pa sc -m resources/test/cli/testPatternHandling/tmr/modelWithOneSensor-incomplete-config.json # Create the configuration json file by giving a name and a path for this json file.