-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use subprocess rather than custom code
Signed-off-by: Michael Carroll <[email protected]>
- Loading branch information
Showing
23 changed files
with
258 additions
and
737 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
configure_file (test_config.hh.in | ||
${PROJECT_BINARY_DIR}/include/log/test_config.hh | ||
) | ||
|
||
add_subdirectory(integration) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright (C) 2018 Open Source Robotics Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
#include "ChirpParams.hh" | ||
|
||
|
||
static constexpr const char* kTopicChirpExe = TOPIC_CHIRP_EXE; | ||
|
||
namespace gz::transport::log::test | ||
{ | ||
////////////////////////////////////////////////// | ||
/// \brief Similar to testing::forkAndRun(), except this function | ||
/// specifically calls the INTEGRATION_topicChirp_aux process and passes | ||
/// it arguments to determine how it should chirp out messages over its | ||
/// topics. | ||
/// \param _topics A list of topic names to chirp on | ||
/// \param _chirps The number of messages to chirp out. Each message | ||
/// will count up starting from the value 1 and ending with the value | ||
/// _chirps. | ||
/// \return A handle to the process. This can be used with | ||
/// testing::waitAndCleanupFork(). | ||
gz::utils::Subprocess BeginChirps( | ||
const std::vector<std::string> &_topics, | ||
const int _chirps, | ||
const std::string &_partitionName) | ||
{ | ||
// Argument list: | ||
// [0]: Executable name | ||
// [1]: Partition name | ||
// [2]: Number of chirps | ||
// [3]-[N]: Each topic name | ||
// [N+1]: Null terminator, required by execv | ||
const std::size_t numArgs = 3 + _topics.size() + 1; | ||
|
||
std::vector<std::string> strArgs; | ||
strArgs.reserve(numArgs-1); | ||
strArgs.push_back(kTopicChirpExe); | ||
strArgs.push_back(_partitionName); | ||
strArgs.push_back(std::to_string(_chirps)); | ||
strArgs.insert(strArgs.end(), _topics.begin(), _topics.end()); | ||
return gz::utils::Subprocess(strArgs); | ||
} | ||
} // namespace gz::transport::log::test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.