From 343fafdc64fc6620d27a20726d0d31433fedf115 Mon Sep 17 00:00:00 2001 From: Sidharth Kshatriya Date: Sat, 2 Nov 2024 13:11:56 +0530 Subject: [PATCH] pack test: dont hunt for `mmap_pack_*` files in `latest-trace/` if the fs supports cloning Otherwise the `pack` test can incorrectly fail on, for example, btrfs: ``` ls: cannot access 'latest-trace/mmap_pack_*': No such file or directory ``` --- src/test/pack.run | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/test/pack.run b/src/test/pack.run index 4c196d7c67b..0f7777eb037 100644 --- a/src/test/pack.run +++ b/src/test/pack.run @@ -13,8 +13,15 @@ if [[ `ls latest-trace/*_pack$bitness-* | wc -l` != "1" ]]; then failed "Failed to coalesce all instances of 'pack'" fi -if [[ `ls latest-trace/mmap_pack_* | wc -l` == "0" ]]; then - failed "Packing produced no files." +touch does_fs_support_clone +# Assumes your `cp` supports the --reflink flag +cp --reflink=always does_fs_support_clone does_fs_support_clone1 +if [[ $? -ne 0 ]]; then + # Since fs does NOT support file cloning, this further check should now be done + # (without the outer `if` the pack test would fail on btrfs) + if [[ `ls latest-trace/mmap_pack_* | wc -l` == "0" ]]; then + failed "Packing produced no files." + fi fi # If there are no copies of _mapped_file it was probably copied