mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Fix order-dependent test.
PiperOrigin-RevId: 363639702 Change-Id: I39f7ca1b4a2c65fe027bcc6ed71b10c2dcf46ca0
This commit is contained in:
parent
03bf9f72c0
commit
df840ae38f
|
@ -160,14 +160,21 @@ static size_t FileCountInDirectory(const std::string& path) {
|
||||||
|
|
||||||
TEST(StackTraceTest, ForkEnterNsLibunwindDoesNotLeakFDs) {
|
TEST(StackTraceTest, ForkEnterNsLibunwindDoesNotLeakFDs) {
|
||||||
SKIP_SANITIZERS_AND_COVERAGE;
|
SKIP_SANITIZERS_AND_COVERAGE;
|
||||||
|
TemporaryFlagOverride<bool> temp_override(
|
||||||
|
&FLAGS_sandbox_libunwind_crash_handler, true);
|
||||||
|
|
||||||
|
// Very first sanitization might create some fds (e.g. for initial
|
||||||
|
// namespaces).
|
||||||
|
SymbolizationWorksCommon([](PolicyBuilder* builder) {
|
||||||
|
builder->AddFile("/sys/devices/system/cpu/online");
|
||||||
|
});
|
||||||
|
|
||||||
// Get list of open FDs in the global forkserver.
|
// Get list of open FDs in the global forkserver.
|
||||||
pid_t forkserver_pid = GlobalForkClient::GetPid();
|
pid_t forkserver_pid = GlobalForkClient::GetPid();
|
||||||
std::string forkserver_fd_path =
|
std::string forkserver_fd_path =
|
||||||
absl::StrCat("/proc/", forkserver_pid, "/fd");
|
absl::StrCat("/proc/", forkserver_pid, "/fd");
|
||||||
size_t filecount_before = FileCountInDirectory(forkserver_fd_path);
|
size_t filecount_before = FileCountInDirectory(forkserver_fd_path);
|
||||||
|
|
||||||
TemporaryFlagOverride<bool> temp_override(
|
|
||||||
&FLAGS_sandbox_libunwind_crash_handler, true);
|
|
||||||
SymbolizationWorksCommon([](PolicyBuilder* builder) {
|
SymbolizationWorksCommon([](PolicyBuilder* builder) {
|
||||||
builder->AddFile("/sys/devices/system/cpu/online");
|
builder->AddFile("/sys/devices/system/cpu/online");
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user