-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use std::filesystem instead of rcpputils::fs #1576
Conversation
Signed-off-by: Kenta Yonekura <yoneken@ieee.org>
Signed-off-by: Kenta Yonekura <yoneken@ieee.org>
e28c09e
to
ad7851d
Compare
For what it is worth, the only users of rosbag2/rosbag2_test_common/include/rosbag2_test_common/temporary_directory_fixture.hpp Line 34 in 1564687
Since the goal is to eventually remove |
@clalancette thanks, done. Do we run CI on Windows? Just want to be sure it works there too @MichaelOrlov could you also please take a look? |
rosbag2_test_common/include/rosbag2_test_common/temporary_directory_fixture.hpp
Outdated
Show resolved
Hide resolved
@fujitatomoya thanks for the comments, addressed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@r7vme Thank you for picking up and finishing this PR. It turns out to be a large PR.
In general, it looks good to me. However, I have a few findings which need to be addressed.
Among a few minor findings which I pointed out in the inline comments there is some missed usage of the rcutils_calculate_directory_size(uri.c_str(), &metadata.bag_size, allocator))
in the
rosbag2/rosbag2_storage/src/rosbag2_storage/metadata_io.cpp
Lines 38 to 48 in a2283ab
BagMetadata MetadataIo::read_metadata(const std::string & uri) | |
{ | |
try { | |
YAML::Node yaml_file = YAML::LoadFile(get_metadata_file_name(uri)); | |
auto metadata = yaml_file["rosbag2_bagfile_information"].as<rosbag2_storage::BagMetadata>(); | |
rcutils_allocator_t allocator = rcutils_get_default_allocator(); | |
if (RCUTILS_RET_OK != | |
rcutils_calculate_directory_size(uri.c_str(), &metadata.bag_size, allocator)) | |
{ | |
throw std::runtime_error( | |
std::string("Exception on calculating the size of directory :") + uri); |
which could be replaced by using https://en.cppreference.com/w/cpp/filesystem/file_size instead
rosbag2_compression/src/rosbag2_compression/sequential_compression_writer.cpp
Outdated
Show resolved
Hide resolved
rosbag2_compression/src/rosbag2_compression/sequential_compression_writer.cpp
Outdated
Show resolved
Hide resolved
rosbag2_compression/src/rosbag2_compression/sequential_compression_writer.cpp
Outdated
Show resolved
Hide resolved
rosbag2_compression/src/rosbag2_compression/sequential_compression_writer.cpp
Outdated
Show resolved
Hide resolved
rosbag2_compression_zstd/src/rosbag2_compression_zstd/zstd_decompressor.cpp
Outdated
Show resolved
Hide resolved
@MichaelOrlov addressed your comments here 0b53db4 Should I squash last 4 commits into one? |
rosbag2_test_common/include/rosbag2_test_common/temporary_directory_fixture.hpp
Outdated
Show resolved
Hide resolved
@r7vme Thank you for addressing most of the comments from the review.
|
956252b
to
11ecdd0
Compare
@MichaelOrlov regarding |
Signed-off-by: Roman Sokolkov <rsokolkov@gmail.com>
11ecdd0
to
fa93197
Compare
@clalancette @MichaelOrlov looks like |
@r7vme Yeah, we are aware of it. This is a generic issue due to the transition to the Ubuntu 24.04 on Rolling. This issue is going to be addressed sometime soon. |
@r7vme As regards
Please do not squash commits in the future. It is very helpful for the reviewer to see changes in the separate commits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@r7vme Thanks, LGTM!
Gist: https://gist.githubusercontent.com/MichaelOrlov/f323f6647c62a2395c5006aa68777d14/raw/fa6e1966d9c3fc82d4d4eeb990dd9e3461fe97b8/ros2.repos |
@MichaelOrlov thanks, is there anything required from my side? Or you can restart failed CI job Rpr__rosbag2__ubuntu_noble_amd64 ? |
These aren't going to work right at the moment. We are close to making them work, but need a bit more time. The regular CI above is good enough. |
@r7vme Some tests failing on Windows CI https://ci.ros2.org/job/ci_windows/21225/
Could you please take a look at failures and test use cases? It seems we have forgotten to use |
Signed-off-by: Roman Sokolkov <rsokolkov@gmail.com>
Re-run CI afer attempt to fix test errors on Windows build |
@r7vme We have one more test failure on Windows
Could you please take a look on it? |
Signed-off-by: Roman Sokolkov <rsokolkov@gmail.com>
@MichaelOrlov I reverted remove_all in test fixture. This part is used in failed test. Let's see it if helps. No other ideas unforunately |
@clalancette could you please take another look? your comment was addressed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MichaelOrlov I reverted remove_all in test fixture. This part is used in failed test. Let's see it if helps. No other ideas unforunately
I have to say that I'm surprised that this fixed the problem. We are using a similar pattern in https://github.com/ros2/rcl_logging/blob/rolling/rcl_logging_spdlog/test/test_logging_interface.cpp , and it is working fine by using std::filesystem::remove_all
.
That said, I'm still approving since I'm OK with putting this in as-is. It just means that we won't be able to remove rcpputils::fs
until we do another PR to fix whatever bug std::filesystem::remove_all
is hitting.
@MichaelOrlov I guess can be merged finally? |
@r7vme Yes we can merge I think. However, please hold off for a couple of days. I need to wrap up some other things and I want to mitigate the potential merge or rebase conflicts. |
Based on PRs #1478 and #1479
Use std::filesystem instead of rcpputils::fs (ros2/rcpputils#164) in all packages of rosbag2.
The only place where it is still used is TemporaryDirectoryFixture inrosbag2/rosbag2_test_common/include/rosbag2_test_common/temporary_directory_fixture.hpp
Line 34 in 1564687
Because there is no alternative in the standard library