David Pinedo | 4e886bf | 2015-06-30 15:37:50 -0600 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | #set -x |
| 3 | if [ -t 1 ] ; then |
| 4 | RED='\033[0;31m' |
| 5 | GREEN='\033[0;32m' |
| 6 | NC='\033[0m' # No Color |
| 7 | else |
| 8 | RED='' |
| 9 | GREEN='' |
| 10 | NC='' |
| 11 | fi |
| 12 | |
| 13 | printf "$GREEN[ RUN ]$NC $0\n" |
| 14 | |
David Pinedo | 2921c86 | 2015-06-30 16:04:23 -0600 | [diff] [blame] | 15 | D=`dirname \`pwd\`` |
| 16 | GDIR=../../../Glave/`basename $D`/ |
David Pinedo | 4e886bf | 2015-06-30 15:37:50 -0600 | [diff] [blame] | 17 | |
David Pinedo | 4e886bf | 2015-06-30 15:37:50 -0600 | [diff] [blame] | 18 | # Create a temp directory to run the test in |
| 19 | rm -rf vktracereplay_tmp |
| 20 | mkdir vktracereplay_tmp |
| 21 | cd vktracereplay_tmp |
| 22 | cp ../$GDIR/glvreplay . |
| 23 | cp ../$GDIR/glvtrace . |
| 24 | cp ../$GDIR/libglvreplay_vk.so . |
| 25 | cp ../$GDIR/libglvtrace_vk.so . |
| 26 | cp ../../demos/cube . |
| 27 | cp ../../demos/*png . |
| 28 | cp ../../demos/*spv . |
| 29 | export LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH |
| 30 | ( |
| 31 | ./glvtrace -s 1 -p cube -o c01.glv -l0 libglvtrace_vk.so & |
| 32 | P=$! |
| 33 | sleep 3 |
| 34 | kill $P |
| 35 | ) >/dev/null 2>&1 |
| 36 | mv 1.ppm 1_trace.ppm |
| 37 | ./glvreplay -s 1 -t c01.glv >/dev/null 2>&1 |
| 38 | #cp cube 1.ppm # For testing this script -- force a failure |
| 39 | #rm 1.ppm # For testing this script -- force a failure |
| 40 | cmp -s 1.ppm 1_trace.ppm |
| 41 | RES=$? |
| 42 | cd .. |
| 43 | rm -rf vktracereplay_tmp |
| 44 | |
| 45 | if [ $RES -eq 0 ] ; then |
| 46 | printf "$GREEN[ PASSED ]$NC 1 test\n" |
| 47 | exit 0 |
| 48 | else |
| 49 | printf "$RED[ FAILED ]$NC screenshot file compare failed\n" |
| 50 | printf "$RED[ FAILED ]$NC 1 test\n" |
| 51 | printf "1 TEST FAILED\n" |
| 52 | exit 1 |
| 53 | fi |