Skip to content

Commit

Permalink
pack test: dont hunt for mmap_pack_* files in latest-trace/ if th…
Browse files Browse the repository at this point in the history
…e 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
  ```
  • Loading branch information
sidkshatriya committed Nov 4, 2024
1 parent 079e55f commit 343fafd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/test/pack.run
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 343fafd

Please sign in to comment.