Skip to content

Commit

Permalink
Merge branch 'main' into import-optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgenvinju committed Sep 19, 2023
2 parents 18373eb + 9636851 commit 52b8033
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 14 deletions.
2 changes: 1 addition & 1 deletion META-INF/RASCAL.MF
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Project-Name: rascal
Source: src/org/rascalmpl/library,test/org/rascalmpl/benchmark,/org/rascalmpl/test/data
Source: src/org/rascalmpl/library,test/org/rascalmpl/benchmark,test//org/rascalmpl/test/data
Courses: src/org/rascalmpl/courses


1 change: 1 addition & 0 deletions src/org/rascalmpl/interpreter/result/JavaMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.rascalmpl.interpreter.utils.JavaBridge;
import org.rascalmpl.interpreter.utils.Names;
import org.rascalmpl.uri.URIUtil;
import org.rascalmpl.uri.file.TempURIResolver;

import io.usethesource.vallang.ISourceLocation;
import io.usethesource.vallang.IValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
module lang::rascal::tests::functionality::Aliasing

import Type;
import Exception;

alias INTEGER0 = int;

Expand Down Expand Up @@ -299,6 +300,7 @@ test bool assignableTupleAlias() {
}

@synopsis{this tests if the solution for #1811 still checks the arity of the tuple}
@ignoreCompiler{The assignment is flagged as a type error}
@expected{UnexpectedType}
test bool assignableTupleAliasError() {
T[int] x = <0,1>;
Expand Down
2 changes: 0 additions & 2 deletions src/org/rascalmpl/library/util/Eval.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ public Eval(IValueFactory values, OutputStream out, OutputStream err, InputStrea

// TODO: this is to fix the course Question compiler with a workaround.
// it would be better to parameterize eval with a PathConfig.

this.eval.addRascalSearchPath(URIUtil.rootLocation("test-modules"));
this.eval.addRascalSearchPath(URIUtil.rootLocation("std"));
// this.eval.getConfiguration().setRascalJavaClassPathProperty(ctx.getConfiguration().getRascalJavaClassPathProperty());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ private void fillModuleWorkList() {
for (String src : new RascalManifest().getSourceRoots(projectRoot)) {
RascalJUnitTestRunner.getRecursiveModuleList(URIUtil.getChildLocation(projectRoot, src + "/" + prefix.replaceAll("::", "/")), result);
}

result.stream().map(m -> prefix + "::" + m).forEach(n -> modules.add(n));
}
catch (IOException e) {
Expand Down Expand Up @@ -304,6 +305,8 @@ private void initializeEvaluator() {
evaluator = new Evaluator(ValueFactoryFactory.getValueFactory(), System.in, System.err, System.out, root, heap);
evaluator.addRascalSearchPathContributor(StandardLibraryContributor.getInstance());
evaluator.getConfiguration().setErrors(true);

RascalJUnitTestRunner.configureProjectEvaluator(evaluator, projectRoot);
}

}
Expand Down
26 changes: 22 additions & 4 deletions src/org/rascalmpl/test/infrastructure/RascalJUnitTestRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static void configureProjectEvaluator(Evaluator evaluator, ISourceLocatio
PathConfig pcfg = PathConfig.fromSourceProjectRascalManifest(projectRoot, RascalConfigMode.INTERPETER);

for (IValue path : pcfg.getSrcs()) {
System.err.println("Adding evaluator search path: " + path);

evaluator.addRascalSearchPath((ISourceLocation) path);
}

Expand Down Expand Up @@ -158,9 +158,17 @@ public static String computeTestName(String name, ISourceLocation loc) {

public static List<String> getRecursiveModuleList(ISourceLocation root, List<String> result) throws IOException {
Queue<ISourceLocation> todo = new LinkedList<>();

todo.add(root);

while (!todo.isEmpty()) {
ISourceLocation currentDir = todo.poll();

if (!URIResolverRegistry.getInstance().exists(currentDir)) {
System.err.println("[INFO] skipping " + currentDir + ", does not exist.");
continue;
}

String prefix = currentDir.getPath().replaceFirst(root.getPath(), "").replaceFirst("/", "").replaceAll("/", "::");
for (ISourceLocation ent : URIResolverRegistry.getInstance().list(currentDir)) {
if (ent.getPath().endsWith(".rsc")) {
Expand Down Expand Up @@ -217,10 +225,10 @@ public Description getDescription() {
}
}
catch (Throwable e) {
System.err.println("[ERROR] " + e);

desc.addChild(modDesc);

Description testDesc = Description.createTestDescription(clazz, name + "compilation failed", new CompilationFailed() {
Description testDesc = Description.createTestDescription(clazz, name + " compilation failed", new CompilationFailed() {
@Override
public Class<? extends Annotation> annotationType() {
return getClass();
Expand All @@ -233,8 +241,18 @@ public Class<? extends Annotation> annotationType() {

return desc;
} catch (IOException e) {
Description testDesc = Description.createTestDescription(clazz, prefix + " compilation failed: " + e.getMessage(), new CompilationFailed() {
@Override
public Class<? extends Annotation> annotationType() {
return getClass();
}
});

desc.addChild(testDesc);

System.err.println("[ERROR] Could not create tests suite: " + e);
throw new RuntimeException("could not create test suite", e);

return desc;
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/org/rascalmpl/test/infrastructure/TestFramework.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ public class TestFramework {
evaluator = new Evaluator(ValueFactoryFactory.getValueFactory(), System.in, System.err, System.out, root, heap);

evaluator.addRascalSearchPathContributor(StandardLibraryContributor.getInstance());

evaluator.addRascalSearchPath(URIUtil.rootLocation("test-modules"));

RascalJUnitTestRunner.configureProjectEvaluator(evaluator, RascalJUnitTestRunner.inferProjectRoot(TestFramework.class));

try {
Expand Down
2 changes: 2 additions & 0 deletions src/org/rascalmpl/uri/resolvers.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
org.rascalmpl.uri.file.FileURIResolver
org.rascalmpl.uri.file.TempURIResolver
org.rascalmpl.uri.CompressedStreamResolver
org.rascalmpl.uri.remote.HttpsURIResolver
org.rascalmpl.uri.remote.HttpURIResolver
Expand All @@ -11,3 +12,4 @@ org.rascalmpl.uri.file.CWDURIResolver
org.rascalmpl.uri.file.SystemPathURIResolver
org.rascalmpl.uri.libraries.MemoryResolver
org.rascalmpl.uri.libraries.RascalLibraryURIResolver

Binary file modified test/org/rascalmpl/test/data/m3/hamcrest-library-1.3-m3.bin
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.rascalmpl.interpreter.env.GlobalEnvironment;
import org.rascalmpl.interpreter.env.ModuleEnvironment;
import org.rascalmpl.interpreter.load.StandardLibraryContributor;
import org.rascalmpl.uri.URIUtil;
import org.rascalmpl.shell.ShellEvaluatorFactory;
import org.rascalmpl.values.ValueFactoryFactory;

import io.usethesource.vallang.ISourceLocation;
Expand All @@ -34,9 +34,7 @@ private static Evaluator freshEvaluator() {
var root = heap.addModule(new ModuleEnvironment("___test___", heap));

var evaluator = new Evaluator(ValueFactoryFactory.getValueFactory(), System.in, System.err, System.out, root, heap);
evaluator.addRascalSearchPathContributor(StandardLibraryContributor.getInstance());
evaluator.addRascalSearchPath(URIUtil.rootLocation("test-modules"));

evaluator.addRascalSearchPathContributor(StandardLibraryContributor.getInstance());
evaluator.setTestResultListener(new ITestResultListener() {
@Override
public void start(String context, int count) { }
Expand Down

0 comments on commit 52b8033

Please sign in to comment.