glibc/scripts/evaluate-test.sh

51 lines
1.2 KiB
Bash
Raw Normal View History

#!/bin/sh
Generate .test-result files for ordinary tests. This patch, an updated version of <https://sourceware.org/ml/libc-alpha/2014-01/msg00193.html>, starts the process of generating explicit PASS or FAIL status for individual glibc tests. It's based on Tomas Dohnalek's patch <https://sourceware.org/ml/libc-alpha/2012-10/msg00278.html>, but is deliberately more minimal: it doesn't try to cover any tests outside of $(tests) / $(xtests) (that's for a later patch), nor does it put the result together in an overall summary file (again, a later patch): it just generates the .test-result files. Thus, this patch keeps the overall logic for when a testsuite run finishes completely unchanged: a test failing will terminate the run. I think we *should* move to a more conventional approach where plain "make check" does not terminate for an individual test failure, unless e.g. you say "make stop-on-test-failure=y check", but that sort of policy change is best done as a separate patch once the infrastructure is in place to generate summary files for completed test runs (which will entirely consist of PASS and XFAIL lines if the testsuite run reaches the point of generating them, until such a policy change is made). Tested x86_64. 2014-02-14 Tomas Dohnalek <tdohnale@redhat.com> Joseph Myers <joseph@codesourcery.com> * Makeconfig (test-name): New variable. (evaluate-test): Likewise. * Makerules (do-test-clean): Remove .test-result files. (common-mostlyclean): Likewise. * Rules ($(objpfx)%.out): Use $(evaluate-test) in both rules. * scripts/evaluate-test.sh: New file.
2014-02-15 02:04:57 +01:00
# Output a test status line.
# Copyright (C) 2012-2022 Free Software Foundation, Inc.
Generate .test-result files for ordinary tests. This patch, an updated version of <https://sourceware.org/ml/libc-alpha/2014-01/msg00193.html>, starts the process of generating explicit PASS or FAIL status for individual glibc tests. It's based on Tomas Dohnalek's patch <https://sourceware.org/ml/libc-alpha/2012-10/msg00278.html>, but is deliberately more minimal: it doesn't try to cover any tests outside of $(tests) / $(xtests) (that's for a later patch), nor does it put the result together in an overall summary file (again, a later patch): it just generates the .test-result files. Thus, this patch keeps the overall logic for when a testsuite run finishes completely unchanged: a test failing will terminate the run. I think we *should* move to a more conventional approach where plain "make check" does not terminate for an individual test failure, unless e.g. you say "make stop-on-test-failure=y check", but that sort of policy change is best done as a separate patch once the infrastructure is in place to generate summary files for completed test runs (which will entirely consist of PASS and XFAIL lines if the testsuite run reaches the point of generating them, until such a policy change is made). Tested x86_64. 2014-02-14 Tomas Dohnalek <tdohnale@redhat.com> Joseph Myers <joseph@codesourcery.com> * Makeconfig (test-name): New variable. (evaluate-test): Likewise. * Makerules (do-test-clean): Remove .test-result files. (common-mostlyclean): Likewise. * Rules ($(objpfx)%.out): Use $(evaluate-test) in both rules. * scripts/evaluate-test.sh: New file.
2014-02-15 02:04:57 +01:00
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# The GNU C Library 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
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with the GNU C Library; if not, see
Prefer https to http for gnu.org and fsf.org URLs Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 07:40:42 +02:00
# <https://www.gnu.org/licenses/>.
Generate .test-result files for ordinary tests. This patch, an updated version of <https://sourceware.org/ml/libc-alpha/2014-01/msg00193.html>, starts the process of generating explicit PASS or FAIL status for individual glibc tests. It's based on Tomas Dohnalek's patch <https://sourceware.org/ml/libc-alpha/2012-10/msg00278.html>, but is deliberately more minimal: it doesn't try to cover any tests outside of $(tests) / $(xtests) (that's for a later patch), nor does it put the result together in an overall summary file (again, a later patch): it just generates the .test-result files. Thus, this patch keeps the overall logic for when a testsuite run finishes completely unchanged: a test failing will terminate the run. I think we *should* move to a more conventional approach where plain "make check" does not terminate for an individual test failure, unless e.g. you say "make stop-on-test-failure=y check", but that sort of policy change is best done as a separate patch once the infrastructure is in place to generate summary files for completed test runs (which will entirely consist of PASS and XFAIL lines if the testsuite run reaches the point of generating them, until such a policy change is made). Tested x86_64. 2014-02-14 Tomas Dohnalek <tdohnale@redhat.com> Joseph Myers <joseph@codesourcery.com> * Makeconfig (test-name): New variable. (evaluate-test): Likewise. * Makerules (do-test-clean): Remove .test-result files. (common-mostlyclean): Likewise. * Rules ($(objpfx)%.out): Use $(evaluate-test) in both rules. * scripts/evaluate-test.sh: New file.
2014-02-15 02:04:57 +01:00
Do not terminate default test runs on test failure. This patch is an updated version of <https://sourceware.org/ml/libc-alpha/2014-01/msg00198.html> and <https://sourceware.org/ml/libc-alpha/2014-03/msg00180.html>. Normal practice for software testsuites is that rather than terminating immediately when a test fails, they continue running and report at the end on how many tests passed or failed. The principle behind the glibc testsuite stopping on failure was probably that the expected state is no failures and so any failure indicates a problem such as miscompilation. In practice, while this is fairly close to true for native testing on x86_64 and x86 (kernel bugs and race conditions can still cause intermittent failures), it's less likely to be the case on other platforms, and so people testing glibc run the testsuite with "make -k" and then examine the logs to determine whether the failures are what they expect to fail on that platform, possibly with some automation for the comparison. This patch switches the glibc testsuite to the normal convention of not stopping on failure - unless you use stop-on-test-failure=y, in which case it behaves essentially as it did before (and does not generate overall test summaries on failure). Instead, the summary tests.sum may contain tests that FAILed. At the end of the test run, any FAIL or ERROR lines from tests.sum are printed, and then it exits with error status if there were any such lines. In addition, build failures will also cause the test run to stop - this has the justification that those *do* indicate serious problems that should be promptly fixed and aren't generally hard to fix (but apart from that, avoiding the build stopping on those failures seems harder). Note that unlike the previous patches in this series, this *does* require people with automation around testing glibc to change their processes - either to start using tests.sum / xtests.sum to track failures and compare them with expectations (with or without also using "make -k" and examining "make" logs to identify build failures), or else to use stop-on-test-failure=y and ignore the new tests.sum / xtests.sum mechanism. (If all you check is the exit status from "make check", no changes are needed unless you want to avoid test runs continuing after the first failure.) Tested x86_64. * scripts/evaluate-test.sh: Handle fourth argument to determine whether test run should stop on failure. * Makeconfig (stop-on-test-failure): New variable. (evaluate-test): Pass fourth argument to evaluate-test.sh based on $(stop-on-test-failure). * Makefile (tests): Give a summary of results from testing and exit with failure status if they include an ERROR or FAIL. (xtests): Likewise. * manual/install.texi (Configuring and compiling): Mention stop-on-test-failure=y. * INSTALL: Regenerated.
2014-03-14 22:02:40 +01:00
# usage: evaluate-test.sh test_name rc xfail stop_on_failure
Generate .test-result files for ordinary tests. This patch, an updated version of <https://sourceware.org/ml/libc-alpha/2014-01/msg00193.html>, starts the process of generating explicit PASS or FAIL status for individual glibc tests. It's based on Tomas Dohnalek's patch <https://sourceware.org/ml/libc-alpha/2012-10/msg00278.html>, but is deliberately more minimal: it doesn't try to cover any tests outside of $(tests) / $(xtests) (that's for a later patch), nor does it put the result together in an overall summary file (again, a later patch): it just generates the .test-result files. Thus, this patch keeps the overall logic for when a testsuite run finishes completely unchanged: a test failing will terminate the run. I think we *should* move to a more conventional approach where plain "make check" does not terminate for an individual test failure, unless e.g. you say "make stop-on-test-failure=y check", but that sort of policy change is best done as a separate patch once the infrastructure is in place to generate summary files for completed test runs (which will entirely consist of PASS and XFAIL lines if the testsuite run reaches the point of generating them, until such a policy change is made). Tested x86_64. 2014-02-14 Tomas Dohnalek <tdohnale@redhat.com> Joseph Myers <joseph@codesourcery.com> * Makeconfig (test-name): New variable. (evaluate-test): Likewise. * Makerules (do-test-clean): Remove .test-result files. (common-mostlyclean): Likewise. * Rules ($(objpfx)%.out): Use $(evaluate-test) in both rules. * scripts/evaluate-test.sh: New file.
2014-02-15 02:04:57 +01:00
test_name=$1
rc=$2
orig_rc=$rc
xfail=$3
Do not terminate default test runs on test failure. This patch is an updated version of <https://sourceware.org/ml/libc-alpha/2014-01/msg00198.html> and <https://sourceware.org/ml/libc-alpha/2014-03/msg00180.html>. Normal practice for software testsuites is that rather than terminating immediately when a test fails, they continue running and report at the end on how many tests passed or failed. The principle behind the glibc testsuite stopping on failure was probably that the expected state is no failures and so any failure indicates a problem such as miscompilation. In practice, while this is fairly close to true for native testing on x86_64 and x86 (kernel bugs and race conditions can still cause intermittent failures), it's less likely to be the case on other platforms, and so people testing glibc run the testsuite with "make -k" and then examine the logs to determine whether the failures are what they expect to fail on that platform, possibly with some automation for the comparison. This patch switches the glibc testsuite to the normal convention of not stopping on failure - unless you use stop-on-test-failure=y, in which case it behaves essentially as it did before (and does not generate overall test summaries on failure). Instead, the summary tests.sum may contain tests that FAILed. At the end of the test run, any FAIL or ERROR lines from tests.sum are printed, and then it exits with error status if there were any such lines. In addition, build failures will also cause the test run to stop - this has the justification that those *do* indicate serious problems that should be promptly fixed and aren't generally hard to fix (but apart from that, avoiding the build stopping on those failures seems harder). Note that unlike the previous patches in this series, this *does* require people with automation around testing glibc to change their processes - either to start using tests.sum / xtests.sum to track failures and compare them with expectations (with or without also using "make -k" and examining "make" logs to identify build failures), or else to use stop-on-test-failure=y and ignore the new tests.sum / xtests.sum mechanism. (If all you check is the exit status from "make check", no changes are needed unless you want to avoid test runs continuing after the first failure.) Tested x86_64. * scripts/evaluate-test.sh: Handle fourth argument to determine whether test run should stop on failure. * Makeconfig (stop-on-test-failure): New variable. (evaluate-test): Pass fourth argument to evaluate-test.sh based on $(stop-on-test-failure). * Makefile (tests): Give a summary of results from testing and exit with failure status if they include an ERROR or FAIL. (xtests): Likewise. * manual/install.texi (Configuring and compiling): Mention stop-on-test-failure=y. * INSTALL: Regenerated.
2014-03-14 22:02:40 +01:00
stop_on_failure=$4
Generate .test-result files for ordinary tests. This patch, an updated version of <https://sourceware.org/ml/libc-alpha/2014-01/msg00193.html>, starts the process of generating explicit PASS or FAIL status for individual glibc tests. It's based on Tomas Dohnalek's patch <https://sourceware.org/ml/libc-alpha/2012-10/msg00278.html>, but is deliberately more minimal: it doesn't try to cover any tests outside of $(tests) / $(xtests) (that's for a later patch), nor does it put the result together in an overall summary file (again, a later patch): it just generates the .test-result files. Thus, this patch keeps the overall logic for when a testsuite run finishes completely unchanged: a test failing will terminate the run. I think we *should* move to a more conventional approach where plain "make check" does not terminate for an individual test failure, unless e.g. you say "make stop-on-test-failure=y check", but that sort of policy change is best done as a separate patch once the infrastructure is in place to generate summary files for completed test runs (which will entirely consist of PASS and XFAIL lines if the testsuite run reaches the point of generating them, until such a policy change is made). Tested x86_64. 2014-02-14 Tomas Dohnalek <tdohnale@redhat.com> Joseph Myers <joseph@codesourcery.com> * Makeconfig (test-name): New variable. (evaluate-test): Likewise. * Makerules (do-test-clean): Remove .test-result files. (common-mostlyclean): Likewise. * Rules ($(objpfx)%.out): Use $(evaluate-test) in both rules. * scripts/evaluate-test.sh: New file.
2014-02-15 02:04:57 +01:00
if [ $rc -eq 77 ]; then
result="UNSUPPORTED"
rc=0
else
if [ $rc -eq 0 ]; then
result="PASS"
else
result="FAIL"
fi
if $xfail; then
result="X$result"
rc=0
fi
fi
Generate .test-result files for ordinary tests. This patch, an updated version of <https://sourceware.org/ml/libc-alpha/2014-01/msg00193.html>, starts the process of generating explicit PASS or FAIL status for individual glibc tests. It's based on Tomas Dohnalek's patch <https://sourceware.org/ml/libc-alpha/2012-10/msg00278.html>, but is deliberately more minimal: it doesn't try to cover any tests outside of $(tests) / $(xtests) (that's for a later patch), nor does it put the result together in an overall summary file (again, a later patch): it just generates the .test-result files. Thus, this patch keeps the overall logic for when a testsuite run finishes completely unchanged: a test failing will terminate the run. I think we *should* move to a more conventional approach where plain "make check" does not terminate for an individual test failure, unless e.g. you say "make stop-on-test-failure=y check", but that sort of policy change is best done as a separate patch once the infrastructure is in place to generate summary files for completed test runs (which will entirely consist of PASS and XFAIL lines if the testsuite run reaches the point of generating them, until such a policy change is made). Tested x86_64. 2014-02-14 Tomas Dohnalek <tdohnale@redhat.com> Joseph Myers <joseph@codesourcery.com> * Makeconfig (test-name): New variable. (evaluate-test): Likewise. * Makerules (do-test-clean): Remove .test-result files. (common-mostlyclean): Likewise. * Rules ($(objpfx)%.out): Use $(evaluate-test) in both rules. * scripts/evaluate-test.sh: New file.
2014-02-15 02:04:57 +01:00
echo "$result: $test_name"
echo "original exit status $orig_rc"
Do not terminate default test runs on test failure. This patch is an updated version of <https://sourceware.org/ml/libc-alpha/2014-01/msg00198.html> and <https://sourceware.org/ml/libc-alpha/2014-03/msg00180.html>. Normal practice for software testsuites is that rather than terminating immediately when a test fails, they continue running and report at the end on how many tests passed or failed. The principle behind the glibc testsuite stopping on failure was probably that the expected state is no failures and so any failure indicates a problem such as miscompilation. In practice, while this is fairly close to true for native testing on x86_64 and x86 (kernel bugs and race conditions can still cause intermittent failures), it's less likely to be the case on other platforms, and so people testing glibc run the testsuite with "make -k" and then examine the logs to determine whether the failures are what they expect to fail on that platform, possibly with some automation for the comparison. This patch switches the glibc testsuite to the normal convention of not stopping on failure - unless you use stop-on-test-failure=y, in which case it behaves essentially as it did before (and does not generate overall test summaries on failure). Instead, the summary tests.sum may contain tests that FAILed. At the end of the test run, any FAIL or ERROR lines from tests.sum are printed, and then it exits with error status if there were any such lines. In addition, build failures will also cause the test run to stop - this has the justification that those *do* indicate serious problems that should be promptly fixed and aren't generally hard to fix (but apart from that, avoiding the build stopping on those failures seems harder). Note that unlike the previous patches in this series, this *does* require people with automation around testing glibc to change their processes - either to start using tests.sum / xtests.sum to track failures and compare them with expectations (with or without also using "make -k" and examining "make" logs to identify build failures), or else to use stop-on-test-failure=y and ignore the new tests.sum / xtests.sum mechanism. (If all you check is the exit status from "make check", no changes are needed unless you want to avoid test runs continuing after the first failure.) Tested x86_64. * scripts/evaluate-test.sh: Handle fourth argument to determine whether test run should stop on failure. * Makeconfig (stop-on-test-failure): New variable. (evaluate-test): Pass fourth argument to evaluate-test.sh based on $(stop-on-test-failure). * Makefile (tests): Give a summary of results from testing and exit with failure status if they include an ERROR or FAIL. (xtests): Likewise. * manual/install.texi (Configuring and compiling): Mention stop-on-test-failure=y. * INSTALL: Regenerated.
2014-03-14 22:02:40 +01:00
if $stop_on_failure; then
exit $rc
else
exit 0
fi