mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Copy environ in sandbox2_test to get better coverage data
PiperOrigin-RevId: 518544187 Change-Id: Id13a5503060817e1dead7ee4a5e310d322de3a5e
This commit is contained in:
parent
99931c2ad6
commit
8a38e4de47
|
@ -58,8 +58,9 @@ class Executor final {
|
|||
|
||||
// Executor will own this file-descriptor, so if intend to use it, pass here
|
||||
// dup(fd) instead
|
||||
Executor(int exec_fd, absl::Span<const std::string> argv,
|
||||
absl::Span<const std::string> envp)
|
||||
Executor(
|
||||
int exec_fd, absl::Span<const std::string> argv,
|
||||
absl::Span<const std::string> envp = absl::MakeConstSpan(CopyEnviron()))
|
||||
: exec_fd_(exec_fd),
|
||||
argv_(argv.begin(), argv.end()),
|
||||
envp_(envp.begin(), envp.end()) {
|
||||
|
|
|
@ -105,8 +105,7 @@ TEST(ExecutorTest, ExecutorFdConstructor) {
|
|||
ASSERT_NE(fd, -1);
|
||||
|
||||
std::vector<std::string> args = {absl::StrCat("FD:", fd)};
|
||||
std::vector<std::string> envs;
|
||||
auto executor = std::make_unique<Executor>(fd, args, envs);
|
||||
auto executor = std::make_unique<Executor>(fd, args);
|
||||
|
||||
SAPI_ASSERT_OK_AND_ASSIGN(auto policy,
|
||||
CreateDefaultPermissiveTestPolicy(path).TryBuild());
|
||||
|
@ -122,8 +121,7 @@ TEST_P(Sandbox2Test, SandboxeeExternalKill) {
|
|||
const std::string path = GetTestSourcePath("sandbox2/testcases/sleep");
|
||||
|
||||
std::vector<std::string> args = {path};
|
||||
std::vector<std::string> envs;
|
||||
auto executor = std::make_unique<Executor>(path, args, envs);
|
||||
auto executor = std::make_unique<Executor>(path, args);
|
||||
|
||||
SAPI_ASSERT_OK_AND_ASSIGN(auto policy,
|
||||
CreateDefaultTestPolicy(path).TryBuild());
|
||||
|
@ -142,8 +140,7 @@ TEST_P(Sandbox2Test, SandboxeeTimeoutDisabledStacktraces) {
|
|||
const std::string path = GetTestSourcePath("sandbox2/testcases/sleep");
|
||||
|
||||
std::vector<std::string> args = {path};
|
||||
std::vector<std::string> envs;
|
||||
auto executor = std::make_unique<Executor>(path, args, envs);
|
||||
auto executor = std::make_unique<Executor>(path, args);
|
||||
|
||||
SAPI_ASSERT_OK_AND_ASSIGN(auto policy, CreateDefaultTestPolicy(path)
|
||||
.CollectStacktracesOnTimeout(false)
|
||||
|
@ -162,8 +159,7 @@ TEST(Sandbox2Test, SandboxeeViolationDisabledStacktraces) {
|
|||
const std::string path = GetTestSourcePath("sandbox2/testcases/sleep");
|
||||
|
||||
std::vector<std::string> args = {path};
|
||||
std::vector<std::string> envs;
|
||||
auto executor = std::make_unique<Executor>(path, args, envs);
|
||||
auto executor = std::make_unique<Executor>(path, args);
|
||||
|
||||
SAPI_ASSERT_OK_AND_ASSIGN(
|
||||
auto policy, PolicyBuilder()
|
||||
|
@ -196,8 +192,7 @@ TEST(StarvationTest, MonitorIsNotStarvedByTheSandboxee) {
|
|||
const std::string path = GetTestSourcePath("sandbox2/testcases/starve");
|
||||
|
||||
std::vector<std::string> args = {path};
|
||||
std::vector<std::string> envs;
|
||||
auto executor = std::make_unique<Executor>(path, args, envs);
|
||||
auto executor = std::make_unique<Executor>(path, args);
|
||||
executor->limits()->set_walltime_limit(absl::Seconds(5));
|
||||
|
||||
SAPI_ASSERT_OK_AND_ASSIGN(auto policy,
|
||||
|
|
Loading…
Reference in New Issue
Block a user