From owner-svn-src-stable-10@FreeBSD.ORG Sun May 31 22:44:15 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7BDCD8F8; Sun, 31 May 2015 22:44:15 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 695751C3B; Sun, 31 May 2015 22:44:15 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4VMiFIp035334; Sun, 31 May 2015 22:44:15 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4VMiFO8035331; Sun, 31 May 2015 22:44:15 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201505312244.t4VMiFO8035331@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 31 May 2015 22:44:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r283848 - stable/10/contrib/atf/atf-sh X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 May 2015 22:44:15 -0000 Author: ngie Date: Sun May 31 22:44:14 2015 New Revision: 283848 URL: https://svnweb.freebsd.org/changeset/base/283848 Log: MFC r283170: Import proposed fix from upstream for atf-sh/atf_check_test:flush_stdout_on_timeout Many thanks for jmmv for the fix! PR: 197060 Original commit message: From 0e546407567ea858e261e72f75c5ed61e07d0ddf Mon Sep 17 00:00:00 2001 From: Julio Merino Date: Tue, 17 Feb 2015 18:10:11 -0500 Subject: [PATCH] Fix atf-sh/atf_check_test:flush_stdout_on_death The test atf-sh/atf_check_test:flush_stdout_on_timeout was flaky as it was playing solely with time. Fix this by making the test more robust and rename it while we are at it: there is nothing left about "timeouts" in this test, considering that ATF itself does not enforce deadlines any longer. Fixes FreeBSD PR 197060. Modified: stable/10/contrib/atf/atf-sh/atf_check_test.sh stable/10/contrib/atf/atf-sh/misc_helpers.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/atf/atf-sh/atf_check_test.sh ============================================================================== --- stable/10/contrib/atf/atf-sh/atf_check_test.sh Sun May 31 22:41:22 2015 (r283847) +++ stable/10/contrib/atf/atf-sh/atf_check_test.sh Sun May 31 22:44:14 2015 (r283848) @@ -164,18 +164,22 @@ equal_body() grep '^failed: \${x} != \${y} (a != b)$' resfile } -atf_test_case flush_stdout_on_timeout -flush_stdout_on_timeout_body() +atf_test_case flush_stdout_on_death +flush_stdout_on_death_body() { - "$(atf_get_srcdir)/misc_helpers" -s "$(atf_get_srcdir)" atf_check_timeout \ - >out 2>err & + CONTROL_FILE="$(pwd)/done" "$(atf_get_srcdir)/misc_helpers" \ + -s "$(atf_get_srcdir)" atf_check_flush_stdout >out 2>err & pid="${!}" - sleep 1 - kill "${pid}" + while [ ! -f ./done ]; do + echo "Still waiting for helper to create control file" + ls + sleep 1 + done + kill -9 "${pid}" grep 'Executing command.*true' out \ || atf_fail 'First command not in output' - grep 'Executing command.*sleep 42' out \ + grep 'Executing command.*false' out \ || atf_fail 'Second command not in output' } @@ -187,7 +191,7 @@ atf_init_test_cases() atf_add_test_case null_stdout atf_add_test_case null_stderr atf_add_test_case equal - atf_add_test_case flush_stdout_on_timeout + atf_add_test_case flush_stdout_on_death } # vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4 Modified: stable/10/contrib/atf/atf-sh/misc_helpers.sh ============================================================================== --- stable/10/contrib/atf/atf-sh/misc_helpers.sh Sun May 31 22:41:22 2015 (r283847) +++ stable/10/contrib/atf/atf-sh/misc_helpers.sh Sun May 31 22:44:14 2015 (r283848) @@ -139,16 +139,20 @@ atf_check_equal_eval_fail_body() atf_check_equal '${x}' '${y}' } -atf_test_case atf_check_timeout -atf_check_timeout_head() +atf_test_case atf_check_flush_stdout +atf_check_flush_stdout_head() { atf_set "descr" "Helper test case for the t_atf_check test program" - atf_set "timeout" 1 + atf_set "timeout" "30" } -atf_check_timeout_body() +atf_check_flush_stdout_body() { atf_check true - atf_check sleep 42 + atf_check -s exit:1 false + touch "${CONTROL_FILE:-done}" + while :; do + sleep 1 + done } # ------------------------------------------------------------------------- @@ -281,7 +285,7 @@ atf_init_test_cases() atf_add_test_case atf_check_equal_fail atf_add_test_case atf_check_equal_eval_ok atf_add_test_case atf_check_equal_eval_fail - atf_add_test_case atf_check_timeout + atf_add_test_case atf_check_flush_stdout # Add helper tests for t_config. atf_add_test_case config_get