]> Cypherpunks repositories - gostls13.git/commitdiff
os: don't check for developer mode in TestSymlinkCreation
authorqmuntal <quimmuntal@gmail.com>
Thu, 24 Oct 2024 15:41:43 +0000 (17:41 +0200)
committerGopher Robot <gobot@golang.org>
Mon, 28 Oct 2024 15:20:33 +0000 (15:20 +0000)
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>
src/os/os_windows_test.go

index d9c8fe3db975c566120ca64fbb3b0e542b083739..591798e9c0c7542577ad273a6c6d3523b593fc7a 100644 (file)
@@ -1017,8 +1017,8 @@ func TestStatNUL(t *testing.T) {
 // works on Windows when developer mode is active.
 // This is supported starting Windows 10 (1703, v10.0.14972).
 func TestSymlinkCreation(t *testing.T) {
-       if !testenv.HasSymlink() && !isWindowsDeveloperModeActive() {
-               t.Skip("Windows developer mode is not active")
+       if !testenv.HasSymlink() {
+               t.Skip("skipping test; no symlink support")
        }
        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
 // drive root (beginning with "\" but no volume name) are created with the
 // correct symlink type.