Commit b4e28996 authored by Alex Brainman's avatar Alex Brainman

x/sys/windows/svc/mgr: skip tests when we are not authorised to manage services

It seems some Windows versions requires you to be
an Administrator to manage services. Just google for
"openscmanager access denied windows 2008" or similar.

Fixes golang/go#11156.

Change-Id: I4b09d244a61179ece7a1319234e5c3199423cbe9
Reviewed-on: https://go-review.googlesource.com/10933Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 58e10963
......@@ -11,6 +11,7 @@ import (
"path/filepath"
"sort"
"strings"
"syscall"
"testing"
"time"
......@@ -20,6 +21,9 @@ import (
func TestOpenLanManServer(t *testing.T) {
m, err := mgr.Connect()
if err != nil {
if errno, ok := err.(syscall.Errno); ok && errno == syscall.ERROR_ACCESS_DENIED {
t.Skip("Skipping test: we don't have rights to manage services.")
}
t.Fatalf("SCM connection failed: %s", err)
}
defer m.Disconnect()
......@@ -107,6 +111,9 @@ func TestMyService(t *testing.T) {
m, err := mgr.Connect()
if err != nil {
if errno, ok := err.(syscall.Errno); ok && errno == syscall.ERROR_ACCESS_DENIED {
t.Skip("Skipping test: we don't have rights to manage services.")
}
t.Fatalf("SCM connection failed: %s", err)
}
defer m.Disconnect()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment