From c2daedbd11293e74f40f6d63b5b6e06197479b11 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Sat, 30 Aug 2014 09:55:01 +0200 Subject: [PATCH] Try not to crash the box with failing tests --- build.go | 2 +- scanner/walk_test.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/build.go b/build.go index 90784c48..2957a80e 100644 --- a/build.go +++ b/build.go @@ -163,7 +163,7 @@ func setup() { } func test(pkg string) { - runPrint("godep", "go", "test", pkg) + runPrint("godep", "go", "test", "-short", "-timeout", "10s", pkg) } func install(pkg string) { diff --git a/scanner/walk_test.go b/scanner/walk_test.go index c0f3895e..43487877 100644 --- a/scanner/walk_test.go +++ b/scanner/walk_test.go @@ -9,6 +9,7 @@ import ( "fmt" "path/filepath" "reflect" + rdebug "runtime/debug" "sort" "testing" @@ -38,6 +39,13 @@ var correctIgnores = map[string][]string{ ".": {".*", "quux"}, } +func init() { + // This test runs the risk of entering infinite recursion if it fails. + // Limit the stack size to 10 megs to creash early in that case instead of + // potentially taking down the box... + rdebug.SetMaxStack(10 * 1 << 20) +} + func TestWalkSub(t *testing.T) { w := Walker{ Dir: "testdata",