mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-12 03:38:59 +00:00
fix clear workdir tests
This commit is contained in:
@@ -52,11 +52,14 @@ mkdir -p ${basedir}/dotfiles
|
|||||||
echo "[+] dotdrop dir: ${basedir}"
|
echo "[+] dotdrop dir: ${basedir}"
|
||||||
echo "[+] dotpath dir: ${basedir}/dotfiles"
|
echo "[+] dotpath dir: ${basedir}/dotfiles"
|
||||||
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
|
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
|
||||||
tmpw=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
|
if [ -z "${DOTDROP_WORKDIR}" ]; then
|
||||||
|
tmpw=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
|
||||||
|
export DOTDROP_WORKDIR="${tmpw}"
|
||||||
|
clear_on_exit "${tmpw}"
|
||||||
|
fi
|
||||||
|
|
||||||
clear_on_exit "${basedir}"
|
clear_on_exit "${basedir}"
|
||||||
clear_on_exit "${tmpd}"
|
clear_on_exit "${tmpd}"
|
||||||
clear_on_exit "${tmpw}"
|
|
||||||
|
|
||||||
echo "{{@@ profile @@}}" > ${basedir}/dotfiles/x
|
echo "{{@@ profile @@}}" > ${basedir}/dotfiles/x
|
||||||
|
|
||||||
@@ -67,7 +70,6 @@ config:
|
|||||||
backup: true
|
backup: true
|
||||||
create: true
|
create: true
|
||||||
dotpath: dotfiles
|
dotpath: dotfiles
|
||||||
workdir: ${tmpw}
|
|
||||||
dotfiles:
|
dotfiles:
|
||||||
f_x:
|
f_x:
|
||||||
src: x
|
src: x
|
||||||
@@ -85,11 +87,10 @@ cd ${ddpath} | ${bin} install -c ${cfg} -f -p p1 --verbose | grep '^1 dotfile(s)
|
|||||||
|
|
||||||
[ ! -e ${tmpd}/x ] && echo "f_x not installed" && exit 1
|
[ ! -e ${tmpd}/x ] && echo "f_x not installed" && exit 1
|
||||||
[ ! -h ${tmpd}/x ] && echo "f_x not symlink" && exit 1
|
[ ! -h ${tmpd}/x ] && echo "f_x not symlink" && exit 1
|
||||||
ls -l ${tmpd}/x
|
[ ! -e ${DOTDROP_WORKDIR}/${tmpd}/x ] && echo "f_x not in workdir (${DOTDROP_WORKDIR}/${tmpd})" && exit 1
|
||||||
[ ! -e ${tmpw}/${tmpd}/x ] && echo "f_x not in workdir (${tmpw}/${tmpd})" && exit 1
|
|
||||||
|
|
||||||
# add file
|
# add file
|
||||||
touch ${tmpw}/new
|
touch ${DOTDROP_WORKDIR}/new
|
||||||
|
|
||||||
echo "[+] re-install with clear-workdir in cli"
|
echo "[+] re-install with clear-workdir in cli"
|
||||||
cd ${ddpath} | printf "y\n" | ${bin} install -W -c ${cfg} -p p1 --verbose
|
cd ${ddpath} | printf "y\n" | ${bin} install -W -c ${cfg} -p p1 --verbose
|
||||||
@@ -97,11 +98,11 @@ cd ${ddpath} | printf "y\n" | ${bin} install -W -c ${cfg} -p p1 --verbose
|
|||||||
|
|
||||||
[ ! -e ${tmpd}/x ] && echo "f_x not installed" && exit 1
|
[ ! -e ${tmpd}/x ] && echo "f_x not installed" && exit 1
|
||||||
[ ! -h ${tmpd}/x ] && echo "f_x not symlink" && exit 1
|
[ ! -h ${tmpd}/x ] && echo "f_x not symlink" && exit 1
|
||||||
[ ! -e ${tmpw}/${tmpd}/x ] && echo "f_x not in workdir (${tmpw}/${tmpd})" && exit 1
|
[ ! -e ${DOTDROP_WORKDIR}/${tmpd}/x ] && echo "f_x not in workdir (${DOTDROP_WORKDIR}/${tmpd})" && exit 1
|
||||||
[ -e ${tmpw}/new ] && echo "workdir not cleared (1)" && exit 1
|
[ -e ${DOTDROP_WORKDIR}/new ] && echo "workdir not cleared (1)" && exit 1
|
||||||
|
|
||||||
# add file
|
# add file
|
||||||
touch ${tmpw}/new
|
touch ${DOTDROP_WORKDIR}/new
|
||||||
|
|
||||||
echo "[+] re-install with config clear-workdir in config"
|
echo "[+] re-install with config clear-workdir in config"
|
||||||
cat > ${cfg} << _EOF
|
cat > ${cfg} << _EOF
|
||||||
@@ -109,7 +110,6 @@ config:
|
|||||||
backup: true
|
backup: true
|
||||||
create: true
|
create: true
|
||||||
dotpath: dotfiles
|
dotpath: dotfiles
|
||||||
workdir: ${tmpw}
|
|
||||||
clear_workdir: true
|
clear_workdir: true
|
||||||
dotfiles:
|
dotfiles:
|
||||||
f_x:
|
f_x:
|
||||||
@@ -126,8 +126,8 @@ cd ${ddpath} | printf "y\n" | ${bin} install -W -c ${cfg} -p p1 --verbose
|
|||||||
|
|
||||||
[ ! -e ${tmpd}/x ] && echo "f_x not installed" && exit 1
|
[ ! -e ${tmpd}/x ] && echo "f_x not installed" && exit 1
|
||||||
[ ! -h ${tmpd}/x ] && echo "f_x not symlink" && exit 1
|
[ ! -h ${tmpd}/x ] && echo "f_x not symlink" && exit 1
|
||||||
[ ! -e ${tmpw}/${tmpd}/x ] && echo "f_x not in workdir (${tmpw}/${tmpd})" && exit 1
|
[ ! -e ${DOTDROP_WORKDIR}/${tmpd}/x ] && echo "f_x not in workdir (${DOTDROP_WORKDIR}/${tmpd})" && exit 1
|
||||||
[ -e ${tmpw}/new ] && echo "workdir not cleared (2)" && exit 1
|
[ -e ${DOTDROP_WORKDIR}/new ] && echo "workdir not cleared (2)" && exit 1
|
||||||
|
|
||||||
echo "OK"
|
echo "OK"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
13
tests.sh
13
tests.sh
@@ -82,7 +82,8 @@ fi
|
|||||||
unset DOTDROP_DEBUG=
|
unset DOTDROP_DEBUG=
|
||||||
export DOTDROP_FORCE_NODEBUG=yes
|
export DOTDROP_FORCE_NODEBUG=yes
|
||||||
|
|
||||||
export DOTDROP_WORKDIR=/tmp/dotdrop-tests-workdir
|
tmpworkdir="/tmp/dotdrop-tests-workdir"
|
||||||
|
export DOTDROP_WORKDIR="${tmpworkdir}"
|
||||||
|
|
||||||
if [ ! -z ${workers} ]; then
|
if [ ! -z ${workers} ]; then
|
||||||
DOTDROP_WORKERS=${workers}
|
DOTDROP_WORKERS=${workers}
|
||||||
@@ -90,8 +91,8 @@ if [ ! -z ${workers} ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# run bash tests
|
# run bash tests
|
||||||
workdir_tmp="no"
|
workdir_tmp_exists="no"
|
||||||
[ -d "~/.config/dotdrop/tmp" ] && workdir_tmp="yes"
|
[ -d "~/.config/dotdrop/tmp" ] && workdir_tmp_exists="yes"
|
||||||
if [ -z ${GITHUB_WORKFLOW} ]; then
|
if [ -z ${GITHUB_WORKFLOW} ]; then
|
||||||
## local
|
## local
|
||||||
export COVERAGE_FILE=
|
export COVERAGE_FILE=
|
||||||
@@ -101,7 +102,11 @@ else
|
|||||||
export COVERAGE_FILE="${cur}/.coverage"
|
export COVERAGE_FILE="${cur}/.coverage"
|
||||||
tests-ng/tests-launcher.py 1
|
tests-ng/tests-launcher.py 1
|
||||||
fi
|
fi
|
||||||
[ "${workdir_tmp}" = "no" ] && rm -rf ~/.config/dotdrop/tmp
|
|
||||||
|
# clear workdir
|
||||||
|
[ "${workdir_tmp_exists}" = "no" ] && rm -rf ~/.config/dotdrop/tmp
|
||||||
|
# clear temp workdir
|
||||||
|
rm -rf "${tmpworkdir}"
|
||||||
|
|
||||||
## test the doc with remark
|
## test the doc with remark
|
||||||
## https://github.com/remarkjs/remark-validate-links
|
## https://github.com/remarkjs/remark-validate-links
|
||||||
|
|||||||
Reference in New Issue
Block a user