Skip to content

Commit 8ff7922

Browse files
wckzhangshijin-aws
authored andcommitted
[v1.10.x] Fabtests: Replace python in runfabtests.sh with python3 or python2
In RHEL8, python is no longer linked to python 2. Instead, it is preferred that the user specifies python2 or python3 (rather than symlinking or setting alternatives). Since our scripts look to be compatible with either version, we check for both and use python3 by default. This also exits the runfabtests script if python is not detected rather than proceeding on (I have seen some unusual bugs when continuing without python). Signed-off-by: William Zhang <[email protected]> (cherry picked from commit a8a5a3e)
1 parent 738805a commit 8ff7922

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

fabtests/scripts/runfabtests.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,19 @@ declare -i pass_count=0
7474
declare -i fail_count=0
7575
declare -i total_failures=0
7676

77+
python=$(which python3 2>/dev/null) || python=$(which python2 2>/dev/null)
78+
79+
if [ $? -ne 0 ]; then
80+
echo "Unable to find python dependency, exiting..."
81+
exit 1
82+
fi
83+
7784
if [[ "$(uname)" == "FreeBSD" ]]; then
78-
declare -ri FI_ENODATA=$(python -c 'import errno; print(errno.ENOMSG)')
85+
declare -ri FI_ENODATA=$($python -c 'import errno; print(errno.ENOMSG)')
7986
else
80-
declare -ri FI_ENODATA=$(python -c 'import errno; print(errno.ENODATA)')
87+
declare -ri FI_ENODATA=$($python -c 'import errno; print(errno.ENODATA)')
8188
fi
82-
declare -ri FI_ENOSYS=$(python -c 'import errno; print(errno.ENOSYS)')
89+
declare -ri FI_ENOSYS=$($python -c 'import errno; print(errno.ENOSYS)')
8390

8491
neg_unit_tests=(
8592
"fi_dgram g00n13s"

0 commit comments

Comments
 (0)