From a617b95c1db74d08d3982ad33c373dbd7d16291c Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Tue, 20 Aug 2024 22:28:37 +0200 Subject: [PATCH] test verbosity --- tests-ng/backup.sh | 6 ++++++ tests-ng/import-to-no-profile.sh | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tests-ng/backup.sh b/tests-ng/backup.sh index b9b16e2..b8b6af9 100755 --- a/tests-ng/backup.sh +++ b/tests-ng/backup.sh @@ -32,6 +32,8 @@ grep_or_fail() { if ! grep "${1}" "${2}" >/dev/null 2>&1; then echo "pattern \"${1}\" not found in ${2}" + echo "content:" + cat "${2}" exit 1 fi } @@ -143,6 +145,7 @@ clear_dotpath clear_fs create_dotpath create_fs +echo "doing test \"${pre}\"" cd "${ddpath}" | ${bin} install -f -c "${cfg}" -p p1 --verbose # checks @@ -177,6 +180,7 @@ clear_dotpath clear_fs create_dotpath create_fs +echo "doing test \"${pre}\"" cd "${ddpath}" | ${bin} install -f -c "${cfg}" -p p1 --verbose # checks @@ -199,6 +203,7 @@ clear_dotpath clear_fs create_dotpath create_fs +echo "doing test \"${pre}\"" cd "${ddpath}" | ${bin} install -f -c "${cfg}" -p p1 --verbose # checks @@ -221,6 +226,7 @@ clear_dotpath clear_fs create_dotpath create_fs +echo "doing test \"${pre}\"" cd "${ddpath}" | ${bin} install -f -c "${cfg}" -p p1 --verbose # checks diff --git a/tests-ng/import-to-no-profile.sh b/tests-ng/import-to-no-profile.sh index f8b15fe..a00d6e2 100755 --- a/tests-ng/import-to-no-profile.sh +++ b/tests-ng/import-to-no-profile.sh @@ -57,6 +57,7 @@ noprofile="ALL" ################################## # import with profile from arg +echo "import with profile from arg" cd "${ddpath}" | ${bin} import -f -c "${cfg}" -p "${noprofile}" -V "${tmpd}"/file1 cat "${cfg}" @@ -71,11 +72,13 @@ nb=$(cat "${cfg}" | grep f_file1 | wc -l) cntpre=$(find "${tmps}"/dotfiles -type f | wc -l) # reimport +echo "reimport" set +e cd "${ddpath}" | ${bin} import -f -c "${cfg}" -p "${noprofile}" -V "${tmpd}"/file1 set -e cat "${cfg}" +echo "test reimport" cntpost=$(find "${tmps}"/dotfiles -type f | wc -l) [ "${cntpost}" != "${cntpre}" ] && echo "imported twice" && exit 1 @@ -84,6 +87,7 @@ nb=$(cat "${cfg}" | grep "dst: ${tmpd}/file1" | wc -l) ################################## # import with profile from env +echo "import with profile from env" export DOTDROP_PROFILE="${noprofile}" cd "${ddpath}" | ${bin} import -f -c "${cfg}" -V "${tmpd}"/file2 cat "${cfg}" @@ -91,7 +95,7 @@ cat "${cfg}" # ensure exists and is not link [ ! -e "${tmps}"/dotfiles/"${tmpd}"/file2 ] && echo "file not imported" && exit 1 # ensure present in config -cat "${cfg}" | grep "${tmpd}"/file2 >/dev/null 2>&1 +cat "${cfg}" | grep "${tmpd}"/file2 >/dev/null 2>&1 || (echo "file2 not present in config" && exit 1) nb=$(cat "${cfg}" | grep f_file2 | wc -l) [ "${nb}" != "1" ] && echo 'bad config' && exit 1