bstinson / centos / t_functional

Forked from centos/t_functional 3 years ago
Clone

Blame tests/p_python/10-test_python.sh

Christoph Galuschka 518959
#!/bin/sh
Christoph Galuschka 518959
# Author: Christoph Galuschka <christoph.galuschka@chello.at>
Christoph Galuschka 518959
#         Athmane Madjodj <athmanem@gmail.com>
Christoph Galuschka 518959
Christoph Galuschka 518959
t_Log "Running $0 - python can print Hello World"
Christoph Galuschka 518959
Pablo Greco aee784
if [ "$centos_ver" -ge 8 ] ; then
Pablo Greco aee784
PYTHON=python3
Pablo Greco aee784
else
Pablo Greco aee784
PYTHON=python
Pablo Greco aee784
fi
Pablo Greco aee784
Christoph Galuschka 518959
# creating source file
Christoph Galuschka 518959
FILE='/var/tmp/python-test.py'
Christoph Galuschka 518959
Christoph Galuschka 518959
cat > $FILE <
Pablo Greco aee784
print ("hello centos")
Christoph Galuschka 518959
EOF
Christoph Galuschka 518959
Christoph Galuschka 518959
# Executing python
Pablo Greco aee784
$PYTHON $FILE | grep -q "hello centos"
Christoph Galuschka 518959
Christoph Galuschka 518959
t_CheckExitStatus $?
Christoph Galuschka 518959
Christoph Galuschka 518959
# remove files
Christoph Galuschka 518959
/bin/rm $FILE