]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: test that timeBeginPeriod succeeds
authorAlex Brainman <alex.brainman@gmail.com>
Thu, 23 Jul 2015 01:42:51 +0000 (11:42 +1000)
committerAlex Brainman <alex.brainman@gmail.com>
Wed, 23 Sep 2015 09:01:08 +0000 (09:01 +0000)
Change-Id: I5183f767dadb6d24a34d2460d02e97ddbaab129a
Reviewed-on: https://go-review.googlesource.com/12546
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/export_windows_test.go
src/runtime/os1_windows.go
src/runtime/syscall_windows_test.go

index 61fcef9c0f6ee9bd308f904e56da48bf166bd216..6322ee2804af272447bdb2539a9fdae261f6c28f 100644 (file)
@@ -6,4 +6,7 @@
 
 package runtime
 
-var TestingWER = &testingWER
+var (
+       TestingWER              = &testingWER
+       TimeBeginPeriodRetValue = &timeBeginPeriodRetValue
+)
index f608b4ad80c00183f6a5f09bab04f28b18f935f6..b6da4df7c72e2b91e0f077bf62b73bee01e4b331 100644 (file)
@@ -139,6 +139,8 @@ const (
 // in sys_windows_386.s and sys_windows_amd64.s
 func externalthreadhandler()
 
+var timeBeginPeriodRetValue uint32
+
 func osinit() {
        asmstdcallAddr = unsafe.Pointer(funcPC(asmstdcall))
 
@@ -154,7 +156,7 @@ func osinit() {
 
        stdcall2(_SetConsoleCtrlHandler, funcPC(ctrlhandler), 1)
 
-       stdcall1(_timeBeginPeriod, 1)
+       timeBeginPeriodRetValue = uint32(stdcall1(_timeBeginPeriod, 1))
 
        ncpu = getproccount()
 
index 677eb5f82d18cd52ce22937dc8123fc8f7a4bdf0..4bedd4add4686c9ba7415053263c3d76f4ff61b6 100644 (file)
@@ -640,3 +640,10 @@ uintptr_t cfunc(callback f, uintptr_t n) {
                t.Errorf("got %d want %d", got, want)
        }
 }
+
+func TestTimeBeginPeriod(t *testing.T) {
+       const TIMERR_NOERROR = 0
+       if *runtime.TimeBeginPeriodRetValue != TIMERR_NOERROR {
+               t.Fatalf("timeBeginPeriod failed: it returned %d", *runtime.TimeBeginPeriodRetValue)
+       }
+}