diff --git a/rosbag2_cpp/test/rosbag2_cpp/test_sequential_writer.cpp b/rosbag2_cpp/test/rosbag2_cpp/test_sequential_writer.cpp index 88a2beebb6..2553b4b135 100644 --- a/rosbag2_cpp/test/rosbag2_cpp/test_sequential_writer.cpp +++ b/rosbag2_cpp/test/rosbag2_cpp/test_sequential_writer.cpp @@ -48,7 +48,7 @@ class SequentialWriterTest : public Test storage_options_.uri = "uri"; rcpputils::fs::path dir(storage_options_.uri); - rcpputils::fs::remove(dir); + rcpputils::fs::remove_all(dir); ON_CALL(*storage_factory_, open_read_write(_, _)).WillByDefault( DoAll( @@ -65,7 +65,7 @@ class SequentialWriterTest : public Test ~SequentialWriterTest() { rcpputils::fs::path dir(storage_options_.uri); - rcpputils::fs::remove(dir); + rcpputils::fs::remove_all(dir); } std::unique_ptr> storage_factory_; diff --git a/rosbag2_tests/test/rosbag2_tests/test_rosbag2_record_end_to_end.cpp b/rosbag2_tests/test/rosbag2_tests/test_rosbag2_record_end_to_end.cpp index 05a317a464..aa3f18ae2e 100644 --- a/rosbag2_tests/test/rosbag2_tests/test_rosbag2_record_end_to_end.cpp +++ b/rosbag2_tests/test/rosbag2_tests/test_rosbag2_record_end_to_end.cpp @@ -559,7 +559,7 @@ TEST_F(RecordFixture, record_fails_gracefully_if_bag_already_exists) { TEST_F(RecordFixture, record_fails_if_both_all_and_topic_list_is_specified) { internal::CaptureStderr(); auto exit_code = - WEXITSTATUS(std::system("ros2 bag record -a /some_topic")); + execute_and_wait_until_completion("ros2 bag record -a /some_topic", temporary_dir_path_); auto error_output = internal::GetCapturedStderr(); EXPECT_THAT(exit_code, Eq(EXIT_FAILURE)); @@ -569,7 +569,7 @@ TEST_F(RecordFixture, record_fails_if_both_all_and_topic_list_is_specified) { TEST_F(RecordFixture, record_fails_gracefully_if_plugin_for_given_encoding_does_not_exist) { internal::CaptureStderr(); auto exit_code = - WEXITSTATUS(std::system("ros2 bag record -a -f some_rmw")); + execute_and_wait_until_completion("ros2 bag record -a -f some_rmw", temporary_dir_path_); auto error_output = internal::GetCapturedStderr(); EXPECT_THAT(exit_code, Eq(EXIT_SUCCESS));