Skip to content

Commit 5ec824e

Browse files
committed
Merge branch 'topic/162' into 'master'
Avoid spurious backtrace when exiting from fatal error. Closes #162 See merge request eng/libadalang/langkit-query-language!216
2 parents 1a64082 + 8e89433 commit 5ec824e

File tree

11 files changed

+38
-2
lines changed

11 files changed

+38
-2
lines changed

lkql_jit/lkql_cli/src/main/java/com/adacore/lkql_jit/LKQLChecker.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,12 @@ protected int executeScript(Context.Builder contextBuilder) {
233233
contextBuilder.option("lkql.ignores", this.args.ignores);
234234
}
235235

236+
// This is needed to make sure that calls to `exitContext` done from within an isolate
237+
// thread (e.g. executing a Java callback from Ada code) directly stop the program instead
238+
// of going it the normal way by raising a special exception, as such exceptions won't be
239+
// handled by the caller when thrown from inside the isolate thread.
240+
contextBuilder.useSystemExit(true);
241+
236242
// Create the context and run the script in it
237243
try (Context context = contextBuilder.build()) {
238244
final Source source = Source.newBuilder("lkql", checkerSource, "checker.lkql").build();

lkql_jit/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@
147147
<lineEndings>UNIX</lineEndings>
148148
</configuration>
149149
</plugin>
150+
151+
<plugin>
152+
<groupId>org.apache.maven.plugins</groupId>
153+
<artifactId>maven-compiler-plugin</artifactId>
154+
<configuration>
155+
<compilerArgs>
156+
<arg>-implicit:class</arg>
157+
</compilerArgs>
158+
</configuration>
159+
</plugin>
150160
</plugins>
151161
</build>
152162

testsuite/drivers/checker_driver.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,17 @@ def run(self) -> None:
4242

4343
args += ['-r', self.test_env['rule_name']]
4444
args += ['--rules-dir', self.test_env['test_dir']]
45-
args += ['--keep-going-on-missing-file']
45+
46+
if self.test_env.get("keep_going_on_missing_file", False):
47+
args += ['--keep-going-on-missing-file']
4648

4749
# Run the checker
4850
if self.perf_mode:
4951
self.perf_run(args)
5052
else:
51-
self.check_run(args)
53+
# Use `catch_error=False` to avoid failing on non-zero status code,
54+
# as some tests actually exert erroneous behaviors.
55+
self.check_run(args, catch_error=False)
5256

5357
def parse_flagged_lines(self, output: str) -> Flags:
5458
# Compile the pattern to match a checker output
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ERROR: File p.ads not found
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
project Prj is
2+
end Prj;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
with P;
2+
3+
package Q is
4+
type T is range 1 .. 5;
5+
6+
subtype U is T;
7+
8+
X : constant P.T := 2;
9+
end Q;

0 commit comments

Comments
 (0)