Skip to content

Commit e6ed8cc

Browse files
authored
Merge branch 'main' into debugger-restart-frame
2 parents b203344 + ca598f3 commit e6ed8cc

File tree

2 files changed

+106
-3
lines changed

2 files changed

+106
-3
lines changed

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>org.rascalmpl</groupId>
55
<artifactId>rascal</artifactId>
6-
<version>0.41.3-RC7-SNAPSHOT</version>
6+
<version>0.41.3-RC8-SNAPSHOT</version>
77
<packaging>jar</packaging>
88

99
<scm>
@@ -32,7 +32,7 @@
3232
<exec.mainClass>org.rascalmpl.shell.RascalShell</exec.mainClass>
3333
<rascal.test.memory>3</rascal.test.memory>
3434
<maven.compiler.release>11</maven.compiler.release>
35-
<rascal-maven.version>0.30.6</rascal-maven.version>
35+
<rascal-maven.version>0.30.7</rascal-maven.version>
3636
<jline.version>3.29.0</jline.version> <!-- do not upgrade unless https://github.com/jline/jline3/issues/1445 is solved-->
3737
</properties>
3838

@@ -131,7 +131,7 @@
131131
<artifactId>rascal-maven-plugin</artifactId>
132132
<version>${rascal-maven.version}</version>
133133
<configuration>
134-
<bootstrapRascalVersion>0.41.3-RC6-BOOT</bootstrapRascalVersion>
134+
<bootstrapRascalVersion>0.41.3-RC7-BOOT</bootstrapRascalVersion>
135135
<parallel>true</parallel>
136136
<parallelPreChecks>
137137
<pre>${project.basedir}/src/org/rascalmpl/library/Prelude.rsc</pre>
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
@license{
2+
Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
1. Redistributions of source code must retain the above copyright notice,
9+
this list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25+
POSSIBILITY OF SUCH DAMAGE.
26+
}
27+
module lang::rascalcore::check::tests::PackagerTests
28+
29+
import lang::rascalcore::check::Checker;
30+
import lang::rascalcore::check::RascalConfig;
31+
import lang::rascalcore::package::Packager;
32+
33+
import Location;
34+
import Map;
35+
import IO;
36+
import ValueIO;
37+
import Message;
38+
39+
import util::FileSystem;
40+
import util::PathConfig;
41+
42+
private void runChecker(PathConfig pcfg, list[str] mnames) {
43+
result = checkModules(mnames, rascalCompilerConfig(pcfg));
44+
for (/e:error(_,_) := result) {
45+
println(e);
46+
}
47+
}
48+
49+
test bool packagerRewritesTModelsCorrectly () {
50+
println("**** Checking List");
51+
tplRoot = |memory:///|;
52+
originalBin = tplRoot + "rascal-lib";
53+
rewrittenBin = tplRoot + "rascal-lib-rewritten";
54+
rascalLibPcfg =
55+
pathConfig(srcs = [|mvn://org.rascalmpl--rascal--0.41.0-RC15/|],
56+
bin = originalBin);
57+
runChecker(rascalLibPcfg, ["List"]);
58+
assert validateTModels(rascalLibPcfg.bin) : "Tpls before packager are not correct";
59+
println("**** Running packager");
60+
lang::rascalcore::package::Packager::main(pcfg = rascalLibPcfg,
61+
sourceLookup=rascalLibPcfg.srcs[0],
62+
relocatedClasses=rewrittenBin);
63+
assert validateTModels(rewrittenBin): "Tpls after packager are not correct";
64+
return true;
65+
}
66+
67+
bool validateTModels(loc bin){
68+
println("**** Validating TModels in <bin>");
69+
bool result = true;
70+
for (loc file <- find(bin, "tpl")) {
71+
result = result && isValidTModel(readBinaryValueFile(file));
72+
}
73+
return result;
74+
}
75+
76+
// Validity check on TModels focussing on the occurrence of logical/physical locations
77+
bool isValidTModel(TModel tm){
78+
bool result = true;
79+
80+
void report(str msg){
81+
result = false;
82+
println(msg);
83+
}
84+
visit(tm.paths){
85+
case loc l: if(!isModuleId(l)) report("Paths: Expected moduleId, found <l>");
86+
}
87+
visit(domain(tm.logical2physical)){
88+
case loc l: if(!isRascalLogicalLoc(l)) report("logical2physical: Expected logical loc, found <l>");
89+
}
90+
visit(range(tm.logical2physical)){
91+
case loc l: if(isRascalLogicalLoc(l)) report("logical2physical: Expected physical loc, found <l>");
92+
}
93+
94+
visit(range(tm.moduleLocs)){
95+
case loc l: if(!isRascalLogicalLoc(l)) report("moduleLocs: Expected logical loc, found <l>");
96+
}
97+
98+
visit(tm.messages){
99+
case loc l: if(isRascalLogicalLoc(l)) report("messages: Expected physical loc, found <l>");
100+
}
101+
102+
return result;
103+
}

0 commit comments

Comments
 (0)