From 686bf508151641fb4d9cfc3c077a02a307121028 Mon Sep 17 00:00:00 2001 From: Scott Dixon Date: Mon, 30 Dec 2024 11:50:06 -0800 Subject: [PATCH] Getting rid of verify.py This change goes all-in on Cmake presets. --- .../c_cpp}/devcontainer.json | 4 +- .devcontainer/{ => python}/devcontainer.json | 0 .github/verify.py | 633 ------------------ .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 99 +-- .vscode/settings.json | 3 +- .vscode/tasks.json | 17 - CMakeLists.txt | 13 + CONTRIBUTING.rst | 100 +-- NunavutConfig.cmake | 40 +- tox.ini | 3 +- verification/.vscode/tasks.json | 17 - verification/CMakeLists.txt | 23 +- verification/CMakePresets.json | 513 +++++++------- verification/preset_generator.py | 86 ++- version_check_nunavut.py | 151 +++++ ...ersion_check.py => version_check_pydsdl.py | 0 17 files changed, 576 insertions(+), 1128 deletions(-) rename {verification/.devcontainer => .devcontainer/c_cpp}/devcontainer.json (85%) rename .devcontainer/{ => python}/devcontainer.json (100%) delete mode 100755 .github/verify.py create mode 100644 CMakeLists.txt create mode 100755 version_check_nunavut.py rename pydsdl_version_check.py => version_check_pydsdl.py (100%) diff --git a/verification/.devcontainer/devcontainer.json b/.devcontainer/c_cpp/devcontainer.json similarity index 85% rename from verification/.devcontainer/devcontainer.json rename to .devcontainer/c_cpp/devcontainer.json index 3d6d5d8d..b8a65f3c 100644 --- a/verification/.devcontainer/devcontainer.json +++ b/.devcontainer/c_cpp/devcontainer.json @@ -1,8 +1,8 @@ { "name": "C/C++ verification environment", "image": "ghcr.io/opencyphal/toolshed:ts22.4.10", - "workspaceFolder": "/workspace", - "workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspace,type=bind,consistency=delegated", + "workspaceFolder": "/repo", + "workspaceMount": "source=${localWorkspaceFolder},target=/repo,type=bind,consistency=delegated", "customizations": { "vscode": { "extensions": [ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/python/devcontainer.json similarity index 100% rename from .devcontainer/devcontainer.json rename to .devcontainer/python/devcontainer.json diff --git a/.github/verify.py b/.github/verify.py deleted file mode 100755 index 0abf2f08..00000000 --- a/.github/verify.py +++ /dev/null @@ -1,633 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) OpenCyphal Development Team -# Copyright Amazon.com Inc. or its affiliates. -# SPDX-License-Identifier: MIT -# -""" - Command-line helper for running verification builds. -""" - -import argparse -import configparser -import functools -import logging -import os -import pathlib -import shutil -import subprocess -import sys -import textwrap -import typing - - -def _make_parser() -> argparse.ArgumentParser: - - script = pathlib.Path(__file__).relative_to(pathlib.Path.cwd()) - - epilog = textwrap.dedent( - f""" - - **Example Usage**:: - - {script} -l c - - """ - ) - - parser = argparse.ArgumentParser( - description="CMake command-line helper for running verification builds.", - epilog=epilog, - formatter_class=argparse.RawTextHelpFormatter, - ) - - parser.add_argument( - "--override", - action="append", - nargs="*", - help=textwrap.dedent( - """ - Optional configuration files to provide override values for verification arguments. - Use this to configure common CI options without creating long CI command lines. Multiple - overrides can be specified with the order being an ascending priority (i.e. the next override - will overwrite any previous overrides). - - This file uses the python configparser syntax and expects a single section called 'overrides'. - See https://docs.python.org/3/library/configparser.html for more information. - - Example ini file: - - [overrides] - verbose: True - remove-first: True - force: True - endianness: any - language: cpp - platform: native32 - toolchain-family: gcc - - """[1:]), - ) - - build_args = parser.add_argument_group( - title="build options", - description=textwrap.dedent( - """ - Arguments that can be used in parallel builds. Each of these will change - the name of the build directory created for the build. - """[1:]), - ) - - build_args.add_argument( - "--version-only", - action="store_true", - help=textwrap.dedent( - f""" - Print out the version number (stored in src/nunavut/_version.py) only and exit. This number - will be the only output to stdout allowing build scripts to extract this string value for - use in the build environment. For example: - - export NUNAVUT_FULL_VERSION=$({script} --version-only) - - """[1:]), - ) - - build_args.add_argument( - "--major-minor-version-only", - action="store_true", - help=textwrap.dedent( - f""" - Print out the major and minor version number (stored in src/nunavut/_version.py) only and exit. - This number will be the only output to stdout allowing build scripts to extract this string - value for use in the build environment. For example: - - export NUNAVUT_MAJOR_MINOR_VERSION=$({script} --major-minor-version-only) - - """[1:]), - ) - - build_args.add_argument( - "--version-check-only", - help=textwrap.dedent( - f""" - Compares a given semantic version number with the current Nunavut version - (stored in src/nunavut/_version.py) and returns 0 if it matches else returns 1. - - if $({script} --version-check-only 1.0.2); then echo "match"; fi - - """[1:]), - ) - - build_args.add_argument("-l", "--language", default="c", help="Value for NUNAVUT_VERIFICATION_LANG (defaults to c)") - - build_args.add_argument("-std", "--language-standard", default="", help="Language standard") - - build_args.add_argument("--build-type", help="Value for CMAKE_BUILD_TYPE") - - build_args.add_argument("--endianness", help="Value for NUNAVUT_VERIFICATION_TARGET_ENDIANNESS") - - build_args.add_argument("--platform", help="Value for NUNAVUT_VERIFICATION_TARGET_PLATFORM") - - build_args.add_argument( - "--disable-asserts", action="store_true", help="Set NUNAVUT_VERIFICATION_SER_ASSERT=OFF (default is ON)" - ) - - build_args.add_argument( - "--disable-fp", action="store_true", help="Set NUNAVUT_VERIFICATION_SER_FP_DISABLE=ON (default is OFF)" - ) - - build_args.add_argument( - "--enable-ovr-var-array", - action="store_true", - help="Set NUNAVUT_VERIFICATION_OVR_VAR_ARRAY_ENABLE=ON (default is OFF)", - ) - - build_args.add_argument( - "--toolchain-family", - choices=["gcc", "clang", "none"], - default="gcc", - help=textwrap.dedent( - """ - Select the toolchain family to use. Use "none" to get the toolchain - from the environment (i.e. set CC and CXX environment variables). - """[1:]), - ) - - build_args.add_argument( - "--none", - action="store_true", - help=textwrap.dedent( - """ - Dummy argument used to support matrix builds where an argument present - in other builds is not provided in the current build. - """[1:]), - ) - - action_args = parser.add_argument_group( - title="behavioral options", - description=textwrap.dedent( - """ - Arguments that change the actions taken by the build. - """[1:]), - ) - - action_args.add_argument("-v", "--verbose", action="count", default=0, help="Set output verbosity.") - - action_args.add_argument( - "-f", - "--force", - action="store_true", - help=textwrap.dedent( - """ - Force recreation of verification directory if it already exists. - - ** WARNING ** This will delete the cmake build directory! - - """[1:]), - ) - - action_args.add_argument("-c", "--configure-only", action="store_true", help="Configure but do not build.") - - action_args.add_argument( - "-b", "--build-only", action="store_true", help="Try to build without configuring. Do not try to run tests." - ) - - action_args.add_argument( - "-t", "--test-only", action="store_true", help="Only try to run tests. Don't configure or build." - ) - - action_args.add_argument( - "--dry-run", - action="store_true", - help=textwrap.dedent( - """ - Don't actually do anything. Just log what this script would have done. - Combine with --verbose to ensure you actually see the script's log output. - """[1:]), - ) - - action_args.add_argument( - "-x", - "--no-coverage", - action="store_true", - help="Deprecated. Use compiler_flag_set instead.", - ) - - action_args.add_argument( - "-cfs", - "--compiler-flag-set", - default="native", - type=pathlib.Path, - help=textwrap.dedent( - """ - Select the compiler flag set to use. This will select the appropriate compiler flags - for the build. The default is 'native' which is the default compiler flags for the - build environment. Use 'native_w_cov' to enable coverage flags. - See cmake/compiler_flag_sets for available options. - """[1:]), - ) - - action_args.add_argument( - "-rm", - "--remove-first", - action="store_true", - help=textwrap.dedent( - """ - If specified, any existing build directory will be deleted first. Use - -f to skip the user prompt. - - Note: This only applies to the configure step. If you do a build-only this - argument has no effect. - """[1:]), - ) - - other_options = parser.add_argument_group( - title="extra build options", - description=textwrap.dedent( - """ - Additional arguments for modifying how the build runs but which are used less frequently. - """[1:]), - ) - - other_options.add_argument( - "-j", - "--jobs", - type=int, - help="The number of concurrent build jobs to request. " - "Defaults to the number of logical CPUs on the local machine.", - ) - - other_options.add_argument("--verification-dir", default="verification", help="Path to the verification directory.") - - other_options.add_argument( - "--use-default-generator", - action="store_true", - help=textwrap.dedent( - """ - We use Ninja by default. Set this flag to omit the explicit generator override - and use whatever the default is for cmake (i.e. normally make) - """[1:]), - ) - - return parser - - -def _apply_overrides(args: argparse.Namespace) -> argparse.Namespace: - if args.override is None: - return args - - for override_list in args.override: - for override in override_list: - if not pathlib.Path(override).exists(): - raise RuntimeError(f'ini file "{override}" does not exist.') - print( - textwrap.dedent( - f""" - ***************************************************************** - About to apply override file : {override} - ***************************************************************** - """ - ) - ) - - overrides = configparser.ConfigParser(interpolation=configparser.ExtendedInterpolation()) - overrides.read(override) - if "overrides" not in overrides: - raise RuntimeError(f'ini file "{override}" did not contain an overrides section.') - for key, value in overrides["overrides"].items(): - corrected_key = key.replace("-", "_") - if value.lower() == "true" or value.lower() == "false": - setattr(args, corrected_key, bool(value)) - else: - try: - setattr(args, corrected_key, int(value)) - except ValueError: - setattr(args, corrected_key, value) - - return args - - -def _cmake_run( - cmake_args: typing.List[str], - cmake_dir: pathlib.Path, - verbose: int, - dry_run: bool, - env: typing.Optional[typing.Dict] = None, -) -> int: - """ - Simple wrapper around cmake execution logic - """ - logging.debug( - textwrap.dedent( - """ - - ***************************************************************** - About to run command: {} - in directory : {} - ***************************************************************** - - """ - ).format(" ".join(cmake_args), str(cmake_dir)) - ) - - copy_of_env: typing.Dict = {} - copy_of_env.update(os.environ) - if env is not None: - copy_of_env.update(env) - - if verbose > 1: - logging.debug(" *****************************************************************") - logging.debug(" Using Environment:") - for key, value in copy_of_env.items(): - overridden = key in env if env is not None else False - logging.debug(" %s = %s%s", key, value, (" (override)" if overridden else "")) - logging.debug(" *****************************************************************\n") - - if not dry_run: - return subprocess.run(cmake_args, cwd=cmake_dir, env=copy_of_env, check=True).returncode - else: - return 0 - - -def _handle_build_dir(args: argparse.Namespace, cmake_dir: pathlib.Path) -> None: - """ - Handle all the logic, user input, logging, and file-system operations needed to - manage the cmake build directory ahead of invoking cmake. - """ - if args.remove_first and cmake_dir.exists(): - okay_to_remove = False - if not args.force: - response = input(f"Are you sure you want to delete {cmake_dir}? [y/N]:") - if (len(response) == 1 and response.lower() == "y") or (len(response) == 3 and response.lower() == "yes"): - okay_to_remove = True - else: - okay_to_remove = True - - if okay_to_remove: - if not args.dry_run: - logging.info("Removing directory %s", cmake_dir) - shutil.rmtree(cmake_dir) - else: - logging.info("Is dry-run. Would have removed directory %s", cmake_dir) - else: - raise RuntimeError( - """ - Build directory {} already exists, -rm or --remove-first was specified, - and permission was not granted to delete it. We cannot continue. Either - allow re-use of this build directory or allow deletion. (use -f flag to - skip user prompts).""".lstrip().format( - cmake_dir - ) - ) - - if not cmake_dir.exists(): - if not args.dry_run: - logging.info("Creating build directory at %s", cmake_dir) - cmake_dir.mkdir() - else: - logging.info("Dry run: Would have created build directory at %s", cmake_dir) - else: - logging.info("Using existing build directory at %s", cmake_dir) - - -def _cmake_configure(args: argparse.Namespace, cmake_args: typing.List[str], cmake_dir: pathlib.Path) -> int: - """ - Format and execute cmake configure command. This also include the cmake build directory (re)creation - logic. - """ - - if args.build_only or args.test_only: - return 0 - - cmake_logging_level = "NOTICE" - - if args.verbose == 1: - cmake_logging_level = "STATUS" - elif args.verbose == 2: - cmake_logging_level = "VERBOSE" - elif args.verbose == 3: - cmake_logging_level = "DEBUG" - elif args.verbose > 3: - cmake_logging_level = "TRACE" - - _handle_build_dir(args, cmake_dir) - - cmake_configure_args = cmake_args.copy() - - cmake_configure_args.append(f"--log-level={cmake_logging_level}") - cmake_configure_args.append(f"-DNUNAVUT_VERIFICATION_LANG={args.language}") - cmake_configure_args.append(f"-DCMAKE_PREFIX_PATH=..") - - if args.language_standard is not None: - cmake_configure_args.append(f"-DNUNAVUT_VERIFICATION_LANG_STANDARD={args.language_standard}") - - if args.build_type is not None: - cmake_configure_args.append(f"-DCMAKE_BUILD_TYPE={args.build_type}") - - if args.endianness is not None: - cmake_configure_args.append(f"-DNUNAVUT_VERIFICATION_TARGET_ENDIANNESS={args.endianness}") - - if args.platform is not None: - cmake_configure_args.append(f"-DNUNAVUT_VERIFICATION_TARGET_PLATFORM={args.platform}") - - if args.disable_asserts: - cmake_configure_args.append("-DNUNAVUT_VERIFICATION_SER_ASSERT:BOOL=OFF") - - if args.disable_fp: - cmake_configure_args.append("-DNUNAVUT_VERIFICATION_SER_FP_DISABLE:BOOL=ON") - - if args.enable_ovr_var_array: - cmake_configure_args.append("-DNUNAVUT_VERIFICATION_OVR_VAR_ARRAY_ENABLE:BOOL=ON") - - if args.verbose > 0: - cmake_configure_args.append("-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON") - - flag_set_dir = pathlib.Path("cmake") / pathlib.Path("compiler_flag_sets") - flagset_file = (flag_set_dir / args.compiler_flag_set).with_suffix(".cmake") - compiler_flag_set = (pathlib.Path(args.verification_dir) / flagset_file).resolve() - if not compiler_flag_set.exists(): - raise RuntimeError( - f"Compiler flag set file {str(compiler_flag_set)} does not exist in the verification directory." - ) - - cmake_configure_args.append(f"-DNUNAVUT_FLAGSET={str(compiler_flag_set)}") - - if args.toolchain_family != "none": - toolchain_dir = pathlib.Path("cmake") / pathlib.Path("toolchains") - if args.toolchain_family == "clang": - toolchain_file = toolchain_dir / pathlib.Path("clang-native").with_suffix(".cmake") - else: - toolchain_file = toolchain_dir / pathlib.Path("gcc-native").with_suffix(".cmake") - - cmake_configure_args.append(f"-DCMAKE_TOOLCHAIN_FILE={str(toolchain_file)}") - - if not args.use_default_generator: - cmake_configure_args.append("-DCMAKE_GENERATOR=Ninja") - - cmake_configure_args.append("..") - - return _cmake_run(cmake_configure_args, cmake_dir, args.verbose, args.dry_run) - - -def _cmake_build(args: argparse.Namespace, cmake_args: typing.List[str], cmake_dir: pathlib.Path) -> int: - """ - Format and execute cmake build command. This method assumes that the cmake_dir is already properly - configured. - """ - if not args.configure_only and not args.test_only: - cmake_build_args = cmake_args.copy() - - cmake_build_args += ["--build", ".", "--target", "all"] - - if args.jobs is not None and args.jobs > 0: - cmake_build_args += ["--", f"-j{args.jobs}"] - - return _cmake_run(cmake_build_args, cmake_dir, args.verbose, args.dry_run) - - return 0 - - -def _cmake_test(args: argparse.Namespace, cmake_args: typing.List[str], cmake_dir: pathlib.Path) -> int: - """ - Format and execute cmake test command. This method assumes that the cmake_dir is already properly - configured. - """ - if not args.configure_only and not args.build_only: - cmake_test_args = cmake_args.copy() - - cmake_test_args += ["--build", ".", "--target"] - - if args.compiler_flag_set.stem == "native_w_cov": - cmake_test_args.append("cov_all_archive") - else: - cmake_test_args.append("test_all") - - return _cmake_run(cmake_test_args, cmake_dir, args.verbose, args.dry_run) - - return 0 - - -def _create_build_dir_name(args: argparse.Namespace) -> str: - name = f"build_{args.language}" - - if args.language_standard is not None: - name += f"_{args.language_standard}" - - name += f"_{args.toolchain_family}" - - if args.platform is not None: - name += f"_{args.platform}" - - if args.build_type is not None: - name += f"_{args.build_type}" - - if args.endianness is not None: - name += f"_{args.endianness}" - - if args.disable_asserts: - name += "_noassert" - - if args.disable_fp: - name += "_nofp" - - if args.enable_ovr_var_array: - name += "_wovervararray" - - return name - - -@functools.lru_cache(maxsize=None) -def _get_version_string() -> typing.Tuple[str, str, str, str]: - version: typing.Dict[str, str] = {} - nunavut_version_file = pathlib.Path("src/nunavut/_version.py") - - with nunavut_version_file.open("r", encoding="UTF-8") as version_py: - exec(version_py.read(), version) # pylint: disable=exec-used - - version_string = version["__version__"] - version_array = version_string.split(".") - if len(version_array) not in (3, 4): - raise RuntimeError(f"Invalid version string: {version_string}") - if len(version_array) == 3: - return (version_array[0], version_array[1], version_array[2], "") - else: - return (version_array[0], version_array[1], version_array[2], version_array[3]) - - -def main() -> int: - """ - Main method to execute when this package/script is invoked as a command. - """ - args = _apply_overrides(_make_parser().parse_args()) - - if args.version_only: - sys.stdout.write(".".join(_get_version_string())) - sys.stdout.flush() - return 0 - - if args.major_minor_version_only: - version = _get_version_string() - sys.stdout.write(f"{version[0]}.{version[1]}") - sys.stdout.flush() - return 0 - - logging_level = logging.WARN - - if args.verbose == 1: - logging_level = logging.INFO - elif args.verbose > 1: - logging_level = logging.DEBUG - - logging.basicConfig(format="%(levelname)s: %(message)s", level=logging_level) - - if args.version_check_only is not None: - version_as_string = ".".join(_get_version_string()) - logging.debug( - "Comparing nunavut version %s to provided version %s (%s)", - version_as_string, - args.version_check_only, - "matches" if (version_as_string == args.version_check_only) else "no-match") - return 0 if (version_as_string == args.version_check_only) else 1 - - logging.debug( - textwrap.dedent( - """ - - ***************************************************************** - Commandline Arguments to {}: - - {} - - For Nunavut version {} - ***************************************************************** - - """ - ).format(os.path.basename(__file__), str(args), _get_version_string()) - ) - - verification_dir = pathlib.Path.cwd() / pathlib.Path(args.verification_dir) - cmake_dir = verification_dir / pathlib.Path(_create_build_dir_name(args)) - cmake_args = ["cmake"] - - configure_result = _cmake_configure(args, cmake_args, cmake_dir) - - if configure_result != 0: - return configure_result - elif args.configure_only: - return 0 - - build_result = _cmake_build(args, cmake_args, cmake_dir) - - if build_result != 0: - return build_result - elif args.build_only: - return 0 - - if not args.configure_only and not args.build_only: - return _cmake_test(args, cmake_args, cmake_dir) - - raise RuntimeError("Internal logic error: only_do_x flags resulted in no action.") - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 21e226fb..41982cd6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: - name: version-check # Fails the release if the release-tag doesn't match the Nunavut version at that tag. run: | - $(./.github/verify.py -vv --version-check-only "2.3.4.dev0") + $(./version_check_nunavut.py -vv --version-check "2.3.4.dev0") - name: lint run: tox -e lint - name: test-nnvg diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index edb838b7..562f2469 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -66,7 +66,7 @@ jobs: path: .tox/py311-test/tmp/ - name: set-environment run: | - echo NUNAVUT_MAJOR_MINOR_VERSION=$(./.github/verify.py --major-minor-version-only) >> $GITHUB_ENV + echo NUNAVUT_MAJOR_MINOR_VERSION=$(./version_check_nunavut --major-minor-version-only) >> $GITHUB_ENV - name: verify tox artifacts run: ls -R working-directory: .tox @@ -139,117 +139,62 @@ jobs: container: ghcr.io/opencyphal/toolshed:ts22.4.10 strategy: matrix: - build_type: [Debug, Release] - architecture: [native32, native64] + architecture: [native32, native] compiler: [gcc, clang] flag: [--none, --enable-ovr-var-array, --disable-asserts] exclude: - - build_type: Debug + - build_type: native32 flag: --disable-asserts - - build_type: Release - flag: --disable-asserts - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - name: verify - run: | - .github/verify.py --override .github/verify_global.ini \ - --build-type ${{ matrix.build_type }} \ - --language c \ - --platform ${{ matrix.architecture }} \ - --toolchain-family ${{ matrix.compiler }} \ - ${{ matrix.flag }} - - language-verification-cpp-14: - runs-on: ubuntu-latest - needs: test - container: ghcr.io/opencyphal/toolshed:ts22.4.10 - strategy: - matrix: - build_type: [DebugAsan, Release] - architecture: [native32, native64] - compiler: [gcc, clang] - flag: [--none, --enable-ovr-var-array, --disable-asserts] - exclude: - - build_type: DebugAsan - flag: --disable-asserts - - build_type: Release - flag: --disable-asserts - + - architecture: native32 + flag: --enable-ovr-var-array steps: - uses: actions/checkout@v4 with: submodules: true - name: verify + # We're using Ninja multi-config so we only have to configure once for all build types run: | - .github/verify.py --override .github/verify_global.ini \ - --build-type ${{ matrix.build_type }} \ - --language-standard c++14 \ - --language cpp \ - --platform ${{ matrix.architecture }} \ - --toolchain-family ${{ matrix.compiler }} \ - ${{ matrix.flag }} + echo NUNAVUT_EXTRA_GENERATOR_ARGS=${{ matrix.flag }} >> $GITHUB_ENV + cmake --preset config-${{ matrix.compiler }}-${{ matrix.architecture }}-c-11 + cmake --build --preset build-${{ matrix.compiler }}-${{ matrix.architecture }}-c-11-release + cmake --build --preset build-${{ matrix.compiler }}-${{ matrix.architecture }}-c-11-debug - language-verification-cpp-17: + language-verification-cpp: runs-on: ubuntu-latest needs: test container: ghcr.io/opencyphal/toolshed:ts22.4.10 strategy: matrix: - build_type: [Debug, Release] - architecture: [native32, native64] + architecture: [native32, native] compiler: [gcc, clang] - flag: [--none, --enable-ovr-var-array, --disable-asserts] - exclude: - - build_type: Debug - flag: --disable-asserts - - build_type: Release - flag: --disable-asserts - + language: [cpp-14, cetl-14-17, cpp-17, cpp-17-pmr, cpp-20, cpp-20-pmr] steps: - uses: actions/checkout@v4 with: submodules: true - name: verify run: | - .github/verify.py --override .github/verify_global.ini \ - --build-type ${{ matrix.build_type }} \ - --language-standard c++17 \ - --language cpp \ - --platform ${{ matrix.architecture }} \ - --toolchain-family ${{ matrix.compiler }} \ - ${{ matrix.flag }} + cmake --preset config-${{ matrix.compiler }}-${{ matrix.architecture }}-${{ matrix.language }} + cmake --build --preset build-${{ matrix.compiler }}-${{ matrix.architecture }}-${{ matrix.language }}-debugasan + cmake --build --preset build-${{ matrix.compiler }}-${{ matrix.architecture }}-${{ matrix.language }}-release - language-verification-cpp-20: + language-verification-cpp-clang-native-extra: runs-on: ubuntu-latest needs: test container: ghcr.io/opencyphal/toolshed:ts22.4.10 strategy: matrix: - build_type: [Debug, Release] - architecture: [native32, native64] - compiler: [gcc, clang] - flag: [--none, --enable-ovr-var-array, --disable-asserts] - exclude: - - build_type: Debug - flag: --disable-asserts - - build_type: Release - flag: --disable-asserts - + language: [cpp-20] + flag: [--enable-ovr-var-array, --disable-asserts] steps: - uses: actions/checkout@v4 with: submodules: true - name: verify run: | - .github/verify.py --override .github/verify_global.ini \ - --build-type ${{ matrix.build_type }} \ - --language-standard c++20 \ - --language cpp \ - --platform ${{ matrix.architecture }} \ - --toolchain-family ${{ matrix.compiler }} \ - ${{ matrix.flag }} + echo NUNAVUT_EXTRA_GENERATOR_ARGS=${{ matrix.flag }} >> $GITHUB_ENV + cmake --preset config-clang-native-${{ matrix.language }} + cmake --build --preset build-clang-native-${{ matrix.language }}-debugasan language-verification-python: runs-on: ubuntu-latest diff --git a/.vscode/settings.json b/.vscode/settings.json index 92c5c203..bbf67685 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -60,5 +60,6 @@ "description": "Words used in in the Nunavut codebase to add to spell checker dictionaries.", "addWords": true } - } + }, + "cmake.sourceDirectory": "${workspaceFolder}/verification" } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 69b4f37b..9ebc7b5a 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -36,23 +36,6 @@ "kind": "build", }, "problemMatcher": [] - }, - { - "label": "verify c native32", - "type": "shell", - "command": "${workspaceFolder}/.github/verify.py", - "args": [ - "--verbose", - "--force", - "--language", "c", - "--endianness", "any", - "--platform", "native32", - "--build-type", "Debug" - ], - "group": "build", - "problemMatcher": [ - "$gcc" - ] } ] } diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..2bb1e1f3 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,13 @@ +# +# Copyright (C) OpenCyphal Development Team +# Copyright Amazon.com Inc. or its affiliates. +# SPDX-License-Identifier: MIT +# +# This top-level CMakeLists.txt is added for symmetry with the python environment. All C/C++ build +# for testing Nunavut is located under the verification folder. + +cmake_minimum_required(VERSION 3.20) + +project(nunavut) + +add_subdirectory("verification") diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index df50898d..5a1571c0 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -82,13 +82,20 @@ To run the language verification build you'll need to use a different docker con docker pull ghcr.io/opencyphal/toolshed:ts22.4.10 docker run --rm -it -v $PWD:/workspace ghcr.io/opencyphal/toolshed:ts22.4.10 - cd /workspace - ./.github/verify.py -l c - ./.github/verify.py -l cpp + cd /workspace/verification + cmake --list-presets -The verify.py script is a simple commandline generator for our cmake scripts. Use help for details:: +Choose one of the presets. For example:: - ./.github/verify.py --help + cmake --preset config-clang-native-c-11 + +To build replace the prefix ``config`` with ``build`` and suffix with one of the configurations listed in the presets +file as ``CMAKE_CONFIGURATION_TYPES`` but in all lower-case. For example:: + + cmake --build --preset build-clang-native-c-11-debug + +The verification cmake uses Ninja Multi-Config so you can run any ``build-clang-native-c-11-`` build flavor without +re-configuring in this example. If you get a "denied" response from ghcr your ip might be getting rate-limited. While these are public containers you'll have to login to get around any rate-limiting for your local site. See [the github docs](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry) @@ -254,88 +261,25 @@ TLDR:: git submodule update --init --recursive docker run --rm -it -v $PWD:/repo ghcr.io/opencyphal/toolshed:ts22.4.10 - export NUNAVUT_VERIFICATION_LANG=c cd verification - mkdir "build_$NUNAVUT_VERIFICATION_LANG" - cd "build_$NUNAVUT_VERIFICATION_LANG" - cmake -DNUNAVUT_FLAGSET=/repo/verification/cmake/compiler_flag_sets/native.cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/gcc-native.cmake -DCMAKE_GENERATOR=Ninja .. - cmake --build . --target help - -Try running a test which will first compile the test. For example, in the C language build :: - - cmake --build . --target test_all - -To run the C++ test use the same steps shown in the TLDR above but set :code:`NUNAVUT_VERIFICATION_LANG` to -"cpp" first. - -In the list of targets that the :code:`cmake --build . --target help` command lists the targets that build tests -will be prefixed with :code:`test_` and the psedo-target that also executes the test will be prefixed with -:code:`run_test_`. You should avoid the :code:`_with_lcov` when you are manually building tests. - -To obtain coverage information for the verification suite (not the Python code), -build the `cov_all` target and inspect the output under the `coverage` directory. + cmake --preset config-clang-native-c-11 + cmake --build --preset build-clang-native-c-11-debug -cmake build options ------------------------------------------------- -The following options are supported when configuring your build. These can be specified by using :code:`-D` arguments -to cmake. For example :: +To see all presets available do:: - cmake -DNUNAVUT_VERIFICATION_LANG=c -DNUNAVUT_VERIFICATION_TARGET_ENDIANNESS=any .. + cmake --list-presets + cmake --build --list-presets -+-----------------------------------------+---------+----------+------------------------------------+------------------------------------------------------------------+ -| Option | Type | Default | Values | Description | -+=========================================+=========+==========+====================================+==================================================================+ -|| CMAKE_BUILD_TYPE || string || release || Debug, Release, MinSizeRel || Compiler optimizations are set based | -|| || || || || on the CMake build type. | -+-----------------------------------------+---------+----------+------------------------------------+------------------------------------------------------------------+ -|| NUNAVUT_VERIFICATION_LANG || string || c, cpp || Specifies the language for source || | -|| || || || || code generated by nnvg. | -+-----------------------------------------+---------+----------+------------------------------------+------------------------------------------------------------------+ -|| NUNAVUT_VERIFICATION_TARGET_ENDIANNESS || string || any || little, big, any || Modifies generated serialization code | -|| || || || || and support code to support various | -|| || || || || CPU architectures. Other than | -|| || || || || endianess, Nunavut serialization and | -|| || || || || support code should be generic. | -+-----------------------------------------+---------+----------+------------------------------------+------------------------------------------------------------------+ -|| NUNAVUT_VERIFICATION_TARGET_PLATFORM || string || (unset) || native32, native64 || The target platform to compile for. | -|| || || || || In future releases we hope to support | -|| || || || || ppc (Big), AVR8, RISCV, ARM. | -+-----------------------------------------+---------+----------+------------------------------------+------------------------------------------------------------------+ -|| NUNAVUT_VERIFICATION_SER_ASSERT || bool || ON || ON, OFF || Enable or disable asserts in | -|| || || || || generated serialization and support | -|| || || || || code. | -+-----------------------------------------+---------+----------+------------------------------------+------------------------------------------------------------------+ -|| NUNAVUT_VERIFICATION_SER_FP_DISABLE || bool || OFF || ON, OFF || Enable to omit floating-point | -|| || || || || serialization routines. | -+-----------------------------------------+---------+----------+------------------------------------+------------------------------------------------------------------+ -| NUNAVUT_VERIFICATION_LANG_STANDARD | string | (empty) | c++17, c99 (etc) | override value for the -std compiler flag of the target language | -+-----------------------------------------+---------+----------+------------------------------------+------------------------------------------------------------------+ +After configuring you can also use Ninja directly:: + cd build + ninja -t targets - -\* *Because this option has no default, a value must be provided by the user.* - -VSCode Remote Container Development of Verification Tests -==================================================================================== - -To write and debug verification tests using `VSCode Remote Containers`_ you'll need to use the -"Open Folder in Container..." option: - -.. image:: /docs/static/images/vscode_open_in_container.png - -Open the "verification" folder: - -.. image:: /docs/static/images/vscode_folder_verification.png - -We play a little trick here where we dump you back into the Nunvut repo root when you reopen in -the container. This lets you also work with the Python source. If you "reopen locally" while in -this state, however, you'll find yourself back in the verification folder which can be a little -disorienting. Write to Microsoft asking them to allow multiple images in the .devcontainer -json and we can get rid of this ugly hack. Sorry. - +To obtain coverage information for the verification suite (not the Python code), +build the `cov_all` target and inspect the output under the `coverage` directory. .. _`read the docs`: https://readthedocs.org/ .. _`tox`: https://tox.readthedocs.io/en/latest/ diff --git a/NunavutConfig.cmake b/NunavutConfig.cmake index 42edc5b5..9791266a 100644 --- a/NunavutConfig.cmake +++ b/NunavutConfig.cmake @@ -37,14 +37,14 @@ set_and_check(NUNAVUT_SOURCE_DIR "${PACKAGE_PREFIX_DIR}/src") check_required_components(Nunavut Python3) execute_process( - COMMAND ${Python3_EXECUTABLE} ${PACKAGE_PREFIX_DIR}/.github/verify.py --major-minor-version-only + COMMAND ${Python3_EXECUTABLE} ${PACKAGE_PREFIX_DIR}/version_check_nunavut.py --major-minor-version-only OUTPUT_VARIABLE NUNAVUT_VERSION_MAJOR_MINOR OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PACKAGE_PREFIX_DIR}" ) execute_process( - COMMAND ${Python3_EXECUTABLE} ${PACKAGE_PREFIX_DIR}/.github/verify.py --version-only + COMMAND ${Python3_EXECUTABLE} ${PACKAGE_PREFIX_DIR}/version_check_nunavut.py --version-only OUTPUT_VARIABLE NUNAVUT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PACKAGE_PREFIX_DIR}" @@ -181,14 +181,18 @@ macro(_nunavut_local_args) set(LOCAL_DYNAMIC_ARGS "") endif() + if (NOT LOCAL_LOOKUP_DIRS) + set(LOCAL_LOOKUP_DIRS "") + endif() + if(ARG_DSDL_NAMESPACES) foreach(LOCAL_DSDL_NAMESPACE IN LISTS ARG_DSDL_NAMESPACES) - list(APPEND LOCAL_DYNAMIC_ARGS "--lookup-dir" "${LOCAL_DSDL_NAMESPACE}") + list(APPEND LOCAL_LOOKUP_DIRS "--lookup-dir" "${LOCAL_DSDL_NAMESPACE}") endforeach() endif() if(NOT ARG_OMIT_PUBLIC_REGULATED_NAMESPACE) - list(APPEND LOCAL_DYNAMIC_ARGS "--lookup-dir" "${NUNAVUT_SUBMODULES_DIR}/public_regulated_data_types/uavcan") + list(APPEND LOCAL_LOOKUP_DIRS "--lookup-dir" "${NUNAVUT_SUBMODULES_DIR}/public_regulated_data_types/uavcan") endif() if(ARG_LANGUAGE_STANDARD) @@ -264,11 +268,19 @@ endmacro() #[==[.rst: .. cmake:variable:: NUNAVUT_SUBMODULES_DIR - Path to the submodules folder in the nunavut repository. + Set by the Nunavut package, this is the path to the submodules folder in the nunavut repository. #]==] set(NUNAVUT_SUBMODULES_DIR ${CMAKE_CURRENT_LIST_DIR}/submodules) +#[==[.rst: + .. cmake:envvar:: NUNAVUT_EXTRA_GENERATOR_ARGS + + If defined, this environment variable is used as additional command-line arguments which are passed + to Nunavut when generating code. + +#]==] + #[==[.rst: .. cmake:command:: export_nunavut_manifest @@ -377,6 +389,7 @@ function(export_nunavut_manifest) --list-format ${LOCAL_JSON_FORMAT} --dry-run ${LOCAL_DYNAMIC_ARGS} + ${LOCAL_LOOKUP_DIRS} ${ARG_DSDL_FILES} ${LOCAL_DEBUG_COMMAND_OPTIONS} WORKING_DIRECTORY ${ARG_WORKING_DIRECTORY} @@ -521,6 +534,7 @@ function(discover_inputs_and_outputs) --list-format ${LOCAL_JSON_FORMAT} --dry-run ${LOCAL_DYNAMIC_ARGS} + ${LOCAL_LOOKUP_DIRS} ${ARG_DSDL_FILES} ${LOCAL_DEBUG_COMMAND_OPTIONS} WORKING_DIRECTORY ${ARG_WORKING_DIRECTORY} @@ -644,6 +658,9 @@ endfunction() Additional command-line arguments to pass to the Nunavut CLI when generating code. These args are not used for invoking the Nunavut CLI to discover dependencies. + These are combined with any arguments specified by a :cmake:variable:`NUNAVUT_EXTRA_GENERATOR_ARGS` + environment variable. + - **option** ``ALLOW_EXPERIMENTAL_LANGUAGES``: If set then unsupported languages will be allowed. @@ -798,14 +815,23 @@ function(add_cyphal_library) OUT_OUTPUTS_LIST LOCAL_LIB_OUTPUTS_LIST ) + list(APPEND LOCAL_DYNAMIC_ARGS + --target-language ${ARG_LANGUAGE} + --outdir ${ARG_OUTPUT_DIR} + ${ARG_EXTRA_GENERATOR_ARGS} + ) + + if (DEFINED ENV{NUNAVUT_EXTRA_GENERATOR_ARGS}) + list(APPEND LOCAL_DYNAMIC_ARGS $ENV{NUNAVUT_EXTRA_GENERATOR_ARGS}) + endif() + # Create the custom command to generate source files. add_custom_command( OUTPUT ${LOCAL_LIB_OUTPUTS_LIST} COMMAND export PYTHONPATH=${LOCAL_PYTHON_PATH} && ${Python3_EXECUTABLE} -m nunavut - --target-language ${ARG_LANGUAGE} - --outdir ${ARG_OUTPUT_DIR} ${LOCAL_DYNAMIC_ARGS} + ${LOCAL_LOOKUP_DIRS} ${ARG_EXTRA_GENERATOR_ARGS} ${ARG_DSDL_FILES} WORKING_DIRECTORY ${ARG_WORKING_DIRECTORY} diff --git a/tox.ini b/tox.ini index 5f6131e0..f0ab3962 100644 --- a/tox.ini +++ b/tox.ini @@ -22,6 +22,7 @@ deps = rope isort nox + jsonschema # +---------------------------------------------------------------------------+ # | CONFIGURATION @@ -222,7 +223,7 @@ deps = setuptools commands = - python pydsdl_version_check.py -vv + python version_check_pydsdl.py -vv python -m build \ -o {toxworkdir}/package/dist \ --sdist \ diff --git a/verification/.vscode/tasks.json b/verification/.vscode/tasks.json index 69b4f37b..9ebc7b5a 100644 --- a/verification/.vscode/tasks.json +++ b/verification/.vscode/tasks.json @@ -36,23 +36,6 @@ "kind": "build", }, "problemMatcher": [] - }, - { - "label": "verify c native32", - "type": "shell", - "command": "${workspaceFolder}/.github/verify.py", - "args": [ - "--verbose", - "--force", - "--language", "c", - "--endianness", "any", - "--platform", "native32", - "--build-type", "Debug" - ], - "group": "build", - "problemMatcher": [ - "$gcc" - ] } ] } diff --git a/verification/CMakeLists.txt b/verification/CMakeLists.txt index 64305215..ebf668c5 100644 --- a/verification/CMakeLists.txt +++ b/verification/CMakeLists.txt @@ -13,15 +13,15 @@ if(DEFINED ENV{NUNAVUT_VERIFICATION_LANG}) message(STATUS "Getting NUNAVUT_VERIFICATION_LANG from the environment ($ENV{NUNAVUT_VERIFICATION_LANG})") set(NUNAVUT_VERIFICATION_LANG "$ENV{NUNAVUT_VERIFICATION_LANG}" CACHE STRING "The Nunavut output language to verify.") else() - set(NUNAVUT_VERIFICATION_LANG "unspecified" CACHE STRING "The Nunavut output language to verify.") + set(NUNAVUT_VERIFICATION_LANG "c" CACHE STRING "The Nunavut output language to verify.") endif() if(NUNAVUT_VERIFICATION_LANG STREQUAL "cpp") - set(NUNAVUT_VERIFICATION_ROOT "${CMAKE_SOURCE_DIR}/cpp") + set(NUNAVUT_VERIFICATION_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/cpp") message(STATUS "NUNAVUT_VERIFICATION_LANG is C++ (${NUNAVUT_VERIFICATION_LANG})") message(STATUS "Setting NUNAVUT_VERIFICATION_ROOT = ${NUNAVUT_VERIFICATION_ROOT}") elseif(NUNAVUT_VERIFICATION_LANG STREQUAL "c") - set(NUNAVUT_VERIFICATION_ROOT "${CMAKE_SOURCE_DIR}/c") + set(NUNAVUT_VERIFICATION_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/c") message(STATUS "NUNAVUT_VERIFICATION_LANG is C (${NUNAVUT_VERIFICATION_LANG})") message(STATUS "Setting NUNAVUT_VERIFICATION_ROOT = ${NUNAVUT_VERIFICATION_ROOT}") else() @@ -71,14 +71,14 @@ message(STATUS "CMAKE_CXX_STANDARD is ${CMAKE_CXX_STANDARD}") # +---------------------------------------------------------------------------+ project(nunavut_verification C CXX) -include(${CMAKE_SOURCE_DIR}/cmake/utils.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/utils.cmake) # +---------------------------------------------------------------------------+ # | GLOBAL DEFINITIONS # +---------------------------------------------------------------------------+ if(NOT DEFINED NUNAVUT_PROJECT_ROOT) get_filename_component(NUNAVUT_PROJECT_ROOT - "${CMAKE_SOURCE_DIR}/../" + "${CMAKE_CURRENT_SOURCE_DIR}/../" REALPATH BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}") message(STATUS "Setting NUNAVUT_PROJECT_ROOT = ${NUNAVUT_PROJECT_ROOT}") @@ -110,7 +110,7 @@ if(DEFINED ENV{NUNAVUT_FLAGSET}) elseif(DEFINED NUNAVUT_FLAGSET) message(STATUS "Using override NUNAVUT_FLAGSET = ${NUNAVUT_FLAGSET}") else() - set(NUNAVUT_FLAGSET "${CMAKE_SOURCE_DIR}/cmake/compiler_flag_sets/native.cmake") + set(NUNAVUT_FLAGSET "${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler_flag_sets/native.cmake") message(STATUS "Setting (default) NUNAVUT_FLAGSET = ${NUNAVUT_FLAGSET}") endif() @@ -119,7 +119,12 @@ include("${NUNAVUT_FLAGSET}") # # Tell cmake where to find our custom scripts. # -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules") +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") + +# +# Tell cmake where to find the Nunavut configuration package. +# +set(CMAKE_PREFIX_PATH ${NUNAVUT_PROJECT_ROOT}) # # All generated source can be found under this directory. @@ -224,10 +229,10 @@ set(LOCAL_TEST_TYPES_PUBLIC_REGULATED uavcan/metatransport/can/ArbitrationID.0.1.dsdl ) -set(LOCAL_NAMESPACE_TEST0_REGULATED ${CMAKE_SOURCE_DIR}/nunavut_test_types/test0/regulated) +set(LOCAL_NAMESPACE_TEST0_REGULATED ${CMAKE_CURRENT_SOURCE_DIR}/nunavut_test_types/test0/regulated) file(GLOB_RECURSE LOCAL_TEST_TYPES_TEST0_REGULATED CONFIGURE_DEPENDS ${LOCAL_NAMESPACE_TEST0_REGULATED}/*.dsdl) -set(LOCAL_NAMESPACE_NESTED_ARRAY_TYPES ${CMAKE_SOURCE_DIR}/nunavut_test_types/nested_array_types/mymsgs) +set(LOCAL_NAMESPACE_NESTED_ARRAY_TYPES ${CMAKE_CURRENT_SOURCE_DIR}/nunavut_test_types/nested_array_types/mymsgs) file(GLOB_RECURSE LOCAL_NESTED_ARRAY_TYPES CONFIGURE_DEPENDS ${LOCAL_NAMESPACE_NESTED_ARRAY_TYPES}/*.dsdl) # +-[C-TYPES]-----------------------------------------------------------------+ diff --git a/verification/CMakePresets.json b/verification/CMakePresets.json index 53f217be..8e4bcd04 100644 --- a/verification/CMakePresets.json +++ b/verification/CMakePresets.json @@ -31,15 +31,12 @@ "toolchainFile": "${sourceDir}/cmake/toolchains/clang-native.cmake" }, { - "name": "config-toolchain-gcc-native-native64", + "name": "config-toolchain-gcc-native", "hidden": true, - "toolchainFile": "${sourceDir}/cmake/toolchains/gcc-native.cmake", - "cacheVariables": { - "NUNAVUT_VERIFICATION_TARGET_PLATFORM": "native64" - } + "toolchainFile": "${sourceDir}/cmake/toolchains/gcc-native.cmake" }, { - "name": "config-toolchain-gcc-native-native32", + "name": "config-toolchain-gcc-native32", "hidden": true, "toolchainFile": "${sourceDir}/cmake/toolchains/gcc-native.cmake", "cacheVariables": { @@ -159,787 +156,787 @@ ] }, { - "name": "config-gcc-native-native64-c-11", + "name": "config-gcc-native-c-11", "inherits": [ "config-common", - "config-toolchain-gcc-native-native64", + "config-toolchain-gcc-native", "config-language-c-11" ] }, { - "name": "config-gcc-native-native64-cpp-14", + "name": "config-gcc-native-cpp-14", "inherits": [ "config-common", - "config-toolchain-gcc-native-native64", + "config-toolchain-gcc-native", "config-language-cpp-14" ] }, { - "name": "config-gcc-native-native64-cetl-14-17", + "name": "config-gcc-native-cetl-14-17", "inherits": [ "config-common", - "config-toolchain-gcc-native-native64", + "config-toolchain-gcc-native", "config-language-cetl-14-17" ] }, { - "name": "config-gcc-native-native64-cpp-17", + "name": "config-gcc-native-cpp-17", "inherits": [ "config-common", - "config-toolchain-gcc-native-native64", + "config-toolchain-gcc-native", "config-language-cpp-17" ] }, { - "name": "config-gcc-native-native64-cpp-17-pmr", + "name": "config-gcc-native-cpp-17-pmr", "inherits": [ "config-common", - "config-toolchain-gcc-native-native64", + "config-toolchain-gcc-native", "config-language-cpp-17-pmr" ] }, { - "name": "config-gcc-native-native64-cpp-20", + "name": "config-gcc-native-cpp-20", "inherits": [ "config-common", - "config-toolchain-gcc-native-native64", + "config-toolchain-gcc-native", "config-language-cpp-20" ] }, { - "name": "config-gcc-native-native64-cpp-20-pmr", + "name": "config-gcc-native-cpp-20-pmr", "inherits": [ "config-common", - "config-toolchain-gcc-native-native64", + "config-toolchain-gcc-native", "config-language-cpp-20-pmr" ] }, { - "name": "config-gcc-native-native32-c-11", + "name": "config-gcc-native32-c-11", "inherits": [ "config-common", - "config-toolchain-gcc-native-native32", + "config-toolchain-gcc-native32", "config-language-c-11" ] }, { - "name": "config-gcc-native-native32-cpp-14", + "name": "config-gcc-native32-cpp-14", "inherits": [ "config-common", - "config-toolchain-gcc-native-native32", + "config-toolchain-gcc-native32", "config-language-cpp-14" ] }, { - "name": "config-gcc-native-native32-cetl-14-17", + "name": "config-gcc-native32-cetl-14-17", "inherits": [ "config-common", - "config-toolchain-gcc-native-native32", + "config-toolchain-gcc-native32", "config-language-cetl-14-17" ] }, { - "name": "config-gcc-native-native32-cpp-17", + "name": "config-gcc-native32-cpp-17", "inherits": [ "config-common", - "config-toolchain-gcc-native-native32", + "config-toolchain-gcc-native32", "config-language-cpp-17" ] }, { - "name": "config-gcc-native-native32-cpp-17-pmr", + "name": "config-gcc-native32-cpp-17-pmr", "inherits": [ "config-common", - "config-toolchain-gcc-native-native32", + "config-toolchain-gcc-native32", "config-language-cpp-17-pmr" ] }, { - "name": "config-gcc-native-native32-cpp-20", + "name": "config-gcc-native32-cpp-20", "inherits": [ "config-common", - "config-toolchain-gcc-native-native32", + "config-toolchain-gcc-native32", "config-language-cpp-20" ] }, { - "name": "config-gcc-native-native32-cpp-20-pmr", + "name": "config-gcc-native32-cpp-20-pmr", "inherits": [ "config-common", - "config-toolchain-gcc-native-native32", + "config-toolchain-gcc-native32", "config-language-cpp-20-pmr" ] } ], "buildPresets": [ { - "name": "build-clang-native-c-11-debugcov", + "name": "build-clang-native-c-11-debugasan", "configurePreset": "config-clang-native-c-11", - "configuration": "DebugCov", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-14-debugcov", + "name": "build-clang-native-cpp-14-debugasan", "configurePreset": "config-clang-native-cpp-14", - "configuration": "DebugCov", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cetl-14-17-debugcov", + "name": "build-clang-native-cetl-14-17-debugasan", "configurePreset": "config-clang-native-cetl-14-17", - "configuration": "DebugCov", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-17-debugcov", + "name": "build-clang-native-cpp-17-debugasan", "configurePreset": "config-clang-native-cpp-17", - "configuration": "DebugCov", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-17-pmr-debugcov", + "name": "build-clang-native-cpp-17-pmr-debugasan", "configurePreset": "config-clang-native-cpp-17-pmr", - "configuration": "DebugCov", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-20-debugcov", + "name": "build-clang-native-cpp-20-debugasan", "configurePreset": "config-clang-native-cpp-20", - "configuration": "DebugCov", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-20-pmr-debugcov", + "name": "build-clang-native-cpp-20-pmr-debugasan", "configurePreset": "config-clang-native-cpp-20-pmr", - "configuration": "DebugCov", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-c-11-debugcov", - "configurePreset": "config-gcc-native-native64-c-11", - "configuration": "DebugCov", + "name": "build-gcc-native-c-11-debugasan", + "configurePreset": "config-gcc-native-c-11", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-14-debugcov", - "configurePreset": "config-gcc-native-native64-cpp-14", - "configuration": "DebugCov", + "name": "build-gcc-native-cpp-14-debugasan", + "configurePreset": "config-gcc-native-cpp-14", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cetl-14-17-debugcov", - "configurePreset": "config-gcc-native-native64-cetl-14-17", - "configuration": "DebugCov", + "name": "build-gcc-native-cetl-14-17-debugasan", + "configurePreset": "config-gcc-native-cetl-14-17", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-17-debugcov", - "configurePreset": "config-gcc-native-native64-cpp-17", - "configuration": "DebugCov", + "name": "build-gcc-native-cpp-17-debugasan", + "configurePreset": "config-gcc-native-cpp-17", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-17-pmr-debugcov", - "configurePreset": "config-gcc-native-native64-cpp-17-pmr", - "configuration": "DebugCov", + "name": "build-gcc-native-cpp-17-pmr-debugasan", + "configurePreset": "config-gcc-native-cpp-17-pmr", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-20-debugcov", - "configurePreset": "config-gcc-native-native64-cpp-20", - "configuration": "DebugCov", + "name": "build-gcc-native-cpp-20-debugasan", + "configurePreset": "config-gcc-native-cpp-20", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-20-pmr-debugcov", - "configurePreset": "config-gcc-native-native64-cpp-20-pmr", - "configuration": "DebugCov", + "name": "build-gcc-native-cpp-20-pmr-debugasan", + "configurePreset": "config-gcc-native-cpp-20-pmr", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-c-11-debugcov", - "configurePreset": "config-gcc-native-native32-c-11", - "configuration": "DebugCov", + "name": "build-gcc-native32-c-11-debugasan", + "configurePreset": "config-gcc-native32-c-11", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-14-debugcov", - "configurePreset": "config-gcc-native-native32-cpp-14", - "configuration": "DebugCov", + "name": "build-gcc-native32-cpp-14-debugasan", + "configurePreset": "config-gcc-native32-cpp-14", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cetl-14-17-debugcov", - "configurePreset": "config-gcc-native-native32-cetl-14-17", - "configuration": "DebugCov", + "name": "build-gcc-native32-cetl-14-17-debugasan", + "configurePreset": "config-gcc-native32-cetl-14-17", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-17-debugcov", - "configurePreset": "config-gcc-native-native32-cpp-17", - "configuration": "DebugCov", + "name": "build-gcc-native32-cpp-17-debugasan", + "configurePreset": "config-gcc-native32-cpp-17", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-17-pmr-debugcov", - "configurePreset": "config-gcc-native-native32-cpp-17-pmr", - "configuration": "DebugCov", + "name": "build-gcc-native32-cpp-17-pmr-debugasan", + "configurePreset": "config-gcc-native32-cpp-17-pmr", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-20-debugcov", - "configurePreset": "config-gcc-native-native32-cpp-20", - "configuration": "DebugCov", + "name": "build-gcc-native32-cpp-20-debugasan", + "configurePreset": "config-gcc-native32-cpp-20", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-20-pmr-debugcov", - "configurePreset": "config-gcc-native-native32-cpp-20-pmr", - "configuration": "DebugCov", + "name": "build-gcc-native32-cpp-20-pmr-debugasan", + "configurePreset": "config-gcc-native32-cpp-20-pmr", + "configuration": "DebugAsan", "targets": [ "test_all" ] }, { - "name": "build-clang-native-c-11-debug", + "name": "build-clang-native-c-11-release", "configurePreset": "config-clang-native-c-11", - "configuration": "Debug", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-14-debug", + "name": "build-clang-native-cpp-14-release", "configurePreset": "config-clang-native-cpp-14", - "configuration": "Debug", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cetl-14-17-debug", + "name": "build-clang-native-cetl-14-17-release", "configurePreset": "config-clang-native-cetl-14-17", - "configuration": "Debug", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-17-debug", + "name": "build-clang-native-cpp-17-release", "configurePreset": "config-clang-native-cpp-17", - "configuration": "Debug", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-17-pmr-debug", + "name": "build-clang-native-cpp-17-pmr-release", "configurePreset": "config-clang-native-cpp-17-pmr", - "configuration": "Debug", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-20-debug", + "name": "build-clang-native-cpp-20-release", "configurePreset": "config-clang-native-cpp-20", - "configuration": "Debug", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-20-pmr-debug", + "name": "build-clang-native-cpp-20-pmr-release", "configurePreset": "config-clang-native-cpp-20-pmr", - "configuration": "Debug", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-c-11-debug", - "configurePreset": "config-gcc-native-native64-c-11", - "configuration": "Debug", + "name": "build-gcc-native-c-11-release", + "configurePreset": "config-gcc-native-c-11", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-14-debug", - "configurePreset": "config-gcc-native-native64-cpp-14", - "configuration": "Debug", + "name": "build-gcc-native-cpp-14-release", + "configurePreset": "config-gcc-native-cpp-14", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cetl-14-17-debug", - "configurePreset": "config-gcc-native-native64-cetl-14-17", - "configuration": "Debug", + "name": "build-gcc-native-cetl-14-17-release", + "configurePreset": "config-gcc-native-cetl-14-17", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-17-debug", - "configurePreset": "config-gcc-native-native64-cpp-17", - "configuration": "Debug", + "name": "build-gcc-native-cpp-17-release", + "configurePreset": "config-gcc-native-cpp-17", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-17-pmr-debug", - "configurePreset": "config-gcc-native-native64-cpp-17-pmr", - "configuration": "Debug", + "name": "build-gcc-native-cpp-17-pmr-release", + "configurePreset": "config-gcc-native-cpp-17-pmr", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-20-debug", - "configurePreset": "config-gcc-native-native64-cpp-20", - "configuration": "Debug", + "name": "build-gcc-native-cpp-20-release", + "configurePreset": "config-gcc-native-cpp-20", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-20-pmr-debug", - "configurePreset": "config-gcc-native-native64-cpp-20-pmr", - "configuration": "Debug", + "name": "build-gcc-native-cpp-20-pmr-release", + "configurePreset": "config-gcc-native-cpp-20-pmr", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-c-11-debug", - "configurePreset": "config-gcc-native-native32-c-11", - "configuration": "Debug", + "name": "build-gcc-native32-c-11-release", + "configurePreset": "config-gcc-native32-c-11", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-14-debug", - "configurePreset": "config-gcc-native-native32-cpp-14", - "configuration": "Debug", + "name": "build-gcc-native32-cpp-14-release", + "configurePreset": "config-gcc-native32-cpp-14", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cetl-14-17-debug", - "configurePreset": "config-gcc-native-native32-cetl-14-17", - "configuration": "Debug", + "name": "build-gcc-native32-cetl-14-17-release", + "configurePreset": "config-gcc-native32-cetl-14-17", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-17-debug", - "configurePreset": "config-gcc-native-native32-cpp-17", - "configuration": "Debug", + "name": "build-gcc-native32-cpp-17-release", + "configurePreset": "config-gcc-native32-cpp-17", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-17-pmr-debug", - "configurePreset": "config-gcc-native-native32-cpp-17-pmr", - "configuration": "Debug", + "name": "build-gcc-native32-cpp-17-pmr-release", + "configurePreset": "config-gcc-native32-cpp-17-pmr", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-20-debug", - "configurePreset": "config-gcc-native-native32-cpp-20", - "configuration": "Debug", + "name": "build-gcc-native32-cpp-20-release", + "configurePreset": "config-gcc-native32-cpp-20", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-20-pmr-debug", - "configurePreset": "config-gcc-native-native32-cpp-20-pmr", - "configuration": "Debug", + "name": "build-gcc-native32-cpp-20-pmr-release", + "configurePreset": "config-gcc-native32-cpp-20-pmr", + "configuration": "Release", "targets": [ "test_all" ] }, { - "name": "build-clang-native-c-11-release", + "name": "build-clang-native-c-11-debugcov", "configurePreset": "config-clang-native-c-11", - "configuration": "Release", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-14-release", + "name": "build-clang-native-cpp-14-debugcov", "configurePreset": "config-clang-native-cpp-14", - "configuration": "Release", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cetl-14-17-release", + "name": "build-clang-native-cetl-14-17-debugcov", "configurePreset": "config-clang-native-cetl-14-17", - "configuration": "Release", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-17-release", + "name": "build-clang-native-cpp-17-debugcov", "configurePreset": "config-clang-native-cpp-17", - "configuration": "Release", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-17-pmr-release", + "name": "build-clang-native-cpp-17-pmr-debugcov", "configurePreset": "config-clang-native-cpp-17-pmr", - "configuration": "Release", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-20-release", + "name": "build-clang-native-cpp-20-debugcov", "configurePreset": "config-clang-native-cpp-20", - "configuration": "Release", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-20-pmr-release", + "name": "build-clang-native-cpp-20-pmr-debugcov", "configurePreset": "config-clang-native-cpp-20-pmr", - "configuration": "Release", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-c-11-release", - "configurePreset": "config-gcc-native-native64-c-11", - "configuration": "Release", + "name": "build-gcc-native-c-11-debugcov", + "configurePreset": "config-gcc-native-c-11", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-14-release", - "configurePreset": "config-gcc-native-native64-cpp-14", - "configuration": "Release", + "name": "build-gcc-native-cpp-14-debugcov", + "configurePreset": "config-gcc-native-cpp-14", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cetl-14-17-release", - "configurePreset": "config-gcc-native-native64-cetl-14-17", - "configuration": "Release", + "name": "build-gcc-native-cetl-14-17-debugcov", + "configurePreset": "config-gcc-native-cetl-14-17", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-17-release", - "configurePreset": "config-gcc-native-native64-cpp-17", - "configuration": "Release", + "name": "build-gcc-native-cpp-17-debugcov", + "configurePreset": "config-gcc-native-cpp-17", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-17-pmr-release", - "configurePreset": "config-gcc-native-native64-cpp-17-pmr", - "configuration": "Release", + "name": "build-gcc-native-cpp-17-pmr-debugcov", + "configurePreset": "config-gcc-native-cpp-17-pmr", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-20-release", - "configurePreset": "config-gcc-native-native64-cpp-20", - "configuration": "Release", + "name": "build-gcc-native-cpp-20-debugcov", + "configurePreset": "config-gcc-native-cpp-20", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-20-pmr-release", - "configurePreset": "config-gcc-native-native64-cpp-20-pmr", - "configuration": "Release", + "name": "build-gcc-native-cpp-20-pmr-debugcov", + "configurePreset": "config-gcc-native-cpp-20-pmr", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-c-11-release", - "configurePreset": "config-gcc-native-native32-c-11", - "configuration": "Release", + "name": "build-gcc-native32-c-11-debugcov", + "configurePreset": "config-gcc-native32-c-11", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-14-release", - "configurePreset": "config-gcc-native-native32-cpp-14", - "configuration": "Release", + "name": "build-gcc-native32-cpp-14-debugcov", + "configurePreset": "config-gcc-native32-cpp-14", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cetl-14-17-release", - "configurePreset": "config-gcc-native-native32-cetl-14-17", - "configuration": "Release", + "name": "build-gcc-native32-cetl-14-17-debugcov", + "configurePreset": "config-gcc-native32-cetl-14-17", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-17-release", - "configurePreset": "config-gcc-native-native32-cpp-17", - "configuration": "Release", + "name": "build-gcc-native32-cpp-17-debugcov", + "configurePreset": "config-gcc-native32-cpp-17", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-17-pmr-release", - "configurePreset": "config-gcc-native-native32-cpp-17-pmr", - "configuration": "Release", + "name": "build-gcc-native32-cpp-17-pmr-debugcov", + "configurePreset": "config-gcc-native32-cpp-17-pmr", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-20-release", - "configurePreset": "config-gcc-native-native32-cpp-20", - "configuration": "Release", + "name": "build-gcc-native32-cpp-20-debugcov", + "configurePreset": "config-gcc-native32-cpp-20", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-20-pmr-release", - "configurePreset": "config-gcc-native-native32-cpp-20-pmr", - "configuration": "Release", + "name": "build-gcc-native32-cpp-20-pmr-debugcov", + "configurePreset": "config-gcc-native32-cpp-20-pmr", + "configuration": "DebugCov", "targets": [ "test_all" ] }, { - "name": "build-clang-native-c-11-debugasan", + "name": "build-clang-native-c-11-debug", "configurePreset": "config-clang-native-c-11", - "configuration": "DebugAsan", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-14-debugasan", + "name": "build-clang-native-cpp-14-debug", "configurePreset": "config-clang-native-cpp-14", - "configuration": "DebugAsan", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cetl-14-17-debugasan", + "name": "build-clang-native-cetl-14-17-debug", "configurePreset": "config-clang-native-cetl-14-17", - "configuration": "DebugAsan", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-17-debugasan", + "name": "build-clang-native-cpp-17-debug", "configurePreset": "config-clang-native-cpp-17", - "configuration": "DebugAsan", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-17-pmr-debugasan", + "name": "build-clang-native-cpp-17-pmr-debug", "configurePreset": "config-clang-native-cpp-17-pmr", - "configuration": "DebugAsan", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-20-debugasan", + "name": "build-clang-native-cpp-20-debug", "configurePreset": "config-clang-native-cpp-20", - "configuration": "DebugAsan", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-clang-native-cpp-20-pmr-debugasan", + "name": "build-clang-native-cpp-20-pmr-debug", "configurePreset": "config-clang-native-cpp-20-pmr", - "configuration": "DebugAsan", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-c-11-debugasan", - "configurePreset": "config-gcc-native-native64-c-11", - "configuration": "DebugAsan", + "name": "build-gcc-native-c-11-debug", + "configurePreset": "config-gcc-native-c-11", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-14-debugasan", - "configurePreset": "config-gcc-native-native64-cpp-14", - "configuration": "DebugAsan", + "name": "build-gcc-native-cpp-14-debug", + "configurePreset": "config-gcc-native-cpp-14", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cetl-14-17-debugasan", - "configurePreset": "config-gcc-native-native64-cetl-14-17", - "configuration": "DebugAsan", + "name": "build-gcc-native-cetl-14-17-debug", + "configurePreset": "config-gcc-native-cetl-14-17", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-17-debugasan", - "configurePreset": "config-gcc-native-native64-cpp-17", - "configuration": "DebugAsan", + "name": "build-gcc-native-cpp-17-debug", + "configurePreset": "config-gcc-native-cpp-17", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-17-pmr-debugasan", - "configurePreset": "config-gcc-native-native64-cpp-17-pmr", - "configuration": "DebugAsan", + "name": "build-gcc-native-cpp-17-pmr-debug", + "configurePreset": "config-gcc-native-cpp-17-pmr", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-20-debugasan", - "configurePreset": "config-gcc-native-native64-cpp-20", - "configuration": "DebugAsan", + "name": "build-gcc-native-cpp-20-debug", + "configurePreset": "config-gcc-native-cpp-20", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native64-cpp-20-pmr-debugasan", - "configurePreset": "config-gcc-native-native64-cpp-20-pmr", - "configuration": "DebugAsan", + "name": "build-gcc-native-cpp-20-pmr-debug", + "configurePreset": "config-gcc-native-cpp-20-pmr", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-c-11-debugasan", - "configurePreset": "config-gcc-native-native32-c-11", - "configuration": "DebugAsan", + "name": "build-gcc-native32-c-11-debug", + "configurePreset": "config-gcc-native32-c-11", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-14-debugasan", - "configurePreset": "config-gcc-native-native32-cpp-14", - "configuration": "DebugAsan", + "name": "build-gcc-native32-cpp-14-debug", + "configurePreset": "config-gcc-native32-cpp-14", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cetl-14-17-debugasan", - "configurePreset": "config-gcc-native-native32-cetl-14-17", - "configuration": "DebugAsan", + "name": "build-gcc-native32-cetl-14-17-debug", + "configurePreset": "config-gcc-native32-cetl-14-17", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-17-debugasan", - "configurePreset": "config-gcc-native-native32-cpp-17", - "configuration": "DebugAsan", + "name": "build-gcc-native32-cpp-17-debug", + "configurePreset": "config-gcc-native32-cpp-17", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-17-pmr-debugasan", - "configurePreset": "config-gcc-native-native32-cpp-17-pmr", - "configuration": "DebugAsan", + "name": "build-gcc-native32-cpp-17-pmr-debug", + "configurePreset": "config-gcc-native32-cpp-17-pmr", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-20-debugasan", - "configurePreset": "config-gcc-native-native32-cpp-20", - "configuration": "DebugAsan", + "name": "build-gcc-native32-cpp-20-debug", + "configurePreset": "config-gcc-native32-cpp-20", + "configuration": "Debug", "targets": [ "test_all" ] }, { - "name": "build-gcc-native-native32-cpp-20-pmr-debugasan", - "configurePreset": "config-gcc-native-native32-cpp-20-pmr", - "configuration": "DebugAsan", + "name": "build-gcc-native32-cpp-20-pmr-debug", + "configurePreset": "config-gcc-native32-cpp-20-pmr", + "configuration": "Debug", "targets": [ "test_all" ] diff --git a/verification/preset_generator.py b/verification/preset_generator.py index b03cf224..3da851ef 100755 --- a/verification/preset_generator.py +++ b/verification/preset_generator.py @@ -17,31 +17,40 @@ import sys import textwrap from pathlib import Path - -dimensions: dict[str, dict] = { - "toolchain": { - "short_name": "tc", - "help": "The toolchain to use. Optionally provide colon separated platform name.", - "split": ":", - "values": { - "toolchainFile": lambda tc: f"${{sourceDir}}/cmake/toolchains/{tc.split(":")[0]}.cmake", - "cacheVariables": lambda tc: ( - {"NUNAVUT_VERIFICATION_TARGET_PLATFORM": tc.split(":")[1]} if len(tc.split(":")) > 1 else {} - ), - }, - }, - "language": { - "short_name": "ln", - "help": "A pair of language name and language standard to use separated by a dash. For example, 'c-11'.", - "split": "-", - "values": { - "cacheVariables": lambda las: { - "NUNAVUT_VERIFICATION_LANG": las.split("-")[0], - "NUNAVUT_VERIFICATION_LANG_STANDARD": las.split("-")[1], - } - }, - }, -} +from collections import OrderedDict + +dimensions: OrderedDict[str, dict] = OrderedDict( + [ + ( + "toolchain", + { + "short_name": "tc", + "help": "The toolchain to use. Optionally provide colon separated platform name.", + "split": ":", + "values": { + "toolchainFile": lambda tc: f"${{sourceDir}}/cmake/toolchains/{tc.split(':')[0]}.cmake", + "cacheVariables": lambda tc: ( + {"NUNAVUT_VERIFICATION_TARGET_PLATFORM": tc.split(":")[1]} if len(tc.split(":")) > 1 else {} + ), + }, + }, + ), + ( + "language", + { + "short_name": "ln", + "help": "A pair of language name and language standard to use separated by a dash. For example, 'c-11'.", + "split": "-", + "values": { + "cacheVariables": lambda las: { + "NUNAVUT_VERIFICATION_LANG": las.split("-")[0], + "NUNAVUT_VERIFICATION_LANG_STANDARD": las.split("-")[1], + } + }, + }, + ), + ] +) def parse_arguments() -> argparse.Namespace: @@ -135,8 +144,28 @@ def parse_arguments() -> argparse.Namespace: def validate_json_schema(args: argparse.Namespace, presets: dict) -> bool: """ - Validates the schema of the json file. + Validates the preset file against certain assumptions this script makes. If jsonschema and requests is available + the script will also validate the file against the CMake presets schema pulled from gihub. """ + try: + import jsonschema # pylint: disable=import-outside-toplevel + import urllib.request # pylint: disable=import-outside-toplevel + + schema_url = "https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/presets/schema.json" + with urllib.request.urlopen(schema_url, timeout=10) as response: + schema = json.loads(response.read().decode()) + + try: + jsonschema.validate(instance=presets, schema=schema) + except jsonschema.ValidationError as e: + print(f"JSON schema validation error: {e.message}") + return False + + except ImportError: + if not getattr(args, "validate_json_schema_warn_once", False): + print("jsonschema is not available. Skipping schema validation.") + args.validate_json_schema_warn_once = True + if "version" not in presets or presets["version"] != args.presets_version: print("The version field is missing from the presets file.") return False @@ -190,7 +219,7 @@ def find_configuration_types(args: argparse.Namespace, hidden_presets: list[dict def update_hidden_configure_presets(args: argparse.Namespace, configure_presets: dict) -> list[dict]: """ - Update the hidden configure presets based on the given arguments. + Update the hidden configure presets based on the arguments given to the script. @return: The updated hidden configure presets merged from the given presets and the arguments. """ @@ -308,6 +337,9 @@ def main() -> int: args, find_configuration_types(args, hidden_presets), visible_presets ) + if not validate_json_schema(args, json_presets): + return 1 + with args.preset_file.open("w", encoding="UTF-8") as f: f.write(json.dumps(json_presets, indent=args.indent)) f.write("\n") diff --git a/version_check_nunavut.py b/version_check_nunavut.py new file mode 100755 index 00000000..4ea6c42c --- /dev/null +++ b/version_check_nunavut.py @@ -0,0 +1,151 @@ +#!/usr/bin/env python3 +# +# Copyright (C) OpenCyphal Development Team +# Copyright Amazon.com Inc. or its affiliates. +# SPDX-License-Identifier: MIT +# +""" + Helper for getting and comparing the version of Nunavut. +""" + +import argparse +import functools +import logging +import pathlib +import sys +import textwrap +import typing + + +def _make_parser() -> argparse.ArgumentParser: + + script = pathlib.Path(__file__).relative_to(pathlib.Path.cwd()) + + epilog = textwrap.dedent( + f""" + + **Example Usage**:: + + {script} --version-only + + """ + ) + + parser = argparse.ArgumentParser( + description="CMake command-line helper for running verification builds.", + epilog=epilog, + formatter_class=argparse.RawTextHelpFormatter, + ) + + parser.add_argument( + "--version-only", + action="store_true", + help=textwrap.dedent( + f""" + Print out the version number (stored in src/nunavut/_version.py) only and exit. This number + will be the only output to stdout allowing build scripts to extract this string value for + use in the build environment. For example: + + export NUNAVUT_FULL_VERSION=$({script} --version-only) + + """[ + 1: + ] + ), + ) + + parser.add_argument( + "--major-minor-version-only", + action="store_true", + help=textwrap.dedent( + f""" + Print out the major and minor version number (stored in src/nunavut/_version.py) only and exit. + This number will be the only output to stdout allowing build scripts to extract this string + value for use in the build environment. For example: + + export NUNAVUT_MAJOR_MINOR_VERSION=$({script} --major-minor-version-only) + + """[ + 1: + ] + ), + ) + + parser.add_argument( + "--version-check", + help=textwrap.dedent( + f""" + Compares a given semantic version number with the current Nunavut version + (stored in src/nunavut/_version.py) and returns 0 if it matches else returns 1. + + if $({script} --version-check 1.0.2); then echo "match"; fi + + """[ + 1: + ] + ), + ) + + parser.add_argument("-v", "--verbose", action="count", default=0, help="Set output verbosity.") + + return parser + + +@functools.lru_cache(maxsize=None) +def _get_version_string() -> typing.Tuple[str, str, str, str]: + version: typing.Dict[str, str] = {} + nunavut_version_file = pathlib.Path("src/nunavut/_version.py") + + with nunavut_version_file.open("r", encoding="UTF-8") as version_py: + exec(version_py.read(), version) # pylint: disable=exec-used + + version_string = version["__version__"] + version_array = version_string.split(".") + if len(version_array) not in (3, 4): + raise RuntimeError(f"Invalid version string: {version_string}") + if len(version_array) == 3: + return (version_array[0], version_array[1], version_array[2], "") + else: + return (version_array[0], version_array[1], version_array[2], version_array[3]) + + +def main() -> int: + """ + Main method to execute when this package/script is invoked as a command. + """ + args = _make_parser().parse_args() + + if args.version_only: + sys.stdout.write(".".join(_get_version_string())) + sys.stdout.flush() + return 0 + + if args.major_minor_version_only: + version = _get_version_string() + sys.stdout.write(f"{version[0]}.{version[1]}") + sys.stdout.flush() + return 0 + + logging_level = logging.WARN + + if args.verbose == 1: + logging_level = logging.INFO + elif args.verbose > 1: + logging_level = logging.DEBUG + + logging.basicConfig(format="%(levelname)s: %(message)s", level=logging_level) + + version_as_string = ".".join(_get_version_string()) + + logging.debug( + "Comparing nunavut version %s to provided version %s (%s)", + version_as_string, + args.version_check, + "matches" if (version_as_string == args.version_check) else "no-match", + ) + + return 0 if (version_as_string == args.version_check) else 1 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/pydsdl_version_check.py b/version_check_pydsdl.py similarity index 100% rename from pydsdl_version_check.py rename to version_check_pydsdl.py