From 3dfa53469eb0840eecf0b839959a66886d30b189 Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Tue, 3 May 2022 23:13:51 +0200 Subject: [PATCH] improve tests --- CONTRIBUTING.md | 5 +++++ tests-ng/compare-ignore-relative.sh | 8 ++++---- tests-ng/compare-ignore.sh | 8 ++++---- tests-ng/compare.sh | 4 ++-- tests-ng/diff-cmd.sh | 2 +- tests-ng/dir-import-update.sh | 2 +- tests-ng/duplicate-key.sh | 2 +- tests-ng/dynvariables.sh | 6 ++++-- tests-ng/global-compare-ignore.sh | 4 ++-- tests-ng/helpers | 30 +++++++++++++++++++++++++++++ tests-ng/import-as.sh | 12 ++++++------ tests-ng/import-duplicate.sh | 4 ++-- tests-ng/import-ignore.sh | 4 ++-- tests-ng/import-link-children.sh | 2 +- tests-ng/import-with-empty.sh | 2 +- tests-ng/import.sh | 10 +++++----- tests-ng/install-ignore.sh | 12 ++++++------ tests-ng/key-prefix-sep.sh | 8 ++++---- tests-ng/link-import-default.sh | 4 ++-- tests-ng/link-value-tests.sh | 24 +++++++++++------------ tests-ng/profile-dynvariables.sh | 4 ++-- tests-ng/transformations.sh | 6 +++--- tests-ng/update-rights.sh | 4 ++-- tests-ng/update-with-key.sh | 6 +++--- tests-ng/update.sh | 4 ++-- tests.sh | 2 +- 26 files changed, 108 insertions(+), 71 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4d61879..01c6cf2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -184,6 +184,11 @@ for different use-cases (usually described in their filename or in the file head Each script starts with the same boilerplate code that you can paste at the start of your new test (see the head of the file down to `# this is the test`). +To run the tests on OSX, install following tools with homebrew +```bash +brew install coreutils gnu-sed +``` + # Documentation Dotdrop documentation is available under [https://dotdrop.readthedocs.io/](https://dotdrop.readthedocs.io/). diff --git a/tests-ng/compare-ignore-relative.sh b/tests-ng/compare-ignore-relative.sh index 662ac33..dea2790 100755 --- a/tests-ng/compare-ignore-relative.sh +++ b/tests-ng/compare-ignore-relative.sh @@ -70,9 +70,9 @@ create_conf ${cfg} # sets token # import echo "[+] import" -cd ${ddpath} | ${bin} import --verbose -c ${cfg} ${tmpd}/program || exit 1 -cd ${ddpath} | ${bin} import --verbose -c ${cfg} ${tmpd}/config || exit 1 -cd ${ddpath} | ${bin} import --verbose -c ${cfg} ${tmpd}/vscode || exit 1 +cd ${ddpath} | ${bin} import -f --verbose -c ${cfg} ${tmpd}/program || exit 1 +cd ${ddpath} | ${bin} import -f --verbose -c ${cfg} ${tmpd}/config || exit 1 +cd ${ddpath} | ${bin} import -f --verbose -c ${cfg} ${tmpd}/vscode || exit 1 # add files on filesystem echo "[+] add files" @@ -149,7 +149,7 @@ mkdir -p ${tmpd}/.zsh/plugins touch ${tmpd}/.zsh/plugins/someplugin echo "[+] import .zsh" -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/.zsh +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/.zsh # no diff expected echo "[+] comparing .zsh" diff --git a/tests-ng/compare-ignore.sh b/tests-ng/compare-ignore.sh index 42c2916..28da8e7 100755 --- a/tests-ng/compare-ignore.sh +++ b/tests-ng/compare-ignore.sh @@ -71,9 +71,9 @@ create_conf ${cfg} # sets token # import echo "[+] import" -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/program -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/config -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/vscode +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/program +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/config +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/vscode # add files echo "[+] add files" @@ -174,7 +174,7 @@ create_conf ${cfg} # sets token # import echo "[+] import" -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/program ${tmpd}/config ${tmpd}/vscode +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/program ${tmpd}/config ${tmpd}/vscode # create the files to ignore touch ${tmpd}/program/.DS_Store diff --git a/tests-ng/compare.sh b/tests-ng/compare.sh index 8e91257..0fdd0a5 100755 --- a/tests-ng/compare.sh +++ b/tests-ng/compare.sh @@ -95,8 +95,8 @@ create_conf ${cfg} # sets token # import dir1 echo "[+] import" -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/dir1 -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/uniquefile +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/dir1 +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/uniquefile cat ${cfg} # let's see the dotpath diff --git a/tests-ng/diff-cmd.sh b/tests-ng/diff-cmd.sh index 8429267..d602c89 100755 --- a/tests-ng/diff-cmd.sh +++ b/tests-ng/diff-cmd.sh @@ -73,7 +73,7 @@ _EOF # import echo "[+] import" -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/singlefile +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/singlefile # modify the file echo "modified" > ${tmpd}/singlefile diff --git a/tests-ng/dir-import-update.sh b/tests-ng/dir-import-update.sh index a7f77cd..39c7908 100755 --- a/tests-ng/dir-import-update.sh +++ b/tests-ng/dir-import-update.sh @@ -62,7 +62,7 @@ cfg="${basedir}/config.yaml" create_conf ${cfg} # sets token # import the dir -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd} +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd} # change token echo "changed" > ${token} diff --git a/tests-ng/duplicate-key.sh b/tests-ng/duplicate-key.sh index 9069203..59b0a87 100755 --- a/tests-ng/duplicate-key.sh +++ b/tests-ng/duplicate-key.sh @@ -90,7 +90,7 @@ mkdir -p ${tmpd}/sub/sub echo "test2" > ${tmpd}/sub/sub/abc # import -cd ${ddpath} | ${bin} import --verbose -c ${cfg} -p p2 \ +cd ${ddpath} | ${bin} import -f --verbose -c ${cfg} -p p2 \ ${tmpd}/abc \ ${tmpd}/sub/abc \ ${tmpd}/sub/abc \ diff --git a/tests-ng/dynvariables.sh b/tests-ng/dynvariables.sh index 0062534..dfb5e45 100755 --- a/tests-ng/dynvariables.sh +++ b/tests-ng/dynvariables.sh @@ -75,7 +75,7 @@ variables: var1: "this is some test" var2: "the_dvar4" dynvariables: - dvar1: head -1 /proc/meminfo + dvar1: head -1 ${cur}/helpers dvar2: "echo 'this is some test' | rev | tr ' ' ','" dvar3: ${scr} dvar4: "echo {{@@ var2 @@}} | rev" @@ -101,10 +101,12 @@ echo "test" >> ${tmps}/dotfiles/abc # install cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V +echo "-----" cat ${tmpd}/abc +echo "-----" grep '^this is some test' ${tmpd}/abc >/dev/null -grep "^MemTotal" ${tmpd}/abc >/dev/null +grep '^# author: deadc0de6' ${tmpd}/abc >/dev/null grep '^tset,emos,si,siht' ${tmpd}/abc >/dev/null grep "^${TESTENV}" ${tmpd}/abc > /dev/null grep '^4ravd_eht' ${tmpd}/abc >/dev/null diff --git a/tests-ng/global-compare-ignore.sh b/tests-ng/global-compare-ignore.sh index 91a4ba8..7b3da57 100755 --- a/tests-ng/global-compare-ignore.sh +++ b/tests-ng/global-compare-ignore.sh @@ -75,8 +75,8 @@ _EOF # import echo "[+] import" -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/program -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/config +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/program +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/config # add files echo "[+] add files" diff --git a/tests-ng/helpers b/tests-ng/helpers index 2d46606..ab76f75 100644 --- a/tests-ng/helpers +++ b/tests-ng/helpers @@ -63,3 +63,33 @@ dotfiles: profiles: _EOF } + +# osx tricks +# brew install coreutils gnu-sed +if [[ $OSTYPE == 'darwin'* ]]; then + mktemp() { + gmktemp "$@" + } + stat() { + gstat "$@" + } + sed() { + gsed "$@" + } + wc() { + gwc "$@" + } + date() { + gdate "$@" + } + chmod() { + gchmod "$@" + } + + export -f mktemp + export -f stat + export -f sed + export -f wc + export -f date + export -f chmod +fi diff --git a/tests-ng/import-as.sh b/tests-ng/import-as.sh index b77da19..c1ca48f 100755 --- a/tests-ng/import-as.sh +++ b/tests-ng/import-as.sh @@ -77,17 +77,17 @@ _EOF #cat ${cfg} # import -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 -V ${tmpd}/adir -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 -V ${tmpd}/file3 +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/adir +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/file3 echo "import --as dotfiles" -cd ${ddpath} | ${bin} import -c ${cfg} -p p2 -V ${tmpd}/adir --as ~/config/adir -cd ${ddpath} | ${bin} import -c ${cfg} -p p2 -V ${tmpd}/file3 --as ~/config2/file3 +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p2 -V ${tmpd}/adir --as ~/config/adir +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p2 -V ${tmpd}/file3 --as ~/config2/file3 cat ${cfg} set +e -cd ${ddpath} | ${bin} import -c ${cfg} -p p2 -V ${tmpd}/adir --as ~/config/should_not && echo "dual dst imported" && exit 1 +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p2 -V ${tmpd}/adir --as ~/config/should_not && echo "dual dst imported" && exit 1 set -e cat ${cfg} | grep should_not && echo "dual dst imported" && exit 1 @@ -137,7 +137,7 @@ dotfiles: profiles: _EOF -cd ${ddpath} | ${bin} import -b -c ${cfg} -p test -V ~/.dotdrop.test --as=~/.whatever +cd ${ddpath} | ${bin} import -f -b -c ${cfg} -p test -V ~/.dotdrop.test --as=~/.whatever #cat ${cfg} [ ! -e ~/.dotdrop-dotfiles-test/dotfiles/whatever ] && echo 'tild imported' && exit 1 diff --git a/tests-ng/import-duplicate.sh b/tests-ng/import-duplicate.sh index 3c818cf..4950334 100755 --- a/tests-ng/import-duplicate.sh +++ b/tests-ng/import-duplicate.sh @@ -93,8 +93,8 @@ _EOF cat ${cfg} # import -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 -V ${tmpd}/.mutt/colors -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 -V ${tmpd}/.colors +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/.mutt/colors +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/.colors cat ${cfg} diff --git a/tests-ng/import-ignore.sh b/tests-ng/import-ignore.sh index a2a16be..ea571ef 100755 --- a/tests-ng/import-ignore.sh +++ b/tests-ng/import-ignore.sh @@ -58,13 +58,13 @@ tmps=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d` mkdir -p ${tmps}/dotfiles # the dotfile destination tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d` +mkdir -p ${tmpd} #echo "dotfile destination: ${tmpd}" clear_on_exit "${tmps}" clear_on_exit "${tmpd}" # dotdrop directory -mkdir -p ${tmpd} mkdir -p ${tmpd}/a/{b,c} echo 'a' > ${tmpd}/a/b/abfile echo 'a' > ${tmpd}/a/c/acfile @@ -90,7 +90,7 @@ _EOF # import echo "[+] import" -cd ${ddpath} | ${bin} import -c ${cfg} --verbose --profile=p1 ${tmpd}/a +cd ${ddpath} | ${bin} import -c ${cfg} -f --verbose --profile=p1 ${tmpd}/a [ -d ${tmps}/dotfiles/newdir ] && echo "newdir not ignored" && exit 1 [ -e ${tmps}/dotfiles/newdir/newfile ] && echo "newfile not ignored" && exit 1 diff --git a/tests-ng/import-link-children.sh b/tests-ng/import-link-children.sh index 2f97c18..7eccba5 100755 --- a/tests-ng/import-link-children.sh +++ b/tests-ng/import-link-children.sh @@ -89,7 +89,7 @@ profiles: _EOF # import -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 -V --link=link_children ${dt} +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V --link=link_children ${dt} # check is set to link_children cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V -G | grep "d_`basename ${dt}`" | grep ',link:link_children,' diff --git a/tests-ng/import-with-empty.sh b/tests-ng/import-with-empty.sh index 6af2aab..73bd1f3 100755 --- a/tests-ng/import-with-empty.sh +++ b/tests-ng/import-with-empty.sh @@ -96,7 +96,7 @@ profiles: _EOF echo "[+] import" -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 --verbose ${dftoimport} +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 --verbose ${dftoimport} [ "$?" != "0" ] && exit 1 echo "[+] install" diff --git a/tests-ng/import.sh b/tests-ng/import.sh index 9646b38..e6ffb92 100755 --- a/tests-ng/import.sh +++ b/tests-ng/import.sh @@ -75,8 +75,8 @@ _EOF #cat ${cfg} # import -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 -V ${tmpd}/adir -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 -V ${tmpd}/file3 +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/adir +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/file3 cat ${cfg} @@ -97,8 +97,8 @@ nb=`cat ${cfg} | grep f_file3 | wc -l` cntpre=`find ${tmps}/dotfiles -type f | wc -l` # reimport -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 -V ${tmpd}/adir -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 -V ${tmpd}/file3 +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/adir +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/file3 cntpost=`find ${tmps}/dotfiles -type f | wc -l` @@ -124,7 +124,7 @@ echo "fil2" > ${d}/file2 mkfifo ${d}/fifo # import -cd ${ddpath} | ${bin} import -c ${cfg} -p p2 -V ${d} +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p2 -V ${d} # ensure exists and is not link [ ! -d ${tmps}/dotfiles/${d} ] && echo "not a directory" && exit 1 diff --git a/tests-ng/install-ignore.sh b/tests-ng/install-ignore.sh index 602d07e..3395f8d 100755 --- a/tests-ng/install-ignore.sh +++ b/tests-ng/install-ignore.sh @@ -71,9 +71,9 @@ create_conf ${cfg} # sets token # import echo "[+] import" -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/program -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/config -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/vscode +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/program +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/config +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/vscode # add files on filesystem echo "[+] add files" @@ -143,7 +143,7 @@ echo "f1" > ${tmpd}/nvim/dir2/file2 echo "ftop" > ${tmpd}/nvim/ftop echo "[+] import top" -cd ${ddpath} | ${bin} import -c ${cfg} -l link_children -p p1 ${tmpd}/nvim +cd ${ddpath} | ${bin} import -f -c ${cfg} -l link_children -p p1 ${tmpd}/nvim # add sub dir mkdir -p ${tmpd}/nvim/templated @@ -151,8 +151,8 @@ echo "noprofile" > ${tmpd}/nvim/templated/ftemplated echo "noprofile" > ${tmpd}/nvim/template echo "[+] import sub" -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${tmpd}/nvim/templated -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${tmpd}/nvim/template +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 ${tmpd}/nvim/templated +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 ${tmpd}/nvim/template cfg2="${basedir}/config2.yaml" sed '/d_nvim:/a \ \ \ \ instignore:\n\ \ \ \ - "*template*"' ${cfg} > ${cfg2} diff --git a/tests-ng/key-prefix-sep.sh b/tests-ng/key-prefix-sep.sh index 77221d5..35a6c31 100755 --- a/tests-ng/key-prefix-sep.sh +++ b/tests-ng/key-prefix-sep.sh @@ -78,8 +78,8 @@ profiles: _EOF # import -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 -V ${tmpd}/top/.colors -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 -V ${tmpd}/.mutt/sub +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/top/.colors +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/.mutt/sub cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -G | cut -f1 -d',' | grep -q '_top_colors' cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -G | cut -f1 -d',' | grep -q '_mutt_sub' @@ -103,8 +103,8 @@ profiles: _EOF # import -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 -V ${tmpd}/top/.colors -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 -V ${tmpd}/.mutt/sub +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/top/.colors +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/.mutt/sub cat ${cfg} cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -G diff --git a/tests-ng/link-import-default.sh b/tests-ng/link-import-default.sh index 3600dcc..3cd082e 100755 --- a/tests-ng/link-import-default.sh +++ b/tests-ng/link-import-default.sh @@ -73,7 +73,7 @@ profiles: _EOF # import -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 -V ${tmpd}/abc +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/abc # checks inside="${tmps}/dotfiles/${tmpd}/abc" @@ -95,7 +95,7 @@ profiles: _EOF # import -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 -V ${tmpd}/abc +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/abc # checks inside="${tmps}/dotfiles/${tmpd}/abc" diff --git a/tests-ng/link-value-tests.sh b/tests-ng/link-value-tests.sh index 7a8a3bc..701b29d 100755 --- a/tests-ng/link-value-tests.sh +++ b/tests-ng/link-value-tests.sh @@ -79,7 +79,7 @@ _EOF # import df="${tmpd}/qwert" -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 ${df} -V # checks cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V @@ -113,7 +113,7 @@ _EOF # import df="${tmpd}/qwert" -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 ${df} -V # checks cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V @@ -147,7 +147,7 @@ _EOF # import df="${tmpd}/qwert" -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V --link=nolink +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 ${df} -V --link=nolink # checks cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V @@ -181,7 +181,7 @@ _EOF # import df="${tmpd}/qwert" -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V --link=link +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 ${df} -V --link=link # checks cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V @@ -215,7 +215,7 @@ _EOF # import df="${tmpd}/qwert" -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 ${df} -V # checks cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V @@ -249,7 +249,7 @@ _EOF # import df="${tmpd}/qwert" -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V --link=nolink +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 ${df} -V --link=nolink # checks cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V @@ -283,7 +283,7 @@ _EOF # import df="${tmpd}/qwert" -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V --link=nolink +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 ${df} -V --link=nolink # checks cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V @@ -317,7 +317,7 @@ _EOF # import df="${tmpd}/qwert" -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V --link=nolink +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 ${df} -V --link=nolink # checks cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V @@ -349,7 +349,7 @@ _EOF # import df="${tmpd}/qwert" -cd ${ddpath} | ${bin} import -c ${cfg} --link=link -p p1 ${df} -V +cd ${ddpath} | ${bin} import -f -c ${cfg} --link=link -p p1 ${df} -V # checks cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V @@ -382,7 +382,7 @@ _EOF # import df="${tmpd}/qwert" set +e -cd ${ddpath} | ${bin} import -c ${cfg} --link=link_children -p p1 ${df} -V +cd ${ddpath} | ${bin} import -f -c ${cfg} --link=link_children -p p1 ${df} -V [ "$?" = "0" ] && echo "link_children with file should fail" && exit 1 set -e @@ -410,7 +410,7 @@ _EOF # import df="${tmpd}/qwert" -cd ${ddpath} | ${bin} import -c ${cfg} --link=link_children -p p1 ${df} -V +cd ${ddpath} | ${bin} import -f -c ${cfg} --link=link_children -p p1 ${df} -V # checks cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V @@ -450,7 +450,7 @@ _EOF # import df="${tmpd}/qwert" -cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V +cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 ${df} -V # checks cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V diff --git a/tests-ng/profile-dynvariables.sh b/tests-ng/profile-dynvariables.sh index 813e802..b7323ae 100755 --- a/tests-ng/profile-dynvariables.sh +++ b/tests-ng/profile-dynvariables.sh @@ -82,7 +82,7 @@ variables: gvar1: "global1" gvar2: "global2" dynvariables: - gdvar1: head -1 /proc/meminfo + gdvar1: head -1 ${cur}/helpers gdvar2: "echo 'this is some test' | rev | tr ' ' ','" gdvar3: ${scr} dotfiles: @@ -123,7 +123,7 @@ grep '^local1' ${tmpd}/abc >/dev/null grep '^global2' ${tmpd}/abc >/dev/null grep '^local2' ${tmpd}/abc >/dev/null # test dynvariables -grep "^MemTotal" ${tmpd}/abc >/dev/null +grep "^# author: deadc0de6" ${tmpd}/abc >/dev/null grep '^tset,emos,si,siht' ${tmpd}/abc >/dev/null grep "^${TESTENV2}" ${tmpd}/abc > /dev/null grep "^cba" ${tmpd}/abc >/dev/null diff --git a/tests-ng/transformations.sh b/tests-ng/transformations.sh index 5bb44b7..80f0d5e 100755 --- a/tests-ng/transformations.sh +++ b/tests-ng/transformations.sh @@ -68,7 +68,7 @@ tokend="compressed archive" touched="touched" cat > ${cfg} << _EOF -trans: +trans_read: base64: cat {0} | base64 -d > {1} uncompress: mkdir -p {1} && tar -xf {0} -C {1} trans_write: @@ -85,12 +85,12 @@ dotfiles: f_abc: dst: ${tmpd}/abc src: abc - trans: base64 + trans_read: base64 trans_write: base64 d_ghi: dst: ${tmpd}/ghi src: ghi - trans: uncompress + trans_read: uncompress trans_write: compress chmod: 700 profiles: diff --git a/tests-ng/update-rights.sh b/tests-ng/update-rights.sh index f7207e6..c214982 100755 --- a/tests-ng/update-rights.sh +++ b/tests-ng/update-rights.sh @@ -72,8 +72,8 @@ create_conf ${cfg} # sets token # import dir1 echo "[+] import" -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd} -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpf} +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd} +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpf} # change file chmod +x ${tmpf} diff --git a/tests-ng/update-with-key.sh b/tests-ng/update-with-key.sh index e3c579f..17363bc 100755 --- a/tests-ng/update-with-key.sh +++ b/tests-ng/update-with-key.sh @@ -73,9 +73,9 @@ create_conf ${cfg} # sets token # import dir1 echo "[+] import" -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/dir1 -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/uniquefile -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/uniquefile2 +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/dir1 +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/uniquefile +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/uniquefile2 # make some modification echo "[+] modify" diff --git a/tests-ng/update.sh b/tests-ng/update.sh index 8d2fcb2..3a6a1b1 100755 --- a/tests-ng/update.sh +++ b/tests-ng/update.sh @@ -97,8 +97,8 @@ create_conf ${cfg} # sets token # import dir1 echo "[+] import" -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/dir1 -cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/uniquefile +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/dir1 +cd ${ddpath} | ${bin} import -f -c ${cfg} ${tmpd}/uniquefile # let's see the dotpath #tree ${basedir}/dotfiles diff --git a/tests.sh b/tests.sh index 814de04..c57bd9e 100755 --- a/tests.sh +++ b/tests.sh @@ -87,7 +87,7 @@ fi #PYTHONPATH="dotdrop" python3 -m pytest tests # disable debug logs -unset DOTDROP_DEBUG= +unset DOTDROP_DEBUG export DOTDROP_FORCE_NODEBUG=yes tmpworkdir="/tmp/dotdrop-tests-workdir"