Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valgrind fails in CI #790

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions effekt/jvm/src/test/scala/effekt/LLVMTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ class LLVMTests extends EffektTests {
lazy val bugs: List[File] = List(
// names not sanitized (even?)
examplesDir / "pos" / "special_names.effekt",
// Jump to the invalid address stated on the next line
examplesDir / "benchmarks" / "input_output" / "dyck_one.effekt",
examplesDir / "benchmarks" / "input_output" / "number_matrix.effekt",
examplesDir / "benchmarks" / "input_output" / "word_count_ascii.effekt",
examplesDir / "benchmarks" / "input_output" / "word_count_utf8.effekt",
)

/**
Expand Down
7 changes: 0 additions & 7 deletions effekt/jvm/src/test/scala/effekt/StdlibTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ class StdlibLLVMTests extends StdlibTests {
override def debug = sys.env.get("EFFEKT_DEBUG").nonEmpty

override def ignored: List[File] = List(
// Syscall param write(buf) points to uninitialised byte(s)
examplesDir / "stdlib" / "io" / "filesystem" / "files.effekt",
examplesDir / "stdlib" / "io" / "filesystem" / "async_file_io.effekt",

// Conditional jump or move depends on uninitialised value(s)
examplesDir / "stdlib" / "io" / "filesystem" / "wordcount.effekt",

// String comparison using `<`, `<=`, `>`, `>=` is not implemented yet on LLVM
examplesDir / "stdlib" / "string" / "compare.effekt",
)
Expand Down
10 changes: 6 additions & 4 deletions examples/benchmarks/input_output/dyck_one.effekt
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,19 @@ def size(tree: Tree): Int =
}
}

extern def filename(): String =
js { "/tmp/dyck_one_js.txt" }
llvm { "/tmp/dyck_one_llvm.txt" }

def run(n: Int): Int = {
with on[IOError].panic

val filename = "/tmp/dyck_one.txt"

val _ = {
with writeFile(filename)
with writeFile(filename())
emitTree(n)
}

with readFile(filename)
with readFile(filename())
with returning::scanner[Byte, Int]
attempt { readTree().size } { panic("Expected tree.")}
}
Expand Down
10 changes: 6 additions & 4 deletions examples/benchmarks/input_output/word_count_ascii.effekt
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ def countWords(): Output / read[Byte] = {
Output(chars, words, lines)
}

extern def filename(): String =
js { "/tmp/word_count_ascii_js.txt" }
llvm { "/tmp/word_count_ascii_llvm.txt" }

def run(n: Int) = {
with on[IOError].panic;

val filename = "/tmp/word_count_ascii.txt"

val _ = {
with writeFile(filename)
with writeFile(filename())
with repeat(n)
for[Int] { range(32, 127) } { c =>
repeat(10) {
Expand All @@ -76,7 +78,7 @@ def run(n: Int) = {
}

val output = {
with readFile(filename)
with readFile(filename())
countWords()
}

Expand Down
1 change: 1 addition & 0 deletions libraries/llvm/bytearray.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct Pos c_bytearray_new(const Int size) {
void *objPtr = malloc(sizeof(struct Header) + size);
struct Header *headerPtr = objPtr;
*headerPtr = (struct Header) { .rc = 0, .eraser = c_bytearray_erase_noop, };
memset(objPtr + sizeof(struct Header), 0, size);
return (struct Pos) {
.tag = size,
.obj = objPtr,
Expand Down
8 changes: 4 additions & 4 deletions libraries/llvm/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ void c_fs_close(Int file, Stack stack) {
/**
* Maps the libuv error code to a stable (platform independent) numeric value.
*
* Tries to use most common errno integer values, but introduces fresh values (> 200)
* for those without common errno values.
* Tries to use most common error number integer values, but introduces fresh values (> 200)
* for those without common error number values.
*/
Int c_error_number(Int errno) {
switch (errno) {
Int c_error_number(Int error) {
switch (error) {
case UV_EPERM: return 1; // EPERM
case UV_ENOENT: return 2; // ENOENT
case UV_ESRCH: return 3; // ESRCH
Expand Down
Loading