mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for André Almeida" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: andrealmeid@igalia.com, Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: locking/futex] selftests/futex: Refactor futex_numa_mpol with kselftest_harness.h
Date: Sat, 20 Sep 2025 16:27:42 -0000	[thread overview]
Message-ID: <175838566211.709179.4103621629573303470.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20250917-tonyk-robust_test_cleanup-v3-13-306b373c244d@igalia.com>

The following commit has been merged into the locking/futex branch of tip:

Commit-ID:     d35ca2f642726a2c8a85c5b864fd05f59f3965af
Gitweb:        https://git.kernel.org/tip/d35ca2f642726a2c8a85c5b864fd05f59f3965af
Author:        André Almeida <andrealmeid@igalia.com>
AuthorDate:    Wed, 17 Sep 2025 18:21:52 -03:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Sat, 20 Sep 2025 18:11:55 +02:00

selftests/futex: Refactor futex_numa_mpol with kselftest_harness.h

To reduce the boilerplate code, refactor futex_numa_mpol test to use
kselftest_harness header instead of futex's logging header.

Signed-off-by: André Almeida <andrealmeid@igalia.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 tools/testing/selftests/futex/functional/futex_numa_mpol.c | 41 +------
 tools/testing/selftests/futex/functional/run.sh            | 15 +---
 2 files changed, 9 insertions(+), 47 deletions(-)

diff --git a/tools/testing/selftests/futex/functional/futex_numa_mpol.c b/tools/testing/selftests/futex/functional/futex_numa_mpol.c
index 722427f..afe5d95 100644
--- a/tools/testing/selftests/futex/functional/futex_numa_mpol.c
+++ b/tools/testing/selftests/futex/functional/futex_numa_mpol.c
@@ -16,9 +16,9 @@
 #include <linux/futex.h>
 #include <sys/mman.h>
 
-#include "logging.h"
 #include "futextest.h"
 #include "futex2test.h"
+#include "../../kselftest_harness.h"
 
 #define MAX_THREADS	64
 
@@ -131,42 +131,16 @@ static void test_futex(void *futex_ptr, int err_value)
 	__test_futex(futex_ptr, err_value, FUTEX2_SIZE_U32 | FUTEX_PRIVATE_FLAG | FUTEX2_NUMA);
 }
 
-static void usage(char *prog)
+static void test_futex_mpol(void *futex_ptr, int err_value)
 {
-	printf("Usage: %s\n", prog);
-	printf("  -c    Use color\n");
-	printf("  -h    Display this help message\n");
-	printf("  -v L  Verbosity level: %d=QUIET %d=CRITICAL %d=INFO\n",
-	       VQUIET, VCRITICAL, VINFO);
+	__test_futex(futex_ptr, err_value, FUTEX2_SIZE_U32 | FUTEX_PRIVATE_FLAG | FUTEX2_NUMA | FUTEX2_MPOL);
 }
 
-int main(int argc, char *argv[])
+TEST(futex_numa_mpol)
 {
 	struct futex32_numa *futex_numa;
-	int mem_size;
 	void *futex_ptr;
-	int c;
-
-	while ((c = getopt(argc, argv, "chv:")) != -1) {
-		switch (c) {
-		case 'c':
-			log_color(1);
-			break;
-		case 'h':
-			usage(basename(argv[0]));
-			exit(0);
-			break;
-		case 'v':
-			log_verbosity(atoi(optarg));
-			break;
-		default:
-			usage(basename(argv[0]));
-			exit(1);
-		}
-	}
-
-	ksft_print_header();
-	ksft_set_plan(2);
+	int mem_size;
 
 	mem_size = sysconf(_SC_PAGE_SIZE);
 	futex_ptr = mmap(NULL, mem_size * 2, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
@@ -239,6 +213,7 @@ int main(int argc, char *argv[])
 #else
 	ksft_test_result_skip("futex2 MPOL hints test requires libnuma 2.0.16+\n");
 #endif
-	ksft_finished();
-	return 0;
+	munmap(futex_ptr, mem_size * 2);
 }
+
+TEST_HARNESS_MAIN
diff --git a/tools/testing/selftests/futex/functional/run.sh b/tools/testing/selftests/futex/functional/run.sh
index f725531..e88545c 100755
--- a/tools/testing/selftests/futex/functional/run.sh
+++ b/tools/testing/selftests/futex/functional/run.sh
@@ -18,19 +18,6 @@
 #
 ###############################################################################
 
-# Test for a color capable console
-if [ -z "$USE_COLOR" ]; then
-    tput setf 7 || tput setaf 7
-    if [ $? -eq 0 ]; then
-        USE_COLOR=1
-        tput sgr0
-    fi
-fi
-if [ "$USE_COLOR" -eq 1 ]; then
-    COLOR="-c"
-fi
-
-
 echo
 ./futex_requeue_pi
 
@@ -63,4 +50,4 @@ echo
 ./futex_priv_hash
 
 echo
-./futex_numa_mpol $COLOR
+./futex_numa_mpol

  reply	other threads:[~2025-09-20 16:27 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-17 21:21 [PATCH v3 00/15] selftests/futex: Refactor tests to use kselftest_harness.h André Almeida
2025-09-17 21:21 ` [PATCH v3 01/15] selftests: kselftest: Create ksft_print_dbg_msg() André Almeida
2025-09-20 16:27   ` [tip: locking/futex] " tip-bot2 for André Almeida
2025-09-25 11:47     ` Mark Brown
2025-09-25 14:14       ` [PATCH] tools/nolibc: Add stdbool.h to nolibc includes André Almeida
2025-09-25 14:24         ` Mark Brown
2025-09-25 14:37           ` André Almeida
2025-09-25 14:45             ` Mark Brown
2025-09-25 14:48               ` Thomas Weißschuh
2025-09-25 14:46             ` Thomas Weißschuh
2025-09-25 16:15         ` Thomas Weißschuh
2025-09-25 16:24           ` Mark Brown
2025-09-25 16:49             ` Thomas Weißschuh
2025-09-17 21:21 ` [PATCH v3 02/15] selftests/futex: Refactor futex_requeue_pi with kselftest_harness.h André Almeida
2025-09-20 16:27   ` [tip: locking/futex] " tip-bot2 for André Almeida
2025-09-17 21:21 ` [PATCH v3 03/15] selftests/futex: Refactor futex_requeue_pi_mismatched_ops " André Almeida
2025-09-20 16:27   ` [tip: locking/futex] " tip-bot2 for André Almeida
2025-09-17 21:21 ` [PATCH v3 04/15] selftests/futex: Refactor futex_requeue_pi_signal_restart " André Almeida
2025-09-20 16:27   ` [tip: locking/futex] " tip-bot2 for André Almeida
2025-09-17 21:21 ` [PATCH v3 05/15] selftests/futex: Refactor futex_wait_timeout " André Almeida
2025-09-20 16:27   ` [tip: locking/futex] " tip-bot2 for André Almeida
2025-09-17 21:21 ` [PATCH v3 06/15] selftests/futex: Refactor futex_wait_wouldblock " André Almeida
2025-09-20 16:27   ` [tip: locking/futex] " tip-bot2 for André Almeida
2025-09-17 21:21 ` [PATCH v3 07/15] selftests/futex: Refactor futex_wait_unitialized_heap " André Almeida
2025-09-20 16:27   ` [tip: locking/futex] " tip-bot2 for André Almeida
2025-09-17 21:21 ` [PATCH v3 08/15] selftests/futex: Refactor futex_wait_private_mapped_file " André Almeida
2025-09-20 16:27   ` [tip: locking/futex] " tip-bot2 for André Almeida
2025-09-17 21:21 ` [PATCH v3 09/15] selftests/futex: Refactor futex_wait " André Almeida
2025-09-20 16:27   ` [tip: locking/futex] " tip-bot2 for André Almeida
2025-09-17 21:21 ` [PATCH v3 10/15] selftests/futex: Refactor futex_requeue " André Almeida
2025-09-20 16:27   ` [tip: locking/futex] " tip-bot2 for André Almeida
2025-09-17 21:21 ` [PATCH v3 11/15] selftests/futex: Refactor futex_waitv " André Almeida
2025-09-20 16:27   ` [tip: locking/futex] " tip-bot2 for André Almeida
2025-09-17 21:21 ` [PATCH v3 12/15] selftests/futex: Refactor futex_priv_hash " André Almeida
2025-09-20 16:27   ` [tip: locking/futex] " tip-bot2 for André Almeida
2025-09-17 21:21 ` [PATCH v3 13/15] selftests/futex: Refactor futex_numa_mpol " André Almeida
2025-09-20 16:27   ` tip-bot2 for André Almeida [this message]
2025-09-17 21:21 ` [PATCH v3 14/15] selftests/futex: Drop logging.h include from futex_numa André Almeida
2025-09-20 16:27   ` [tip: locking/futex] " tip-bot2 for André Almeida
2025-09-17 21:21 ` [PATCH v3 15/15] selftests/futex: Remove logging.h file André Almeida
2025-09-20 16:27   ` [tip: locking/futex] " tip-bot2 for André Almeida

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=175838566211.709179.4103621629573303470.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=andrealmeid@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®