From 4fc22f66c2fb8db2a8b727b0f24c53b24bc919c0 Mon Sep 17 00:00:00 2001 From: Jeff Gaston Date: Mon, 30 Oct 2017 14:53:03 -0700 Subject: [PATCH] Make test_tree_tests.sh slightly easier to read Bug: 64363847 Test: ./tests/test_tree_tests.sh Change-Id: I40c1bcebf176bf4d70d4bc6339f419881013e0a6 --- tests/test_tree_tests.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/test_tree_tests.sh b/tests/test_tree_tests.sh index 967cf3d..03d918f 100755 --- a/tests/test_tree_tests.sh +++ b/tests/test_tree_tests.sh @@ -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