Add update-only mode for test dataset generator
Add support for running content updates against an existing migration test dataset without recreating the filesystem structure. Also make ACL/xattr updates non-fatal on filesystems that do not support those operations.
This commit is contained in:
@@ -5,7 +5,7 @@ set -euo pipefail
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage:
|
||||
generate_migration_test_dataset.sh TARGET_DIR [UPDATE_INTERVAL_SECONDS]
|
||||
generate_migration_test_dataset.sh [--update-only] TARGET_DIR [UPDATE_INTERVAL_SECONDS]
|
||||
|
||||
Creates a compact filesystem migration test dataset under TARGET_DIR.
|
||||
The dataset matches the manifest in migration-test-manifest.md.
|
||||
@@ -23,6 +23,12 @@ Notes:
|
||||
EOF
|
||||
}
|
||||
|
||||
UPDATE_ONLY=0
|
||||
if [[ ${1:-} == "--update-only" ]]; then
|
||||
UPDATE_ONLY=1
|
||||
shift
|
||||
fi
|
||||
|
||||
if [[ $# -lt 1 || $# -gt 2 ]]; then
|
||||
usage
|
||||
exit 1
|
||||
@@ -132,17 +138,25 @@ apply_mode() {
|
||||
|
||||
set_acl_and_xattr_metadata() {
|
||||
if (( have_setfattr )); then
|
||||
setfattr -n user.migration_case -v "xattr-text" "$ROOT/metadata/xattr_text_1mb_644.txt"
|
||||
setfattr -n user.migration_case -v "xattr-random" "$ROOT/metadata/xattr_random_3mb_600.bin"
|
||||
if ! setfattr -n user.migration_case -v "xattr-text" "$ROOT/metadata/xattr_text_1mb_644.txt"; then
|
||||
log "Skipping xattr assignment on $ROOT/metadata/xattr_text_1mb_644.txt: operation not supported"
|
||||
fi
|
||||
if ! setfattr -n user.migration_case -v "xattr-random" "$ROOT/metadata/xattr_random_3mb_600.bin"; then
|
||||
log "Skipping xattr assignment on $ROOT/metadata/xattr_random_3mb_600.bin: operation not supported"
|
||||
fi
|
||||
else
|
||||
echo "Skipping xattr assignment: setfattr not available"
|
||||
log "Skipping xattr assignment: setfattr not available"
|
||||
fi
|
||||
|
||||
if (( have_setfacl )); then
|
||||
setfacl -m u:nobody:r-- "$ROOT/metadata/acl_text_1mb_644.txt"
|
||||
setfacl -m u:nobody:r-x "$ROOT/metadata/acl_script_1mb_755.sh"
|
||||
if ! setfacl -m u:nobody:r-- "$ROOT/metadata/acl_text_1mb_644.txt"; then
|
||||
log "Skipping ACL assignment on $ROOT/metadata/acl_text_1mb_644.txt: operation not supported"
|
||||
fi
|
||||
if ! setfacl -m u:nobody:r-x "$ROOT/metadata/acl_script_1mb_755.sh"; then
|
||||
log "Skipping ACL assignment on $ROOT/metadata/acl_script_1mb_755.sh: operation not supported"
|
||||
fi
|
||||
else
|
||||
echo "Skipping ACL assignment: setfacl not available"
|
||||
log "Skipping ACL assignment: setfacl not available"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -357,16 +371,21 @@ Notes:
|
||||
EOF
|
||||
}
|
||||
|
||||
create_base_dirs
|
||||
create_regular_files
|
||||
create_named_variants
|
||||
create_deep_and_duplicate_cases
|
||||
create_time_and_readonly_cases
|
||||
create_links
|
||||
create_metadata_cases
|
||||
write_summary
|
||||
|
||||
echo "Created migration test dataset at: $ROOT"
|
||||
if (( UPDATE_ONLY )); then
|
||||
log "Running in update-only mode for $ROOT"
|
||||
update_mutable_files_pass
|
||||
log "Completed initial update-only pass"
|
||||
else
|
||||
create_base_dirs
|
||||
create_regular_files
|
||||
create_named_variants
|
||||
create_deep_and_duplicate_cases
|
||||
create_time_and_readonly_cases
|
||||
create_links
|
||||
create_metadata_cases
|
||||
write_summary
|
||||
echo "Created migration test dataset at: $ROOT"
|
||||
fi
|
||||
|
||||
if [[ -n "$UPDATE_INTERVAL" ]]; then
|
||||
run_update_loop
|
||||
|
||||
Reference in New Issue
Block a user