From 06287e49e496212ab22b63b8ed3545625f731fb1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 8 May 2024 10:55:43 +0200 Subject: [PATCH] gnulib-tool: In --megatestdir mode, stop when there is an error. * gnulib-tool.sh (megatest): Fail when one of the 'configure' or 'make' steps fails. * pygnulib/main.py (main): Likewise. --- ChangeLog | 7 +++++++ gnulib-tool.sh | 8 ++++---- pygnulib/main.py | 11 +++++++---- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d74b450bc..fa78ed6a80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-05-08 Bruno Haible + + gnulib-tool: In --megatestdir mode, stop when there is an error. + * gnulib-tool.sh (megatest): Fail when one of the 'configure' or 'make' + steps fails. + * pygnulib/main.py (main): Likewise. + 2024-05-08 Collin Funk gnulib-tool.py: Fix behavior of --test when a subprocess fails. diff --git a/gnulib-tool.sh b/gnulib-tool.sh index 521d16e47a..b5aadcaeaa 100755 --- a/gnulib-tool.sh +++ b/gnulib-tool.sh @@ -7501,10 +7501,10 @@ s/\([.*$]\)/[\1]/g' cd "$destdir" mkdir build cd build - ../configure - $MAKE - $MAKE check - $MAKE distclean + ../configure || func_exit 1 + $MAKE || func_exit 1 + $MAKE check || func_exit 1 + $MAKE distclean || func_exit 1 remaining=`find . -type f -print` if test -n "$remaining"; then echo "Remaining files:" $remaining 1>&2 diff --git a/pygnulib/main.py b/pygnulib/main.py index 128f25f9c1..8462916653 100644 --- a/pygnulib/main.py +++ b/pygnulib/main.py @@ -1130,10 +1130,13 @@ def main(temp_directory: str) -> None: os.chdir(destdir) os.mkdir('build') os.chdir('build') - sp.call(['../configure']) - sp.call([UTILS['make']]) - sp.call([UTILS['make'], 'check']) - sp.call([UTILS['make'], 'distclean']) + try: # Try to execute commands + sp.run(['../configure'], check=True) + sp.run([UTILS['make']], check=True) + sp.run([UTILS['make'], 'check'], check=True) + sp.run([UTILS['make'], 'distclean'], check=True) + except Exception: + sys.exit(1) args = ['find', '.', '-type', 'f', '-print'] remaining = sp.check_output(args).decode(ENCS['shell']) lines = [ line.strip() -- 2.39.5