From patchwork Sat Jan 19 00:12:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tycho Andersen X-Patchwork-Id: 10771847 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65B4413BF for ; Sat, 19 Jan 2019 00:12:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54FDB30764 for ; Sat, 19 Jan 2019 00:12:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 495AE3078E; Sat, 19 Jan 2019 00:12:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE6B130764 for ; Sat, 19 Jan 2019 00:12:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730198AbfASAMu (ORCPT ); Fri, 18 Jan 2019 19:12:50 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:39824 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730132AbfASAMt (ORCPT ); Fri, 18 Jan 2019 19:12:49 -0500 Received: by mail-qk1-f195.google.com with SMTP id c21so9061622qkl.6 for ; Fri, 18 Jan 2019 16:12:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho-ws.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yYt/K9NYhTv2NeJAx/KG9lq59/XGrM4evbM+iin9jyc=; b=SWu7fbN20E/BcGEqPu8Q2vi3pnrfAXEX514qycWU22bHVsOQXeHs7NEei7f0I6ukNb mAUh63b9FudOND7r5AZJdcAjPajxLfKBs/1SPJzi0dYN9cxX5JihX6O1CWF60wQmpUcW bxOxWn1P4OA/ooAanw3WV/Nya2UjAPkn9uYa1PGMf8viHLrWyhbLnMaFtJpbI+u00bqZ WPukauGk0CINuSwma7vUrII6uJ1YakEDUakQamnfKN6xIZ7TPvgpE8tDGbXPPWKBbdc/ P/BZnx1MwYLgEkhqNB+HEkivJ4svnU4q5Gn+qk23niZrZe1wPSZh0cMgsxb4QvUbZc6E 6srw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yYt/K9NYhTv2NeJAx/KG9lq59/XGrM4evbM+iin9jyc=; b=f+RkSw38TBLDLXzdv24bdAndoU6HX5OMy5SRwl23OcUQLb62zWwrB+tP00aOhcW7YP /pumZX0wlwv9fIQPOzzURPcjfiLGXPoOd4Arz1Rm/wta1PNfLKnuJyE/zA4EMXrV2Ehe 84t7UfXxXArO5+D1tF5IshkwuypdUBlStow12Cu65ISewIbTgBqqQA/A+DTurRWO4ZM0 I/X0qaFRKRZ6YKcvt4+4Zq1/Bt0758+3uhCJJpsgaxNWzGg7WqNRNiALaVQKrC5jQB9a 9cynVJql2uufrfCzIxDHUHhMXb0S0hP+O0Avfjr9Br9dWdmaka8XDY5lt3d54FXLAgsl 6enw== X-Gm-Message-State: AJcUukdgXLs13kwRuPTFii/8LfJlDsxNlJHIyiBXKjm7Bd/fB1dgkq5J zdkeSw5vB2u5kPFVr6NApAxTCg== X-Google-Smtp-Source: ALg8bN69hr9P8qlQphs5KANrd0pNvQIb1AIfQhhqsFRB3NIZ1kIWmIVgbWRD4jXUJJ7QEswBk4VB+g== X-Received: by 2002:a37:8006:: with SMTP id b6mr16115382qkd.19.1547856767670; Fri, 18 Jan 2019 16:12:47 -0800 (PST) Received: from localhost.localdomain ([64.125.109.186]) by smtp.gmail.com with ESMTPSA id m14sm41140501qka.21.2019.01.18.16.12.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 16:12:47 -0800 (PST) From: Tycho Andersen To: Shuah Khan , Kees Cook Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Tycho Andersen Subject: [PATCH 1/6] selftests: don't kill child immediately in get_metadata() test Date: Fri, 18 Jan 2019 17:12:12 -0700 Message-Id: <20190119001217.12660-2-tycho@tycho.ws> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190119001217.12660-1-tycho@tycho.ws> References: <20190119001217.12660-1-tycho@tycho.ws> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This this test forks a child, and then the parent waits for a write() to a pipe signalling the child is ready to be attached to. If something in the child ASSERTs before it does this write, the test will hang waiting for it. Instead, let's EXPECT, so that execution continues until we do the write. Any failure after that is fine and can ASSERT. Signed-off-by: Tycho Andersen --- tools/testing/selftests/seccomp/seccomp_bpf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index 496a9a8c773a..9aba1b904089 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -2943,11 +2943,11 @@ TEST(get_metadata) }; /* one with log, one without */ - ASSERT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER, + EXPECT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER, SECCOMP_FILTER_FLAG_LOG, &prog)); - ASSERT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog)); + EXPECT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog)); - ASSERT_EQ(0, close(pipefd[0])); + EXPECT_EQ(0, close(pipefd[0])); ASSERT_EQ(1, write(pipefd[1], "1", 1)); ASSERT_EQ(0, close(pipefd[1]));