Commit c10db833 authored by cesomark's avatar cesomark

Added tests for instances. Also test cleanup

parent cc3d025b
Pipeline #156306 failed with stages
in 11 seconds
......@@ -381,7 +381,7 @@ public class EMADLGenerator {
// TODO: Replace warinings with errors, until then use this method
stopGeneratorIfWarning();
Log.warn("Tagfile was found, ignoring data_paths.txt: " + dataPath);
Log.warn("Tagging info for symbol was found, ignoring data_paths.txt: " + dataPath);
} else {
DataPathConfigParser newParserConfig = new DataPathConfigParser(getModelsPath() + "data_paths.txt");
dataPath = newParserConfig.getDataPath(component.getFullName());
......@@ -565,7 +565,7 @@ public class EMADLGenerator {
private void stopGeneratorIfWarning() {
for (int i = 0; i < Log.getFindings().size(); i++) {
if (Log.getFindings().get(i).toString().matches("Filepath '(.)*/test/resources/models' does not exist!")) {
if (Log.getFindings().get(i).toString().matches("Filepath '(.)*' does not exist!")) {
throw new RuntimeException(Log.getFindings().get(i).toString());
} else if (Log.getFindings().get(i).toString()
.equals("DatapathType is incorrect, must be of Type: HDF5 or LMDB")) {
......
......@@ -190,24 +190,32 @@ public class GenerationTest extends AbstractSymtabTest {
EMADLGeneratorCli.main(args);
assertEquals(Log.getFindings().size(), 1);
assertEquals(Log.getFindings().get(0).toString(),
"Tagfile was found, ignoring data_paths.txt: src/test/resources/models");
"Tagging info for symbol was found, ignoring data_paths.txt: src/test/resources/models");
assertTrue(Log.getErrorCount() == 0);
}
@Test
public void testAlexNetTaggingForInstances() {
Log.getFindings().clear();
String[] args = { "-m", "src/test/resources/models/", "-r", "tagging.Parent", "-b", "MXNET", "-f", "n", "-c",
"n" };
EMADLGeneratorCli.main(args);
}
@Test(expected = RuntimeException.class)
public void testInvalidPathCoCos() {
Log.getFindings().clear();
String[] args = { "-m", "src/test/resources/models/", "-r", "tagging.AlexnetInvalid", "-b", "MXNET", "-f", "n",
"-c", "n" };
EMADLGeneratorCli.main(args);
assertEquals(Log.getFindings().size(), 3);
assertTrue(
Log.getFindings().get(0).toString().matches("Filepath '(.)*/test/resources/models' does not exist!"));
assertEquals(Log.getFindings().get(1).toString(), "DatapathType is incorrect, must be of Type: HDF5 or LMDB");
assertEquals(Log.getFindings().get(2).toString(),
"Tagfile was found, ignoring data_paths.txt: test/resources/models");
}
assertTrue(Log.getErrorCount() == 0);
@Test(expected = RuntimeException.class)
public void testInvalidPathCoCosInstances() {
Log.getFindings().clear();
String[] args = { "-m", "src/test/resources/models/", "-r", "tagging.ParentInvalidPath", "-b", "MXNET", "-f",
"n", "-c", "n" };
EMADLGeneratorCli.main(args);
}
@Test(expected = RuntimeException.class)
......@@ -217,11 +225,14 @@ public class GenerationTest extends AbstractSymtabTest {
String[] args = { "-m", "src/test/resources/models/", "-r", "tagging.AlexnetInvalidType", "-b", "MXNET", "-f",
"n", "-c", "n" };
EMADLGeneratorCli.main(args);
assertEquals(Log.getFindings().size(), 2);
assertEquals(Log.getFindings().get(0).toString(), "DatapathType is incorrect, must be of Type: HDF5 or LMDB");
assertEquals(Log.getFindings().get(1).toString(),
"Tagfile was found, ignoring data_paths.txt: src/test/resources/models");
}
assertTrue(Log.getErrorCount() == 0);
@Test(expected = RuntimeException.class)
public void testInvalidTypeCocosInstances() {
Log.getFindings().clear();
String[] args = { "-m", "src/test/resources/models/", "-r", "tagging.ParentInvalidType", "-b", "MXNET", "-f",
"n", "-c", "n" };
EMADLGeneratorCli.main(args);
}
}
......@@ -5,7 +5,12 @@ tags Alexnet {
tag Alexnet with DataPath = {path = src/test/resources/models, type = LMDB};
tag AlexnetInvalid with DataPath = {path = test/resources/models, type = random};
tag AlexnetInvalidType with DataPath = {path = src/test/resources/models, type = LMBD};
tag Parent.a1 with DataPath = {path = instanceA1, type = random};
tag Parent.a1 with DataPath = {path = src/test/resources/models, type = LMDB};
tag Parent.a2 with DataPath = {path = src/test/resources/models, type = LMDB};
tag ParentInvalidType.a1 with DataPath = {path = src/test/resources/models, type = LMDB};
tag ParentInvalidType.a2 with DataPath = {path = src/test/resources/models, type = LMDB_1};
tag ParentInvalidPath.a1 with DataPath = {path = /NO_VALID_PATH/, type = LMDB};
tag ParentInvalidPath.a2 with DataPath = {path = src/test/resources/models, type = LMDB};
}
......
package tagging;
component ParentInvalidPath{
instance Alexnet a1;
instance Alexnet a2;
}
\ No newline at end of file
package tagging;
component ParentInvalidType{
instance Alexnet a1;
instance Alexnet a2;
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment