MCPcopy Create free account
hub / github.com/apache/impala / TEST_F

Function TEST_F

be/src/kudu/util/subprocess-test.cc:60–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58class SubprocessTest : public KuduTest {};
59
60TEST_F(SubprocessTest, TestSimplePipe) {
61 Subprocess p({ "/usr/bin/tr", "a-z", "A-Z" });
62 p.ShareParentStdout(false);
63 ASSERT_OK(p.Start());
64
65 FILE* out = fdopen(p.ReleaseChildStdinFd(), "w");
66 PCHECK(out);
67 FILE* in = fdopen(p.from_child_stdout_fd(), "r");
68 PCHECK(in);
69
70 fprintf(out, "hello world\n");
71 // We have to close 'out' or else tr won't write any output, since
72 // it enters a buffered mode if it detects that its input is a FIFO.
73 int err;
74 RETRY_ON_EINTR(err, fclose(out));
75
76 char buf[1024];
77 ASSERT_EQ(buf, fgets(buf, sizeof(buf), in));
78 ASSERT_STREQ("HELLO WORLD\n", &buf[0]);
79
80 int wait_status = 0;
81 ASSERT_OK(p.Wait(&wait_status));
82 ASSERT_TRUE(WIFEXITED(wait_status));
83 ASSERT_EQ(0, WEXITSTATUS(wait_status));
84}
85
86TEST_F(SubprocessTest, TestErrPipe) {
87 Subprocess p({ "/usr/bin/tee", "/dev/stderr" });

Callers

nothing calls this directly

Calls 15

JoinPathSegmentsFunction · 0.85
DefaultClass · 0.85
SubstituteFunction · 0.85
AssertEventuallyFunction · 0.85
SleepForFunction · 0.85
ShareParentStdoutMethod · 0.80
ReleaseChildStdinFdMethod · 0.80
from_child_stdout_fdMethod · 0.80
ShareParentStderrMethod · 0.80
from_child_stderr_fdMethod · 0.80
KillMethod · 0.80
SetEnvVarsMethod · 0.80

Tested by

no test coverage detected