From 455711f1dfb18c1ba7e8fe1b23d130be4b5bab36 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Fri, 8 Feb 2019 10:56:04 +0100 Subject: [PATCH] Simplify test failure detection in %check There is the same logic in the upstream script: https://hg.mozilla.org/projects/nss/file/tip/tests/common/cleanup.sh#l56 --- nss.spec | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/nss.spec b/nss.spec index 0dc3e78..8aa35d0 100644 --- a/nss.spec +++ b/nss.spec @@ -43,7 +43,7 @@ rpm.define(string.format("nss_release_tag NSS_%s_RTM", Summary: Network Security Services Name: nss Version: %{nss_version} -Release: 4%{?dist} +Release: 5%{?dist} License: MPLv2.0 URL: http://www.mozilla.org/projects/security/pki/nss/ Requires: nspr >= %{nspr_version} @@ -478,35 +478,7 @@ pushd nss/tests HOST=localhost DOMSUF=localdomain PORT=$MYRAND NSS_CYCLES=%{?nss_cycles} NSS_TESTS=%{?nss_tests} NSS_SSL_TESTS=%{?nss_ssl_tests} NSS_SSL_RUN=%{?nss_ssl_run} ./all.sh popd -# Normally, the grep exit status is 0 if selected lines are found and 1 otherwise, -# Grep exits with status greater than 1 if an error ocurred. -# If there are test failures we expect TEST_FAILURES > 0 and GREP_EXIT_STATUS = 0, -# With no test failures we expect TEST_FAILURES = 0 and GREP_EXIT_STATUS = 1, whereas -# GREP_EXIT_STATUS > 1 would indicate an error in grep such as failure to find the log file. killall $RANDSERV || : - -TEST_FAILURES=$(grep -c -- '- FAILED$' ./tests_results/security/localhost.1/output.log) || GREP_EXIT_STATUS=$? - -if [ ${GREP_EXIT_STATUS:-0} -eq 1 ]; then - echo "okay: test suite detected no failures" -else - if [ ${GREP_EXIT_STATUS:-0} -eq 0 ]; then - # while a situation in which grep return status is 0 and it doesn't output - # anything shouldn't happen, set the default to something that is - # obviously wrong (-1) - echo "error: test suite had ${TEST_FAILURES:--1} test failure(s)" - exit 1 - else - if [ ${GREP_EXIT_STATUS:-0} -eq 2 ]; then - echo "error: grep has not found log file" - exit 1 - else - echo "error: grep failed with exit code: ${GREP_EXIT_STATUS}" - exit 1 - fi - fi -fi -echo "test suite completed" %endif %install @@ -895,6 +867,9 @@ update-crypto-policies &> /dev/null || : %changelog +* Fri Feb 8 2019 Daiki Ueno - 3.41.0-5 +- Simplify test failure detection in %%check + * Fri Feb 01 2019 Fedora Release Engineering - 3.41.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild