From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6D56942ED9; Fri, 21 Jul 2023 13:52:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5367642D3A; Fri, 21 Jul 2023 13:51:47 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 8D94240DD8 for ; Fri, 21 Jul 2023 13:51:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689940304; x=1721476304; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=N22OQvIxyuMRlJaTLHpPOULB+tF04Cvw6UcuvrRykQw=; b=XVa0Z/X/JzqGOA+0cq8n0kbL2Hls0w3ucUSZ5mjxVvIQfnGzk7vooPZ5 KAZ2LVukTmoxvAqFKMSz3MYgpG2wr0hCB49Arx8G/uuB+fxvyj61BH6Ek ZeJx0C3B2odcAkDsy0Dwic/fl9YLB/19nRsqgjX2vavkBPnmOBLEIRp4b l/Xt8Nvr/Qj/0cqalJ1eHrOyfd3k9uP9r3YuH7zx/vIQRIE/YJyBVqEJQ Z9fF19VOWu+0CKtJCm9/MBszy6JGXZUkjbby+983nYXWMO8Tb7sydT0Wp AYgYhgXmu3WeLqgkfuiYDxw8okoM0PkkeYPazuvRbhHvAl0FDc3lG7Lg4 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10777"; a="346599192" X-IronPort-AV: E=Sophos;i="6.01,220,1684825200"; d="scan'208";a="346599192" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2023 04:51:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10777"; a="971420599" X-IronPort-AV: E=Sophos;i="6.01,220,1684825200"; d="scan'208";a="971420599" Received: from silpixa00401385.ir.intel.com ([10.237.214.156]) by fmsmga006.fm.intel.com with ESMTP; 21 Jul 2023 04:51:43 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [RFC PATCH 4/5] app/test: define unit tests suites based on test macros Date: Fri, 21 Jul 2023 12:51:24 +0100 Message-Id: <20230721115125.55137-5-bruce.richardson@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230721115125.55137-1-bruce.richardson@intel.com> References: <20230721115125.55137-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Rather than having the test suites listed out in the meson.build files and having to have them enabled/disabled selectively based on what libs are being built, pull the tests to run from the source files which were added to the build. Signed-off-by: Bruce Richardson --- app/meson.build | 7 ++++++- app/test/suites/meson.build | 29 +++++++++++++++++++++++++++++ buildtools/get-test-suites.py | 24 ++++++++++++++++++++++++ buildtools/meson.build | 1 + 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 app/test/suites/meson.build create mode 100644 buildtools/get-test-suites.py diff --git a/app/meson.build b/app/meson.build index 0d8b618e7f..c14dc80892 100644 --- a/app/meson.build +++ b/app/meson.build @@ -101,7 +101,7 @@ foreach app:apps link_libs = dpdk_static_libraries + dpdk_drivers endif - executable('dpdk-' + name, + exec = executable('dpdk-' + name, sources, c_args: cflags, link_args: ldflags, @@ -110,4 +110,9 @@ foreach app:apps include_directories: includes, install_rpath: join_paths(get_option('prefix'), driver_install_path), install: true) + if name == 'test' + dpdk_test = exec + autotest_sources = sources + subdir('test/suites') # define the pre-canned test suites + endif endforeach diff --git a/app/test/suites/meson.build b/app/test/suites/meson.build new file mode 100644 index 0000000000..135620578c --- /dev/null +++ b/app/test/suites/meson.build @@ -0,0 +1,29 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2023 Intel Corporation + +# some perf tests (eg: memcpy perf autotest)take very long +# to complete, so timeout to 10 minutes +timeout_seconds = 600 + +# process source files to determine the different unit test suites +# - fast_tests +# - perf_tests +# - driver_tests +test_suites = run_command(get_test_suites_cmd, autotest_sources).stdout().strip().split() +foreach suite:test_suites + suite = suite.split('=') + suite_name = suite[0] + suite_tests = suite[1].split(',') + if suite_name == 'fast-tests' + # special fast-test handling here + + else + foreach t: suite_tests + test(t, dpdk_test, + args: ['--', t], + timeout: timeout_seconds, + is_parallel: false, + suite: suite_name) + endforeach + endif +endforeach diff --git a/buildtools/get-test-suites.py b/buildtools/get-test-suites.py new file mode 100644 index 0000000000..43cde80970 --- /dev/null +++ b/buildtools/get-test-suites.py @@ -0,0 +1,24 @@ +#! /usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2023 Intel Corporation + +import sys +import re + +input_list = sys.argv[1:] +test_def_regex = re.compile("REGISTER_([A-Z]+)_TEST\s*\(\s*([a-z0-9_]+)") +test_suites = {} + +for fname in input_list: + with open(fname) as f: + contents = [ln for ln in f.readlines() if test_def_regex.match(ln.strip())] + for ln in contents: + (test_suite, test_name) = test_def_regex.match(ln).group(1, 2) + suite_name = f"{test_suite.lower()}-tests" + if suite_name in test_suites: + test_suites[suite_name].append(test_name) + else: + test_suites[suite_name] = [test_name] + +for suite in test_suites.keys(): + print(f"{suite}={','.join(test_suites[suite])}") diff --git a/buildtools/meson.build b/buildtools/meson.build index e1c600e40f..12e4b36165 100644 --- a/buildtools/meson.build +++ b/buildtools/meson.build @@ -18,6 +18,7 @@ map_to_win_cmd = py3 + files('map_to_win.py') sphinx_wrapper = py3 + files('call-sphinx-build.py') get_cpu_count_cmd = py3 + files('get-cpu-count.py') get_numa_count_cmd = py3 + files('get-numa-count.py') +get_test_suites_cmd = py3 + files('get-test-suites.py') binutils_avx512_check = (py3 + files('binutils-avx512-check.py') + [objdump] + cc.cmd_array()) -- 2.39.2