]>
Commit | Line | Data |
---|---|---|
494da23a TL |
1 | #!/bin/bash |
2 | ||
3 | # Not entirely sure why these executables don't seem to be available in the | |
4 | # $PATH when running from tox. Calling out to `which` seems to fix it, at the | |
5 | # expense of making the script a bit obtuse | |
6 | ||
7 | mktemp=$(which mktemp) | |
8 | cat=$(which cat) | |
9 | grep=$(which grep) | |
9f95a23c | 10 | PYTHON_EXECUTABLE=`which python3` |
494da23a TL |
11 | STDERR_FILE=$($mktemp) |
12 | INVALID="→" | |
13 | ||
14 | echo "stderr file created: $STDERR_FILE" | |
15 | ||
16 | INVALID="$INVALID" $PYTHON_EXECUTABLE $1 2> ${STDERR_FILE} | |
17 | ||
18 | retVal=$? | |
19 | ||
20 | if [ $retVal -ne 0 ]; then | |
21 | echo "Failed test: Unexpected failure from running Python script" | |
22 | echo "Below is output of stderr captured:" | |
23 | $cat "${STDERR_FILE}" | |
24 | exit $retVal | |
25 | fi | |
26 | ||
27 | $grep --quiet "$INVALID" ${STDERR_FILE} | |
28 | ||
29 | retVal=$? | |
30 | if [ $retVal -ne 0 ]; then | |
31 | echo "Failed test: expected to find \"${INVALID}\" character in tmpfile: \"${STDERR_FILE}\"" | |
32 | echo "Below is output of stderr captured:" | |
33 | $cat "${STDERR_FILE}" | |
34 | fi | |
35 | exit $retVal |