Commit 35fa2eee authored by Sascha Niklas Schneiders's avatar Sascha Niklas Schneiders
Browse files

test execution and generation finally works on windows now

parent f83ab6c7
Pipeline #66653 failed with stage
in 2 minutes and 4 seconds
cd native
call variables.bat
call compileTestsArmadilloBackendOpenBLAS.bat %PROJECT_ROOT%/%1 %PROJECT_ROOT%/%2
call compileTestsArmadilloBackendOpenBLAS.bat %PROJECT_ROOT%%1 %PROJECT_ROOT%%2
exit
\ No newline at end of file
cd native
call variables.bat
cd %PROJECT_ROOT%/%1
cd %PROJECT_ROOT%%1
call TestsForCurrentModel.exe
\ No newline at end of file
......@@ -128,4 +128,8 @@ public class TagBreakpointsSymbolCreator implements TagSymbolCreator {
return false;
}
@Override
public void create(ASTTaggingUnit astTaggingUnit, Scope scope) {
//TODO implement me, required by newer version
}
}
......@@ -128,4 +128,8 @@ public class TagDelaySymbolCreator implements TagSymbolCreator {
return false;
}
@Override
public void create(ASTTaggingUnit astTaggingUnit, Scope scope) {
//TODO implement me, required by newer version
}
}
......@@ -27,4 +27,8 @@ public class TagExecutionOrderSymbolCreator implements TagSymbolCreator {
packageName;
}
@Override
public void create(ASTTaggingUnit astTaggingUnit, Scope scope) {
//TODO implement me, required by newer version
}
}
......@@ -123,4 +123,8 @@ public class TagInitSymbolCreator implements TagSymbolCreator {
return false;
}
@Override
public void create(ASTTaggingUnit astTaggingUnit, Scope scope) {
//TODO implement me, required by newer version
}
}
......@@ -127,4 +127,9 @@ public class TagMinMaxSymbolCreator implements TagSymbolCreator {
scope.getScopeKind()), scope.get_SourcePositionStart());
return false;
}
@Override
public void create(ASTTaggingUnit astTaggingUnit, Scope scope) {
//TODO implement me, required by newer version
}
}
......@@ -127,4 +127,8 @@ public class TagTableSymbolCreator implements TagSymbolCreator {
return false;
}
@Override
public void create(ASTTaggingUnit astTaggingUnit, Scope scope) {
//TODO implement me, required by newer version
}
}
......@@ -26,101 +26,105 @@ import java.util.stream.Collectors;
*/
public class TagThresholdSymbolCreator implements TagSymbolCreator {
public static Scope getGlobalScope(final Scope scope) {
Scope s = scope;
while (s.getEnclosingScope().isPresent()) {
s = s.getEnclosingScope().get();
public static Scope getGlobalScope(final Scope scope) {
Scope s = scope;
while (s.getEnclosingScope().isPresent()) {
s = s.getEnclosingScope().get();
}
return s;
}
return s;
}
public void create(ASTTaggingUnit unit, TaggingResolver gs) {
if (unit.getQualifiedNameList().stream()
.map(q -> q.toString())
.filter(n -> n.endsWith("TagThresholdTagSchema"))
.count() == 0) {
return; // the tagging model is not conform to the TagExecutionOrderTagSchema tagging schema
}
final String packageName = Joiners.DOT.join(unit.getPackageList());
final String rootCmp = // if-else does not work b/cpp of final (required by streams)
(unit.getTagBody().getTargetModelOpt().isPresent()) ?
Joiners.DOT.join(packageName,
unit.getTagBody().getTargetModelOpt().get()
.getQualifiedNameString()) :
packageName;
public void create(ASTTaggingUnit unit, TaggingResolver gs) {
if (unit.getQualifiedNameList().stream()
.map(q -> q.toString())
.filter(n -> n.endsWith("TagThresholdTagSchema"))
.count() == 0) {
return; // the tagging model is not conform to the TagExecutionOrderTagSchema tagging schema
}
final String packageName = Joiners.DOT.join(unit.getPackageList());
final String rootCmp = // if-else does not work b/cpp of final (required by streams)
(unit.getTagBody().getTargetModelOpt().isPresent()) ?
Joiners.DOT.join(packageName,
unit.getTagBody().getTargetModelOpt().get()
.getQualifiedNameString()) :
packageName;
for (ASTTag element : unit.getTagBody().getTagList()) {
element.getTagElementList().stream()
.filter(t -> t.getName().equals("TagThreshold"))
.filter(t -> t.getTagValueOpt().isPresent())
.map(t -> checkContent(t.getTagValueOpt().get()))
.filter(v -> v != null)
.forEachOrdered(v ->
element.getScopeList().stream()
.filter(this::checkScope)
.map(s -> (ASTNameScope) s)
.map(s -> getGlobalScope(gs).<Symbol>resolveDownMany(
Joiners.DOT.join(rootCmp, s.getQualifiedName().toString()),
SymbolKind.KIND))
.filter(s -> !s.isEmpty())
.map(this::checkKind)
.filter(s -> s != null)
.forEachOrdered(s -> gs.addTag(s, new TagThresholdSymbol(v.doubleValue()))));
for (ASTTag element : unit.getTagBody().getTagList()) {
element.getTagElementList().stream()
.filter(t -> t.getName().equals("TagThreshold"))
.filter(t -> t.getTagValueOpt().isPresent())
.map(t -> checkContent(t.getTagValueOpt().get()))
.filter(v -> v != null)
.forEachOrdered(v ->
element.getScopeList().stream()
.filter(this::checkScope)
.map(s -> (ASTNameScope) s)
.map(s -> getGlobalScope(gs).<Symbol>resolveDownMany(
Joiners.DOT.join(rootCmp, s.getQualifiedName().toString()),
SymbolKind.KIND))
.filter(s -> !s.isEmpty())
.map(this::checkKind)
.filter(s -> s != null)
.forEachOrdered(s -> gs.addTag(s, new TagThresholdSymbol(v.doubleValue()))));
}
}
}
protected Number checkContent(String s) {
TagValueParser parser = new TagValueParser();
Optional<ASTNumericTagValue> ast;
try {
boolean enableFailQuick = Log.isFailQuickEnabled();
Log.enableFailQuick(false);
long errorCount = Log.getErrorCount();
protected Number checkContent(String s) {
TagValueParser parser = new TagValueParser();
Optional<ASTNumericTagValue> ast;
try {
boolean enableFailQuick = Log.isFailQuickEnabled();
Log.enableFailQuick(false);
long errorCount = Log.getErrorCount();
ast = parser.parse_StringNumericTagValue(s);
ast = parser.parse_StringNumericTagValue(s);
Log.enableFailQuick(enableFailQuick);
if (Log.getErrorCount() > errorCount) {
throw new Exception("Error occured during parsing.");
}
} catch (Exception e) {
Log.error(String.format("0xT0030 Could not parse %s with TagValueParser#parse_StringNumericTagValue.",
s), e);
return null;
}
if (!ast.isPresent()) {
return null;
Log.enableFailQuick(enableFailQuick);
if (Log.getErrorCount() > errorCount) {
throw new Exception("Error occured during parsing.");
}
} catch (Exception e) {
Log.error(String.format("0xT0030 Could not parse %s with TagValueParser#parse_StringNumericTagValue.",
s), e);
return null;
}
if (!ast.isPresent()) {
return null;
}
return NumericLiteral.getValue(ast.get().getNumericLiteral());
}
return NumericLiteral.getValue(ast.get().getNumericLiteral());
}
protected ExpandedComponentInstanceSymbol checkKind(Collection<Symbol> symbols) {
ExpandedComponentInstanceSymbol ret = null;
for (Symbol symbol : symbols) {
if (symbol.getKind().isSame(ExpandedComponentInstanceSymbol.KIND)) {
if (ret != null) {
Log.error(String.format("0xT0031 Found more than one symbol: '%s' and '%s'",
ret, symbol));
return null;
protected ExpandedComponentInstanceSymbol checkKind(Collection<Symbol> symbols) {
ExpandedComponentInstanceSymbol ret = null;
for (Symbol symbol : symbols) {
if (symbol.getKind().isSame(ExpandedComponentInstanceSymbol.KIND)) {
if (ret != null) {
Log.error(String.format("0xT0031 Found more than one symbol: '%s' and '%s'",
ret, symbol));
return null;
}
ret = (ExpandedComponentInstanceSymbol) symbol;
}
}
ret = (ExpandedComponentInstanceSymbol)symbol;
}
}
if (ret == null) {
Log.error(String.format("0xT0032 Invalid symbol kinds: %s. tagTypeName expects as symbol kind 'ExpandedComponentInstanceSymbol.KIND'.",
symbols.stream().map(s -> "'" + s.getKind().toString() + "'").collect(Collectors.joining(", "))));
return null;
if (ret == null) {
Log.error(String.format("0xT0032 Invalid symbol kinds: %s. tagTypeName expects as symbol kind 'ExpandedComponentInstanceSymbol.KIND'.",
symbols.stream().map(s -> "'" + s.getKind().toString() + "'").collect(Collectors.joining(", "))));
return null;
}
return ret;
}
return ret;
}
protected boolean checkScope(ASTScope scope) {
if (scope.getScopeKind().equals("NameScope")) {
return true;
protected boolean checkScope(ASTScope scope) {
if (scope.getScopeKind().equals("NameScope")) {
return true;
}
Log.error(String.format("0xT0033 Invalid scope kind: '%s'. PowerConsumption expects as scope kind 'NameScope'.",
scope.getScopeKind()), scope.get_SourcePositionStart());
return false;
}
Log.error(String.format("0xT0033 Invalid scope kind: '%s'. PowerConsumption expects as scope kind 'NameScope'.",
scope.getScopeKind()), scope.get_SourcePositionStart());
return false;
}
@Override
public void create(ASTTaggingUnit astTaggingUnit, Scope scope) {
//TODO implement me, required by newer version
}
}
......@@ -118,4 +118,6 @@ public class Slist extends AbstractSymtab {
public static void resetNonVirtualBlockSize() {
nonVirtualBlockSize = 0;
}
}
package de.monticore.lang.monticar.generator.testing;
import de.se_rwth.commons.logging.Log;
import java.util.ArrayList;
import java.util.List;
......@@ -129,7 +131,7 @@ public class StreamTest {
if (matchPort != port) {
String curName = getNameWithoutArrayPart(port.getName());
if (curName.equals(matchName)) {
System.out.println("Found Same Ports: " + matchPort.getName() + " " + port.getName() + " for names " + matchName + " " + curName);
Log.debug(matchPort.getName() + " " + port.getName() + " for names " + matchName + " " + curName, "Found Same Ports");
if (!samePorts.contains(port))
samePorts.add(port);
if (!samePorts.contains(matchPort)) {
......
......@@ -2,7 +2,7 @@ package de.monticore.lang.monticar.generator.testing;
import de.se_rwth.commons.logging.Log;
import java.io.IOException;
import java.io.*;
/**
* @author Sascha Schneiders
......@@ -10,6 +10,12 @@ import java.io.IOException;
public class StreamTestExecution {
public static void compileTests(String targetFullPath, String targetBasePath) throws IOException {
File f = new File("."+targetBasePath + "/exec");
if (!f.exists()) {
f.mkdirs();
f.mkdir();
}
Process p = Runtime.
getRuntime().
exec(new String[]{"compileCPPTests.bat", targetFullPath, targetBasePath + "/exec"});
......
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