From patchwork Wed Aug 22 17:31:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 960970 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="V+ctabto"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41wT9G26ccz9s5c for ; Wed, 22 Aug 2018 23:36:50 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=ttjDfdGhyTMcIebs+Q98wjt50wl2M6uYOfvc/XzdmDs=; b=V+c tabto+w75pu8jDf2Q7zAVNUyTzUO27G9L+QyzPYkuy8uewl+d9j8ZQpaKoa8ObGA6ROGZY2S9NvVB tCmBOhkOM2AKFj9XGCm5nUnj5JlJnqSU0xRD3SGu/IOZunnm0tbPUAUkjTDEoSsRkQGEmhB9uNUT/ +ixLDn9yxUefJtnZn6BwSFpQFSeqT5ejnyuvS/ga3sLYGNv8lwQ8Oq3zOou1OlMu8ZFt5bPu1KdbS GR1dFSx/dwmgU2h0qBpYDirdATUxPcPA7H3YZclC2nNNQlDv+nXjjW43XKxkKFw7tJYBh4sWBJntG vCVmRf/2BXXWusYbrJzl2wEi+A2pzUQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fsTJN-0001vc-5f; Wed, 22 Aug 2018 13:36:37 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fsTJF-0001tv-Ow for hostap@lists.infradead.org; Wed, 22 Aug 2018 13:36:35 +0000 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Aug 2018 06:36:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,274,1531810800"; d="scan'208";a="85477198" Received: from unknown (HELO andrei-XPS-12-9Q33.ger.corp.intel.com) ([10.12.217.183]) by orsmga002.jf.intel.com with ESMTP; 22 Aug 2018 06:36:11 -0700 From: Andrei Otcheretianski To: hostap@lists.infradead.org Subject: [PATCH] tests: Store the correct PID in hostapd-test.pid file Date: Wed, 22 Aug 2018 20:31:43 +0300 Message-Id: <1534959105-13163-1-git-send-email-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180822_063629_816522_013BC5DD X-CRM114-Status: UNSURE ( 9.93 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [192.55.52.136 listed in list.dnswl.org] 2.4 DATE_IN_FUTURE_03_06 Date: is 3 to 6 hours after Received: date -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrei Otcheretianski MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The ./start.sh script spawns hostapd process using "sudo". Since sudo forks a child process, $! holds the pid of sudo itself. Fix that by storing the PID of the child process instead. Signed-off-by: Andrei Otcheretianski --- tests/hwsim/start.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/start.sh b/tests/hwsim/start.sh index 527ee22..7682fce 100755 --- a/tests/hwsim/start.sh +++ b/tests/hwsim/start.sh @@ -121,7 +121,10 @@ sudo $(printf -- "$VALGRIND_WPAS" 5) $WPAS -g /tmp/wpas-wlan5 -G$GROUP \ -ddKt$TRACE -f $LOGDIR/log5 & sudo $VALGRIND_HAPD $HAPD -ddKt$TRACE -g /var/run/hostapd-global -G $GROUP -f $LOGDIR/hostapd & HPID=$! -echo $HPID > $LOGDIR/hostapd-test.pid + +# Sleep a bit, otherwise pgrep may run before the child is forked +sleep 0.1 +pgrep -P $HPID > $LOGDIR/hostapd-test.pid if [ -x $HLR_AUC_GW ]; then cp $DIR/auth_serv/hlr_auc_gw.milenage_db $LOGDIR/hlr_auc_gw.milenage_db