aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/syscall_windows_test.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2015-12-21 10:29:21 -0500
committerRuss Cox <rsc@golang.org>2015-12-29 21:16:59 +0000
commit8d5ff2e182c52c4fa6af18e536dcef6e12ad8cb2 (patch)
tree5f5d3338d27a14b5e98af29ccb89d1a390ced3ea /src/runtime/syscall_windows_test.go
parenta69932051266a817d950996c79927541ebdd26bb (diff)
downloadgo-8d5ff2e182c52c4fa6af18e536dcef6e12ad8cb2.tar.xz
runtime: move test programs out of source code, coalesce
Now there are just three programs to compile instead of many, and repeated tests can reuse the compilation result instead of rebuilding it. Combined, these changes reduce the time spent testing runtime during all.bash on my laptop from about 60 to about 30 seconds. (All.bash itself runs in 5½ minutes.) For #10571. Change-Id: Ie2c1798b847f1a635a860d11dcdab14375319ae9 Reviewed-on: https://go-review.googlesource.com/18085 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/syscall_windows_test.go')
-rw-r--r--src/runtime/syscall_windows_test.go26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/runtime/syscall_windows_test.go b/src/runtime/syscall_windows_test.go
index 30630bc904..79807035cc 100644
--- a/src/runtime/syscall_windows_test.go
+++ b/src/runtime/syscall_windows_test.go
@@ -500,7 +500,7 @@ func TestOutputDebugString(t *testing.T) {
}
func TestRaiseException(t *testing.T) {
- o := executeTest(t, raiseExceptionSource, nil)
+ o := runTestProg(t, "testprog", "RaiseException")
if strings.Contains(o, "RaiseException should not return") {
t.Fatalf("RaiseException did not crash program: %v", o)
}
@@ -509,35 +509,13 @@ func TestRaiseException(t *testing.T) {
}
}
-const raiseExceptionSource = `
-package main
-import "syscall"
-func main() {
- const EXCEPTION_NONCONTINUABLE = 1
- mod := syscall.MustLoadDLL("kernel32.dll")
- proc := mod.MustFindProc("RaiseException")
- proc.Call(0xbad, EXCEPTION_NONCONTINUABLE, 0, 0)
- println("RaiseException should not return")
-}
-`
-
func TestZeroDivisionException(t *testing.T) {
- o := executeTest(t, zeroDivisionExceptionSource, nil)
+ o := runTestProg(t, "testprog", "ZeroDivisionException")
if !strings.Contains(o, "panic: runtime error: integer divide by zero") {
t.Fatalf("No stack trace: %v", o)
}
}
-const zeroDivisionExceptionSource = `
-package main
-func main() {
- x := 1
- y := 0
- z := x / y
- println(z)
-}
-`
-
func TestWERDialogue(t *testing.T) {
if os.Getenv("TESTING_WER_DIALOGUE") == "1" {
defer os.Exit(0)