Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2107644lqo; Sun, 19 May 2024 14:00:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVmTcpS5GNz3lkFWJSUnjLUyxInHvkQv7n5jv3LA5+3xktUt/FdTp7Kqv9adXQk5PCJJP+8XcqFrW/Xc9emlCiLeqfd5uleZ+7NNSPDoQ== X-Google-Smtp-Source: AGHT+IHD5pOrD/LCUsTaz8m0KRIyUCqJKEO41OSpSy4DeUJY/5QBX+hCXNjEImqV2OfFwZcJL/aU X-Received: by 2002:a05:6a00:2e12:b0:6f3:ea8a:f974 with SMTP id d2e1a72fcca58-6f4e029bb36mr32355309b3a.1.1716152434186; Sun, 19 May 2024 14:00:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716152434; cv=pass; d=google.com; s=arc-20160816; b=e6fHaYEuF4KngN6hzVJvHuQX/Q5skTtjM5juJo9mP/N13nr5n2QUWrQrUnCeHTql6b hCwAKJ7zcPsSgQQqZWHyxx9gTSO9bnPLhx0ZqKN2cNfGhISmf4wXZxAi+rY92o3wA43i 85d9liAuKzpAAM72parITzdZbPft/XGeD/E1GM/pX+pjyewTv4wXXQuiHRldKgkWXueV vtq48PV7hwOVVn7JXn4G/xvAzjBpocwBHP7HfwqymIV9wviP3QkObiSpn0AqZ4fQJwDJ pq2bFYMzAAm/7BILZDvjOfDHGv2xyVQ1d5N6v2T1uxUGa8g9zt085bAu/cgA7Xv2lS8C UkVA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=LKcmPKdAjQdF3bbQtJTzkXMVlTzxEokxNER4gf+xieY=; fh=eVY06L/C5FDTmF2RNqfudsnjwkB3tbhT/y33cGhZc0I=; b=F5chQL50gqUqlZOzzmrPiMB9wOHUjQJ60TAmKZve55VajXr6pJzr/9yQJsT5Ls4mdX qN0WCTFVMQ7a+tf6F2JL2xD5vxjueyEAWr8h4sqonY9M7771EBNZrAkBQtm5Grk2l4Zb rlCMwpJU73miyuZOSyKW+yyS6F+Wnj3bUbLPAhQ2ZdRD9MWYDs3W3+fMzd9oEf5hNvcx 2HbW6mCqjXIik42isGiFbm/8I+H0f74dWhq944NLw6L5jdz2HW43VdBInCOGScFk3u7x BevlseL9e/7EPIFoxYSkiXMf9bgwW4nXcJlMhTkuheAI92IG0rLw6E5Enq9vAfb9GaJG vSEA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@codeweavers.com header.s=s1 header.b=ENcCEfUl; arc=pass (i=1 spf=pass spfdomain=codeweavers.com dkim=pass dkdomain=codeweavers.com dmarc=pass fromdomain=codeweavers.com); spf=pass (google.com: domain of linux-kernel+bounces-183248-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183248-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codeweavers.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f4d2a96ae9si1462026b3a.127.2024.05.19.14.00.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 May 2024 14:00:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183248-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@codeweavers.com header.s=s1 header.b=ENcCEfUl; arc=pass (i=1 spf=pass spfdomain=codeweavers.com dkim=pass dkdomain=codeweavers.com dmarc=pass fromdomain=codeweavers.com); spf=pass (google.com: domain of linux-kernel+bounces-183248-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183248-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codeweavers.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4D05C28259A for ; Sun, 19 May 2024 20:29:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BE14580026; Sun, 19 May 2024 20:25:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=codeweavers.com header.i=@codeweavers.com header.b="ENcCEfUl" Received: from mail.codeweavers.com (mail.codeweavers.com [4.36.192.163]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A74296F086; Sun, 19 May 2024 20:25:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=4.36.192.163 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716150319; cv=none; b=SaNltT0pmi6YqDTLTKKd7lMOZt5ASrfJcDHLBbOAQNZQew+US513Ib3Q3Ut4dSiA9guBYAOGsAkJ8BuMcpjAuX7kW6GwyUlG7NR/ZLj0kK7P+exE7V4N4j5Bnftax63WMJWZGBgVWADbNgCxTlqC9bu88MAAOT1WXceQqCspsg8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716150319; c=relaxed/simple; bh=UtZlrYh+PmJdbzwEPZ8FZ2UGM/54x6+dlq/Hl5BOk+Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SeaTMzb2+cJo162vHxY6Ga9QBdhYLgJwetk/zl7Pbo2WA12q7KI3vTpglOjpU/hzoEEMp0NrPSzUPmvHXdubxTop/VrsyXRwmWs8AFZ2OFLQrN1tL+o2f3xKnfk23w2mF7dRPLa744jin6odQ7NV6utKg0YCz5g6jidM+JpphWE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=codeweavers.com; spf=pass smtp.mailfrom=codeweavers.com; dkim=pass (2048-bit key) header.d=codeweavers.com header.i=@codeweavers.com header.b=ENcCEfUl; arc=none smtp.client-ip=4.36.192.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=codeweavers.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=codeweavers.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codeweavers.com; s=s1; h=Message-ID:Date:Subject:Cc:To:From:Sender; bh=LKcmPKdAjQdF3bbQtJTzkXMVlTzxEokxNER4gf+xieY=; b=ENcCEfUlvEPP120diLJytEHF/k pwF860SPuiVOXqtGOqi2Qzl1N+41Hezh6kFQfqHpQcAzaSEjx2WanHkYzNLoqGMHYc/cshYo8l3UI 07iiZImqBK3J5a9AWKqOSsGOY0ojdjYq9QpCG5c7nmRDdSgWeiVqovDukfggSHkZ5ks/B7v1YaGL5 g0mAzD8Zy0bRqV6tncp6nFN4Ny58/rCbI31MRJv1KJDguOClH1Lxtk68mI9ppOGKPI73mX/jsvWTb i38C3kXzwc4Gpj5NMqpLEdR3yJanxCefQXRUVopQPpJrtfImxWAkfjxvH0E/6OyT7cvvdlwDap796 Ubdlvmbg==; Received: from cw137ip160.mn.codeweavers.com ([10.69.137.160] helo=camazotz.mn.codeweavers.com) by mail.codeweavers.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1s8n5f-008wIn-0k; Sun, 19 May 2024 15:25:07 -0500 From: Elizabeth Figura To: Arnd Bergmann , Greg Kroah-Hartman , Jonathan Corbet , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, wine-devel@winehq.org, =?UTF-8?q?Andr=C3=A9=20Almeida?= , Wolfram Sang , Arkadiusz Hiler , Peter Zijlstra , Andy Lutomirski , linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Randy Dunlap , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , Elizabeth Figura Subject: [PATCH v5 21/28] selftests: ntsync: Add some tests for auto-reset event state. Date: Sun, 19 May 2024 15:24:47 -0500 Message-ID: <20240519202454.1192826-22-zfigura@codeweavers.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240519202454.1192826-1-zfigura@codeweavers.com> References: <20240519202454.1192826-1-zfigura@codeweavers.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Test event-specific ioctls NTSYNC_IOC_EVENT_SET, NTSYNC_IOC_EVENT_RESET, NTSYNC_IOC_EVENT_PULSE, NTSYNC_IOC_EVENT_READ for auto-reset events, and waiting on auto-reset events. Signed-off-by: Elizabeth Figura --- .../testing/selftests/drivers/ntsync/ntsync.c | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/tools/testing/selftests/drivers/ntsync/ntsync.c b/tools/testing/selftests/drivers/ntsync/ntsync.c index b6481c2b85cc..12ccb4ec28e4 100644 --- a/tools/testing/selftests/drivers/ntsync/ntsync.c +++ b/tools/testing/selftests/drivers/ntsync/ntsync.c @@ -442,6 +442,65 @@ TEST(manual_event_state) close(fd); } +TEST(auto_event_state) +{ + struct ntsync_event_args event_args; + __u32 index, signaled; + int fd, event, ret; + + fd = open("/dev/ntsync", O_CLOEXEC | O_RDONLY); + ASSERT_LE(0, fd); + + event_args.manual = 0; + event_args.signaled = 1; + event_args.event = 0xdeadbeef; + ret = ioctl(fd, NTSYNC_IOC_CREATE_EVENT, &event_args); + EXPECT_EQ(0, ret); + EXPECT_NE(0xdeadbeef, event_args.event); + event = event_args.event; + + check_event_state(event, 1, 0); + + signaled = 0xdeadbeef; + ret = ioctl(event, NTSYNC_IOC_EVENT_SET, &signaled); + EXPECT_EQ(0, ret); + EXPECT_EQ(1, signaled); + check_event_state(event, 1, 0); + + ret = wait_any(fd, 1, &event, 123, &index); + EXPECT_EQ(0, ret); + EXPECT_EQ(0, index); + check_event_state(event, 0, 0); + + signaled = 0xdeadbeef; + ret = ioctl(event, NTSYNC_IOC_EVENT_RESET, &signaled); + EXPECT_EQ(0, ret); + EXPECT_EQ(0, signaled); + check_event_state(event, 0, 0); + + ret = wait_any(fd, 1, &event, 123, &index); + EXPECT_EQ(-1, ret); + EXPECT_EQ(ETIMEDOUT, errno); + + ret = ioctl(event, NTSYNC_IOC_EVENT_SET, &signaled); + EXPECT_EQ(0, ret); + EXPECT_EQ(0, signaled); + + ret = ioctl(event, NTSYNC_IOC_EVENT_PULSE, &signaled); + EXPECT_EQ(0, ret); + EXPECT_EQ(1, signaled); + check_event_state(event, 0, 0); + + ret = ioctl(event, NTSYNC_IOC_EVENT_PULSE, &signaled); + EXPECT_EQ(0, ret); + EXPECT_EQ(0, signaled); + check_event_state(event, 0, 0); + + close(event); + + close(fd); +} + TEST(test_wait_any) { int objs[NTSYNC_MAX_WAIT_COUNT + 1], fd, ret; -- 2.43.0