From a9ee32376081af19ebb6e6c54b969cce2d2c0ebe Mon Sep 17 00:00:00 2001 From: Li Jie Date: Sat, 18 Jan 2025 16:42:11 +0800 Subject: [PATCH] test: disable log and output to speed up testing --- compiler/cl/compile_test.go | 10 ++++++++++ compiler/ssa/cl_test.go | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/compiler/cl/compile_test.go b/compiler/cl/compile_test.go index 5922f66f..7132ad05 100644 --- a/compiler/cl/compile_test.go +++ b/compiler/cl/compile_test.go @@ -17,6 +17,9 @@ package cl_test import ( + "io" + "log" + "os" "testing" "github.com/goplus/llgo/compiler/cl" @@ -24,6 +27,13 @@ import ( "github.com/goplus/llgo/compiler/internal/build" ) +func init() { + devNull, _ := os.OpenFile(os.DevNull, os.O_WRONLY, 0) + os.Stderr = devNull + os.Stdout = devNull + log.SetOutput(io.Discard) +} + func testCompile(t *testing.T, src, expected string) { t.Helper() cltest.TestCompileEx(t, src, "foo.go", expected, false) diff --git a/compiler/ssa/cl_test.go b/compiler/ssa/cl_test.go index 91d229f6..0fe49ce3 100644 --- a/compiler/ssa/cl_test.go +++ b/compiler/ssa/cl_test.go @@ -18,6 +18,9 @@ package ssa_test import ( "go/types" + "io" + "log" + "os" "testing" "github.com/goplus/llgo/compiler/cl/cltest" @@ -26,6 +29,10 @@ import ( ) func init() { + devNull, _ := os.OpenFile(os.DevNull, os.O_WRONLY, 0) + os.Stderr = devNull + os.Stdout = devNull + log.SetOutput(io.Discard) ssa.SetDebug(ssa.DbgFlagAll) }