mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Make the fd cleanup test less brittle
PiperOrigin-RevId: 398229418 Change-Id: If8af43f33b07839ea8d46b85ff77efa8557a31a8
This commit is contained in:
parent
b5fb483b11
commit
b470a6ece5
|
@ -173,12 +173,14 @@ TEST(SandboxTest, RestartSandboxFD) {
|
|||
|
||||
auto test_body = [](sapi::Sandbox* sandbox) -> absl::Status {
|
||||
// Open some FDs and check their value.
|
||||
EXPECT_THAT(LeakFileDescriptor(sandbox, "/proc/self/exe"), Eq(3));
|
||||
EXPECT_THAT(LeakFileDescriptor(sandbox, "/proc/self/exe"), Eq(4));
|
||||
int first_remote_fd = LeakFileDescriptor(sandbox, "/proc/self/exe");
|
||||
EXPECT_THAT(LeakFileDescriptor(sandbox, "/proc/self/exe"),
|
||||
Eq(first_remote_fd + 1));
|
||||
SAPI_RETURN_IF_ERROR(sandbox->Restart(false));
|
||||
// We should have a fresh sandbox now = FDs open previously should be
|
||||
// closed now.
|
||||
EXPECT_THAT(LeakFileDescriptor(sandbox, "/proc/self/exe"), Eq(3));
|
||||
EXPECT_THAT(LeakFileDescriptor(sandbox, "/proc/self/exe"),
|
||||
Eq(first_remote_fd));
|
||||
return absl::OkStatus();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user