Commit 52a9e91f authored by Kirhan, Cihad's avatar Kirhan, Cihad
Browse files

ConfLang integration

parent ec7da96a
Pipeline #448669 failed with stage
in 1 minute and 50 seconds
......@@ -4,23 +4,18 @@ package de.monticore.lang.monticar.cnnarch.caffe2generator;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import conflang._symboltable.ConfLangConfigurationSymbol;
import de.monticore.io.paths.ModelPath;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureSymbol;
import de.monticore.lang.monticar.cnnarch.generator.CNNTrainGenerator;
//import de.monticore.lang.monticar.cnntrain._ast.ASTCNNTrainNode;
//import de.monticore.lang.monticar.cnntrain._ast.ASTOptimizerEntry;
//import de.monticore.lang.monticar.cnntrain._cocos.CNNTrainCocos;
//import de.monticore.lang.monticar.cnntrain._symboltable.CNNTrainCompilationUnitSymbol;
//import de.monticore.lang.monticar.cnntrain._symboltable.CNNTrainLanguage;
//import de.monticore.lang.monticar.cnntrain._symboltable.ConfigurationSymbol;
//import de.monticore.lang.monticar.cnntrain._symboltable.OptimizerSymbol;
import de.monticore.lang.monticar.generator.FileContent;
import de.monticore.lang.monticar.generator.cpp.GeneratorCPP;
//import de.monticore.symboltable.GlobalScope;
import de.se_rwth.commons.logging.Log;
import java.io.IOException;
import java.nio.file.Path;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public class CNNTrain2Caffe2 extends CNNTrainGenerator {
......@@ -87,7 +82,7 @@ public class CNNTrain2Caffe2 extends CNNTrainGenerator {
// }
@Override
public List<FileContent> generateFileContents(ConfLangConfigurationSymbol configuration, Map<String, Object> architectureAdapterMap) {
public List<FileContent> generateFileContents(ConfLangConfigurationSymbol configuration, Map<String, ArchitectureSymbol> architectureAdapterMap) {
ConfigurationDataConfLang configData = new ConfigurationDataConfLang(configuration, getInstanceName());
List<ConfigurationDataConfLang> configDataList = Lists.newArrayList(configData);
Map<String, Object> ftlContext = Collections.singletonMap("configurations", configDataList);
......
......@@ -7,16 +7,15 @@ import org.apache.commons.cli.ParseException;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.Assertion;
import org.junit.contrib.java.lang.system.ExpectedSystemExit;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.Arrays;
import org.junit.contrib.java.lang.system.Assertion;
import org.junit.contrib.java.lang.system.ExpectedSystemExit;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals;
public class GenerationTest extends AbstractSymtabTest{
@Rule
......@@ -35,9 +34,7 @@ public class GenerationTest extends AbstractSymtabTest{
String[] args = {"-m", "src/test/resources/architectures", "-r", "LeNet", "-o", "./target/generated-sources-cnnarch/"};
CNNArch2Caffe2Cli.main(args);
// assertTrue(Log.getFindings().isEmpty()); TODO: activate
assertEquals(0, Log.getErrorCount());
assertTrue(Log.getFindings().isEmpty());
checkFilesAreEqual(
Paths.get("./target/generated-sources-cnnarch"),
Paths.get("./src/test/resources/target_code"),
......@@ -79,9 +76,7 @@ public class GenerationTest extends AbstractSymtabTest{
String[] args = {"-m", "src/test/resources/architectures", "-r", "VGG16", "-o", "./target/generated-sources-cnnarch/"};
CNNArch2Caffe2Cli.main(args);
// assertTrue(Log.getFindings().isEmpty()); TODO: activate
assertEquals(0, Log.getErrorCount());
assertTrue(Log.getFindings().isEmpty());
checkFilesAreEqual(
Paths.get("./target/generated-sources-cnnarch"),
Paths.get("./src/test/resources/target_code"),
......@@ -138,9 +133,7 @@ public class GenerationTest extends AbstractSymtabTest{
CNNTrain2Caffe2 trainGenerator = new CNNTrain2Caffe2();
trainGenerator.generate(Paths.get(sourcePath), "FullConfig");
// assertTrue(Log.getFindings().isEmpty()); TODO: activate
assertEquals(0, Log.getErrorCount());
assertTrue(Log.getFindings().isEmpty());
checkFilesAreEqual(
Paths.get("./target/generated-sources-cnnarch"),
Paths.get("./src/test/resources/target_code"),
......@@ -156,9 +149,7 @@ public class GenerationTest extends AbstractSymtabTest{
trainGenerator.generate(modelPath, "SimpleConfig");
// assertTrue(Log.getFindings().isEmpty()); TODO: activate
assertEquals(0, Log.getErrorCount());
assertTrue(Log.getFindings().isEmpty());
checkFilesAreEqual(
Paths.get("./target/generated-sources-cnnarch"),
Paths.get("./src/test/resources/target_code"),
......@@ -173,9 +164,7 @@ public class GenerationTest extends AbstractSymtabTest{
CNNTrain2Caffe2 trainGenerator = new CNNTrain2Caffe2();
trainGenerator.generate(modelPath, "EmptyConfig");
// assertTrue(Log.getFindings().isEmpty()); TODO: activate
assertEquals(0, Log.getErrorCount());
assertTrue(Log.getFindings().isEmpty());
checkFilesAreEqual(
Paths.get("./target/generated-sources-cnnarch"),
Paths.get("./src/test/resources/target_code"),
......@@ -190,9 +179,7 @@ public class GenerationTest extends AbstractSymtabTest{
CNNTrain2Caffe2 trainGenerator = new CNNTrain2Caffe2();
trainGenerator.generate(modelPath, "UnsupportedConfig");
// assertTrue(Log.getFindings().isEmpty()); TODO: activate
assertEquals(0, Log.getErrorCount());
assertTrue(Log.getFindings().isEmpty());
checkFilesAreEqual(
Paths.get("./target/generated-sources-cnnarch"),
Paths.get("./src/test/resources/target_code"),
......@@ -208,9 +195,7 @@ public class GenerationTest extends AbstractSymtabTest{
generator.setGenerationTargetPath("./target/generated-sources-cnnarch");
generator.generateCMake(rootModelName);
// assertTrue(Log.getFindings().isEmpty()); TODO: activate
assertEquals(0, Log.getErrorCount());
assertTrue(Log.getFindings().isEmpty());
checkFilesAreEqual(
Paths.get("./target/generated-sources-cnnarch"),
Paths.get("./src/test/resources/target_code"),
......
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