Fixed: [arallel execution of same test for different devices

This commit is contained in:
boccioli_m
2015-09-16 16:18:36 +02:00
parent cb1c14b5c6
commit 00d70ee7e1
2 changed files with 13 additions and 11 deletions

View File

@@ -1524,7 +1524,7 @@ public class TestingList extends Panel {
HashMap args2 = new HashMap(); //this is the global map that will contain one map per test.
HashMap testArgs; //this is the map for a test.
RunTest runTest;
String sTestName = "", sDeviceName = "", sTestPath = "";
String sTestName = "", sDeviceName = "", sTestPath = "", sTestID = ""; //sTestID is the compination of device name + test path
for (int row : rowsToExecute) {
//System.out.println(String.valueOf(row) + "\t" + sDeviceName + "\t" + sTestName + "\t" + sTestCaseName + "\t" + String.valueOf(rowsToExecute.length));
try {
@@ -1533,6 +1533,7 @@ public class TestingList extends Panel {
sTestPath = (String) testArgs.get(testArgNames.TEST_PATH.toString());
sDeviceName = (String) testArgs.get(testArgNames.DEVICE.toString());
mParameters = (HashMap) testArgs.get(testArgNames.PARAMETERS.toString());
sTestID = sDeviceName+"|"+sTestPath;
File f = new File(sTestPath);
if (!f.exists() || f.isDirectory()) {
logger.log(Level.SEVERE, "Cannot find test script: " + sTestPath);
@@ -1552,7 +1553,7 @@ public class TestingList extends Panel {
logger.log(Level.INFO, "Running Test '" + sTestName + "'. No parameters found.");
System.out.println("Running test '" + sTestName + "'. No parameters found.");
}
args2.put(sTestPath, testArgs);
args2.put(sTestID, testArgs);
hTests = args2;
iRet = 0;
} catch (Exception ex) {
@@ -1576,7 +1577,7 @@ public class TestingList extends Panel {
System.out.println("hTests: "+hTests.entrySet().toString());
if(hTests.isEmpty()) return iRet;
for (Map.Entry<String, HashMap> hTest : hTests.entrySet()) {
sTestPath = hTest.getKey().toString();
sTestPath = (String) hTest.getValue().get(testArgNames.TEST_PATH.toString());
sTestPath = sTestPath.replace("\\", "\\\\");
sParallelizeCommand = sParallelizeCommand + "(run,(str('" + sTestPath;
sParallelizeArguments = "None, {'parameters':" + convertParametersMapToPythonMap(hTest.getValue().get("parameters").toString())
@@ -1591,9 +1592,9 @@ public class TestingList extends Panel {
sParallelizeCommand = sParallelizeCommand + ")))"; //very last part of command "parallelize"
}
}
//System.out.println(sParallelizeCommand);
System.out.println(sParallelizeCommand);
Object ret = eval(sParallelizeCommand);
//System.out.println(ret);
System.out.println(ret);
String sTestResult, sTestStatus;
if(ret == null){
SwingUtils.showMessage(TestingList.this, "executeParallelTestsGroup()", "The test script(s) did not return any feedback.");
@@ -1604,12 +1605,13 @@ public class TestingList extends Panel {
//check if the mapping of the selected test has all expected return values
if (((List<PyList>) oTestRet).size() >= 4) {
//extract return data of the current test
sTestPath = String.valueOf(((List<PyList>) oTestRet).get(0));
sTestPath = String.valueOf(((List<PyList>) oTestRet).get(0));
sDeviceName = String.valueOf(((List<PyList>) oTestRet).get(1));
sTestResult = String.valueOf(((List<PyList>) oTestRet).get(2));
sTestStatus = String.valueOf(((List<PyList>) oTestRet).get(3));
sTestID = sDeviceName+"|"+sTestPath;
//from the map of executed tests, get the test name (key is test path)
HashMap<String, HashMap> hTest = hTests.get(sTestPath);
HashMap<String, HashMap> hTest = hTests.get(sTestID);
sTestName = String.valueOf(hTest.get(testArgNames.TEST.toString()));
} else { //problem, the test script does not return all the expected return values
String sErrorText = "Test " + sTestPath + " did not return all required return values";
@@ -1617,10 +1619,10 @@ public class TestingList extends Panel {
SwingUtils.showMessage(TestingList.this, "executeParallelTestsGroup()", sErrorText);
System.out.println(String.valueOf(sErrorText));
//try to fetch at least first element of returned map. If fails, it will go to catch
sTestPath = String.valueOf(((List<PyList>) oTestRet).get(0));
sTestID = String.valueOf(((List<PyList>) oTestRet).get(0));
sTestStatus = sErrorText;
sTestResult = "false";
HashMap<String, HashMap> hTest = hTests.get(sTestPath);
HashMap<String, HashMap> hTest = hTests.get(sTestID);
sDeviceName = String.valueOf(hTest.get(testArgNames.DEVICE.toString()));
sTestName = String.valueOf(hTest.get(testArgNames.TEST.toString()));
}