File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,15 @@ static fs::path make_root()
4646 return root;
4747}
4848
49+ static void cleanup_root (const fs::path &root) noexcept
50+ {
51+ // Git may still be finishing background maintenance when the test-owned
52+ // repository is torn down. Cleanup is best-effort and must not turn a
53+ // successful hash assertion into an exception from remove_all().
54+ std::error_code ec;
55+ fs::remove_all (root, ec);
56+ }
57+
4958static fs::path make_git_repo (const fs::path &root)
5059{
5160 fs::path repo = root / " repo" ;
@@ -73,7 +82,7 @@ static void test_reproducible_hash()
7382 assert (a.has_value ());
7483 assert (b.has_value ());
7584 assert (*a == *b);
76- fs::remove_all (root);
85+ cleanup_root (root);
7786}
7887
7988static void test_git_metadata_and_untracked_files_are_excluded ()
@@ -91,7 +100,7 @@ static void test_git_metadata_and_untracked_files_are_excluded()
91100 const auto after = vix::cli::util::sha256_package_directory (repo);
92101 assert (after.has_value ());
93102 assert (*before == *after);
94- fs::remove_all (root);
103+ cleanup_root (root);
95104}
96105
97106static void test_tracked_file_modification_changes_hash ()
@@ -106,7 +115,7 @@ static void test_tracked_file_modification_changes_hash()
106115 const auto after = vix::cli::util::sha256_package_directory (repo);
107116 assert (after.has_value ());
108117 assert (*before != *after);
109- fs::remove_all (root);
118+ cleanup_root (root);
110119}
111120
112121int main ()
You can’t perform that action at this time.
0 commit comments