diff --git a/script/cfg.py b/script/cfg.py index e204ed6..ca6ec50 100644 --- a/script/cfg.py +++ b/script/cfg.py @@ -20,7 +20,7 @@ read_files_isos = '''rsync -4 --list-only $rsync_pwd_option PRODUCTISOPATH/ | grep -P 'Media1?.iso$' | grep -E 'ARCHORS' | awk '{ $1=$2=$3=$4=""; print substr($0,5); }' >> __envsub/files_iso.lst ''' -read_files_repo = '''rsync -4 --list-only $rsync_pwd_option PRODUCTREPOPATH/ | grep -P 'Media[1-3](.license)?$' | awk '{ $1=$2=$3=$4=""; print substr($0,5); } ' | grep -v IGNOREPATTERN | grep -E 'REPOORS' | grep -E 'ARCHORS' >> __envsub/files_repo.lst +read_files_repo = '''rsync -4 --list-only $rsync_pwd_option PRODUCTREPOPATH/ | { grep -P 'Media[1-3](.license)?$' || true; } | awk '{ $1=$2=$3=$4=""; print substr($0,5); } ' | grep -v IGNOREPATTERN | grep -E 'REPOORS' | grep -E 'ARCHORS' >> __envsub/files_repo.lst ''' read_files_repo_media = '''rsync -4 $rsync_pwd_option PRODUCTREPOPATH/*Media1/media.1/media __envsub/Media1.lst''' diff --git a/t/test_rsync.sh b/t/test_rsync.sh new file mode 100644 index 0000000..aa6f7ea --- /dev/null +++ b/t/test_rsync.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -eo pipefail +scriptdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +errs=0 + +function rsync() { + [ $successful -eq 1 ] && return 0 + echo "[sender] change_dir $3 (in repos) failed: No such file or directory (2)" >&2 + echo "rsync error: some files/attrs were not transferred" >&2 + echo "read_files.sh failed for in $dir" >&2 + return 256 +} +function curl() { + return 0 +} +export -f rsync curl + +successful=0 +export successful + +for dir in "$@"; do + for expected in $(seq 0 1); do + successful=$expected + out=$(bash -e "$@/read_files.sh" $dir) + [ $? -eq 0 ] || echo "FAIL $dir : $out" $((++errs)) + done +done +(exit $errs)