Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/syscalls/linux/eventfd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ TEST(EventfdTest, IllegalPwrite) {

TEST(EventfdTest, BigWriteFails) {
// Starting Linux 6.9, big writes fail. gVisor has the newer behavior.
if (!IsRunningOnGvisor()) {
if (!IsRunningOnGvisor() && GvisorPlatform() != Platform::kStarnix) {
auto version = ASSERT_NO_ERRNO_AND_VALUE(GetKernelVersion());
SKIP_IF(version.major < 6 || (version.major == 6 && version.minor < 9));
}
Expand Down Expand Up @@ -199,7 +199,7 @@ TEST(EventfdTest, NotifyNonZero) {
TEST(EventfdTest, SpliceReturnsEINVAL) {
// Splicing into eventfd has been disabled in
// 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops").
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);

// Create an eventfd descriptor.
FileDescriptor efd = ASSERT_NO_ERRNO_AND_VALUE(NewEventFD(7, 0));
Expand Down
2 changes: 1 addition & 1 deletion test/syscalls/linux/exec_binary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ class ElfInterpreterStaticTest
TEST_P(ElfInterpreterStaticTest, Test) {
// TODO(gvisor.dev/issue/3721): Test has been observed to segfault on 5.X
// kernels.
if (!IsRunningOnGvisor()) {
if (GvisorPlatform() == Platform::kNative) {
auto version = ASSERT_NO_ERRNO_AND_VALUE(GetKernelVersion());
SKIP_IF(version.major > 4);
}
Expand Down
4 changes: 2 additions & 2 deletions test/syscalls/linux/iptables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void IPTablesTest::TearDown() {
// can test that gVisor has the same initial state that a newly-booted Linux
// machine would have.
TEST_F(IPTablesTest, InitialState) {
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);
SKIP_IF(!ASSERT_NO_ERRNO_AND_VALUE(HaveCapability(CAP_NET_RAW)));

//
Expand Down Expand Up @@ -424,7 +424,7 @@ TEST_F(IPTablesTest, LargeReplacePayload) {
// Tests the initial state of the raw table. The raw table has PREROUTING and
// OUTPUT hooks (no INPUT, FORWARD, or POSTROUTING).
TEST_F(IPTablesTest, RawTableInitialState) {
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);
SKIP_IF(!ASSERT_NO_ERRNO_AND_VALUE(HaveCapability(CAP_NET_RAW)));

struct ipt_getinfo info = {};
Expand Down
2 changes: 1 addition & 1 deletion test/syscalls/linux/kill.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ TEST(KillTest, CanKillAllPIDs) {
// as our namespace may contain may more processes that cannot tolerate
// the signal below. We also cannot reliably create a new pid namespace
// for ourselves and test the same functionality.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);

int pipe_fds[2];
ASSERT_THAT(pipe(pipe_fds), SyscallSucceeds());
Expand Down
2 changes: 1 addition & 1 deletion test/syscalls/linux/memory_accounting.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ TEST(MemoryAccounting, AnonAccountingPreservedOnSaveRestore) {
// the machine. In gvisor, this test is the only thing running on the
// "machine", so values in /proc/meminfo accurately reflect the memory used by
// the test.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);

uint64_t anon_initial = ASSERT_NO_ERRNO_AND_VALUE(AnonUsageFromMeminfo());

Expand Down
2 changes: 1 addition & 1 deletion test/syscalls/linux/pidfd_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ TEST(PidfdTest, PidfdGetfdNonDumpableExitingRace) {
// Skip when running natively because the host kernel may be vulnerable to
// CVE-2026-46333, which would cause the test to fail. We only want to verify
// the fix inside the gVisor sandbox.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);
AutoCapability cap(CAP_SYS_PTRACE, false);
for (int iter = 0; iter < 100; ++iter) {
int pfd[2];
Expand Down
2 changes: 1 addition & 1 deletion test/syscalls/linux/proc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ TEST(ProcSelfMaps, MapUnmap) {
TEST(ProcSelfMaps, Mprotect) {
// FIXME(jamieliu): Linux's mprotect() sometimes fails to merge VMAs in this
// case.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);

// Reserve 5 pages of address space.
Mapping m = ASSERT_NO_ERRNO_AND_VALUE(
Expand Down
2 changes: 1 addition & 1 deletion test/syscalls/linux/proc_net.cc
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ TEST(ProcSysNetIpv4IpForward, Exists) {
TEST(ProcSysNetIpv4IpForward, DefaultValueEqZero) {
// Test is only valid in sandbox. Not hermetic in native tests
// running on a arbitrary machine.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);
auto const fd = ASSERT_NO_ERRNO_AND_VALUE(Open(kIpForward, O_RDONLY));

char buf = 101;
Expand Down
2 changes: 1 addition & 1 deletion test/syscalls/linux/ptrace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2393,7 +2393,7 @@ TEST(PtraceTest, SeizeSetOptions) {

TEST(PtraceTest, SetYAMAPtraceScope) {
// Do not modify the ptrace scope on the host.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);
SKIP_IF(!ASSERT_NO_ERRNO_AND_VALUE(HaveCapability(CAP_SYS_ADMIN)));

const FileDescriptor fd = ASSERT_NO_ERRNO_AND_VALUE(
Expand Down
6 changes: 3 additions & 3 deletions test/syscalls/linux/raw_socket_icmp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ TEST_F(RawSocketICMPTest, RawAndPingSockets) {
// So we only run the test with gVisor and not hostinet, and even then require
// CAP_NET_RAW.
// See https://lwn.net/Articles/443051/
SKIP_IF(!IsRunningOnGvisor() || IsRunningWithHostinet() ||
SKIP_IF(GvisorPlatform() == Platform::kNative || IsRunningWithHostinet() ||
ASSERT_NO_ERRNO_AND_VALUE(
HaveRawIPSocketCapability(AF_INET, IPPROTO_ICMP)));

Expand Down Expand Up @@ -302,7 +302,7 @@ TEST_F(RawSocketICMPTest, ShortEchoRawAndPingSockets) {
// So we only run the test with gVisor and not hostinet, and even then require
// CAP_NET_RAW.
// See https://lwn.net/Articles/443051/
SKIP_IF(!IsRunningOnGvisor() || IsRunningWithHostinet() ||
SKIP_IF(GvisorPlatform() == Platform::kNative || IsRunningWithHostinet() ||
ASSERT_NO_ERRNO_AND_VALUE(
HaveRawIPSocketCapability(AF_INET, IPPROTO_ICMP)));

Expand Down Expand Up @@ -349,7 +349,7 @@ TEST_F(RawSocketICMPTest, ShortEchoReplyRawAndPingSockets) {
// So we only run the test with gVisor and not hostinet, and even then require
// CAP_NET_RAW.
// See https://lwn.net/Articles/443051/
SKIP_IF(!IsRunningOnGvisor() || IsRunningWithHostinet() ||
SKIP_IF(GvisorPlatform() == Platform::kNative || IsRunningWithHostinet() ||
ASSERT_NO_ERRNO_AND_VALUE(
HaveRawIPSocketCapability(AF_INET, IPPROTO_ICMP)));

Expand Down
4 changes: 2 additions & 2 deletions test/syscalls/linux/readahead.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TEST(ReadaheadTest, UnsupportedFile) {

TEST(ReadaheadTest, InvalidOffset) {
// This test is not valid for some Linux Kernels.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);
const TempPath in_file = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFile());
const FileDescriptor fd =
ASSERT_NO_ERRNO_AND_VALUE(Open(in_file.path(), O_RDWR));
Expand Down Expand Up @@ -92,7 +92,7 @@ TEST(ReadaheadTest, WriteOnly) {

TEST(ReadaheadTest, InvalidSize) {
// This test is not valid on some Linux kernels.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);
const TempPath in_file = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFile());
const FileDescriptor fd =
ASSERT_NO_ERRNO_AND_VALUE(Open(in_file.path(), O_RDWR));
Expand Down
2 changes: 1 addition & 1 deletion test/syscalls/linux/rlimits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ TEST(RlimitTest, RlimitNProc) {
// The native test can be run in a user namespace without a mapping for
// kNobody or there can be other processes that are running from the kNobody
// user.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);

// Run the test in a sub-thread to avoid changing UID of the current thread.
ScopedThread([&] {
Expand Down
4 changes: 2 additions & 2 deletions test/syscalls/linux/sendfile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ TEST(SendFileTest, SendToNotARegularFile) {

TEST(SendFileTest, SendPipeWouldBlock) {
// This test fails on Linux, likely due to a Linux bug.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);
// Create temp file.
constexpr char kData[] =
"The fool doth think he is wise, but the wise man knows himself to be a "
Expand Down Expand Up @@ -530,7 +530,7 @@ TEST(SendFileTest, SendPipeEOF) {

TEST(SendFileTest, SendToFullPipeReturnsEAGAIN) {
// This test fails on Linux, likely due to a Linux bug.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);
// Create and open an empty input file.
const TempPath in_file = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFile());
const FileDescriptor in_fd =
Expand Down
2 changes: 1 addition & 1 deletion test/syscalls/linux/shm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ TEST(ShmTest, ShmStat) {
// This test relies on the segment we create to be the first one on the
// system, causing it to occupy slot 1. We can't reasonably expect this on a
// general Linux host.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);

const ShmSegment shm = ASSERT_NO_ERRNO_AND_VALUE(
Shmget(IPC_PRIVATE, kAllocSize, IPC_CREAT | 0777));
Expand Down
2 changes: 1 addition & 1 deletion test/syscalls/linux/socket_generic_test_cases.cc
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ TEST_P(AllSocketPairTest, RecvmmsgInvalidTimeout) {
TEST_P(AllSocketPairTest, RecvmmsgTimeoutBeforeRecv) {
// There is a known bug in the Linux recvmmsg(2) causing it to block forever
// if the timeout expires while blocking for the first message.
SKIP_IF(!IsRunningOnGvisor() || IsRunningWithHostinet());
SKIP_IF(GvisorPlatform() == Platform::kNative || IsRunningWithHostinet());

auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair());
char buf[10];
Expand Down
2 changes: 1 addition & 1 deletion test/syscalls/linux/socket_ip_unbound.cc
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ TEST_P(IPUnboundSocketTest, InvalidLargeTOS) {

TEST_P(IPUnboundSocketTest, CheckSkipECN) {
// Test is inconsistent on different kernels.
SKIP_IF(!IsRunningOnGvisor() || IsRunningWithHostinet());
SKIP_IF(GvisorPlatform() == Platform::kNative || IsRunningWithHostinet());
auto socket = ASSERT_NO_ERRNO_AND_VALUE(NewSocket());
int set = 0xFF;
socklen_t set_sz = sizeof(set);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void IPv4DatagramBasedUnboundSocketTest::SetUp() {
// privs. So we only run the test with gVisor and not hostinet, and even
// then require CAP_NET_RAW.
// See https://lwn.net/Articles/443051/
SKIP_IF(!IsRunningOnGvisor() || IsRunningWithHostinet() ||
SKIP_IF(GvisorPlatform() == Platform::kNative || IsRunningWithHostinet() ||
ASSERT_NO_ERRNO_AND_VALUE(HaveRawIPSocketCapability(
GetParam().domain, GetParam().protocol)));
}
Expand Down Expand Up @@ -277,7 +277,7 @@ TEST_P(IPv4DatagramBasedUnboundSocketTest, IpMulticastIfSetNic) {

TEST_P(IPv4DatagramBasedUnboundSocketTest, TestJoinGroupNoIf) {
// TODO(b/185517803): Fix for native test.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);
auto socket1 = ASSERT_NO_ERRNO_AND_VALUE(NewSocket());
auto socket2 = ASSERT_NO_ERRNO_AND_VALUE(NewSocket());

Expand Down
4 changes: 2 additions & 2 deletions test/syscalls/linux/socket_ipv4_udp_unbound.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ TEST_P(IPv4UDPUnboundSocketTest, IpMulticastLoopbackNoGroup) {
// from being sent. Group membership interface configured by address.
TEST_P(IPv4UDPUnboundSocketTest, IpMulticastLoopbackAddrNoDefaultSendIf) {
// TODO(b/185517803): Fix for native test.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);
auto socket1 = ASSERT_NO_ERRNO_AND_VALUE(NewSocket());
auto socket2 = ASSERT_NO_ERRNO_AND_VALUE(NewSocket());

Expand Down Expand Up @@ -133,7 +133,7 @@ TEST_P(IPv4UDPUnboundSocketTest, IpMulticastLoopbackAddrNoDefaultSendIf) {
// from being sent. Group membership interface configured by NIC ID.
TEST_P(IPv4UDPUnboundSocketTest, IpMulticastLoopbackNicNoDefaultSendIf) {
// TODO(b/185517803): Fix for native test.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);
auto socket1 = ASSERT_NO_ERRNO_AND_VALUE(NewSocket());
auto socket2 = ASSERT_NO_ERRNO_AND_VALUE(NewSocket());

Expand Down
2 changes: 1 addition & 1 deletion test/syscalls/linux/socket_netlink_netfilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,7 @@ TEST(NetlinkNetfilterTest, ErrNewBaseChainWithMalformedHookDataMissingHookNum) {
TEST(NetlinkNetfilterTest, ErrNewBaseChainWithInvalidChainType) {
SKIP_IF(!ASSERT_NO_ERRNO_AND_VALUE(HaveCaps()));
// TODO: b/421437663 - Fix this error test for native Linux.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);
std::string test_table_name = GetUniqueTestTableName();
const char test_chain_name[] = "test_chain_bad_policy";
const char test_chain_type_name[] = "test_chain_type_invalid";
Expand Down
4 changes: 2 additions & 2 deletions test/syscalls/linux/socket_netlink_route.cc
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ TEST_P(NetlinkSetLinkTest, ChangeLinkName) {
SKIP_IF(IsRunningWithHostinet());
// Hosts that run with old kernel allow renaming only when
// the interface is down. The restriction has been removed.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);
Link loopback_link = ASSERT_NO_ERRNO_AND_VALUE(LoopbackLink());

FileDescriptor fd =
Expand Down Expand Up @@ -459,7 +459,7 @@ TEST_P(NetlinkSetLinkTest, ChangeMTU) {

TEST_P(NetlinkSetLinkTest, ChangeMACAddress) {
SKIP_IF(!ASSERT_NO_ERRNO_AND_VALUE(HaveCapability(CAP_NET_ADMIN)));
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);
SKIP_IF(IsRunningWithHostinet());
Link loopback_link = ASSERT_NO_ERRNO_AND_VALUE(LoopbackLink());

Expand Down
2 changes: 1 addition & 1 deletion test/syscalls/linux/statfs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ TEST(FstatfsTest, InternalDevShm) {
TEST(FstatfsTest, BlocksFree) {
// This test relies on the test being the only user of the filesystem, which
// is not feasible outside of a sandbox.
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);

const std::string file_path = NewTempAbsPath();
const std::string dir = std::string(Dirname(file_path));
Expand Down
2 changes: 1 addition & 1 deletion test/syscalls/linux/timerfd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ TEST(TimerfdClockRealtimeTest, ClockAbsoluteRealtime) {
TEST(TimerfdClockRealtimeTest, ClockAbsoluteRealtimeCancelOnSet) {
// Skip on native Linux since we can't guarantee there
// will be no clock jumps causing ECANCELED
SKIP_IF(!IsRunningOnGvisor());
SKIP_IF(GvisorPlatform() == Platform::kNative);

constexpr int kDelaySecs = 1;

Expand Down
Loading