1 #!/bin/bash -ex 2 3 function mtime() { 4 stat -c %Y $1 5 } 6 7 # Go to top of blueprint tree 8 TOP=$(dirname ${BASH_SOURCE[0]})/.. 9 cd ${TOP} 10 11 rm -rf out.test 12 mkdir out.test 13 14 rm -rf src.test 15 mkdir src.test 16 cp -r tests/test_tree src.test/test_tree 17 ln -s ../.. src.test/test_tree/blueprint 18 19 cd out.test 20 export SRCDIR=../src.test/test_tree 21 ${SRCDIR}/blueprint/bootstrap.bash 22 ./blueprint.bash 23 24 if ! cmp -s ${SRCDIR}/build.ninja.in .minibootstrap/build.ninja.in; then 25 echo "tests/test_tree/build.ninja.in and .minibootstrap/build.ninja.in should be the same" >&2 26 echo "run regen_build_ninja_in.sh" >&2 27 exit 1 28 fi 29 30 OLDTIME=$(mtime build.ninja) 31 32 sleep 2 33 ./blueprint.bash 34 35 if [ ${OLDTIME} != $(mtime build.ninja) ]; then 36 echo "unnecessary build.ninja regeneration for null build" >&2 37 exit 1 38 fi 39 40 mkdir ${SRCDIR}/newglob 41 42 sleep 2 43 ./blueprint.bash 44 45 if [ ${OLDTIME} != $(mtime build.ninja) ]; then 46 echo "unnecessary build.ninja regeneration for glob addition" >&2 47 exit 1 48 fi 49 50 touch ${SRCDIR}/newglob/Blueprints 51 52 sleep 2 53 ./blueprint.bash 54 55 if [ ${OLDTIME} = $(mtime build.ninja) ]; then 56 echo "Failed to rebuild for glob addition" >&2 57 exit 1 58 fi 59 60 OLDTIME=$(mtime build.ninja) 61 rm ${SRCDIR}/newglob/Blueprints 62 63 sleep 2 64 ./blueprint.bash 65 66 if [ ${OLDTIME} = $(mtime build.ninja) ]; then 67 echo "Failed to rebuild for glob removal" >&2 68 exit 1 69 fi 70 71 OLDTIME=$(mtime build.ninja) 72 rmdir ${SRCDIR}/newglob 73 74 sleep 2 75 ./blueprint.bash 76 77 if [ ${OLDTIME} != $(mtime build.ninja) ]; then 78 echo "unnecessary build.ninja regeneration for glob removal" >&2 79 exit 1 80 fi 81