public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/3] lib: add .min_cpus in tst_test struct
@ 2020-12-03 11:06 Li Wang
  2020-12-03 11:06 ` [LTP] [PATCH 2/3] syscalls: take use of .min_cpus Li Wang
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Li Wang @ 2020-12-03 11:06 UTC (permalink / raw)
  To: ltp

As the name implies, this new field is mainly to set minimum numbers
of CPU for LTP testcase. If system online CPUs are less than .min_cpus,
test will be exit with TCONF.

Note: I wouldn't add more description in test-writing-guidelines.txt,
because it is easy to understand the usage from the name.

Signed-off-by: Li Wang <liwang@redhat.com>
---
 include/tst_test.h | 3 +++
 lib/tst_test.c     | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/include/tst_test.h b/include/tst_test.h
index c91d3f18a..64a0934dd 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -157,6 +157,9 @@ struct tst_test {
 	 */
 	int all_filesystems:1;
 
+	/* Minimal numbers of CPU online required by the test */
+	unsigned long min_cpus;
+
 	/*
 	 * If set non-zero number of request_hugepages, test will try to reserve the
 	 * expected number of hugepage for testing in setup phase. If system does not
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 535c0ff4c..90b69789c 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -918,6 +918,9 @@ static void do_setup(int argc, char *argv[])
 	if (tst_test->all_filesystems)
 		tst_test->needs_device = 1;
 
+	if (tst_test->min_cpus > tst_ncpus())
+		tst_brk(TCONF, "Test needs %lu CPUs online", tst_test->min_cpus);
+
 	if (tst_test->request_hugepages)
 		tst_request_hugepages(tst_test->request_hugepages);
 
-- 
2.21.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-12-09 12:37 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-03 11:06 [LTP] [PATCH 1/3] lib: add .min_cpus in tst_test struct Li Wang
2020-12-03 11:06 ` [LTP] [PATCH 2/3] syscalls: take use of .min_cpus Li Wang
2020-12-03 11:06 ` [LTP] [PATCH 3/3] af_alg07: add dynamic bias for ARM Li Wang
2020-12-03 12:32   ` Richard Palethorpe
2020-12-03 14:27     ` Martin Doucha
2020-12-03 12:18 ` [LTP] [PATCH 1/3] lib: add .min_cpus in tst_test struct Richard Palethorpe
2020-12-04  6:33 ` [LTP] [PATCH v2 " Li Wang
2020-12-04  6:33   ` [LTP] [PATCH v2 2/3] syscalls: make use of .min_cpus Li Wang
2020-12-07 14:41     ` Cyril Hrubis
2020-12-04  6:33   ` [LTP] [PATCH v2 3/3] af_alg07: add dynamic bias for ARM Li Wang
2020-12-09  6:12     ` Li Wang
2020-12-09  9:17       ` Richard Palethorpe
2020-12-09 11:26     ` Martin Doucha
2020-12-09 12:37       ` Li Wang
2020-12-07 14:41   ` [LTP] [PATCH v2 1/3] lib: add .min_cpus in tst_test struct Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox