18 #include <gtest/gtest.h>
24 namespace fs = std::filesystem;
41 truncate(
m_source.c_str(), 4 * 1024);
43 fd = mkstemp(
m_dest.data());
67 std::stringstream stderr;
69 unsigned num_progresses = 0;
71 proc.ConnectStderr([&](pid_t, std::string
const& line) { stderr << line; });
74 proc.Initiate().then(m_exec, [&](boost::future<int> exit_code) {
76 EXPECT_FALSE(proc.IsRunning());
77 auto code = exit_code.get();
78 EXPECT_EQ(code, 0) <<
"Unexpected exit code for SIGTERM, rsync: " << stderr.str();
81 EXPECT_TRUE(proc.IsRunning());
86 <<
"Expected continuation to have been executed as io_context::run has exited";
88 EXPECT_EQ(4 * 1024, fs::file_size(m_dest));
89 EXPECT_GT(num_progresses, 0) <<
"There should have been at least one progress report..";
boost::asio::io_context m_ctx
void SetUp() override
Creates a temporary file source (m_source) and destination (m_dest) that can be used by test cases.
void TearDown() override
Delete temp files.
Represents an rsync process as an asynchronous operation.
Adapts boost::asio::io_context into a compatible boost::thread Executor type.
TEST_F(RsyncAsyncProcessTest, Copy)
std::optional< bool > whole_file
Transfer with/without delta xfer algorithm.
std::optional< unsigned > bw_limit
Enables rate-limiting in kb/s.
Options controlling rsync invocation.
Describes file transfer progress,.
daq::RsyncAsyncProcess and related class declarations.
EXPECT_EQ(meta.rr_uri, "zpb.rr://meta")