From b279a0d46dfeca1ca40057c3c910ab1657d60be5 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 28 Jan 2020 18:32:20 -0800 Subject: tests: in python tests, do not require .pyo files (for python3) This change partially fixes automake bug#32088: https://debbugs.gnu.org/32088 * t/py-compile-basedir.sh: Remove all .pyo checks. Also, in this test only, allow for either 4 or 6 files resulting from compilation, as new-enough Python3 results in 6 (per Andreas Huettel, https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32088#17) * t/py-compile-basic.sh: Remove all .pyo checks. * t/py-compile-destdir.sh: Likewise. * t/py-compile-option-terminate.sh: Likewise. * t/python-virtualenv.sh: Likewise. * t/python10.sh: Likewise. * t/python12.sh: Likewise. * t/python3.sh: Likewise. --- t/py-compile-basedir.sh | 5 ++--- t/py-compile-basic.sh | 3 --- t/py-compile-destdir.sh | 12 +++++------- t/py-compile-option-terminate.sh | 5 ----- t/python-virtualenv.sh | 4 ---- t/python10.sh | 6 ------ t/python12.sh | 3 +-- t/python3.sh | 1 - 8 files changed, 8 insertions(+), 31 deletions(-) diff --git a/t/py-compile-basedir.sh b/t/py-compile-basedir.sh index 5165b9246..13a22ff1d 100644 --- a/t/py-compile-basedir.sh +++ b/t/py-compile-basedir.sh @@ -40,11 +40,10 @@ for d in foo foo/bar "$(pwd)/foo" . .. ../foo ''; do ./py-compile --basedir "$d" "$f.py" "sub/$f.py" find "$d2" # For debugging. py_installed "$d2/$f.pyc" - py_installed "$d2/$f.pyo" py_installed "$d2/sub/$f.pyc" - py_installed "$d2/sub/$f.pyo" files=$(find "$d2" | grep '\.py[co]$') - test $(echo "$files" | wc -l) -eq 4 + # with new-enough Python3, there are six files. + test $(echo "$files" | wc -l) -eq 4 || $(echo "$files" | wc -l) -eq 6 case $d2 in .|..) rm -f $files;; *) rm -rf "$d2";; diff --git a/t/py-compile-basic.sh b/t/py-compile-basic.sh index d7b15e989..5d73b046a 100644 --- a/t/py-compile-basic.sh +++ b/t/py-compile-basic.sh @@ -61,10 +61,7 @@ mkdir -p 1/_/2/_/3/_ ./py-compile foo.py sub/bar.py 1/_/2/_/3/_/0.py py_installed foo.pyc -py_installed foo.pyo py_installed sub/bar.pyc -py_installed sub/bar.pyo py_installed 1/_/2/_/3/_/0.pyc -py_installed 1/_/2/_/3/_/0.pyo : diff --git a/t/py-compile-destdir.sh b/t/py-compile-destdir.sh index 57c360bfd..4ceef840a 100644 --- a/t/py-compile-destdir.sh +++ b/t/py-compile-destdir.sh @@ -34,13 +34,11 @@ echo 'def bar (): return "bar"' > $destdir/sub/bar.py find $destdir # For debugging. st=0 -for x in c o; do - for b in foo sub/bar; do - f=$(pyc_location -p "$destdir/$b.py$x") - test -f "$f" - strings "$f" || : # For debugging. - $FGREP $destdir $f && { echo BAD: $f; st=1; } - done +for b in foo sub/bar; do + f=$(pyc_location -p "$destdir/$b.pyc") + test -f "$f" + strings "$f" || : # For debugging. + $FGREP $destdir $f && { echo BAD: $f; st=1; } done exit $st diff --git a/t/py-compile-option-terminate.sh b/t/py-compile-option-terminate.sh index b89ee174b..bc378fff0 100644 --- a/t/py-compile-option-terminate.sh +++ b/t/py-compile-option-terminate.sh @@ -27,17 +27,12 @@ cp "$am_scriptdir/py-compile" . \ : > ./--foo.py ./py-compile -- -o.py --foo.py py_installed ./-o.pyc -py_installed ./-o.pyo py_installed ./--foo.pyc -py_installed ./--foo.pyo rm -f ./-*.py[co] : > x.py ./py-compile x.py -o.py --foo.py py_installed ./x.pyc -py_installed ./x.pyo py_installed ./-o.pyc -py_installed ./-o.pyo py_installed ./--foo.pyc -py_installed ./--foo.pyo : diff --git a/t/python-virtualenv.sh b/t/python-virtualenv.sh index 6f052584a..6f4e0c07c 100644 --- a/t/python-virtualenv.sh +++ b/t/python-virtualenv.sh @@ -124,10 +124,8 @@ check_install () test -f "$py_site"/am_foo.py py_installed "$py_site"/am_foo.pyc - py_installed "$py_site"/am_foo.pyo py_installed "$py_site"/am_virtenv/__init__.py py_installed "$py_site"/am_virtenv/__init__.pyc - py_installed "$py_site"/am_virtenv/__init__.pyo test -f "$py_site"/libquux.a test -f "$py_site"/am_virtenv/libzardoz.a } @@ -138,10 +136,8 @@ check_uninstall () test ! -e "$py_site"/am_foo.py py_installed --not "$py_site"/am_foo.pyc - py_installed --not "$py_site"/am_foo.pyo test ! -e "$py_site"/am_virtenv/__init__.py py_installed --not "$py_site"/am_virtenv/__init__.pyc - py_installed --not "$py_site"/am_virtenv/__init__.pyo test ! -e "$py_site"/libquux.a test ! -e "$py_site"/am_virtenv/libzardoz.a } diff --git a/t/python10.sh b/t/python10.sh index 5a4f64b7d..683a14b1b 100644 --- a/t/python10.sh +++ b/t/python10.sh @@ -60,27 +60,21 @@ cwd=$(pwd) || fatal_ "getting current working directory" $MAKE install test -f "$inst/your/two.py" py_installed "$inst/your/two.pyc" -py_installed "$inst/your/two.pyo" py_installed --not "$inst/my/one.py" py_installed --not "$inst/my/one.pyc" -py_installed --not "$inst/my/one.pyo" $MAKE uninstall py_installed --not "$inst/your/two.py" py_installed --not "$inst/your/two.pyc" -py_installed --not "$inst/your/two.pyo" ../configure --prefix=$cwd/"$inst" one=1 $MAKE install py_installed --not "$inst/your/two.py" py_installed --not "$inst/your/two.pyc" -py_installed --not "$inst/your/two.pyo" test -f "$inst/my/one.py" py_installed "$inst/my/one.pyc" -py_installed "$inst/my/one.pyo" $MAKE uninstall py_installed --not "$inst/my/one.py" py_installed --not "$inst/my/one.pyc" -py_installed --not "$inst/my/one.pyo" $MAKE disttest diff --git a/t/python12.sh b/t/python12.sh index 948961ff2..cba49ea61 100644 --- a/t/python12.sh +++ b/t/python12.sh @@ -44,11 +44,10 @@ $MAKE install DESTDIR=$destdir # Perfunctory test that the files were created. test -f "$destdir/usr/share/my/my.py" -pyo=$(pyc_location -p "$destdir/usr/share/my/my.pyo") pyc=$(pyc_location -p "$destdir/usr/share/my/my.pyc") # If DESTDIR has made it into the byte compiled files, fail the test. -st=0; $FGREP "$destdir" "$pyc" "$pyo" || st=$? +st=0; $FGREP "$destdir" "$pyc" || st=$? test $st -eq 1 : diff --git a/t/python3.sh b/t/python3.sh index 665b7dab5..5658f7f58 100644 --- a/t/python3.sh +++ b/t/python3.sh @@ -42,6 +42,5 @@ cd build $MAKE install py_installed inst/my/one.py py_installed inst/my/one.pyc -py_installed inst/my/one.pyo : -- cgit v1.2.1