1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 15:39:43 +00:00

add tests cleaning

This commit is contained in:
deadc0de6
2021-10-19 22:18:39 +02:00
parent f9c318679a
commit f4cff17f1b
110 changed files with 413 additions and 355 deletions

View File

@@ -68,6 +68,10 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${tmpa}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -137,8 +141,5 @@ should_grep profile_var ${tmpa}/profile
should_grep profile_var_2 ${tmpa}/profile
should_grep "$USER" ${tmpa}/dyn
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpa}
echo "OK"
exit 0

View File

@@ -54,6 +54,10 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmpa}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -112,8 +116,5 @@ grep empty ${tmpa}/empty >/dev/null
[ ! -e ${tmpa}/tgt ] && echo "tgt arg action not found" && exit 1
grep tgt ${tmpa}/tgt >/dev/null
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpa}
echo "OK"
exit 0

View File

@@ -54,6 +54,10 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${tmpa}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -152,8 +156,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
set -e
[ -e ${tmpd}/abc ] && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpa}
echo "OK"
exit 0

View File

@@ -54,6 +54,10 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${tmpa}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -183,8 +187,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V # 2>&1 | tee ${tmpa}/log
[ -d ${tmpd}/dir3/empty ] && echo "empty directory not cleaned" && exit 1
[ -d ${tmpd}/dir3/sub/empty ] && echo "empty directory not cleaned" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpa}
echo "OK"
exit 0

View File

@@ -61,6 +61,10 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${tmpa}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -174,8 +178,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p2 -V
set -e
[ -e ${tmpd}/fail ] && echo "fail exists" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpa}
echo "OK"
exit 0

View File

@@ -54,6 +54,10 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${tmpa}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -136,8 +140,5 @@ grep "${tmpd}/abc" ${tmpa}/pre >/dev/null
grep "${tmpd}/abc" ${tmpa}/post >/dev/null
grep "${tmpd}/abc" ${tmpa}/naked >/dev/null
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpa}
echo "OK"
exit 0

View File

@@ -54,6 +54,10 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${tmpa}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -130,8 +134,5 @@ grep fake ${tmpa}/fake >/dev/null
[ ! -e ${tmpa}/fake_pre ] && echo 'fake pre action not executed' && exit 1
grep 'fake pre' ${tmpa}/fake_pre >/dev/null
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpa}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the dotfile
dnormal="${tmpd}/dir_normal"
mkdir -p ${dnormal}
@@ -113,8 +116,5 @@ cnt=`cd ${ddpath} | ${bin} compare -c ${cfg} -p p1 2>&1 | grep 'modes differ' |
set -e
[ "${cnt}" != "5" ] && echo "compare modes failed (${cnt})" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -67,6 +67,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the dotfiles
dnormal="${tmpd}/dir_normal"
mkdir -p ${dnormal}
@@ -243,8 +246,5 @@ tot=`echo ${toimport} | wc -w`
cnt=`cat ${cfg} | grep "chmod: " | wc -l`
[ "${cnt}" != "${tot}" ] && echo "not all chmod inserted (3)" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -81,6 +81,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -270,8 +273,5 @@ cd ${ddpath} | printf 'y\ny\n' | ${bin} install -f -c ${cfg} -p p2 -V f_nomode
echo "different mode (2)"
has_rights "${tmpd}/nomode" "600"
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -78,6 +78,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the dotfiles
f1="${tmpd}/f1"
touch ${f1}
@@ -120,8 +123,5 @@ has_rights "${tmps}/dotfiles/${tmpd}/f2" "644"
# install
cd ${ddpath} | ${bin} install -c ${cfg} -f -p p1 -V | grep '0 dotfile(s) installed' || (echo "should not install" && exit 1)
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the dotfile
dnormal="${tmpd}/dir_normal"
mkdir -p ${dnormal}
@@ -150,8 +153,5 @@ cd ${ddpath} | ${bin} update -c ${cfg} -f -p p1 -V ${flink}
cnt=`cat ${cfg} | grep "chmod: '777'" | wc -l`
[ "${cnt}" != "5" ] && echo "chmod not updated (5)" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ touch ${dt}/folder/a
# the dotfile to be imported
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
# some files
cp -r ${dt}/folder ${tmpd}/
mkdir -p ${tmpd}/folder
@@ -151,8 +154,5 @@ cd ${ddpath} | ${bin} compare -c ${cfg} --verbose --profile=p1
[ "$?" != "0" ] && exit 1
set -e
# CLEANING
rm -rf ${basedir} ${tmpd}
echo "OK"
exit 0

View File

@@ -54,6 +54,9 @@ echo "[+] dotpath dir: ${basedir}/dotfiles"
# the dotfile to be imported
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
# some files
mkdir -p ${tmpd}/{program,config,vscode}
touch ${tmpd}/program/a
@@ -182,8 +185,5 @@ cd ${ddpath} | ${bin} compare -c ${cfg2} --verbose -C ${tmpd}/.zsh
[ "$?" != "0" ] && exit 1
set -e
## CLEANING
rm -rf ${basedir} ${tmpd}
echo "OK"
exit 0

View File

@@ -54,6 +54,9 @@ echo "[+] dotpath dir: ${basedir}/dotfiles"
# the dotfile to be imported
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
# some files
mkdir -p ${tmpd}/{program,config}
touch ${tmpd}/program/a
@@ -194,8 +197,5 @@ cat ${cfg2}
cd ${ddpath} | ${bin} compare -c ${cfg2} --verbose
[ "$?" != "0" ] && exit 1
## CLEANING
rm -rf ${basedir} ${tmpd}
echo "OK"
exit 0

View File

@@ -77,6 +77,9 @@ echo "[+] dotpath dir: ${basedir}/dotfiles"
# the dotfile to be imported
tmpd=`mktemp -d --suffix='-dotdrop-tests' 2>/dev/null || mktemp -d`
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
# some files
mkdir -p ${tmpd}/program/ignore_me
echo "some data" > ${tmpd}/program/a
@@ -146,7 +149,4 @@ echo ${ret}
[ "${ret}" = "0" ] && exit 1
set -e
# clean
rm -rf ${basedir} ${tmpd}
echo "OK"

View File

@@ -76,6 +76,9 @@ echo "[+] dotpath dir: ${basedir}/dotfiles"
# the dotfile to be imported
tmpd=`mktemp -d --suffix='-dotdrop-tests' 2>/dev/null || mktemp -d`
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
# some files
mkdir -p ${tmpd}/program/ignore_me
echo "some data" > ${tmpd}/program/a
@@ -125,8 +128,5 @@ cd ${ddpath} | ${bin} compare -c ${cfg2} --verbose
[ "$?" = "0" ] && exit 1
set -e
# clean
rm -rf ${basedir} ${tmpd}
echo "OK"
exit 0

View File

@@ -56,6 +56,9 @@ echo "${yori}" > ${dt}/file_y
tmpd=`mktemp -d --suffix='-dotdrop-tests-dest' || mktemp -d`
touch ${tmpd}/file
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
cat > ${cfg} << _EOF
@@ -140,8 +143,5 @@ cd ${ddpath} | ${bin} compare -c ${cfg} --verbose -p y
[ "$?" = "0" ] && exit 1
set -e
# CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -54,6 +54,9 @@ echo "[+] dotpath dir: ${basedir}/dotfiles"
# the dotfile to be imported
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
# single file
echo 'unique' > ${tmpd}/uniquefile
@@ -121,8 +124,5 @@ cd ${ddpath} | ${bin} compare -c ${cfg} -L
[ "$?" = "0" ] && exit 1
set -e
## CLEANING
rm -rf ${basedir} ${tmpd}
echo "OK"
exit 0

View File

@@ -56,6 +56,8 @@ basedir=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
echo "[+] dotdrop dir: ${basedir}"
echo "[+] dotpath dir: ${basedir}/dotfiles"
clear_on_exit "${basedir}"
export DOTDROP_WORKERS=1
# create the config file
@@ -94,11 +96,13 @@ echo "[+] test install not existing src"
cd ${ddpath} | ${bin} install -c ${cfg} -f --dry -p p1 --verbose f_y
echo "[+] test install to temp"
cd ${ddpath} | ${bin} install -t -c ${cfg} -p p1 --verbose f_x
[ "$?" != "0" ] && exit 1
cd ${ddpath} | ${bin} install -t -c ${cfg} -p p1 --verbose f_x > ${basedir}/log 2>&1
[ "$?" != "0" ] && echo "install to tmp failed" && exit 1
## CLEANING
rm -rf ${basedir}
# cleaning
tmpfile=`cat ${basedir}/log | grep 'installed to tmp ' | sed 's/^.*to tmp "\(.*\)"./\1/'`
echo "tmpfile: ${tmpfile}"
rm -rf "${tmpfile}"
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -133,8 +136,5 @@ cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -G | grep '^f_children' | head -1 |
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -G | grep '^f_children2' | head -1 | grep ',link:link_children,'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -G | grep '^f_children3' | head -1 | grep ',link:nolink,'
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -54,6 +54,9 @@ echo "[+] dotpath dir: ${basedir}/dotfiles"
# the dotfile to be imported
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
# some files
echo "original" > ${tmpd}/singlefile
@@ -117,8 +120,5 @@ set -e
#cat ${tmpd}/fake
grep fakediff ${tmpd}/fake &> /dev/null || exit 1
## CLEANING
rm -rf ${basedir} ${tmpd}
echo "OK"
exit 0

View File

@@ -54,6 +54,9 @@ echo "dotdrop dir: ${basedir}"
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
create_dir ${tmpd}
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${basedir}/config.yaml"
create_conf ${cfg} # sets token
@@ -69,8 +72,5 @@ cd ${ddpath} | ${bin} update -f -c ${cfg} ${tmpd} --verbose
grep 'changed' ${token} >/dev/null 2>&1
## CLEANING
rm -rf ${basedir} ${tmpd}
echo "OK"
exit 0

View File

@@ -54,6 +54,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -88,8 +91,5 @@ grep "^dotpath: ${tmps}/dotfiles$" ${tmpd}/abc >/dev/null
grep "^cfgpath: ${tmps}/config.yaml$" ${tmpd}/abc >/dev/null
grep "^workdir: /tmp/xxx$" ${tmpd}/abc >/dev/null
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -55,6 +55,9 @@ echo "dotfiles source (dotpath): ${tmps}"
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
echo "dotfiles destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -88,8 +91,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -b -V
[ ! -e ${tmpd}/abc ] && exit 1
grep 'abc' ${tmpd}/abc
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpx} ${tmpy}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -99,8 +102,5 @@ grep "dst:${tmpd}/abc/file1" ${tmpd}/abc/file1>/dev/null
grep "src:${tmps}/dotfiles/abc/subdir/file2" ${tmpd}/abc/subdir/file2 >/dev/null
grep "dst:${tmpd}/abc/subdir/file2" ${tmpd}/abc/subdir/file2 >/dev/null
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -88,8 +91,5 @@ grep "dst:${tmpd}/abc" ${tmpd}/abc >/dev/null
grep "key:f_abc" ${tmpd}/abc >/dev/null
grep "link:nolink" ${tmpd}/abc >/dev/null
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -55,6 +55,9 @@ echo "dotfiles source (dotpath): ${tmps}"
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
echo "dotfiles destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -110,8 +113,5 @@ ret="$?"
set -e
[ "$ret" = "0" ] && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpx} ${tmpy}
echo "OK"
exit 0

View File

@@ -55,6 +55,9 @@ echo "dotfiles source (dotpath): ${tmps}"
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
echo "dotfiles destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -92,8 +95,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -b -V
# checks
[ ! -e ${tmpd}/abc ] && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -55,6 +55,11 @@ tmpw=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
# temp
tmpa=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${tmpw}"
clear_on_exit "${tmpa}"
# -----------------------------
# test install
# -----------------------------
@@ -312,8 +317,5 @@ cd ${ddpath} | ${bin} remove -c ${cfg} -f -p p1 -V --dry ${dotfiles}
diff ${cfg} ${tmpa}/config.yaml || (echo "dry remove failed (8)" && exit 1)
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpw} ${tmpa}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -98,8 +101,5 @@ cd ${ddpath} | ${bin} import --verbose -c ${cfg} -p p2 \
cnt=`cd ${ddpath} | ${bin} files --verbose -c ${cfg} -p p2 -b | grep '^f_' | wc -l`
[ "${cnt}" != "4" ] && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -54,6 +54,10 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${tmpa}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -120,8 +124,5 @@ grep 'dvar1 dvar2 dvar3' ${tmpa}/postaction2 >/dev/null
grep 'var1 var2 var3' ${tmpa}/naked1 >/dev/null
grep 'dvar1 dvar2 dvar3' ${tmpa}/naked2 >/dev/null
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpa}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -88,8 +91,5 @@ grep "^${tmpd}" ${tmpd}/abc >/dev/null
#cat ${tmpd}/abc
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -53,6 +53,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
extvars="${tmps}/variables.yaml"
extdvars="${tmps}/dynvariables.yaml"
@@ -148,8 +151,5 @@ grep '^pvar: pvar1' ${tmpd}/abc >/dev/null
grep '^pdvar: pdvar1' ${tmpd}/abc >/dev/null
grep '^test: profileok' ${tmpd}/abc >/dev/null
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -109,8 +112,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p profile_4 --verbose
#cat ${tmpd}/def
grep ${c2} ${tmpd}/def >/dev/null || exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -53,11 +53,15 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create a shell script
export TESTENV="this is my testenv"
scr=`mktemp --suffix='-dotdrop-tests' || mktemp -d`
chmod +x ${scr}
echo -e "#!/bin/bash\necho $TESTENV\n" >> ${scr}
clear_on_exit "${scr}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -107,8 +111,5 @@ grep '^4ravd_eht' ${tmpd}/abc >/dev/null
#cat ${tmpd}/abc
## CLEANING
rm -rf ${tmps} ${tmpd} ${scr}
echo "OK"
exit 0

View File

@@ -54,6 +54,10 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${tmpa}"
act="${tmps}/actions.yaml"
cat > ${act} << _EOF
actions:
@@ -116,8 +120,5 @@ echo "naked is ok"
grep over ${tmpa}/write >/dev/null
echo "write is ok"
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpa}
echo "OK"
exit 0

View File

@@ -53,6 +53,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
extvars="${tmps}/variables.yaml"
cfg="${tmps}/config.yaml"
@@ -195,8 +198,5 @@ grep '^dvar4: extvar1 var2 var3' ${tmpd}/abc >/dev/null
grep '^varx: profvarx' ${tmpd}/abc >/dev/null
grep '^vary: profvary' ${tmpd}/abc >/dev/null
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -56,6 +56,12 @@ filter_file=`mktemp`
filter_file2=`mktemp`
filter_file3=`mktemp`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${filter_file}"
clear_on_exit "${filter_file2}"
clear_on_exit "${filter_file3}"
# create the config file
cfg="${tmps}/config.yaml"
cfgext="${tmps}/ext.yaml"
@@ -135,8 +141,5 @@ grep '^something$' ${tmpd}/abc >/dev/null && exit 1
set -e
grep '^filteredvariable$' ${tmpd}/abc > /dev/null
## CLEANING
rm -rf ${tmps} ${tmpd} ${filter_file} ${filter_file2} ${filter_file3}
echo "OK"
exit 0

View File

@@ -54,6 +54,10 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${tmpa}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -117,8 +121,5 @@ grep pre2 ${tmpa}/pre2 >/dev/null
[ ! -e ${tmpa}/post2 ] && exit 1
grep post2 ${tmpa}/post2 >/dev/null
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpa}
echo "OK"
exit 0

View File

@@ -56,6 +56,12 @@ func_file=`mktemp`
func_file2=`mktemp`
func_file3=`mktemp`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${func_file}"
clear_on_exit "${func_file2}"
clear_on_exit "${func_file3}"
# create the config file
cfg="${tmps}/config.yaml"
cfgext="${tmps}/ext.yaml"
@@ -151,8 +157,5 @@ grep '^nope$' ${tmpd}/abc >/dev/null && exit 1
set -e
grep '^Falseadded$' ${tmpd}/abc >/dev/null
## CLEANING
rm -rf ${tmps} ${tmpd} ${func_file} ${func_file2} ${func_file3}
echo "OK"
exit 0

View File

@@ -54,6 +54,9 @@ echo "[+] dotpath dir: ${basedir}/dotfiles"
# the dotfile to be imported
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
# some files
mkdir -p ${tmpd}/{program,config}
touch ${tmpd}/program/a
@@ -105,8 +108,5 @@ cd ${ddpath} | ${bin} compare -c ${cfg2} --verbose
[ "$?" != "0" ] && exit 1
set -e
## CLEANING
rm -rf ${basedir} ${tmpd}
echo "OK"
exit 0

View File

@@ -77,6 +77,9 @@ echo "[+] dotpath dir: ${basedir}/dotfiles"
# the dotfile to be imported
tmpd=`mktemp -d --suffix='-dotdrop-tests' 2>/dev/null || mktemp -d`
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
# some files
mkdir -p ${tmpd}/{program,config}
touch ${tmpd}/program/a
@@ -112,8 +115,5 @@ cd ${ddpath} | ${bin} compare -c ${cfg2} --verbose
[ "$?" = "0" ] && exit 1
set -e
## CLEANING
rm -rf ${basedir} ${tmpd}
echo "OK"
exit 0

View File

@@ -58,6 +58,9 @@ echo 'a' > ${dt}/a/c/acfile
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
cp -r ${dt}/a ${tmpd}/
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
cat > ${cfg} << _EOF
@@ -104,8 +107,5 @@ grep 'b' ${dt}/a/c/acfile || (echo "acfile not updated" && exit 1)
set -e
[ -e ${dt}/a/newfile ] && echo "newfile found" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -83,6 +83,9 @@ echo 'a' > ${basedir}/dotfiles/a/c/acfile
tmpd=`mktemp -d --suffix='-dotdrop-tests' 2>/dev/null || mktemp -d`
cp -r ${basedir}/dotfiles/a ${tmpd}/
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${basedir}/config.yaml"
cat > ${cfg} << _EOF
@@ -128,8 +131,5 @@ set -e
[ -e ${basedir}/dotfiles/a/newdir/b/c ] && echo "newdir/b/c should not have been updated" && exit 1
[ ! -e ${basedir}/dotfiles/a/newdir/b/d ] && echo "newdir/b/d should have been updated" && exit 1
## CLEANING
rm -rf ${basedir} ${tmpd}
echo "OK"
exit 0

View File

@@ -57,6 +57,10 @@ tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
# temporary
tmpa=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${tmpa}"
###########
# test globs in import_actions
###########
@@ -107,8 +111,5 @@ grep fromaction1 ${tmpa}/fromaction1
[ ! -e ${tmpa}/fromaction2 ] && echo "action2 not executed" && exit 1
grep fromaction2 ${tmpa}/fromaction2
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpa}
echo "OK"
exit 0

View File

@@ -54,6 +54,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -88,8 +91,5 @@ grep '^// This dotfile is managed using dotdrop' ${tmpd}/abc >/dev/null
#cat ${tmpd}/abc
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -3,6 +3,31 @@
#
# file to be sourced from test scripts
#
# for i in *.sh; do ./$i >/dev/null 2>&1; find /tmp/ -maxdepth 1 -type f -iname 'tmp*' >> /tmp/$i.log; find /tmp/ -maxdepth 1 -type d -iname 'tmp.*-dotdrop-tests' >> /tmp/$i.log; find /tmp/ -maxdepth 1 -type d -iname 'dotdrop-*' >> /tmp/$i.log; wc -l /tmp/$i.log; [ "`wc -l /tmp/$i.log | awk '{print $1}'`" -gt "0" ] && break; done
declare -a to_be_cleared
# add a file/directory to be cleared
# on exit
#
# $1: file path to clear
clear_on_exit()
{
local len="${#to_be_cleared[*]}"
to_be_cleared[${len}]="$1"
if [ "${len}" = "0" ]; then
# set trap
trap on_exit EXIT
fi
}
# clear files
on_exit()
{
for i in "${to_be_cleared[@]}"; do
rm -rf "${i}"
done
}
# create a directory with sub-dirs and file
# for tests

View File

@@ -54,6 +54,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -116,8 +119,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
[ -e ${tmpd}/d1/empty ] && echo 'empty should not exist' && exit 1
[ ! -e ${tmpd}/d1/notempty ] && echo 'not empty should exist' && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -45,11 +45,6 @@ echo -e "$(tput setaf 6)==> RUNNING $(basename $BASH_SOURCE) <==$(tput sgr0)"
# this is the test
################################################################
clean()
{
rm -rf ${tmps} ${tmpd} ~/.dotdrop.test ~/.dotdrop-dotfiles-test
}
# the dotfile source
tmps=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
mkdir -p ${tmps}/dotfiles
@@ -57,6 +52,11 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "~/.dotdrop.test"
clear_on_exit "~/.dotdrop-dotfiles-test"
# create the dotfile
mkdir -p ${tmpd}/adir
echo "adir/file1" > ${tmpd}/adir/file1
@@ -140,11 +140,8 @@ _EOF
cd ${ddpath} | ${bin} import -b -c ${cfg} -p test -V ~/.dotdrop.test --as=~/.whatever
#cat ${cfg}
[ ! -e ~/.dotdrop-dotfiles-test/dotfiles/whatever ] && clean && echo 'tild imported' && exit 1
cat ${cfg} | grep '~/.whatever' && clean && echo 'import with tild failed' && exit 1
## CLEANING
clean
[ ! -e ~/.dotdrop-dotfiles-test/dotfiles/whatever ] && echo 'tild imported' && exit 1
cat ${cfg} | grep '~/.whatever' && echo 'import with tild failed' && exit 1
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles-other
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg1="${tmps}/config1.yaml"
cfg2="${tmps}/config2.yaml"
@@ -175,8 +178,5 @@ _EOF
cd ${ddpath} | ${bin} install -c ${cfg1} -p p2 -V -f
cd ${ddpath} | ${bin} compare -c ${cfg1} -p p2 -V
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the dotfile
touch ${tmpd}/.colors
mkdir -p ${tmpd}/.mutt
@@ -103,8 +106,5 @@ cat ${cfg}
cat ${cfg} | grep ${tmpd}/.mutt/colors >/dev/null 2>&1
cat ${cfg} | grep ${tmpd}/.colors >/dev/null 2>&1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -60,6 +60,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# dotdrop directory
mkdir -p ${tmpd}
mkdir -p ${tmpd}/a/{b,c}
@@ -93,8 +96,5 @@ cd ${ddpath} | ${bin} import -c ${cfg} --verbose --profile=p1 ${tmpd}/a
[ -e ${tmps}/dotfiles/newdir/newfile ] && echo "newfile not ignored" && exit 1
[ -e ${tmps}/dotfiles/a/b/newfile ] && echo "newfile not ignored" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# dotpath
dotpath="${tmps}/dotfiles"
mkdir -p ${dotpath}
@@ -123,8 +126,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
[ ! -h ${dtsub2} ] && echo "dtsub2 is not a symlink" && exit 1
[ -h ${dtsub3} ] && echo "dtsub3 is not a regular directory" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -75,6 +75,9 @@ mkdir -p ${basedir}/dotfiles
# the dotfile destination
tmpd=`mkdir -d --suffix='-dotdrop-tests' 2>/dev/null || mktemp -d`
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
# dotdrop directory
echo "[+] dotdrop dir: ${basedir}"
echo "[+] dotpath dir: ${basedir}/dotfiles"
@@ -109,8 +112,5 @@ cd ${ddpath} | ${bin} import -f -c ${cfg2} --verbose --profile=p1 ${tmpd}/a --as
[ -e ${basedir}/dotfiles/a/b/abfile2 ] && echo "abfile2 should not have been imported" && exit 1
[ ! -e ${basedir}/dotfiles/a/b/abfile3 ] && echo "abfile3 should have been imported" && exit 1
## CLEANING
rm -rf ${tmpd} ${basedir}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the dotfile
echo "test" > ${tmps}/dotfiles/abc
@@ -296,8 +299,5 @@ cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V
[ "$?" = "0" ] && echo "configs glob" && exit 1
set -e
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -53,6 +53,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
extdotfiles="${tmps}/df_p1.yaml"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
dynextdotfiles_name="d_uid_dynvar"
dynextdotfiles="${tmps}/ext_${dynextdotfiles_name}"
@@ -121,8 +124,5 @@ grep 'def' ${tmpd}/def >/dev/null 2>&1
grep 'xyz' ${tmpd}/xyz >/dev/null 2>&1
grep 'dyn' ${tmpd}/dyn >/dev/null 2>&1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -53,6 +53,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the dotfile
mkdir -p ${tmpd}/adir
echo "first" > ${tmpd}/adir/file1
@@ -84,8 +87,5 @@ cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/adir/file1
[ ! -e ${tmps}/dotfiles/${tmpd}/adir/file1 ] && echo "not exist" && exit 1
grep 'second' ${tmps}/dotfiles/${tmpd}/adir/file1 >/dev/null
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -53,6 +53,9 @@ echo "[+] dotpath dir: ${basedir}/dotfiles"
# the temp directory
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
# create a dotfile
dftoimport="${tmpd}/a_dotfile"
echo 'some content' > ${dftoimport}
@@ -101,13 +104,10 @@ cd ${ddpath} | ${bin} install -c ${cfg} -f -p p1 --verbose | grep '^5 dotfile(s)
rm -f ${dftoimport}
cd ${ddpath} | ${bin} install -c ${cfg} -f -p p1 --verbose | grep '^6 dotfile(s) installed.$'
nb=`cd ${ddpath} | ${bin} files -c ${cfg} -p p1 --verbose | grep '^[a-zA-Z]' | wc -l`
[ "${nb}" != "6" ] && echo 'error in dotfile list' && exit 1
nb=`cd ${ddpath} | ${bin} files -c ${cfg} -p p1 --verbose | grep '^[a-zA-Z]' | grep -v '^Dotfile(s)' | wc -l`
[ "${nb}" != "6" ] && echo "error in dotfile list (${nb} VS 6)" && exit 1
#cat ${cfg}
## CLEANING
rm -rf ${basedir} ${tmpd}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the dotfile
mkdir -p ${tmpd}/adir
echo "adir/file1" > ${tmpd}/adir/file1
@@ -130,8 +133,5 @@ cd ${ddpath} | ${bin} import -c ${cfg} -p p2 -V ${d}
cat ${cfg} | grep ${d} >/dev/null 2>&1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -53,6 +53,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
extcfg="${tmps}/ext-config.yaml"
cfg="${tmps}/config.yaml"
@@ -132,8 +135,5 @@ grep '^provar: provar' ${tmpd}/abc >/dev/null
grep '^dvarx: dprofvarx' ${tmpd}/abc >/dev/null
grep '^dprovar: dprovar' ${tmpd}/abc >/dev/null
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
subcfg="${tmps}/subconfig.yaml"
@@ -103,8 +106,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
exit 1
}
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -55,6 +55,10 @@ tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
# the action temp
tmpa=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${tmpa}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -177,8 +181,5 @@ nb=`wc -l ${tmpa}/post2 | awk '{print $1}'`
nb=`wc -l ${tmpa}/naked | awk '{print $1}'`
[ "${nb}" != "1" ] && echo "naked executed multiple times" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpa}
echo "OK"
exit 0

View File

@@ -55,6 +55,10 @@ tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
# temporary
tmpa=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${tmpa}"
export DOTDROP_WORKERS=1
# create the config file
cfg="${tmps}/config.yaml"
@@ -137,8 +141,5 @@ for ((i=0;i<${attempts};i++)); do
rm ${tmpd}/first ${tmpd}/second ${tmpd}/third
done
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpa}
echo "OK"
exit 0

View File

@@ -53,6 +53,9 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -101,8 +104,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p0 --verbose
grep 'p0v' ${tmpd}/abc
grep 'p0dv' ${tmpd}/abc
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -116,8 +119,5 @@ cnt=`cd ${ddpath} | ${bin} files -c ${cfg} -p p0 | grep f_abc | wc -l`
cnt=`cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -b | grep '^f_' | wc -l`
[ "${cnt}" != "1" ] && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -53,6 +53,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the dotfile
mkdir -p ${tmps}/dotfiles/abc
echo "test link_dotfile_default 1" > ${tmps}/dotfiles/abc/file1
@@ -159,8 +162,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
[ ! -h ${tmpd}/abc/file2 ] && echo "not a symlink" && exit 1
rm -rf ${tmpd}/abc
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -51,6 +51,8 @@ basedir=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
echo "[+] dotdrop dir: ${basedir}"
echo "[+] dotpath dir: ${basedir}/dotfiles"
clear_on_exit "${basedir}"
# create the config file
cfg="${basedir}/config.yaml"
cat > ${cfg} << _EOF
@@ -90,8 +92,5 @@ echo "[+] install"
cd ${ddpath} | ${bin} install -c ${cfg} -f -p p1 --verbose | grep '^5 dotfile(s) installed.$'
[ "$?" != "0" ] && exit 1
## CLEANING
rm -rf ${basedir}
echo "OK"
exit 0

View File

@@ -55,6 +55,9 @@ echo "[+] dotpath dir: ${basedir}/dotfiles"
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
tmps="${basedir}"
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
# some files
mkdir -p ${tmpd}/{program,config,vscode}
echo "some data" > ${tmpd}/program/a
@@ -179,8 +182,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg2} -p p1 -V f_template
grep 'p1' ${tmpd}/nvim/templated/ftemplated
grep 'p1' ${tmpd}/nvim/template
## CLEANING
rm -rf ${basedir} ${tmpd}
echo "OK"
exit 0

View File

@@ -53,6 +53,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -105,8 +108,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
grep "p1" ${tmpd}/dir1/not-empty/file
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -77,6 +77,9 @@ echo "[+] dotpath dir: ${basedir}/dotfiles"
# the dotfile to be imported
tmpd=`mktemp -d --suffix='-dotdrop-tests' 2>/dev/null || mktemp -d`
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
# some files
mkdir -p ${tmpd}/program/ignore_me
echo "some data" > ${tmpd}/program/a
@@ -118,9 +121,6 @@ echo "(1) didn't find program/b ... good"
[[ -n "$(find ${tmpd}/program/ignore_me -name c)" ]] || exit 1
echo "(1) found program/c ... good"
## CLEANING
rm -rf ${basedir} ${tmpd}
echo "OK"
exit 0

View File

@@ -53,6 +53,9 @@ tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
echo "[+] dotdrop dir: ${basedir}"
echo "[+] dotpath dir: ${basedir}/dotfiles"
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${basedir}/config.yaml"
cat > ${cfg} << _EOF
@@ -87,8 +90,5 @@ echo "[+] install"
cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 --showdiff --verbose --temp | grep '^3 dotfile(s) installed.$'
[ "$?" != "0" ] && exit 1
## CLEANING
rm -rf ${basedir}
echo "OK"
exit 0

View File

@@ -72,6 +72,9 @@ echo "[+] dotdrop dir: ${basedir}"
echo "[+] dotpath dir: ${basedir}/dotfiles"
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
echo "content" > ${basedir}/dotfiles/x
# create the config file
@@ -120,8 +123,5 @@ cd ${ddpath} | printf "y\n" | ${bin} install -c ${cfg} -p p1 --verbose
has_rights "${tmpd}/x" "666"
## CLEANING
rm -rf ${basedir} ${tmpd}
echo "OK"
exit 0

View File

@@ -53,6 +53,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -137,8 +140,5 @@ set -e
grep "dotfile dst filename: `basename ${tmpd}/def`" ${tmpd}/def
grep "dotfile dst dirname: `dirname ${tmpd}/def`" ${tmpd}/def
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -101,8 +104,5 @@ inside="${tmps}/dotfiles/${tmpd}/abc"
cat ${cfg}
cat ${cfg} | grep 'link: link' >/dev/null
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -57,6 +57,9 @@ echo "dotfiles destination: ${tmpd}"
tmpw=`mktemp -d -p ${HOME} --suffix='-dotdrop-tests' || mktemp -d`
echo "workdir: ${tmpw}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${tmpw}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -97,8 +100,5 @@ set +e
grep '{{@@' ${tmpd}/abc/template >/dev/null 2>&1 && echo "[ERROR] template in dir not replace" && exit 1
set -e
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpw}
echo "OK"
exit 0

View File

@@ -57,6 +57,9 @@ echo "dotfiles destination: ${tmpd}"
tmpw=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
echo "workdir: ${tmpw}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${tmpw}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -97,8 +100,5 @@ set +e
grep '{{@@' ${tmpd}/abc/template >/dev/null 2>&1 && echo "[ERROR] template in dir not replace" && exit 1
set -e
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpw}
echo "OK"
exit 0

View File

@@ -57,6 +57,9 @@ echo "dotfiles destination: ${tmpd}"
tmpw=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
echo "workdir: ${tmpw}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${tmpw}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -90,8 +93,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -b -V
[ ! -e ${tmpd}/abc ] && echo "[ERROR] dotfile not installed" && exit 1
[ ! -h ${tmpd}/abc ] && echo "[ERROR] dotfile is not a symlink" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpw}
echo "OK"
exit 0

View File

@@ -53,6 +53,9 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -462,8 +465,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
[ ! -h ${df}/directory ] && echo "directory is not a symlink" && exit 1
[ -h ${df}/directory/file ] && echo "directory/file is a symlink" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -51,6 +51,9 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -95,8 +98,5 @@ cat ${tmpd}/abc
grep 'global_var' ${tmpd}/abc >/dev/null 2>&1
grep 'local_var' ${tmpd}/abc >/dev/null 2>&1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -50,6 +50,9 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
cfg="${tmps}/config.yaml"
cat > ${cfg} << _EOF
config:
@@ -127,8 +130,5 @@ cd ${ddpath} | ${bin} compare -c ${cfg} -p p1 -V
cat ${cfg}
grep 'minversion' ${cfg} && echo "minversion added, not needed" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -78,6 +78,9 @@ echo "[+] dotpath dir: ${basedir}/dotfiles"
# the dotfile to be imported
tmpd=`mktemp -d --suffix='-dotdrop-tests' 2>/dev/null || mktemp -d`
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
# some files
mkdir -p ${tmpd}/program/ignore_me
echo "some data" > ${tmpd}/program/a
@@ -109,8 +112,5 @@ pattern to work, it must match a file that is being ignored by a previous ignore
cd ${ddpath} | ${bin} install -c ${cfg2} --verbose 2>&1 >/dev/null | grep -F "${patt}" ||
(echo "dotdrop did not warn when negative ignore pattern did not match an already-ignored file" && exit 1)
## CLEANING
rm -rf ${basedir} ${tmpd}
echo "OK"
exit 0

View File

@@ -54,6 +54,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -280,9 +283,5 @@ echo "* normal dotfile"
[ ! -e ${tmpd}/fn ] && echo 'not installed' && exit 1
grep 'should not be stripped' ${tmpd}/fn && echo "no templated" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -55,6 +55,10 @@ tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
# the action temp
tmpa=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "${tmpa}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -131,8 +135,5 @@ nb=`wc -l ${tmpa}/post2 | awk '{print $1}'`
nb=`wc -l ${tmpa}/naked | awk '{print $1}'`
[ "${nb}" -gt "1" ] && echo "action naked executed twice" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpa}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
cfg2="${tmps}/sub.yaml"
@@ -138,8 +141,5 @@ grep 'subdyncontent' ${tmpd}/abc >/dev/null || (echo "dynvariables 2 not resolve
#cat ${tmpd}/abc
[ ! -e ${tmpd}/ghi ] && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -53,6 +53,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create a shell script
export TESTENV="this is my global testenv"
scr=`mktemp --suffix='-dotdrop-tests' || mktemp -d`
@@ -64,6 +67,9 @@ scr2=`mktemp --suffix='-dotdrop-tests' || mktemp -d`
chmod +x ${scr2}
echo -e "#!/bin/bash\necho $TESTENV2\n" >> ${scr2}
clear_on_exit "${scr}"
clear_on_exit "${scr2}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -124,8 +130,5 @@ grep "^cba" ${tmpd}/abc >/dev/null
#cat ${tmpd}/abc
## CLEANING
rm -rf ${tmps} ${tmpd} ${scr} ${scr2}
echo "OK"
exit 0

View File

@@ -54,6 +54,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -117,8 +120,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p pinclude -V
[ ! -e ${tmpd}/abc ] && echo "dotfile not installed" && exit 1
grep main ${tmpd}/abc
## CLEANING
rm -rf ${tmps} ${tmpd} ${scr} ${scr2}
echo "OK"
exit 0

View File

@@ -45,11 +45,6 @@ echo -e "$(tput setaf 6)==> RUNNING $(basename $BASH_SOURCE) <==$(tput sgr0)"
# this is the test
################################################################
clean()
{
rm -rf ${tmps} ${tmpd} ~/.dotdrop-test
}
# the dotfile source
tmps=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
mkdir -p ${tmps}/dotfiles
@@ -57,6 +52,10 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
clear_on_exit "~/.dotdrop-test"
# create the dotfile
echo "original" > ${tmpd}/testfile
@@ -79,11 +78,11 @@ cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/testfile
cat ${cfg}
# ensure exists and is not link
[ ! -e ${tmps}/dotfiles/${tmpd}/testfile ] && echo "does not exist" && clean && exit 1
[ ! -e ${tmps}/dotfiles/${tmpd}/testfile ] && echo "does not exist" && exit 1
cat ${cfg} | grep ${tmpd}/testfile >/dev/null 2>&1
grep 'original' ${tmps}/dotfiles/${tmpd}/testfile
nb=`cat ${cfg} | grep ${tmpd}/testfile | wc -l`
[ "${nb}" != "1" ] && echo 'not 1 entry' && clean && exit 1
[ "${nb}" != "1" ] && echo 'not 1 entry' && exit 1
# re-import without changing
echo "[+] re-import without changes"
@@ -91,11 +90,11 @@ cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/testfile
cat ${cfg}
# test is only once
[ ! -e ${tmps}/dotfiles/${tmpd}/testfile ] && echo "does not exist" && clean && exit 1
[ ! -e ${tmps}/dotfiles/${tmpd}/testfile ] && echo "does not exist" && exit 1
cat ${cfg} | grep ${tmpd}/testfile >/dev/null 2>&1
grep 'original' ${tmps}/dotfiles/${tmpd}/testfile
nb=`cat ${cfg} | grep ${tmpd}/testfile | wc -l`
[ "${nb}" != "1" ] && echo 'two entries!' && clean && exit 1
[ "${nb}" != "1" ] && echo 'two entries!' && exit 1
# re-import with changes
echo "[+] re-import with changes"
@@ -104,11 +103,11 @@ cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ${tmpd}/testfile
cat ${cfg}
# test is only once
[ ! -e ${tmps}/dotfiles/${tmpd}/testfile ] && echo "does not exist" && clean && exit 1
[ ! -e ${tmps}/dotfiles/${tmpd}/testfile ] && echo "does not exist" && exit 1
cat ${cfg} | grep ${tmpd}/testfile >/dev/null 2>&1
grep 'modified' ${tmps}/dotfiles/${tmpd}/testfile
nb=`cat ${cfg} | grep ${tmpd}/testfile | wc -l`
[ "${nb}" != "1" ] && echo 'two entries!' && clean && exit 1
[ "${nb}" != "1" ] && echo 'two entries!' && exit 1
# ###################################################
@@ -119,11 +118,11 @@ cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ~/.dotdrop.test
cat ${cfg}
# ensure exists and is not link
[ ! -e "${tmps}/dotfiles/dotdrop.test" ] && echo "does not exist" && clean && exit 1
[ ! -e "${tmps}/dotfiles/dotdrop.test" ] && echo "does not exist" && exit 1
cat ${cfg} | grep "~/.dotdrop.test" >/dev/null 2>&1
grep 'original' ${tmps}/dotfiles/dotdrop.test
nb=`cat ${cfg} | grep "~/.dotdrop.test" | wc -l`
[ "${nb}" != "1" ] && echo 'not 1 entry' && clean && exit 1
[ "${nb}" != "1" ] && echo 'not 1 entry' && exit 1
# re-import without changing
echo "[+] re-import without changes in home"
@@ -131,11 +130,11 @@ cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ~/.dotdrop.test
cat ${cfg}
# test is only once
[ ! -e "${tmps}/dotfiles/dotdrop.test" ] && echo "does not exist" && clean && exit 1
[ ! -e "${tmps}/dotfiles/dotdrop.test" ] && echo "does not exist" && exit 1
cat ${cfg} | grep "~/.dotdrop.test" >/dev/null 2>&1
grep 'original' ${tmps}/dotfiles/dotdrop.test
nb=`cat ${cfg} | grep "~/.dotdrop.test" | wc -l`
[ "${nb}" != "1" ] && echo 'two entries!' && clean && exit 1
[ "${nb}" != "1" ] && echo 'two entries!' && exit 1
# re-import with changes
echo "[+] re-import with changes in home"
@@ -144,14 +143,11 @@ cd ${ddpath} | ${bin} import -f -c ${cfg} -p p1 -V ~/.dotdrop.test
cat ${cfg}
# test is only once
[ ! -e "${tmps}/dotfiles/dotdrop.test" ] && echo "does not exist" && clean && exit 1
[ ! -e "${tmps}/dotfiles/dotdrop.test" ] && echo "does not exist" && exit 1
cat ${cfg} | grep "~/.dotdrop.test" >/dev/null 2>&1
grep 'modified' ${tmps}/dotfiles/dotdrop.test
nb=`cat ${cfg} | grep "~/.dotdrop.test" | wc -l`
[ "${nb}" != "1" ] && echo 'two entries!' && clean && exit 1
## CLEANING
clean
[ "${nb}" != "1" ] && echo 'two entries!' && exit 1
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
# the dotfile destination
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -135,8 +138,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p host -V
[ "$?" = 0 ] && exit 1
set -e
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -53,6 +53,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -102,8 +105,5 @@ grep '^dvar4: var1 var2 var3' ${tmpd}/abc >/dev/null
#cat ${tmpd}/abc
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
# the dotfile to be imported
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
cat > ${cfg} << _EOF
@@ -173,8 +176,5 @@ cat ${cfg}
cat ${cfg}
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
#echo "dotfile destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
##################################################
# test symlink directory
##################################################
@@ -215,8 +218,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
[ ! -h ${tmpd}/abc/file2 ] && echo "does not exist" && exit 1
grep '^p1$' ${tmpd}/abc/file1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -54,6 +54,9 @@ echo "dotfiles source (dotpath): ${tmps}"
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
echo "dotfiles destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -145,8 +148,5 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -b -V
[ ! -h ${tmpd}/f/2 ] && echo "[ERROR] children f/2 not linked" && exit 1
[ ! -h ${tmpd}/f/3 ] && echo "[ERROR] children f/3 not linked" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -54,6 +54,9 @@ echo "dotfiles source (dotpath): ${tmps}"
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
echo "dotfiles destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -144,8 +147,5 @@ grep "^abc; ${tmps}/dotfiles/abc; f_abc$" ${tmps}/dotfiles/abc
cat ${tmps}/dotfiles/ghi
grep "^ghi; readvar; writevar$" ${tmps}/dotfiles/ghi
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -54,6 +54,9 @@ echo "dotfiles source (dotpath): ${tmps}"
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
echo "dotfiles destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -133,8 +136,5 @@ grep "^abc; ${tmps}/dotfiles/abc; arg1; f_abc; arg2$" ${tmps}/dotfiles/abc
cat ${tmps}/dotfiles/ghi
grep "^ghi; readvar; p1; writevar; f_ghi$" ${tmps}/dotfiles/ghi
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -56,6 +56,9 @@ echo "dotfiles source (dotpath): ${tmps}"
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
echo "dotfiles destination: ${tmpd}"
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -110,6 +113,7 @@ echo 'marker' > ${tmps}/dotfiles/def
# create the compressed dotfile
tmpx=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmpx}"
mkdir -p ${tmpx}/{a,b,c}
mkdir -p ${tmpx}/a/{dir1,dir2}
# ambiguous redirect ??
@@ -205,6 +209,7 @@ tar -tf ${tmps}/dotfiles/ghi | grep './a/dir1/otherfile' || (echo "otherfile not
set -e
tmpy=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmpy}"
tar -xf ${tmps}/dotfiles/ghi -C ${tmpy}
content=`cat ${tmpy}/a/somefile`
[ "${content}" != "${touched}" ] && echo "bad content" && exit 1
@@ -212,8 +217,5 @@ content=`cat ${tmpy}/a/somefile`
# check canary dotfile
[ ! -e ${tmps}/dotfiles/def ] && echo "def not found" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd} ${tmpx} ${tmpy}
echo "OK"
exit 0

View File

@@ -60,6 +60,9 @@ cp -r ${dt}/folder ${tmpd}/
touch ${tmpd}/folder/b
mkdir ${tmpd}/folder/c
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
# create the config file
cfg="${tmps}/config.yaml"
cat > ${cfg} << _EOF
@@ -159,8 +162,5 @@ cd ${ddpath} | ${bin} update -f -c ${cfg} --verbose --profile=p1 --key thedotfil
[ -e ${dt}/folder/b ] && echo "should not have been updated" && exit 1
[ -e ${dt}/folder/c ] && echo "should not have been updated" && exit 1
# CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -56,6 +56,10 @@ echo 'a' > ${dt}/a/c/acfile
# fs dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
cp -r ${dt}/a ${tmpd}/
# create the config file
@@ -101,8 +105,5 @@ cd ${ddpath} | ${bin} update -f -c ${cfg} --verbose --profile=p1 --key f_abc
grep 'b' ${dt}/a/c/acfile >/dev/null || (echo "b not found" && exit 1)
[ -e ${dt}/a/newfile ] && echo "new file does not exist" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -63,6 +63,10 @@ echo 'a' > ${dt}/a/c/acfile
# fs dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
clear_on_exit "${tmps}"
clear_on_exit "${tmpd}"
cp -r ${dt}/a ${tmpd}/
# create the config file
@@ -104,8 +108,5 @@ cd ${ddpath} | ${bin} update -f -c ${cfg} --verbose --profile=p1 --key f_abc
grep_or_fail 'b' "${dt}/a/c/acfile"
[ -e ${dt}/a/newfile ] && echo "should not have been updated" && exit 1
## CLEANING
rm -rf ${tmps} ${tmpd}
echo "OK"
exit 0

View File

@@ -81,6 +81,10 @@ echo 'a' > ${basedir}/dotfiles/a/c/acfile
# the dotfile to be updated
tmpd=`mktemp -d --suffix='-dotdrop-tests' 2>/dev/null || mktemp -d`
clear_on_exit "${basedir}"
clear_on_exit "${tmpd}"
cp -r ${basedir}/dotfiles/a ${tmpd}/
# create the config file
@@ -128,8 +132,5 @@ set -e
[ -e ${basedir}/dotfiles/a/newdir/b/c ] && echo "newdir/b/c should not have been updated" && exit 1
[ ! -e ${basedir}/dotfiles/a/newdir/b/d ] && echo "newdir/b/d should have been updated" && exit 1
## CLEANING
rm -rf ${basedir} ${tmpd}
echo "OK"
exit 0

Some files were not shown because too many files have changed in this diff Show More