Skip to content

Commit a348bf6

Browse files
authored
Make panics output to stdout (#823)
Fixes #815
1 parent f4c840f commit a348bf6

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

effekt/jvm/src/test/scala/effekt/LLVMTests.scala

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ class LLVMTests extends EffektTests {
2020
)
2121

2222
/**
23-
* Documentation of currently failing tests and their reason
23+
* Documentation of currently failing tests because of missing features
24+
* and their reason
2425
*/
2526
lazy val missingFeatures: List[File] = List(
2627
// Regex
@@ -52,5 +53,22 @@ class LLVMTests extends EffektTests {
5253
examplesDir / "pos" / "issue733.effekt",
5354
)
5455

55-
override lazy val ignored: List[File] = missingFeatures
56+
override lazy val ignored: List[File] = missingFeatures ++ noValgrind(examplesDir)
57+
}
58+
59+
/**
60+
* Documentation of tests that succeed in running, but fail valgrind
61+
* and their reason
62+
*/
63+
def noValgrind(examplesDir: File): List[File] = List(
64+
examplesDir / "llvm" / "prompt-duplication.effekt",
65+
)
66+
67+
class LLVMNoValgrindTests extends EffektTests {
68+
def backendName = "llvm"
69+
70+
override def valgrind = false
71+
override def debug = false
72+
73+
override lazy val positives: List[File] = noValgrind(examplesDir)
5674
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1+
PANIC: Continuation invoked itself
12
[error] Process exited with non-zero exit code 1.
2-
[error] Valgrind log:

libraries/llvm/panic.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33

44
#include <stdio.h>
55

6+
// TODO:
7+
// this should _morally_ be using `stderr`, but we don't tee it in tests
8+
// see PR #823 & issue #815 for context
9+
610
void hole() {
7-
fprintf(stderr, "PANIC: Reached a hole in the program\n");
11+
printf("PANIC: Reached a hole in the program\n");
812
exit(1);
913
}
1014

1115
void duplicated_prompt() {
12-
fprintf(stderr, "PANIC: Continuation invoked itself\n");
16+
printf("PANIC: Continuation invoked itself\n");
1317
exit(1);
1418
}
1519

0 commit comments

Comments
 (0)