Permalink
Browse files

[travis] Add lenet_mnist bundle to Debug build

Along with this I moved test running logic out of the travis.yml into a separate run script.
  • Loading branch information...
jfix71 committed Oct 16, 2018
1 parent b12bf9e commit 5213ee61da6dd81f45aaa6e7621043282c2becc4
Showing with 60 additions and 6 deletions.
  1. +9 −0 .ci/lenet_mnist_expected_output.txt
  2. +1 −6 .travis.yml
  3. +50 −0 .travis/run_tests.sh
@@ -0,0 +1,9 @@
Result: 1
Result: 2
Result: 3
Result: 4
Result: 5
Result: 6
Result: 7
Result: 8
Result: 9
@@ -73,10 +73,5 @@ jobs:
script:
- CLANG_COMMAND=/usr/bin/clang-format-6.0 ./utils/format.sh check

# Note: keep_alive() prevents travis from exiting early on tests that take a while.
script:
- function keep_alive() { while true; do echo -en "\a"; sleep 60; done }
- keep_alive &
- ninja all
- CTEST_PARALLEL_LEVEL=2 ninja test || ( cat Testing/Temporary/LastTest.log && exit 1 )
- if [ "$TEST_NAME" = "DEBUG" ]; then CTEST_PARALLEL_LEVEL=2 ninja test_unopt; fi
- ../.travis/run_tests.sh ${TEST_NAME}
@@ -0,0 +1,50 @@
#!/bin/bash

set -euo pipefail

: ${1?"Usage: \`$0 TEST_NAME\` (TEST_NAME must be one of {ASAN, DEBUG})"}
TEST_NAME=${1}

# Note: keep_alive() prevents travis from exiting early on tests that take a while.
keep_alive() { while true; do echo -en "\a"; sleep 540; done }

# Pass in which tests to run (one of {test, test_unopt}).
run_unit_tests() {
CTEST_PARALLEL_LEVEL=2 ninja ${1} || ( cat Testing/Temporary/LastTest.log && exit 1 )
}

# Pass one of {YES, NO} for QUANTIZE.
run_and_check_bundle() {
echo "Checking lenet_mnist bundle with QUANTIZE=${1}"
cd ${GLOW_SRC}/examples/bundles/lenet_mnist/
( QUANTIZE=${1} make &> raw_results.txt ) || ( cat raw_results.txt && exit 1 )
( tail -n72 raw_results.txt | grep -F "Result: " > results.txt ) || ( cat raw_results.txt && exit 1 )
diff results.txt ${GLOW_SRC}/.ci/lenet_mnist_expected_output.txt
rm results.txt raw_results.txt
echo "Successfully completed checking lenet_mnist bundle with QUANTIZE=${1}"
}

export GLOW_SRC=${PWD}/..
export LOADER=${GLOW_SRC}/build/bin/image-classifier

keep_alive &

case ${TEST_NAME} in
ASAN)
ninja all
run_unit_tests test
;;

DEBUG)
ninja all
run_unit_tests test
run_unit_tests test_unopt
run_and_check_bundle YES
run_and_check_bundle NO
;;

*)
echo "Error, '${TEST_NAME}' not valid mode; Must be one of {ASAN, DEBUG}."
exit 1
;;
esac

0 comments on commit 5213ee6

Please sign in to comment.