From owner-svn-src-all@FreeBSD.ORG Tue Feb 24 22:22:07 2015 Return-Path: Delivered-To: svn-src-all@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 944F6D97; Tue, 24 Feb 2015 22:22:07 +0000 (UTC) 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 7FA3B2CC; Tue, 24 Feb 2015 22:22:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t1OMM7LD073428; Tue, 24 Feb 2015 22:22:07 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t1OMM7OJ073427; Tue, 24 Feb 2015 22:22:07 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201502242222.t1OMM7OJ073427@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Tue, 24 Feb 2015 22:22:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279256 - head/usr.sbin/pw/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Feb 2015 22:22:07 -0000 Author: brd (doc committer) Date: Tue Feb 24 22:22:06 2015 New Revision: 279256 URL: https://svnweb.freebsd.org/changeset/base/279256 Log: Fix a race condition by allowing up to 5 seconds of difference between the time stamps. PR: 197861 Approved by: will Modified: head/usr.sbin/pw/tests/pw_useradd.sh Modified: head/usr.sbin/pw/tests/pw_useradd.sh ============================================================================== --- head/usr.sbin/pw/tests/pw_useradd.sh Tue Feb 24 22:17:12 2015 (r279255) +++ head/usr.sbin/pw/tests/pw_useradd.sh Tue Feb 24 22:22:06 2015 (r279256) @@ -114,9 +114,11 @@ user_add_account_expiration_date_relativ populate_etc_skel EPOCH=`date -j -v+13m "+%s"` + BUF=`expr $EPOCH + 5` atf_check -s exit:0 ${PW} useradd test -e +13o - atf_check -s exit:0 -o match:"^test:\*:.*::0:${EPOCH}:User &:.*" \ - ${PW} usershow test + TIME=`${PW} usershow test | awk -F ':' '{print $7}'` + [ ! -z $TIME -a $TIME -ge $EPOCH -a $TIME -lt $BUF ] || \ + atf_fail "Expiration time($TIME) was not within $EPOCH - $BUF seconds." } # Test add user with password expiration as an epoch date @@ -160,9 +162,11 @@ user_add_password_expiration_date_relati populate_etc_skel EPOCH=`date -j -v+13m "+%s"` + BUF=`expr $EPOCH + 5` atf_check -s exit:0 ${PW} useradd test -p +13o - atf_check -s exit:0 -o match:"^test:\*:.*::${EPOCH}:0:User &:.*" \ - ${PW} usershow test + TIME=`${PW} usershow test | awk -F ':' '{print $6}'` + [ ! -z $TIME -a $TIME -ge $EPOCH -a $TIME -lt $BUF ] || \ + atf_fail "Expiration time($TIME) was not within $EPOCH - $BUF seconds." } atf_init_test_cases() {