* tree-vect-loop-manip.c (vect_do_peeling): Do not use
[official-gcc.git] / libgo / misc / cgo / test / issue8517_windows.go
blob3782631e91b46488115fec94bdbcd4e8bc73e9f1
1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package cgotest
7 //void testHandleLeaks();
8 import "C"
10 import (
11 "syscall"
12 "testing"
13 "unsafe"
16 var issue8517counter int
18 var (
19 kernel32 = syscall.MustLoadDLL("kernel32.dll")
20 getProcessHandleCount = kernel32.MustFindProc("GetProcessHandleCount")
23 func processHandleCount(t *testing.T) int {
24 const current_process = ^uintptr(0)
25 var c uint32
26 r, _, err := getProcessHandleCount.Call(current_process, uintptr(unsafe.Pointer(&c)))
27 if r == 0 {
28 t.Fatal(err)
30 return int(c)
33 func test8517(t *testing.T) {
34 c1 := processHandleCount(t)
35 C.testHandleLeaks()
36 c2 := processHandleCount(t)
37 if c1+issue8517counter <= c2 {
38 t.Fatalf("too many handles leaked: issue8517counter=%v c1=%v c2=%v", issue8517counter, c1, c2)
42 //export testHandleLeaksCallback
43 func testHandleLeaksCallback() {
44 issue8517counter++