lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241105142616.761042-3-acme@kernel.org>
Date: Tue,  5 Nov 2024 11:26:14 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Ingo Molnar <mingo@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Jiri Olsa <jolsa@...nel.org>,
	Ian Rogers <irogers@...gle.com>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Kan Liang <kan.liang@...ux.intel.com>,
	Clark Williams <williams@...hat.com>,
	linux-kernel@...r.kernel.org,
	linux-perf-users@...r.kernel.org,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
	Howard Chu <howardchu95@...il.com>,
	James Clark <james.clark@...aro.org>,
	Leo Yan <leo.yan@...ux.dev>,
	Thomas Richter <tmricht@...ux.ibm.com>,
	Veronika Molnarova <vmolnaro@...hat.com>
Subject: [PATCH v2 2/4] perf test: Skip the python binding builtin test case with NO_LIBPYTHON=1

From: Arnaldo Carvalho de Melo <acme@...hat.com>

The python_use test suite was being built and tested even when the
python binding that it is designed to test is not being built, fix it by
making it skip the test with an informative message.

Testing this patch:

When building with NO_LIBPYTHON=1, i.e. explicitely disabling linking
against libpython and thus not building the python binding:

  $ perf test 17
  17: 'import perf' in python     : Skip (No python binding, enable by not using NO_LIBPYTHON=1.)
  $

Not disabling linking with libpython, the default, that results in the
python binding being built:

  $ perf test 17
  17: 'import perf' in python     : Ok
  $

Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: Athira Rajeev <atrajeev@...ux.vnet.ibm.com>
Cc: Howard Chu <howardchu95@...il.com>
Cc: Ian Rogers <irogers@...gle.com>
Cc: James Clark <james.clark@...aro.org>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Kan Liang <kan.liang@...ux.intel.com>
Cc: Leo Yan <leo.yan@...ux.dev>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Thomas Richter <tmricht@...ux.ibm.com>
Cc: Veronika Molnarova <vmolnaro@...hat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/tests/python-use.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/python-use.c b/tools/perf/tests/python-use.c
index b7325caad22bab10..7a86e59ebb27fa75 100644
--- a/tools/perf/tests/python-use.c
+++ b/tools/perf/tests/python-use.c
@@ -11,6 +11,7 @@
 
 static int test__python_use(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
 {
+#ifdef HAVE_LIBPYTHON_SUPPORT
 	char *cmd;
 	int ret;
 
@@ -22,6 +23,23 @@ static int test__python_use(struct test_suite *test __maybe_unused, int subtest
 	ret = system(cmd) ? -1 : 0;
 	free(cmd);
 	return ret;
+#else
+	return TEST_SKIP;
+#endif // HAVE_LIBPYTHON_SUPPORT
 }
 
-DEFINE_SUITE("'import perf' in python", python_use);
+static struct test_case tests__python_use[] = {
+	{
+		.name	   = "python_use",
+		.desc	   = "'import perf' in python",
+		.run_case  = test__python_use,
+#ifndef HAVE_LIBPYTHON_SUPPORT
+		.skip_reason = "No python binding, enable by not using NO_LIBPYTHON=1",
+#endif
+       },
+};
+
+struct test_suite suite__python_use = {
+	.desc = "'import perf' in python",
+	.test_cases = tests__python_use,
+};
-- 
2.47.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ