}
// processOptions disables CPU feature values based on the parsed env string.
-// The env string is expected to be of the form feature1=0,feature2=0...
+// The env string is expected to be of the form feature1=off,feature2=off...
// where feature names is one of the architecture specifc list stored in the
-// cpu packages options variable. If env contains all=0 then all capabilities
+// cpu packages options variable. If env contains all=off then all capabilities
// referenced through the options variable are disabled. Other feature
-// names and values other than 0 are silently ignored.
+// names and values other than 'off' are silently ignored.
func processOptions(env string) {
field:
for env != "" {
}
key, value := field[:i], field[i+1:]
- // Only allow turning off CPU features by specifying '0'.
- if value == "0" {
+ // Only allow turning off CPU features by specifying 'off'.
+ if value == "off" {
if key == "all" {
for _, v := range options {
*v.Feature = false
}
func TestDisableAllCapabilities(t *testing.T) {
- runDebugOptionsTest(t, "TestAllCapabilitiesDisabled", "all=0")
+ runDebugOptionsTest(t, "TestAllCapabilitiesDisabled", "all=off")
}
func TestAllCapabilitiesDisabled(t *testing.T) {
MustHaveDebugOptionsSupport(t)
- if os.Getenv("GODEBUGCPU") != "all=0" {
- t.Skipf("skipping test: GODEBUGCPU=all=0 not set")
+ if os.Getenv("GODEBUGCPU") != "all=off" {
+ t.Skipf("skipping test: GODEBUGCPU=all=off not set")
}
for _, o := range Options {
}
func TestDisableSSE2(t *testing.T) {
- runDebugOptionsTest(t, "TestSSE2DebugOption", "sse2=0")
+ runDebugOptionsTest(t, "TestSSE2DebugOption", "sse2=off")
}
func TestSSE2DebugOption(t *testing.T) {
MustHaveDebugOptionsSupport(t)
- if os.Getenv("GODEBUGCPU") != "sse2=0" {
- t.Skipf("skipping test: GODEBUGCPU=sse2=0 not set")
+ if os.Getenv("GODEBUGCPU") != "sse2=off" {
+ t.Skipf("skipping test: GODEBUGCPU=sse2=off not set")
}
want := runtime.GOARCH != "386" // SSE2 can only be disabled on 386.