mirror of
https://github.com/golang/go
synced 2024-11-15 05:50:37 -07:00
os: don't check for developer mode in TestSymlinkCreation
testenv.HasSymlink is already smart enough to return false if the process is not elevated or developer mode is not enabled. There is no need to check it twice. Change-Id: Ib26c1509058230b07dbf5f2c808a10ae731f4ae4 Reviewed-on: https://go-review.googlesource.com/c/go/+/622156 Auto-Submit: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
This commit is contained in:
parent
9f8bf04057
commit
d8f9c4c1ac
@ -1017,8 +1017,8 @@ func TestStatNUL(t *testing.T) {
|
|||||||
// works on Windows when developer mode is active.
|
// works on Windows when developer mode is active.
|
||||||
// This is supported starting Windows 10 (1703, v10.0.14972).
|
// This is supported starting Windows 10 (1703, v10.0.14972).
|
||||||
func TestSymlinkCreation(t *testing.T) {
|
func TestSymlinkCreation(t *testing.T) {
|
||||||
if !testenv.HasSymlink() && !isWindowsDeveloperModeActive() {
|
if !testenv.HasSymlink() {
|
||||||
t.Skip("Windows developer mode is not active")
|
t.Skip("skipping test; no symlink support")
|
||||||
}
|
}
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
@ -1034,23 +1034,6 @@ func TestSymlinkCreation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// isWindowsDeveloperModeActive checks whether or not the developer mode is active on Windows 10.
|
|
||||||
// Returns false for prior Windows versions.
|
|
||||||
// see https://docs.microsoft.com/en-us/windows/uwp/get-started/enable-your-device-for-development
|
|
||||||
func isWindowsDeveloperModeActive() bool {
|
|
||||||
key, err := registry.OpenKey(registry.LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\AppModelUnlock", registry.READ)
|
|
||||||
if err != nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
val, _, err := key.GetIntegerValue("AllowDevelopmentWithoutDevLicense")
|
|
||||||
if err != nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return val != 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// TestRootRelativeDirSymlink verifies that symlinks to paths relative to the
|
// TestRootRelativeDirSymlink verifies that symlinks to paths relative to the
|
||||||
// drive root (beginning with "\" but no volume name) are created with the
|
// drive root (beginning with "\" but no volume name) are created with the
|
||||||
// correct symlink type.
|
// correct symlink type.
|
||||||
|
Loading…
Reference in New Issue
Block a user