Hash :
ae8fb001
Author :
Date :
2022-01-18T02:00:22
tests: fix py-compile-basedir.sh: missing "test"
Prompted by a patch from Thomas Deutschmann <whissi@gentoo.org>,
via https://lists.gnu.org/r/automake-patches/2022-01/msg00001.html:
commit v1.16.1-26-gb279a0d46 ("tests: in python tests, do not
require .pyo files (for python3)") was missing a `test` call.
Reported to Gentoo at https://bugs.gentoo.org/715040.
* t/py-compile-basedir.sh: Rather than just adding the missing
"test", rewrite using a case statement, to avoid some duplication.
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
#! /bin/sh
# Copyright (C) 2011-2022 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Test the '--basedir' option of the 'py-compile' script,
required=python
. test-init.sh
# We'll need to create files in '..', so we need one more subdirectory
# level in order not to clutter up the top-level tests directory.
mkdir sandbox
cd sandbox
cp "$am_scriptdir/py-compile" . \
|| fatal_ "failed to fetch auxiliary script py-compile"
f=__init__
for d in foo foo/bar "$(pwd)/foo" . .. ../foo ''; do
if test -z "$d"; then
d2=.
else
d2=$d
fi
../install-sh -d "$d2" "$d2/sub" || exit 99
: > "$d2/$f.py"
: > "$d2/sub/$f.py"
./py-compile --basedir "$d" "$f.py" "sub/$f.py"
find "$d2" # For debugging.
py_installed "$d2/$f.pyc"
py_installed "$d2/sub/$f.pyc"
files=$(find "$d2" | grep '\.py[co]$')
# with new-enough Python3, there are six files.
case $(echo "$files" | wc -l) in 4|6) ;; *) false;; esac
case $d2 in
.|..) rm -f $files;;
*) rm -rf "$d2";;
esac
done
: