From 9071ee5c7723bd215ba4362f19d5d7855d561c4d Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Wed, 27 Nov 2024 20:17:45 +0100 Subject: [PATCH] chore(fstypes): show section version in dump --- src/fstypes.cpp | 5 +++-- test/dwarfs_test.cpp | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/fstypes.cpp b/src/fstypes.cpp index d99de8ddb..e9bcadb64 100644 --- a/src/fstypes.cpp +++ b/src/fstypes.cpp @@ -82,7 +82,7 @@ std::string get_section_name(section_type type) { } void section_header::dump(std::ostream& os) const { - os << "type=" << get_default(sections, type) << ", compression=" + os << "[V1] type=" << get_default(sections, type) << ", compression=" << get_default(compressions, static_cast(compression)) << ", length=" << length; } @@ -94,7 +94,8 @@ std::string section_header::to_string() const { } void section_header_v2::dump(std::ostream& os) const { - os << "num=" << number + os << "[V" << static_cast(major) << "." << static_cast(minor) + << "] num=" << number << ", type=" << get_default(sections, static_cast(type)) << ", compression=" << get_default(compressions, static_cast(compression)) diff --git a/test/dwarfs_test.cpp b/test/dwarfs_test.cpp index 58f32a19c..aeb91c597 100644 --- a/test/dwarfs_test.cpp +++ b/test/dwarfs_test.cpp @@ -849,7 +849,8 @@ TEST_P(compression_regression, github45) { reader::filesystem_v2::identify(lgr, *input, mm, idss, 3); std::string line; - std::regex const re("^SECTION num=\\d+, type=BLOCK, compression=(\\w+).*"); + std::regex const re( + "^SECTION \\[[^\\]]+\\] num=\\d+, type=BLOCK, compression=(\\w+).*"); std::set compressions; while (std::getline(idss, line)) { std::smatch m;