aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/shellcommand_ut.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/system/shellcommand_ut.cpp
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system/shellcommand_ut.cpp')
-rw-r--r--util/system/shellcommand_ut.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/util/system/shellcommand_ut.cpp b/util/system/shellcommand_ut.cpp
index 9d849279d2..8e5af4c7d4 100644
--- a/util/system/shellcommand_ut.cpp
+++ b/util/system/shellcommand_ut.cpp
@@ -1,9 +1,9 @@
-#include "shellcommand.h"
+#include "shellcommand.h"
#include "compat.h"
-#include "defaults.h"
+#include "defaults.h"
#include "fs.h"
-#include "sigset.h"
+#include "sigset.h"
#include "spinlock.h"
#include <library/cpp/testing/unittest/env.h>
@@ -18,13 +18,13 @@
#include <util/folder/tempdir.h>
#if defined(_win_)
- #define NL "\r\n"
-const char catCommand[] = "sort"; // not really cat but ok
-const size_t textSize = 1;
+ #define NL "\r\n"
+const char catCommand[] = "sort"; // not really cat but ok
+const size_t textSize = 1;
#else
- #define NL "\n"
-const char catCommand[] = "/bin/cat";
-const size_t textSize = 20000;
+ #define NL "\n"
+const char catCommand[] = "/bin/cat";
+const size_t textSize = 20000;
#endif
class TGuardedStringStream: public IInputStream, public IOutputStream {
@@ -88,8 +88,8 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
TShellCommandOptions options;
options.SetQuoteArguments(true);
TShellCommand cmd("echo");
- cmd << "hey"
- << "hello&world";
+ cmd << "hey"
+ << "hello&world";
cmd.Run();
UNIT_ASSERT_VALUES_EQUAL(cmd.GetError(), "");
UNIT_ASSERT_VALUES_EQUAL(cmd.GetOutput(), "hey hello&world" NL);
@@ -125,8 +125,8 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
{
options.SetUseShell(false);
TShellCommand cmd(dir, options);
- cmd << "|"
- << "sort";
+ cmd << "|"
+ << "sort";
cmd.Run();
UNIT_ASSERT(TShellCommand::SHELL_ERROR == cmd.GetStatus());
@@ -135,8 +135,8 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
{
options.SetUseShell(true);
TShellCommand cmd(dir, options);
- cmd << "|"
- << "sort";
+ cmd << "|"
+ << "sort";
cmd.Run();
UNIT_ASSERT(TShellCommand::SHELL_FINISHED == cmd.GetStatus());
UNIT_ASSERT_VALUES_EQUAL(cmd.GetError().size(), 0u);
@@ -304,7 +304,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
options.SetQuoteArguments(false);
{
TShellCommand cmd("/bin/sleep", options);
- cmd << " 1300 & wait; /usr/bin/touch " << tmpfile;
+ cmd << " 1300 & wait; /usr/bin/touch " << tmpfile;
cmd.Run();
sleep(1);
UNIT_ASSERT(TShellCommand::SHELL_RUNNING == cmd.GetStatus());
@@ -337,13 +337,13 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
{
TShellCommand cmd("/bin/sleep", options);
// touch file only if sleep not interrupted by SIGTERM
- cmd << " 10 & wait; [ $? == 0 ] || /usr/bin/touch " << tmpfile;
+ cmd << " 10 & wait; [ $? == 0 ] || /usr/bin/touch " << tmpfile;
cmd.Run();
sleep(1);
UNIT_ASSERT(TShellCommand::SHELL_RUNNING == cmd.GetStatus());
cmd.Terminate();
cmd.Wait();
- UNIT_ASSERT(TShellCommand::SHELL_ERROR == cmd.GetStatus() || TShellCommand::SHELL_FINISHED == cmd.GetStatus());
+ UNIT_ASSERT(TShellCommand::SHELL_ERROR == cmd.GetStatus() || TShellCommand::SHELL_FINISHED == cmd.GetStatus());
}
sleep(1);
UNIT_ASSERT(!NFs::Exists(tmpfile));
@@ -353,7 +353,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
{
TShellCommand cmd("/bin/sleep", options);
// touch file regardless -- it will be interrupted
- cmd << " 10 & wait; /usr/bin/touch " << tmpfile;
+ cmd << " 10 & wait; /usr/bin/touch " << tmpfile;
cmd.Run();
sleep(1);
UNIT_ASSERT(TShellCommand::SHELL_RUNNING == cmd.GetStatus());