Source file src/runtime/gomaxprocs_windows_test.go

     1  // Copyright 2025 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.
     4  
     5  package runtime_test
     6  
     7  import (
     8  	"strings"
     9  	"testing"
    10  )
    11  
    12  func TestGOMAXPROCSUpdate(t *testing.T) {
    13  	if testing.Short() {
    14  		t.Skip("skipping test: long sleeps")
    15  	}
    16  
    17  	got := runTestProg(t, "testprog", "WindowsUpdateGOMAXPROCS")
    18  	if strings.Contains(got, "SKIP") {
    19  		t.Skip(got)
    20  	}
    21  	if !strings.Contains(got, "OK") {
    22  		t.Fatalf("output got %q want OK", got)
    23  	}
    24  }
    25  
    26  func TestCgroupGOMAXPROCSDontUpdate(t *testing.T) {
    27  	if testing.Short() {
    28  		t.Skip("skipping test: long sleeps")
    29  	}
    30  
    31  	// Two ways to disable updates: explicit GOMAXPROCS or GODEBUG for
    32  	// update feature.
    33  	for _, v := range []string{"GOMAXPROCS=4", "GODEBUG=updatemaxprocs=0"} {
    34  		t.Run(v, func(t *testing.T) {
    35  			got := runTestProg(t, "testprog", "WindowsDontUpdateGOMAXPROCS", v)
    36  			if strings.Contains(got, "SKIP") {
    37  				t.Skip(got)
    38  			}
    39  			if !strings.Contains(got, "OK") {
    40  				t.Fatalf("output got %q want OK", got)
    41  			}
    42  		})
    43  	}
    44  }
    45  

View as plain text