Make test_tree_tests.sh slightly easier to read

Bug: 64363847
Test: ./tests/test_tree_tests.sh
Change-Id: I40c1bcebf176bf4d70d4bc6339f419881013e0a6
This commit is contained in:
Jeff Gaston 2017-10-30 14:53:03 -07:00
parent 3802ba9f18
commit 4fc22f66c2

View file

@ -12,6 +12,7 @@ export TEMPDIR=$(mktemp -d -t blueprint.test.XXX)
function cleanup() {
cd "${TOP}"
echo "cleaning up ${TEMPDIR}"
rm -rf "${TEMPDIR}"
}
trap cleanup EXIT
@ -25,7 +26,10 @@ cp -r "${TOP}" "${SRCDIR}/blueprint"
cd "${OUTDIR}"
export BLUEPRINTDIR=${SRCDIR}/blueprint
#setup
${SRCDIR}/blueprint/bootstrap.bash $@
#confirm no build.ninja file is rebuilt when no change happens
./blueprint.bash
OLDTIME_BOOTSTRAP=$(mtime .bootstrap/build.ninja)
@ -44,20 +48,22 @@ if [ ${OLDTIME_BOOTSTRAP} != $(mtime .bootstrap/build.ninja) ]; then
exit 1
fi
#confirm no build.ninja file is rebuilt when a new directory is created
mkdir ${SRCDIR}/newglob
sleep 2
./blueprint.bash
if [ ${OLDTIME} != $(mtime build.ninja) ]; then
echo "unnecessary build.ninja regeneration for glob addition" >&2
echo "unnecessary build.ninja regeneration for new empty directory" >&2
exit 1
fi
if [ ${OLDTIME_BOOTSTRAP} != $(mtime .bootstrap/build.ninja) ]; then
echo "unnecessary .bootstrap/build.ninja regeneration for glob addition" >&2
echo "unnecessary .bootstrap/build.ninja regeneration for new empty directory" >&2
exit 1
fi
#confirm that build.ninja is rebuilt when a new Blueprints file is added
touch ${SRCDIR}/newglob/Blueprints
sleep 2
@ -72,6 +78,7 @@ if [ ${OLDTIME_BOOTSTRAP} = $(mtime .bootstrap/build.ninja) ]; then
exit 1
fi
#confirm that build.ninja is rebuilt when a glob match is removed
OLDTIME=$(mtime build.ninja)
OLDTIME_BOOTSTRAP=$(mtime .bootstrap/build.ninja)
rm ${SRCDIR}/newglob/Blueprints
@ -88,6 +95,7 @@ if [ ${OLDTIME_BOOTSTRAP} = $(mtime .bootstrap/build.ninja) ]; then
exit 1
fi
#confirm that build.ninja is not rebuilt when a glob match is removed
OLDTIME=$(mtime build.ninja)
OLDTIME_BOOTSTRAP=$(mtime .bootstrap/build.ninja)
rmdir ${SRCDIR}/newglob
@ -96,10 +104,13 @@ sleep 2
./blueprint.bash
if [ ${OLDTIME} != $(mtime build.ninja) ]; then
echo "unnecessary build.ninja regeneration for glob removal" >&2
echo "unnecessary build.ninja regeneration for removal of empty directory" >&2
exit 1
fi
if [ ${OLDTIME_BOOTSTRAP} != $(mtime .bootstrap/build.ninja) ]; then
echo "unnecessary .bootstrap/build.ninja regeneration for glob removal" >&2
echo "unnecessary .bootstrap/build.ninja regeneration for removal of empty directory" >&2
exit 1
fi
echo tests passed