1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#!/bin/bash
set +e
set +x
echo "# Running Python Testing Programs"
if ! test -d debian; then
echo Please run this script right outside of the debian/ directory.
fi
FILES_CORE=(
test_autograd
test_autograd_fallback,
test_modules
test_nn
test_ops
test_ops_gradients
test_ops_fwd_gradients,
test_ops_jit
test_torch
)
FILES_FINDALL=( $(cd test && find . -type f -name 'test_*.py' | sed -e 's@^./@@g' | sed -e 's@.py$@@g' | sort | uniq) )
FILES=()
# allow us to select the pytest subsets
while [[ $# -gt 0 ]]; do
case $1 in
--core)
FILES=( ${FILES[@]} ${FILES_CORE[@]} )
shift
;;
--all)
FILES=( ${FILES[@]} ${FILES_FINDALL[@]} )
shift
;;
*)
echo "Unknown option $1"
exit 1
;;
esac
done
FILES=( $(echo ${FILES[@]} | sort | uniq) )
echo "# Found" ${#FILES[@]} "tests"
echo "#"
sleep 1
failed=( )
cd test/
for (( i = 0; i < ${#FILES[@]}; i++ )); do
echo
echo
echo "# Py test ${i}/${#FILES[@]} ${FILES[$i]}"
echo "$(pwd)# /usr/bin/python3 -m pytest ${FILES[$i]}.py -v"
/usr/bin/python3 -m pytest ${FILES[$i]}.py -v
if test 0 != $?; then
failed+=( ${Files[$i]} )
fi
done
echo
echo "# listing failed tests ..."
for i in ${failed[@]}; do
echo ${i}
done
|