One common technique that may work here is to write a special purpose
sub-test for each test that requires special capabilities. Make the
sub-test do nothing unless some environment variable is set. Have the
real test exec the test program itself with the environment variable
set and with -test.run pointing to the subtest and with whatever
special operation you need.
One example: TestFcntlFlock in syscall/syscall_unix_test.go (slightly
different from the above because it uses the same test). Another
example: TestStdPipe in os/pipe_test.go.
Ian