diff options
author | morozyto <morozyto@yandex-team.ru> | 2022-02-10 16:49:48 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:48 +0300 |
commit | 7a7321022af5e93d07031ccb460d313e4f18d04e (patch) | |
tree | ef13bca2817079136b98297da1e27c5f840f248c /util/system/shellcommand_ut.cpp | |
parent | 79b3cf0f1d6edfa0268153eddcb48f3467527461 (diff) | |
download | ydb-7a7321022af5e93d07031ccb460d313e4f18d04e.tar.gz |
Restoring authorship annotation for <morozyto@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system/shellcommand_ut.cpp')
-rw-r--r-- | util/system/shellcommand_ut.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/util/system/shellcommand_ut.cpp b/util/system/shellcommand_ut.cpp index 9d849279d2..88caf51d45 100644 --- a/util/system/shellcommand_ut.cpp +++ b/util/system/shellcommand_ut.cpp @@ -436,35 +436,35 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) { UNIT_ASSERT_VALUES_EQUAL(cmd.GetOutput(), "hello" NL); UNIT_ASSERT_VALUES_EQUAL(cmd.GetError().size(), 0u); } - Y_UNIT_TEST(TestPipeOutput) { - TShellCommandOptions options; - options.SetAsync(true); - options.PipeOutput(); - constexpr TStringBuf firstMessage = "first message"; - constexpr TStringBuf secondMessage = "second message"; - const TString command = TStringBuilder() << "echo '" << firstMessage << "' && sleep 10 && echo '" << secondMessage << "'"; - TShellCommand cmd(command, options); - cmd.Run(); - TUnbufferedFileInput cmdOutput(TFile(cmd.GetOutputHandle().Release())); - TString firstLineOutput, secondLineOutput; - { - Sleep(TDuration::Seconds(5)); - firstLineOutput = cmdOutput.ReadLine(); - cmd.Wait(); - secondLineOutput = cmdOutput.ReadLine(); - } - UNIT_ASSERT_VALUES_EQUAL(firstLineOutput, firstMessage); - UNIT_ASSERT_VALUES_EQUAL(secondLineOutput, secondLineOutput); - } - Y_UNIT_TEST(TestOptionsConsistency) { - TShellCommandOptions options; - - options.SetInheritOutput(false).SetInheritError(false); - options.SetOutputStream(nullptr).SetErrorStream(nullptr); - - UNIT_ASSERT(options.OutputMode == TShellCommandOptions::HANDLE_STREAM); - UNIT_ASSERT(options.ErrorMode == TShellCommandOptions::HANDLE_STREAM); - } + Y_UNIT_TEST(TestPipeOutput) { + TShellCommandOptions options; + options.SetAsync(true); + options.PipeOutput(); + constexpr TStringBuf firstMessage = "first message"; + constexpr TStringBuf secondMessage = "second message"; + const TString command = TStringBuilder() << "echo '" << firstMessage << "' && sleep 10 && echo '" << secondMessage << "'"; + TShellCommand cmd(command, options); + cmd.Run(); + TUnbufferedFileInput cmdOutput(TFile(cmd.GetOutputHandle().Release())); + TString firstLineOutput, secondLineOutput; + { + Sleep(TDuration::Seconds(5)); + firstLineOutput = cmdOutput.ReadLine(); + cmd.Wait(); + secondLineOutput = cmdOutput.ReadLine(); + } + UNIT_ASSERT_VALUES_EQUAL(firstLineOutput, firstMessage); + UNIT_ASSERT_VALUES_EQUAL(secondLineOutput, secondLineOutput); + } + Y_UNIT_TEST(TestOptionsConsistency) { + TShellCommandOptions options; + + options.SetInheritOutput(false).SetInheritError(false); + options.SetOutputStream(nullptr).SetErrorStream(nullptr); + + UNIT_ASSERT(options.OutputMode == TShellCommandOptions::HANDLE_STREAM); + UNIT_ASSERT(options.ErrorMode == TShellCommandOptions::HANDLE_STREAM); + } Y_UNIT_TEST(TestForkCallback) { TString tmpFile = TString("shellcommand_ut.test_for_callback.txt"); TFsPath cwd(::NFs::CurrentWorkingDirectory()); |