chore: add clean.sh to remove test artifacts

This commit is contained in:
swaits committed 2025-01-10 09:21:44 -07:00
1 parent 0cd345a123
commit d0e7fe4371
1 file changed
+22
Executable
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# remove-diff-out.sh
#
# Removes all files (including hidden) in any <pkg>/tests/<test>/diff or out directories.
set -euo pipefail
# 1) Make the shell match hidden files (dotfiles) in globs.
# 2) Let an empty glob expand to zero arguments rather than itself.
shopt -s dotglob nullglob
# 2) Loop over any matching directories: <pkg>/tests/<test>/{diff,out}
for dir in */tests/*/{diff,out}; do
# Only proceed if it's actually a directory
if [[ -d "$dir" ]]; then
echo "Removing files under: $dir"
# Remove everything inside (including hidden files)
rm -rf -- "$dir"/*
fi
done
echo "Done!"