From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7FE9380FDF for ; Mon, 1 Jun 2026 06:51:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780296699; cv=none; b=Mzxn/Qxnv7gqvYfgoTEeM5ApFi0CjeIkyA73X0/5cIF+JYq9SQs41833HrzIveKJKZm8h16Lio5vW6nOY+lqAvwxeKEc209oDzUrm+CWhdOHlCVWPl8hrLVoeGIldvsaBfbVCpXsq6uqNh8W4AykLpJm/O3JvVW4XIlRqq6Ee/o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780296699; c=relaxed/simple; bh=zQyElqJggpdAoRCfqjPth8BzP2CEJO+096dvpyMO/58=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=HYgZG9CJBxHS/8uqjsnS+IkTS44UPWw22RH8GQTrXcG+Z8HtpE6hnT+4mFDDILmbFKqPCyJy2aB/F7LwXTomVCab1hSDvxyjMzyYXg4gqVoXteGKaS5G5hvG9jaZV0pn0n80EMcPAKC3V8/PLV2slPQaSi06OC64mFdcwuZ3QcA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--wakel.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=u9gNx47r; arc=none smtp.client-ip=209.85.210.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--wakel.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="u9gNx47r" Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-842278a630dso2520327b3a.2 for ; Sun, 31 May 2026 23:51:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780296696; x=1780901496; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=1hNLATkHbi9kvgAQrnw7X+32QULnpyW2fwEQdl2tOKs=; b=u9gNx47rgs+cOMCbfZhaLasmWvP3V9hNxDa1zF5pSB/8ABVHgNEEF8jLURpGyV/TYB RKyW/v9KVndwUDWoacszTForcQmkgfC+JwNbPhK6UyyAA0AX7cH1fKtAY3OFhP0JxVtv kYw9OBjgH9J3Bj3Q8C9Iwhk8SeAy4A5PXxZtw534gHhrfcPFrQDy3ej8CMS6ltC68coc vwwVfZy+F+JXTNPQdquBvbH7XZeYjzYykBPOYWZ0u3bo7CvkVysq9vyIYowx0bQcKcWL OcdQHMJbdvTcYuJY7eWdG5g5dTpAizFYGhI5JqUj7CM3htvdeJiy9X/Pji+joyIVXJ1a FBVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780296696; x=1780901496; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1hNLATkHbi9kvgAQrnw7X+32QULnpyW2fwEQdl2tOKs=; b=rG2b1Zn7JyZ5jhUkAnpftm+o0/9zm59b2fv4jyNM1mkiJvB0erxip0Q4BDT4bnA5/i yepnBxb3mrIQoAuzuK0TQrvDY2u0gpsszpABrqiMO/EynljQxY6v0PKpBJ+dspz0l92M DX0DL/6vj1CTvRXXEprlkPfhH8EHl22ewIzKu2ewJCAKZ3X+d3aHRRN32VJ2b+LXeDUa 2ZmAtbeChKqRZQUJUFZ5FgVJ+Fy+wQVdYMFH2eVDfa8GF2SMU2qai7BBY5bRFUhDBeFl cKrVVs2JIso38+3JVfiNFVR/8pRfcRKojawSkjxubAdwGq+6HzMYxKi2KrsygDT2Ynj1 wtRQ== X-Forwarded-Encrypted: i=1; AFNElJ+ulex9pper8NOdpae4a+bz+rsQkA9Ec8FxovFMsHpoOrZ+83OvHbWiYhZpDhQdBr2D8/EzzV9FFDiO02Y=@vger.kernel.org X-Gm-Message-State: AOJu0YwTzV73Cgoi/m3ImLT36d0jIKpcA0zkUuwK00RWADTcMRByjpas LinJLXz3A7LMsshd6GdDbEKrRDnG7lgaYaQqE2Zs5XWcyi0MMz6Xs2HD+oAtejJWPnS4487vxGW 7vA== X-Received: from pfbmu27.prod.google.com ([2002:a05:6a00:6e9b:b0:842:414c:de5f]) (user=wakel job=prod-delivery.src-stubby-dispatcher) by 2002:aa7:9a8c:0:b0:83d:b0a0:90e3 with SMTP id d2e1a72fcca58-84225478823mr8881984b3a.31.1780296695741; Sun, 31 May 2026 23:51:35 -0700 (PDT) Date: Mon, 1 Jun 2026 06:51:22 +0000 In-Reply-To: <20260601065126.3623867-1-wakel@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260601065126.3623867-1-wakel@google.com> X-Mailer: git-send-email 2.54.0.823.g6e5bcc1fc9-goog Message-ID: <20260601065126.3623867-4-wakel@google.com> Subject: [PATCH 3/7] selftests/futex: Migrate futex_requeue_pi_mismatched_ops to harness From: Wake Liu To: Thomas Gleixner , Ingo Molnar , Shuah Khan , linux-kselftest@vger.kernel.org Cc: Peter Zijlstra , Darren Hart , Davidlohr Bueso , "=?UTF-8?q?Andr=C3=A9=20Almeida?=" , Carlos Llamas , linux-kernel@vger.kernel.org, wakel@google.com Content-Type: text/plain; charset="UTF-8" Migrate futex_requeue_pi_mismatched_ops test to the kselftest harness framework, removing mixed legacy ksft_* API usages and passing test metadata to helper thread. Signed-off-by: Wake Liu --- .../futex_requeue_pi_mismatched_ops.c | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c b/tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c index f686e605359c..c55eadd261da 100644 --- a/tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c +++ b/tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c @@ -29,14 +29,17 @@ futex_t f1 = FUTEX_INITIALIZER; futex_t f2 = FUTEX_INITIALIZER; -int child_ret = 0; +int child_ret; void *blocking_child(void *arg) { + struct __test_metadata *_metadata = (struct __test_metadata *)arg; + child_ret = futex_wait(&f1, f1, NULL, FUTEX_PRIVATE_FLAG); if (child_ret < 0) { child_ret = -errno; - ksft_exit_fail_msg("futex_wait\n"); + ASSERT_EQ(child_ret, 0) + TH_LOG("futex_wait failed: %s", strerror(errno)); } return (void *)&child_ret; } @@ -46,8 +49,8 @@ TEST(requeue_pi_mismatched_ops) pthread_t child; int ret; - if (pthread_create(&child, NULL, blocking_child, NULL)) - ksft_exit_fail_msg("pthread_create\n"); + ASSERT_EQ(pthread_create(&child, NULL, blocking_child, _metadata), 0) + TH_LOG("pthread_create failed"); /* Allow the child to block in the kernel. */ sleep(1); @@ -67,27 +70,31 @@ TEST(requeue_pi_mismatched_ops) * FUTEX_WAKE. */ ret = futex_wake(&f1, 1, FUTEX_PRIVATE_FLAG); - if (ret == 1) + if (ret == 1) { ret = 0; - else if (ret < 0) - ksft_exit_fail_msg("futex_wake\n"); - else - ksft_exit_fail_msg("futex_wake did not wake the child\n"); + } else if (ret < 0) { + ASSERT_GE(ret, 0) + TH_LOG("futex_wake failed: %s", strerror(errno)); + } else { + ASSERT_TRUE(0) + TH_LOG("futex_wake did not wake the child"); + } } else { - ksft_exit_fail_msg("futex_cmp_requeue_pi\n"); + ASSERT_TRUE(0) + TH_LOG("futex_cmp_requeue_pi failed with unexpected errno: %s", strerror(errno)); } } else if (ret > 0) { - ksft_test_result_fail("futex_cmp_requeue_pi failed to detect the mismatch\n"); + EXPECT_EQ(ret, 0) + TH_LOG("futex_cmp_requeue_pi failed to detect the mismatch"); } else { - ksft_exit_fail_msg("futex_cmp_requeue_pi found no waiters\n"); + ASSERT_TRUE(0) + TH_LOG("futex_cmp_requeue_pi found no waiters"); } pthread_join(child, NULL); - if (!ret && !child_ret) - ksft_test_result_pass("futex_requeue_pi_mismatched_ops passed\n"); - else - ksft_test_result_pass("futex_requeue_pi_mismatched_ops failed\n"); + EXPECT_EQ(ret, 0) TH_LOG("Test failed: ret=%d", ret); + EXPECT_EQ(child_ret, 0) TH_LOG("Child failed: child_ret=%d", child_ret); } TEST_HARNESS_MAIN -- 2.54.0.823.g6e5bcc1fc9-goog