Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1406615rdb; Mon, 19 Feb 2024 14:54:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVRUqLi4gUkEDMFTh9PhCki1Tk/zSCXCm49R/edgVWgc+nGvoaPpcQD+VcKFutyLb02Ega72BRuc/xfjnJGQYZnP7RA5o3Hi8SA3hnf+Q== X-Google-Smtp-Source: AGHT+IHhtgpQXwx0qjnJT8G9QtgQx9fA0s2POcR8H0uRpzkInYs/BFVUIMQ7pRlstjFskjjl61SC X-Received: by 2002:a05:6a00:3016:b0:6e4:74d9:6f0f with SMTP id ay22-20020a056a00301600b006e474d96f0fmr2511727pfb.0.1708383267364; Mon, 19 Feb 2024 14:54:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708383267; cv=pass; d=google.com; s=arc-20160816; b=odnhR2WzoXdSDKVX1ZC2VULIkvNnxQMypGf9IpdxL9h+m8+oQUOTO6r2vWkNuRx1cf DLYAS8sOTjunHmw55gId8ph/ftsGuylN2bvO5xEvQfiCZpt8FGc5+Vo718EazqsYkc/S UHVbp7uJr4C2YK1WuXDL62OBpH5WBDBHFqgc8GygLGCvefkrpus+qWw/EIQVvhbH8LGb cwWq4qRdXreqUNCqlC1EQeWz324tEjjyHCXctHzKoFWu8j9rfk43VDs77VGl9J8xKtWE 9+noXDDuIFskvRxqiAXPbq6oNQ4GZ+AZVEIM1n8LRIDeMPbzyqQylO4HG4Y9Kl8hIbyH Uk7w== 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=hR3Xqo6s6FufP5gEw1XgbtLHrluZu7hd5XGp+hLIfiM=; b=A8KAWNfjpO7hbFD8DErTOib27TVxyhw7qKh+PwF0J9WK9eRtQksEu3wUkqhT1A4yTp O/RzwPYpmUN3IAS7l8RuauHlc+71YHBbb9PIfYYfbsrWdVtk1gL6FnjRV7UAlMcBV7oY o3cerfbq2L0mCUQDUkpddL5IQOrnAqcotmxAAs51pg0aRGOuCQlqE1CVpM1npz/vFKSv TqEq3qSes5ylwMIkMZSHdO0Y9H529bLI3931WYNzuD840a1ACFace+nkbENODAtYLefk f5aJJyTje9egdLe0IJhsv7/P1sJ46h1EPbtyJ9JbAJn5ueeESo0Zngi0fhR3AzVS30td pCBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@codeweavers.com header.s=s1 header.b=GMEk38aR; 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-72105-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72105-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codeweavers.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id e20-20020a056a001a9400b006e4659e4ae2si2038230pfv.168.2024.02.19.14.54.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 14:54:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72105-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@codeweavers.com header.s=s1 header.b=GMEk38aR; 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-72105-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72105-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 597D1B26992 for ; Mon, 19 Feb 2024 22:45:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 273D664AB3; Mon, 19 Feb 2024 22:39:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=codeweavers.com header.i=@codeweavers.com header.b="GMEk38aR" 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 1FF1B5676F; Mon, 19 Feb 2024 22:39:38 +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=1708382382; cv=none; b=AX7xr21cugCMysCNUWoyd2haUA6/F4Dk5UOAjhonWG+uRPKkI8be7b4WdvNQUlYz4a4OjyMIePhOOcBlUYXucB6TX6Pul2n2NA1hHl+QRc68tKB+8EwTMfwUB2fKs5W6lTwz+2i13ptbr8NgLt+/5J8R1O03fHpyyRiw5qt0v9A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708382382; 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=m4Ra80NOAboonw1gCG0f7TrnHxiZq39MvM2uoXJN0PbSaXh38G3/+vrSFA4z46+MCXs7rj07iEFjQIv6Bxy8aoz7Cr4ngzNwnfKkfs7LZPFn7az6Jf3EEEuZrSSVBDS/gQo8z9Mv0zmAX9g0afk7erWoh1OpWSWe7Dde2WiqLkg= 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=GMEk38aR; 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=GMEk38aRzCsql4OCoE6k2dq9E1 Y8bFWT5JrWXlybQ3GCszyrdYRHLDdXHcaoqp8fXEOJ1YwlrmimdgZgPwoOO8uuWdXOqaXhYpL4PZi +RKeZjFu+zgmDKtDvKmJ8cGJla4mKC9fnu8ktMD8hmMXN7vURDgEXQhBIPAMoKYktQ5+1vi9pls2W KDKv8ehlQfnNgsvNbDQ9ZKj4w4ucvinyZwhnB9Qz0jXReaNP7oHd+NdrxrHuyTX4r0++U543Wmmqs Q83POryFlXV6yZOWxwt3QW71vNXbeO5pKsD78m+1nNc621l5ltMtO8m9LDmkq/N7gVyOI59fGC1Yu V5LLH88Q==; 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 1rcCIS-0037Oz-23; Mon, 19 Feb 2024 16:39:36 -0600 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 , Elizabeth Figura Subject: [PATCH v2 25/31] selftests: ntsync: Add some tests for auto-reset event state. Date: Mon, 19 Feb 2024 16:38:27 -0600 Message-ID: <20240219223833.95710-26-zfigura@codeweavers.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240219223833.95710-1-zfigura@codeweavers.com> References: <20240219223833.95710-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