go/src/runtime/syscall_unix_test.go
Michael Knyszek e4435cb844 runtime: add page tracer
This change adds a new GODEBUG flag called pagetrace that writes a
low-overhead trace of how pages of memory are managed by the Go runtime.

The page tracer is kept behind a GOEXPERIMENT flag due to a potential
security risk for setuid binaries.

Change-Id: I6f4a2447d02693c25214400846a5d2832ad6e5c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/444157
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-18 03:45:30 +00:00

25 lines
635 B
Go

// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build unix
package runtime_test
import (
"runtime"
"syscall"
"testing"
)
func TestSyscallFlagAlignment(t *testing.T) {
// TODO(mknyszek): Check other flags.
check := func(name string, got, want int) {
if got != want {
t.Errorf("flag %s does not line up: got %d, want %d", name, got, want)
}
}
check("O_WRONLY", runtime.O_WRONLY, syscall.O_WRONLY)
check("O_CREAT", runtime.O_CREAT, syscall.O_CREAT)
check("O_TRUNC", runtime.O_TRUNC, syscall.O_TRUNC)
}