From c8d00725799053716226cf845763cb4a0a0081cb Mon Sep 17 00:00:00 2001 From: marvin <marvin@marvin-TERRA-MOBILE-1529H> Date: Tue, 24 Mar 2020 23:20:47 +0100 Subject: [PATCH] Compiler launch fixed (see Main.jak) --- .../configs/config.xml | 3 ++ .../ConfiguratorMain/Configurator.jak | 38 +++++++++++++++++-- .../Configurator.jak | 9 +++++ .../Configurator.jak | 9 +++++ .../Configurator.jak | 9 +++++ src/var/FeatureModelConfigurator/model.xml | 3 ++ .../src/Configurator.jak | 38 +++++++++++++++++-- .../src/Configurator.java | 38 +++++++++++++++++-- .../template/Main.jak | 15 +++++--- 9 files changed, 147 insertions(+), 15 deletions(-) create mode 100644 src/var/FeatureModelConfigurator/features/lds_lfcd_sensor_BAD_RANGE/Configurator.jak create mode 100644 src/var/FeatureModelConfigurator/features/lds_lfcd_sensor_GOOD_RANGE/Configurator.jak create mode 100644 src/var/FeatureModelConfigurator/features/lds_lfcd_sensor_HIGH_NOISE/Configurator.jak diff --git a/src/var/FeatureModelConfigurator/configs/config.xml b/src/var/FeatureModelConfigurator/configs/config.xml index d12aa23..081fa79 100644 --- a/src/var/FeatureModelConfigurator/configs/config.xml +++ b/src/var/FeatureModelConfigurator/configs/config.xml @@ -13,6 +13,9 @@ <feature automatic="unselected" name="Pi_Camera"/> <feature automatic="unselected" name="imu"/> <feature automatic="unselected" name="lds_lfcd_sensor"/> + <feature automatic="unselected" name="lds_lfcd_sensor_BAD_RANGE"/> + <feature automatic="unselected" name="lds_lfcd_sensor_GOOD_RANGE"/> + <feature automatic="unselected" name="lds_lfcd_sensor_HIGH_NOISE"/> <feature automatic="unselected" name="realsense_R200"/> <feature automatic="unselected" name="Pi_Camera___turtlebot3_burger_for_autorace"/> <feature automatic="unselected" name="Pi_Camera___turtlebot3_waffle_pi"/> diff --git a/src/var/FeatureModelConfigurator/features/ConfiguratorMain/Configurator.jak b/src/var/FeatureModelConfigurator/features/ConfiguratorMain/Configurator.jak index e241cc6..2583323 100644 --- a/src/var/FeatureModelConfigurator/features/ConfiguratorMain/Configurator.jak +++ b/src/var/FeatureModelConfigurator/features/ConfiguratorMain/Configurator.jak @@ -2,6 +2,9 @@ import java.util.List; import java.util.ArrayList; import java.io.IOException; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.File; import org.jdom2.Document; import org.jdom2.Element; @@ -29,11 +32,12 @@ public class Configurator { private List m_aModuleList; //output path private String m_sOutputPath = "resources/output/featuremodel.xml"; - //TODO: set this - //path for test case selector, which has to be launched from this application - private String m_sTestCaseSelectorPath; //path to the feature model xml private String m_sFeatureModelPath = "model.xml"; + //path to the directory of test manager + private String m_sTestManagerPath = "../../../build/sim/"; + //path to the directory of testcase compliler + private String m_sTestCaseCompilerPath = "../../../build/test/compiler/"; //document representation of the feature model private Document m_oFeatureModelDoc; @@ -117,6 +121,34 @@ public class Configurator { System.out.println(oEx); return; } + + Runtime oRuntime = Runtime.getRuntime(); + + //TODO launch compiler + try { + File oWorkingDir = new File(m_sTestCaseCompilerPath); + Process oTestCaseCompiler = oRuntime.exec("./compile", null, oWorkingDir); + BufferedReader oOutput = new BufferedReader(new InputStreamReader(oTestCaseCompiler.getInputStream())); + String sOutput = null; + while ((sOutput = oOutput.readLine()) != null) { + System.out.println(sOutput); + } + } catch (IOException oEx) { + System.out.println("ERROR: launching Testcase Compiler failed: " + oEx.toString()); + } + + //TODO launch test manager + try { + File oWorkingDir = new File(m_sTestManagerPath); + Process oTestManager = oRuntime.exec("./testmanager.sh", null, oWorkingDir); + BufferedReader oOutput = new BufferedReader(new InputStreamReader(oTestManager.getInputStream())); + String sOutput = null; + while ((sOutput = oOutput.readLine()) != null) { + System.out.println(sOutput); + } + } catch (IOException oEx) { + System.out.println("ERROR: launching TestManager failed: " + oEx.toString()); + } } //get all parents of a given module from the Feature Model file diff --git a/src/var/FeatureModelConfigurator/features/lds_lfcd_sensor_BAD_RANGE/Configurator.jak b/src/var/FeatureModelConfigurator/features/lds_lfcd_sensor_BAD_RANGE/Configurator.jak new file mode 100644 index 0000000..a05a3fc --- /dev/null +++ b/src/var/FeatureModelConfigurator/features/lds_lfcd_sensor_BAD_RANGE/Configurator.jak @@ -0,0 +1,9 @@ +/** + * TODO description + */ +public refines class Configurator { + public void save() { + Super().addToModuleList("lds_lfcd_sensor_BAD_RANGE"); + Super().save(); + } +} \ No newline at end of file diff --git a/src/var/FeatureModelConfigurator/features/lds_lfcd_sensor_GOOD_RANGE/Configurator.jak b/src/var/FeatureModelConfigurator/features/lds_lfcd_sensor_GOOD_RANGE/Configurator.jak new file mode 100644 index 0000000..e5dea41 --- /dev/null +++ b/src/var/FeatureModelConfigurator/features/lds_lfcd_sensor_GOOD_RANGE/Configurator.jak @@ -0,0 +1,9 @@ +/** + * TODO description + */ +public refines class Configurator { + public void save() { + Super().addToModuleList("lds_lfcd_sensor_GOOD_RANGE"); + Super().save(); + } +} \ No newline at end of file diff --git a/src/var/FeatureModelConfigurator/features/lds_lfcd_sensor_HIGH_NOISE/Configurator.jak b/src/var/FeatureModelConfigurator/features/lds_lfcd_sensor_HIGH_NOISE/Configurator.jak new file mode 100644 index 0000000..280652f --- /dev/null +++ b/src/var/FeatureModelConfigurator/features/lds_lfcd_sensor_HIGH_NOISE/Configurator.jak @@ -0,0 +1,9 @@ +/** + * TODO description + */ +public refines class Configurator { + public void save() { + Super().addToModuleList("lds_lfcd_sensor_HIGH_NOISE"); + Super().save(); + } +} \ No newline at end of file diff --git a/src/var/FeatureModelConfigurator/model.xml b/src/var/FeatureModelConfigurator/model.xml index 73ef364..5fedabf 100644 --- a/src/var/FeatureModelConfigurator/model.xml +++ b/src/var/FeatureModelConfigurator/model.xml @@ -26,6 +26,9 @@ <feature name="Pi_Camera" /> <feature name="imu" /> <feature name="lds_lfcd_sensor" /> + <feature name="lds_lfcd_sensor_BAD_RANGE" /> + <feature name="lds_lfcd_sensor_GOOD_RANGE" /> + <feature name="lds_lfcd_sensor_HIGH_NOISE" /> <feature name="realsense_R200" /> <feature name="Pi_Camera___turtlebot3_burger_for_autorace" /> <feature name="Pi_Camera___turtlebot3_waffle_pi" /> diff --git a/src/var/FeatureModelConfigurator/src/Configurator.jak b/src/var/FeatureModelConfigurator/src/Configurator.jak index b8dfb6a..d75c8f5 100644 --- a/src/var/FeatureModelConfigurator/src/Configurator.jak +++ b/src/var/FeatureModelConfigurator/src/Configurator.jak @@ -2,6 +2,9 @@ import java.util.List; import java.util.ArrayList; import java.io.IOException; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.File; import org.jdom2.Document; import org.jdom2.Element; @@ -31,11 +34,12 @@ abstract class Configurator$$ConfiguratorMain { private List m_aModuleList; //output path private String m_sOutputPath = "resources/output/featuremodel.xml"; - //TODO: set this - //path for test case selector, which has to be launched from this application - private String m_sTestCaseSelectorPath; //path to the feature model xml private String m_sFeatureModelPath = "model.xml"; + //path to the directory of test manager + private String m_sTestManagerPath = "../../../build/sim/"; + //path to the directory of testcase compliler + private String m_sTestCaseCompilerPath = "../../../build/test/compiler/"; //document representation of the feature model private Document m_oFeatureModelDoc; @@ -119,6 +123,34 @@ abstract class Configurator$$ConfiguratorMain { System.out.println(oEx); return; } + + Runtime oRuntime = Runtime.getRuntime(); + + //TODO launch compiler + try { + File oWorkingDir = new File(m_sTestCaseCompilerPath); + Process oTestCaseCompiler = oRuntime.exec("./compile", null, oWorkingDir); + BufferedReader oOutput = new BufferedReader(new InputStreamReader(oTestCaseCompiler.getInputStream())); + String sOutput = null; + while ((sOutput = oOutput.readLine()) != null) { + System.out.println(sOutput); + } + } catch (IOException oEx) { + System.out.println("ERROR: launching Testcase Compiler failed: " + oEx.toString()); + } + + //TODO launch test manager + try { + File oWorkingDir = new File(m_sTestManagerPath); + Process oTestManager = oRuntime.exec("./testmanager.sh", null, oWorkingDir); + BufferedReader oOutput = new BufferedReader(new InputStreamReader(oTestManager.getInputStream())); + String sOutput = null; + while ((sOutput = oOutput.readLine()) != null) { + System.out.println(sOutput); + } + } catch (IOException oEx) { + System.out.println("ERROR: launching TestManager failed: " + oEx.toString()); + } } //get all parents of a given module from the Feature Model file diff --git a/src/var/FeatureModelConfigurator/src/Configurator.java b/src/var/FeatureModelConfigurator/src/Configurator.java index 3c33295..ab46e9a 100644 --- a/src/var/FeatureModelConfigurator/src/Configurator.java +++ b/src/var/FeatureModelConfigurator/src/Configurator.java @@ -2,6 +2,9 @@ import java.util.List; import java.util.ArrayList; import java.io.IOException; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.File; import org.jdom2.Document; import org.jdom2.Element; @@ -31,11 +34,12 @@ abstract class Configurator$$ConfiguratorMain { private List m_aModuleList; //output path private String m_sOutputPath = "resources/output/featuremodel.xml"; - //TODO: set this - //path for test case selector, which has to be launched from this application - private String m_sTestCaseSelectorPath; //path to the feature model xml private String m_sFeatureModelPath = "model.xml"; + //path to the directory of test manager + private String m_sTestManagerPath = "../../../build/sim/"; + //path to the directory of testcase compliler + private String m_sTestCaseCompilerPath = "../../../build/test/compiler/"; //document representation of the feature model private Document m_oFeatureModelDoc; @@ -119,6 +123,34 @@ abstract class Configurator$$ConfiguratorMain { System.out.println(oEx); return; } + + Runtime oRuntime = Runtime.getRuntime(); + + //TODO launch compiler + try { + File oWorkingDir = new File(m_sTestCaseCompilerPath); + Process oTestCaseCompiler = oRuntime.exec("./compile", null, oWorkingDir); + BufferedReader oOutput = new BufferedReader(new InputStreamReader(oTestCaseCompiler.getInputStream())); + String sOutput = null; + while ((sOutput = oOutput.readLine()) != null) { + System.out.println(sOutput); + } + } catch (IOException oEx) { + System.out.println("ERROR: launching Testcase Compiler failed: " + oEx.toString()); + } + + //TODO launch test manager + try { + File oWorkingDir = new File(m_sTestManagerPath); + Process oTestManager = oRuntime.exec("./testmanager.sh", null, oWorkingDir); + BufferedReader oOutput = new BufferedReader(new InputStreamReader(oTestManager.getInputStream())); + String sOutput = null; + while ((sOutput = oOutput.readLine()) != null) { + System.out.println(sOutput); + } + } catch (IOException oEx) { + System.out.println("ERROR: launching TestManager failed: " + oEx.toString()); + } } //get all parents of a given module from the Feature Model file diff --git a/src/var/FeatureModelImplGenerator/template/Main.jak b/src/var/FeatureModelImplGenerator/template/Main.jak index 505ec87..2583323 100644 --- a/src/var/FeatureModelImplGenerator/template/Main.jak +++ b/src/var/FeatureModelImplGenerator/template/Main.jak @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; +import java.io.File; import org.jdom2.Document; import org.jdom2.Element; @@ -33,10 +34,10 @@ public class Configurator { private String m_sOutputPath = "resources/output/featuremodel.xml"; //path to the feature model xml private String m_sFeatureModelPath = "model.xml"; - //path to the test manager - private String m_sTestManagerPath = "../../../build/sim/testmanager.sh"; - //path to the testcase compliler - private String m_sTestCaseCompilerPath = "../../../build/test/compiler/compile"; + //path to the directory of test manager + private String m_sTestManagerPath = "../../../build/sim/"; + //path to the directory of testcase compliler + private String m_sTestCaseCompilerPath = "../../../build/test/compiler/"; //document representation of the feature model private Document m_oFeatureModelDoc; @@ -125,7 +126,8 @@ public class Configurator { //TODO launch compiler try { - Process oTestCaseCompiler = oRuntime.exec(m_sTestCaseCompilerPath); + File oWorkingDir = new File(m_sTestCaseCompilerPath); + Process oTestCaseCompiler = oRuntime.exec("./compile", null, oWorkingDir); BufferedReader oOutput = new BufferedReader(new InputStreamReader(oTestCaseCompiler.getInputStream())); String sOutput = null; while ((sOutput = oOutput.readLine()) != null) { @@ -137,7 +139,8 @@ public class Configurator { //TODO launch test manager try { - Process oTestManager = oRuntime.exec(m_sTestManagerPath); + File oWorkingDir = new File(m_sTestManagerPath); + Process oTestManager = oRuntime.exec("./testmanager.sh", null, oWorkingDir); BufferedReader oOutput = new BufferedReader(new InputStreamReader(oTestManager.getInputStream())); String sOutput = null; while ((sOutput = oOutput.readLine()) != null) { -- GitLab