diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43e3ec251..91d790897 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,7 +88,7 @@ jobs: node-version: ${{ env.NODE_VERSION }} - name: Run tests - run: EFFEKT_VALGRIND=1 sbt clean test + run: EFFEKT_VALGRIND=1 EFFEKT_DEBUG=1 sbt clean test - name: Assemble fully optimized js file run: sbt effektJS/fullOptJS diff --git a/effekt/jvm/src/main/scala/effekt/Runner.scala b/effekt/jvm/src/main/scala/effekt/Runner.scala index adfd243cc..329679e0b 100644 --- a/effekt/jvm/src/main/scala/effekt/Runner.scala +++ b/effekt/jvm/src/main/scala/effekt/Runner.scala @@ -332,8 +332,9 @@ object LLVMRunner extends Runner[String] { val executableFile = basePath var gccArgs = Seq(gcc, gccMainFile, "-o", executableFile, objPath) ++ linkedLibraries - if (C.config.debug()) gccArgs ++= Seq("-fsanitize=address,undefined", "-fstack-protector-all", "-Og", "-g", "-Wall", "-Wextra") + if (C.config.debug()) gccArgs ++= Seq("-g", "-Wall", "-Wextra", "-Werror") if (C.config.valgrind()) gccArgs ++= Seq("-O0", "-g") + else if (C.config.debug()) gccArgs ++= Seq("-fsanitize=address,undefined", "-fstack-protector-all") exec(gccArgs: _*) diff --git a/effekt/jvm/src/test/scala/effekt/EffektTests.scala b/effekt/jvm/src/test/scala/effekt/EffektTests.scala index f947693b4..d8de0ba1f 100644 --- a/effekt/jvm/src/test/scala/effekt/EffektTests.scala +++ b/effekt/jvm/src/test/scala/effekt/EffektTests.scala @@ -20,6 +20,9 @@ trait EffektTests extends munit.FunSuite { // Whether to execute using valgrind def valgrind = false + // Whether to execute using debug mode + def debug = false + def output: File = new File(".") / "out" / "tests" / getClass.getName.toLowerCase // The sources of all testfiles are stored here: @@ -64,6 +67,7 @@ trait EffektTests extends munit.FunSuite { "--out", output.getPath, ) if (valgrind) options = options :+ "--valgrind" + if (debug) options = options :+ "--debug" val configs = compiler.createConfig(options) configs.verify() diff --git a/effekt/jvm/src/test/scala/effekt/LLVMTests.scala b/effekt/jvm/src/test/scala/effekt/LLVMTests.scala index 50b77aa70..8d8e50c6b 100644 --- a/effekt/jvm/src/test/scala/effekt/LLVMTests.scala +++ b/effekt/jvm/src/test/scala/effekt/LLVMTests.scala @@ -11,6 +11,7 @@ class LLVMTests extends EffektTests { def backendName = "llvm" override def valgrind = sys.env.get("EFFEKT_VALGRIND").nonEmpty + override def debug = sys.env.get("EFFEKT_DEBUG").nonEmpty override lazy val positives: List[File] = List( examplesDir / "llvm", diff --git a/effekt/jvm/src/test/scala/effekt/StdlibTests.scala b/effekt/jvm/src/test/scala/effekt/StdlibTests.scala index 76dd5c5dd..1086dbc0f 100644 --- a/effekt/jvm/src/test/scala/effekt/StdlibTests.scala +++ b/effekt/jvm/src/test/scala/effekt/StdlibTests.scala @@ -36,6 +36,7 @@ class StdlibLLVMTests extends StdlibTests { def backendName: String = "llvm" override def valgrind = sys.env.get("EFFEKT_VALGRIND").nonEmpty + override def debug = sys.env.get("EFFEKT_DEBUG").nonEmpty override def ignored: List[File] = List( // Toplevel let-bindings (for ANSI-color-codes in output) not supported