Lines Matching refs:process_
110 process_.RedirectOutput(output_file_); in SetUp()
124 ProcessImpl process_; member in brillo::ProcessTest
131 process_.AddArg(kBinEcho); in TEST_F()
132 process_.AddArg("hello world"); in TEST_F()
133 EXPECT_EQ(0, process_.Run()); in TEST_F()
139 process_.AddArg(kBinEcho); in TEST_F()
140 process_.AddStringOption("--hello", "world"); in TEST_F()
141 EXPECT_EQ(0, process_.Run()); in TEST_F()
146 process_.AddArg(kBinEcho); in TEST_F()
147 process_.AddIntOption("--answer", 42); in TEST_F()
148 EXPECT_EQ(0, process_.Run()); in TEST_F()
153 process_.AddArg(kBinFalse); in TEST_F()
154 EXPECT_EQ(1, process_.Run()); in TEST_F()
160 process_.AddArg(kBinCat); in TEST_F()
161 process_.RedirectInput("/dev/null"); in TEST_F()
162 EXPECT_EQ(0, process_.Run()); in TEST_F()
166 process_.AddArg(kBinCat); in TEST_F()
167 process_.RedirectInput("/bad/path"); in TEST_F()
168 EXPECT_EQ(static_cast<pid_t>(Process::kErrorExitStatus), process_.Run()); in TEST_F()
172 process_.AddArg(kBinEcho); in TEST_F()
173 process_.RedirectOutput("/bad/path"); in TEST_F()
174 EXPECT_EQ(static_cast<pid_t>(Process::kErrorExitStatus), process_.Run()); in TEST_F()
178 process_.AddArg("false"); in TEST_F()
179 EXPECT_EQ(static_cast<pid_t>(Process::kErrorExitStatus), process_.Run()); in TEST_F()
183 process_.AddArg(kBinSh); in CheckStderrCaptured()
184 process_.AddArg("-c"); in CheckStderrCaptured()
185 process_.AddArg("echo errormessage 1>&2 && exit 1"); in CheckStderrCaptured()
186 EXPECT_EQ(1, process_.Run()); in CheckStderrCaptured()
209 process_.RedirectOutput(""); in TEST_F()
210 process_.AddArg(kBinSh); in TEST_F()
211 process_.AddArg("-c"); in TEST_F()
212 process_.AddArg("echo errormessage >&2 && exit 1"); in TEST_F()
213 process_.RedirectUsingPipe(STDERR_FILENO, false); in TEST_F()
214 EXPECT_EQ(-1, process_.GetPipe(STDERR_FILENO)); in TEST_F()
215 EXPECT_EQ(1, process_.Run()); in TEST_F()
216 int pipe_fd = process_.GetPipe(STDERR_FILENO); in TEST_F()
218 EXPECT_EQ(-1, process_.GetPipe(STDOUT_FILENO)); in TEST_F()
219 EXPECT_EQ(-1, process_.GetPipe(STDIN_FILENO)); in TEST_F()
229 process_.RedirectOutput(""); in TEST_F()
230 process_.AddArg(kBinSh); in TEST_F()
231 process_.AddArg("-c"); in TEST_F()
232 process_.AddArg("echo errormessage >&2 && exit 1"); in TEST_F()
233 process_.RedirectUsingPipe(STDERR_FILENO, false); in TEST_F()
234 EXPECT_EQ(1, process_.Run()); in TEST_F()
235 int pipe_fd = process_.GetPipe(STDERR_FILENO); in TEST_F()
237 EXPECT_EQ(-1, process_.GetPipe(STDOUT_FILENO)); in TEST_F()
238 EXPECT_EQ(-1, process_.GetPipe(STDIN_FILENO)); in TEST_F()
247 process_.RedirectOutput(""); in TEST_F()
248 process_.AddArg(kBinEcho); in TEST_F()
249 process_.AddArg("hello world\n"); in TEST_F()
250 process_.RedirectUsingPipe(STDOUT_FILENO, false); in TEST_F()
251 EXPECT_EQ(-1, process_.GetPipe(STDOUT_FILENO)); in TEST_F()
252 EXPECT_EQ(0, process_.Run()); in TEST_F()
253 int pipe_fd = process_.GetPipe(STDOUT_FILENO); in TEST_F()
255 EXPECT_EQ(-1, process_.GetPipe(STDERR_FILENO)); in TEST_F()
256 EXPECT_EQ(-1, process_.GetPipe(STDIN_FILENO)); in TEST_F()
265 process_.AddArg(kBinCat); in TEST_F()
266 process_.RedirectUsingPipe(STDIN_FILENO, true); in TEST_F()
267 process_.RedirectOutput(output_file_); in TEST_F()
268 EXPECT_TRUE(process_.Start()); in TEST_F()
269 int write_fd = process_.GetPipe(STDIN_FILENO); in TEST_F()
270 EXPECT_EQ(-1, process_.GetPipe(STDERR_FILENO)); in TEST_F()
273 EXPECT_EQ(0, process_.Wait()); in TEST_F()
279 process_.AddArg(kBinEcho); in TEST_F()
280 process_.SetUid(uid); in TEST_F()
281 EXPECT_EQ(0, process_.Run()); in TEST_F()
286 process_.AddArg(kBinEcho); in TEST_F()
287 process_.SetGid(gid); in TEST_F()
288 EXPECT_EQ(0, process_.Run()); in TEST_F()
293 process_.AddArg(kBinEcho); in TEST_F()
294 process_.SetUid(0); in TEST_F()
295 EXPECT_EQ(static_cast<pid_t>(Process::kErrorExitStatus), process_.Run()); in TEST_F()
303 process_.AddArg(kBinEcho); in TEST_F()
304 process_.SetGid(0); in TEST_F()
305 EXPECT_EQ(static_cast<pid_t>(Process::kErrorExitStatus), process_.Run()); in TEST_F()
312 EXPECT_EQ(-1, process_.Run()); in TEST_F()
317 process_.AddArg(kBinSh); in TEST_F()
318 process_.AddArg("-c"); in TEST_F()
319 process_.AddArg("kill -SEGV $$"); in TEST_F()
320 EXPECT_EQ(-1, process_.Run()); in TEST_F()
326 process_.AddArg(kBinSh); in TEST_F()
327 process_.AddArg("-c"); in TEST_F()
328 process_.AddArg("kill -KILL $$"); in TEST_F()
329 EXPECT_EQ(-1, process_.Run()); in TEST_F()
335 process_.Kill(SIGTERM, 0); in TEST_F()
347 EXPECT_FALSE(process_.ResetPidByFile(pid_path.value())); in TEST_F()
349 EXPECT_TRUE(process_.ResetPidByFile(pid_path.value())); in TEST_F()
350 EXPECT_EQ(456, process_.pid()); in TEST_F()
355 process_.UpdatePid(0); in TEST_F()
359 process_.AddArg(kBinSleep); in TEST_F()
360 process_.AddArg("10000"); in TEST_F()
361 ASSERT_TRUE(process_.Start()); in TEST_F()
362 pid_t pid = process_.pid(); in TEST_F()
364 EXPECT_TRUE(process_.Kill(SIGTERM, 1)); in TEST_F()
365 EXPECT_EQ(0, process_.pid()); in TEST_F()
369 process_.AddArg(kBinFalse); in TEST_F()
370 process_.Reset(0); in TEST_F()
371 process_.AddArg(kBinEcho); in TEST_F()
372 EXPECT_EQ(0, process_.Run()); in TEST_F()
378 process_.AddArg(kBinTrue); in TEST_F()
379 process_.SetPreExecCallback(base::Bind(&ReturnFalse)); in TEST_F()
380 ASSERT_NE(0, process_.Run()); in TEST_F()
385 process_.AddArg(kBinStat); in TEST_F()
386 process_.AddArg(GetFdPath(pipe.reader).value()); in TEST_F()
387 process_.AddArg(GetFdPath(pipe.writer).value()); in TEST_F()
388 process_.SetCloseUnusedFileDescriptors(false); in TEST_F()
389 EXPECT_EQ(0, process_.Run()); in TEST_F()
394 process_.AddArg(kBinStat); in TEST_F()
395 process_.AddArg(GetFdPath(pipe.reader).value()); in TEST_F()
396 process_.AddArg(GetFdPath(pipe.writer).value()); in TEST_F()
397 process_.SetCloseUnusedFileDescriptors(true); in TEST_F()
400 EXPECT_EQ(1, process_.Run()); in TEST_F()