Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1567994ybv; Thu, 6 Feb 2020 06:15:19 -0800 (PST) X-Google-Smtp-Source: APXvYqxtJAgEHgfPxHvxsLOKn9Hndd53Yt/iv5TIalPKhinF2hAnf9NTa5tsyrTfGUUq701MVnBl X-Received: by 2002:aca:cf12:: with SMTP id f18mr7047033oig.81.1580998519021; Thu, 06 Feb 2020 06:15:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580998519; cv=none; d=google.com; s=arc-20160816; b=zF8pMxKoXRIUVn0YTCuqt9qsYZhfntEVBnneEyUwmfL89lmibC6aTEDGS/SKDsbMDV hgcSR0Hqh2jJdwyPB970MMr/5ykGcmi+NLPv4CUfuaph5xjnDoC7xGyPHp9i22JFOQ7P RF772OuH4hrnINua2QZhggIiS0MJ2folzzLSv4ce549bvlACPfZCw2g+8xURaH0CGhsA 5LcohdRvRWzFoWn/FznTpp+hmK7/vK3D2Xzc5WM/tpZrDKDY9ShJKLmTaWixfPyQ051E EfYx/koh/4HSt8s91faH3fCGnOtsYjyyDyP/DhvCpYDK3FXzLErXxkyEdsz9lHCFyrXc ojtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=EJED3uujaUKK1SbgoJgCjusoEatDIw38P0WIUwceEBU=; b=BolVGAqpwJSoYWDDfLxvc758YRZuBPLjPslDAzpmxPr3Y0Xn5hEIs9MQAQ832vUwnE viY4K/hzgOb2Cqu78Ux+h+gJuZzo6STdWUdttKOFRSlbppjTyF/hgyRAmVEBLr1N2kg4 7Kqv3NQwdnWPG7+bABfmeAdVa/HJalEAfh6GLcvn61Nqf72mQqN1dbBNLFlMZyPxLoy0 7qEWg+lOzlsJBLhrhFpdtCsmpSbhVgS/J06iPvI0hMhI6k3t/xs3e2ElDTugmwJ2+vCM sNXcD7nuiz+AhjsR98Cagb/XNJr9wN16/TmFstmyn8kRT5ZlBm1XDRTYnc4qVCjfn6I1 /zoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m17si1942210otk.109.2020.02.06.06.15.06; Thu, 06 Feb 2020 06:15:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728081AbgBFONj (ORCPT + 99 others); Thu, 6 Feb 2020 09:13:39 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:40466 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727955AbgBFONj (ORCPT ); Thu, 6 Feb 2020 09:13:39 -0500 Received: from turingmachine.home (unknown [IPv6:2804:431:c7f5:7989:d711:794d:1c68:5ed3]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tonyk) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 2F2CC295297; Thu, 6 Feb 2020 14:13:31 +0000 (GMT) From: =?UTF-8?q?Andr=C3=A9=20Almeida?= To: linux-kernel@vger.kernel.org, tglx@linutronix.de Cc: kernel@collabora.com, krisman@collabora.com, shuah@kernel.org, linux-kselftest@vger.kernel.org, rostedt@goodmis.org, ryao@gentoo.org, peterz@infradead.org, dvhart@infradead.org, mingo@redhat.com, z.figura12@gmail.com, steven@valvesoftware.com, pgriffais@valvesoftware.com, =?UTF-8?q?Andr=C3=A9=20Almeida?= Subject: [PATCH v2 3/4] selftests: futex: Add FUTEX_WAIT_MULTIPLE wouldblock test Date: Thu, 6 Feb 2020 11:10:50 -0300 Message-Id: <20200206141051.6124-4-andrealmeid@collabora.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200206141051.6124-1-andrealmeid@collabora.com> References: <20200206141051.6124-1-andrealmeid@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gabriel Krisman Bertazi Add test for wouldblock return when waiting for multiple futexes. Skip the test if it's a x32 application and the kernel returned the approtiaded error, since this ABI is not supported for this operation. Signed-off-by: Gabriel Krisman Bertazi Co-developed-by: André Almeida Signed-off-by: André Almeida --- .../futex/functional/futex_wait_wouldblock.c | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/futex/functional/futex_wait_wouldblock.c b/tools/testing/selftests/futex/functional/futex_wait_wouldblock.c index 0ae390ff8164..bcbac042992d 100644 --- a/tools/testing/selftests/futex/functional/futex_wait_wouldblock.c +++ b/tools/testing/selftests/futex/functional/futex_wait_wouldblock.c @@ -12,6 +12,7 @@ * * HISTORY * 2009-Nov-14: Initial version by Gowrishankar + * 2019-Dec-13: Add WAIT_MULTIPLE test by Krisman * *****************************************************************************/ @@ -40,6 +41,7 @@ int main(int argc, char *argv[]) { struct timespec to = {.tv_sec = 0, .tv_nsec = timeout_ns}; futex_t f1 = FUTEX_INITIALIZER; + struct futex_wait_block fwb = {&f1, f1+1, 0}; int res, ret = RET_PASS; int c; @@ -61,7 +63,7 @@ int main(int argc, char *argv[]) } ksft_print_header(); - ksft_set_plan(1); + ksft_set_plan(2); ksft_print_msg("%s: Test the unexpected futex value in FUTEX_WAIT\n", basename(argv[0])); @@ -71,8 +73,30 @@ int main(int argc, char *argv[]) fail("futex_wait returned: %d %s\n", res ? errno : res, res ? strerror(errno) : ""); ret = RET_FAIL; + } else + ksft_test_result_pass("futex_wait wouldblock succeeds\n"); + + info("Calling futex_wait_multiple on f1: %u @ %p with val=%u\n", + f1, &f1, f1+1); + res = futex_wait_multiple(&fwb, 1, NULL, FUTEX_PRIVATE_FLAG); + +#ifdef __ILP32__ + if (res != -1 || errno != ENOSYS) { + ksft_test_result_fail("futex_wait_multiple returned %d\n", + res < 0 ? errno : res); + ret = RET_FAIL; + } else { + ksft_test_result_skip("futex_wait_multiple not supported at x32\n"); + } +#else + if (!res || errno != EWOULDBLOCK) { + ksft_test_result_fail("futex_wait_multiple returned %d\n", + res < 0 ? errno : res); + ret = RET_FAIL; } + ksft_test_result_pass("futex_wait_multiple wouldblock succeeds\n"); +#endif /* __ILP32__ */ - print_result(TEST_NAME, ret); + ksft_print_cnts(); return ret; } -- 2.25.0