From 66b26750f3e9b721275dfb0e55ddba7216290b76 Mon Sep 17 00:00:00 2001 From: Nikola Radakovic Date: Wed, 8 Jul 2026 10:11:35 +0200 Subject: [PATCH 1/2] Fix header inclusion in tests Add missing headers from standard library which are missing. Without explicit inclusion of these headers some toolchain implementation could have issues. --- tests/language_and_standards/cpp11_test.cpp | 1 + tests/language_and_standards/cpp14_test.cpp | 1 + tests/language_and_standards/cpp17_test.cpp | 4 +++- tests/language_and_standards/cpp20_test.cpp | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/language_and_standards/cpp11_test.cpp b/tests/language_and_standards/cpp11_test.cpp index 6409a71..c09749a 100644 --- a/tests/language_and_standards/cpp11_test.cpp +++ b/tests/language_and_standards/cpp11_test.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include // Test 1: auto keyword diff --git a/tests/language_and_standards/cpp14_test.cpp b/tests/language_and_standards/cpp14_test.cpp index 716b535..28aec61 100644 --- a/tests/language_and_standards/cpp14_test.cpp +++ b/tests/language_and_standards/cpp14_test.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include // Test 1: Auto return type deduction diff --git a/tests/language_and_standards/cpp17_test.cpp b/tests/language_and_standards/cpp17_test.cpp index cdf83e7..7b88287 100644 --- a/tests/language_and_standards/cpp17_test.cpp +++ b/tests/language_and_standards/cpp17_test.cpp @@ -17,8 +17,10 @@ #include #include #include -#include +#include #include +#include +#include // Test 1: Structured bindings struct Point { diff --git a/tests/language_and_standards/cpp20_test.cpp b/tests/language_and_standards/cpp20_test.cpp index fea474e..4943ff1 100644 --- a/tests/language_and_standards/cpp20_test.cpp +++ b/tests/language_and_standards/cpp20_test.cpp @@ -18,7 +18,9 @@ #include #include #include +#include #include +#include #include // Test 1: Concepts (simplified - basic constraint checking) From 664c0e37560d1bb966678f27fa2ec2839c28c128 Mon Sep 17 00:00:00 2001 From: Nikola Radakovic Date: Wed, 8 Jul 2026 10:13:14 +0200 Subject: [PATCH 2/2] Align documentation to the latest tests implementation Update documentation to reflect the latest status of test targets. --- README.md | 4 +- docs/examples_and_validation.md | 88 ------------------ docs/extension_api.md | 2 +- docs/maintenance.md | 22 +++-- docs/overview.md | 6 +- docs/repository_layout.md | 14 +-- docs/test_suite.md | 122 ++++++++++++++++--------- docs/tests_and_validation.md | 107 ++++++++++++++++++++++ examples/README.md | 8 +- tests/README.md | 13 ++- tests/feature_verification/BUILD | 8 +- tests/feature_verification/README.md | 6 +- tests/language_and_standards/BUILD | 5 +- tests/language_and_standards/README.md | 6 +- 14 files changed, 242 insertions(+), 169 deletions(-) delete mode 100644 docs/examples_and_validation.md create mode 100644 docs/tests_and_validation.md diff --git a/README.md b/README.md index 7903c12..56d52ff 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,9 @@ validates the setup, and how QNX-specific authentication and licensing fit in. - [Repository layout](docs/repository_layout.md) - [Extension API](docs/extension_api.md) - [Generation flow](docs/generation_flow.md) -- [Examples and validation](docs/examples_and_validation.md) +- [Tests and validation](docs/tests_and_validation.md) - [QNX integration](docs/qnx_integration.md) -- [Test Suite](docs/test_suite.md) - Comprehensive test documentation +- [Test Suite](docs/test_suite.md) - [Maintenance](docs/maintenance.md) ## Quick Summary diff --git a/docs/examples_and_validation.md b/docs/examples_and_validation.md deleted file mode 100644 index 4baca2f..0000000 --- a/docs/examples_and_validation.md +++ /dev/null @@ -1,88 +0,0 @@ - - -# Examples And Validation - -## Example Workspace Purpose - -The `examples/` directory is a separate Bazel workspace used as a lightweight -integration test bed for the repository. - -It demonstrates how consumers declare toolchains while also serving as the main -smoke-test surface for validating that the generated toolchains can build and, -where appropriate, run example targets. - -These examples are intended only for sanity testing global changes on the -module extension side. They are not a reference point for full platform setup. -For a proper build on a dedicated platform, consumers must consult the -relevant platform developers and owners rather than relying on these examples -as a platform configuration guide. - -## Important Files - -`examples/MODULE.bazel` - -Declares representative Linux and QNX toolchain repositories and wires the -example workspace back to the local checkout with `local_path_override`. - -`examples/.bazelrc` - -Defines named Bazel configurations that activate the generated toolchains and -platforms. - -`examples/BUILD` - -Contains small C++ targets used to verify compilation, linking, pthread -support, and sanitizer integration. - -`examples/test.sh` - -Matrix runner that maps each configuration name to a small build or test -sequence. - -## Smoke-Test Matrix - -The example workspace currently validates these configuration groups: - -- Linux host toolchains -- Linux cross-compilation toolchains -- runtime-specific Linux toolchains such as AutoSD and EB corbos Linux for Safety Applications -- packaged QNX toolchains - -The smoke-test runner isolates Bazel state per configuration so it does not -rely on `bazel clean --expunge` between cases. - -## Useful Commands - -```bash -cd examples -./test.sh --list -./test.sh host_config_1 -./test.sh --keep-going -``` - -## What The Tests Prove - -As stated before, the example workspace is not intended to be an exhaustive compiler correctness -suite. Instead, it answers a narrower question: did the configuration -repository produce a usable toolchain definition for each supported scenario? - -In practice this means checking among other things: - -- successful compilation with the selected compiler and sysroot, -- correct toolchain registration and platform matching, -- basic linking behavior, -- feature coverage such as pthread-enabled builds, -- optional sanitizer feature wiring for the local Linux toolchain path. \ No newline at end of file diff --git a/docs/extension_api.md b/docs/extension_api.md index 1c2b6d1..5d7ed65 100644 --- a/docs/extension_api.md +++ b/docs/extension_api.md @@ -104,7 +104,7 @@ configuration such as: --extra_toolchains=@score_gcc_toolchain//:x86_64-linux-gcc_12.2.0 ``` -The example workspace under `examples/` provides complete `.bazelrc` +The test workspace under `tests/` provides complete `.bazelrc` configurations for this activation step. ## Behavior Notes diff --git a/docs/maintenance.md b/docs/maintenance.md index f41ce25..69234a9 100644 --- a/docs/maintenance.md +++ b/docs/maintenance.md @@ -23,8 +23,9 @@ Adding support for a new toolchain variant usually touches several layers: 2. add a package BUILD descriptor under `packages/linux/` or `packages/qnx/`, 3. ensure the required template placeholders already exist, or extend the platform template files, -4. update the example workspace if the new variant should be validated by the - smoke-test matrix, +4. update the test workspace under `tests/` if the new variant should be + validated by the test matrix (add a matching `--config` entry in + `tests/.bazelrc`), 5. add or update documentation in this Markdown source and the repository README. ## When To Use The Version Matrix @@ -43,20 +44,25 @@ experimental, or intentionally not part of the default support matrix. - QNX `aarch64` naming differs from some underlying SDK paths, - QNX licensing and authentication requirements live outside Bazel target analysis and must be configured in the execution environment, -- documentation examples must stay aligned with actual `examples/.bazelrc` +- documentation examples must stay aligned with actual `tests/.bazelrc` configuration names. ## Recommended Validation After Changes For repository changes that affect toolchain resolution, package metadata, or -template generation, validate with the example workspace: +template generation, validate with the test workspace (a separate Bazel +workspace, so run the commands from `tests/`): ```bash -cd examples -./test.sh --list -./test.sh host_config_1 -./test.sh --keep-going +cd tests +bazel test --config x86_64-linux //... +bazel test --config x86_64-linux //:feature_verification_tests +bazel test --config x86_64-linux //:language_and_standards_tests ``` +The available `--config` values (for example `x86_64-linux`, `aarch64-linux`, +`x86_64-qnx`, `aarch64-qnx`, `x86_64-linux-autosd10`, `aarch64-linux-ebclfsa`) +are defined in `tests/.bazelrc`. + For documentation-only changes, build or preview the Markdown site to catch markup and table-of-contents/navigation issues before publishing. \ No newline at end of file diff --git a/docs/overview.md b/docs/overview.md index ef90584..f924631 100644 --- a/docs/overview.md +++ b/docs/overview.md @@ -24,8 +24,8 @@ It exists to answer three practical needs: - provide a single Bazel-native way to declare Linux and QNX C/C++ toolchains, - keep package provenance, compiler flags, and platform constraints consistent, -- validate those toolchains through an example workspace instead of relying on - ad hoc local setup. +- validate those toolchains through a dedicated test workspace instead of + relying on ad hoc local setup. ## What The Repository Contains @@ -38,7 +38,7 @@ them as `cc_toolchain` targets: - package metadata in `packages/` - generated-file templates in `templates/` - authentication helpers in `tools/` -- an example validation workspace in `examples/` +- a dedicated test workspace in `tests/` ## Supported Platform Families diff --git a/docs/repository_layout.md b/docs/repository_layout.md index de56b21..a1e45ae 100644 --- a/docs/repository_layout.md +++ b/docs/repository_layout.md @@ -22,7 +22,7 @@ The repository is organized by subsystem rather than by platform product: ```text . |- docs/ Markdown documentation sources -|- examples/ Example workspace and smoke tests +|- tests/ Test workspace and validation suites |- extensions/ Bzlmod extension entry points |- packages/ Toolchain package descriptors and version matrix |- rules/ Repository rules and shared helpers @@ -58,13 +58,13 @@ QNX because the execution environment, sysroot layout, and licensing model are different. > NOTE: Future plan is to have a single template for toolchain configuration. -`examples/` +`tests/` -A standalone Bazel workspace used as an integration surface. It declares -representative toolchain configurations and validates them with a smoke-test -runner. -> NOTE: These tests are just a sanity check. They should not be used as reference -> points for platform development. +A standalone Bazel workspace used as the integration and validation surface. It +declares representative toolchain configurations and validates them with +feature-verification and language-standard test suites. +> NOTE: These tests validate toolchain generation. They should not be used as +> reference points for platform development. `tools/` diff --git a/docs/test_suite.md b/docs/test_suite.md index 1858b9d..266b5e3 100644 --- a/docs/test_suite.md +++ b/docs/test_suite.md @@ -13,15 +13,17 @@ All tests are located in the `tests/` directory of the repository. ## Quick Start +All tests are defined in a separate Bazel workspace; therefore, Bazel commands must be run from the `tests/` directory. + Run all tests: ```bash -bazel test --config host_config_1 //tests/... +bazel test --config x86_64-linux //... ``` Run specific test suites: ```bash -bazel test --config host_config_1 //tests/feature_verification:feature_verification_tests -bazel test --config host_config_1 //tests/language_and_standards:language_and_standards_tests +bazel test --config x86_64-linux //:feature_verification_tests +bazel test --config x86_64-linux //:language_and_standards_tests ``` ## Test Categories @@ -48,7 +50,7 @@ These tests verify that specific toolchain features are correctly implemented an 4. **`coverage_test`** - Code coverage instrumentation - Verifies code coverage instrumentation flags are applied - Provides multiple code paths for coverage analysis - - Can be analyzed with: `bazel coverage --combined_report=lcov //tests/feature_verification:coverage_test` + - Can be analyzed with: `bazel coverage --combined_report=lcov //feature_verification:coverage_test` 5. **`pic_test`** - Position-Independent Code (`-fPIC`) - Tests -fPIC flag is correctly applied @@ -73,12 +75,12 @@ These tests verify that specific toolchain features are correctly implemented an ```bash # All feature verification tests -bazel test --config host_config_1 //tests/feature_verification:feature_verification_tests +bazel test --config x86_64-linux //:feature_verification_tests # Individual tests -bazel test --config host_config_1 //tests/feature_verification:defines_test -bazel test --config host_config_1 //tests/feature_verification:pic_test -bazel test --config host_config_1 //tests/feature_verification:pthread_test +bazel test --config x86_64-linux //feature_verification:defines_test +bazel test --config x86_64-linux //feature_verification:pic_test +bazel test --config x86_64-linux //feature_verification:pthread_test ``` #### Feature Coverage @@ -159,12 +161,12 @@ These tests verify support for different programming languages and C++ standard ```bash # All language and standards tests -bazel test --config host_config_1 //tests/language_and_standards:language_and_standards_tests +bazel test --config x86_64-linux //:language_and_standards_tests # Individual tests -bazel test --config host_config_1 //tests/language_and_standards:c_lang_test -bazel test --config host_config_1 //tests/language_and_standards:cpp11_test -bazel test --config host_config_1 //tests/language_and_standards:cpp20_test +bazel test --config x86_64-linux //language_and_standards:c_lang_test +bazel test --config x86_64-linux //language_and_standards:cpp11_test +bazel test --config x86_64-linux //language_and_standards:cpp20_test ``` #### Compilation Flags @@ -173,7 +175,7 @@ Each test is compiled with specific flags to enable the corresponding language s | Test | Compilation Flag | GCC Version Required | |------|------------------|----------------------| -| c_lang_test | (default C) | Any (C99 support) | +| c_lang_test | -std=c99 | Any (C99 support) | | cpp11_test | -std=c++11 | GCC 4.8+ | | cpp14_test | -std=c++14 | GCC 5+ | | cpp17_test | -std=c++17 | GCC 7+ | @@ -185,56 +187,84 @@ Each test is compiled with specific flags to enable the corresponding language s ```bash # Run all tests -bazel test --config host_config_1 //tests/... +bazel test --config x86_64-linux //... # Run with verbose output -bazel test --config host_config_1 --test_output=all //tests/feature_verification:defines_test +bazel test --config x86_64-linux --test_output=all //feature_verification:defines_test # Run specific test directory -bazel test --config host_config_1 //tests/feature_verification/... -bazel test --config host_config_1 //tests/language_and_standards/... +bazel test --config x86_64-linux //feature_verification/... +bazel test --config x86_64-linux //language_and_standards/... ``` ### Platform-Specific Testing -#### Linux x86_64 (Default Host) +Bazel `test` compiles a test binary **and executes it**. A binary built for a +target platform can only be executed on that target platform (or a +binary-compatible one). This has a direct consequence for how the suites are +run: + +- **`bazel test` is only valid when the execution machine matches the target + platform.** When the host equals the target — for example running the + `x86_64-linux` config on an `x86_64` Linux host — the binaries build and run + directly on the host. +- **For every other configuration the tests must be executed on the + corresponding target platform.** On a non-matching host, use `bazel build` to + verify only compilation and linking, then deploy and run the resulting + binaries on the target — or invoke `bazel test` directly from that target + platform. + +#### Host equals target (e.g. Linux x86_64) ```bash -# All tests can execute on Linux host -bazel test --config host_config_1 //tests/... +# Host is the target: binaries build and execute locally +bazel test --config x86_64-linux //... ``` -#### Cross-Compilation (QNX ARM) +#### Cross configurations (QNX, aarch64-linux, runtime-specific) -Feature verification tests are marked with `tags = ["manual"]` to prevent execution attempts on incompatible architectures: +Configs such as `x86_64-qnx`, `aarch64-qnx`, `aarch64-linux`, +`x86_64-linux-autosd10`, and `aarch64-linux-ebclfsa` target platforms that +differ from a typical x86_64 Linux host. Do **not** run `bazel test` for these +configs on the host — the produced binaries are not executable there. ```bash -# Compile (don't execute) for QNX ARM -bazel build --config target_config_1 //tests/feature_verification:defines_test -bazel build --config target_config_1 //tests/feature_verification:include_paths_test +# On the host: verify compilation and linking only (no execution) +bazel build --config x86_64-qnx //... +bazel build --config aarch64-qnx //... +bazel build --config aarch64-linux //... -# Run only executable (native) tests on QNX config -bazel test --config target_config_1 //tests/language_and_standards:language_and_standards_tests +# On the matching target platform: build and execute the tests +bazel test --config x86_64-qnx //... ``` +> IMPORTANT: `x86_64-qnx` tests must be executed on an `x86_64` QNX system, +> `aarch64-qnx` tests on an `aarch64` QNX system, `aarch64-linux` tests on an +> `aarch64` Linux system, and so on. Running them on a mismatched host will +> fail because the test binaries cannot be executed there. + ## Expected Test Results -### Successful Run +The counts below assume execution on a matching target platform (or the host +when the host equals the target). + +### All tests on the host (`//...`) ``` Executed 13 tests: 13 passed ``` ### Feature Verification Tests -- All 8 tests compile and link successfully -- Cross-compilation tests marked as "manual" to prevent execution on incompatible hosts -- Expected output: +- The `feature_verification_tests` suite aggregates 7 tests. `warnings_test` + is defined separately and is picked up by wildcard targets such as + `//feature_verification/...`. +- Expected output for the suite: ``` - Executed 8 tests: 8 passed + Executed 7 tests: 7 passed ``` ### Language and Standards Tests -- All 5 tests execute and pass on Linux x86_64 -- Each test verifies the appropriate language features and standard version +- All 5 tests pass when executed on a matching target platform. +- Each test verifies the appropriate language features and standard version. - Expected output: ``` Executed 5 tests: 5 passed @@ -292,10 +322,16 @@ g++ --version **Issue:** Cross-compilation tests fail with architecture mismatch +This happens when `bazel test` is run for a target platform on a mismatched +host. Build only on the host, then execute the tests on the matching target +platform: + ```bash -# Solution: Use bazel build instead of bazel test, or skip manual tests -bazel build --config target_config_1 //tests/feature_verification:defines_test -bazel test --config host_config_1 --test_tag_filters=-manual //tests/... +# On the host: build only (no execution) +bazel build --config aarch64-qnx //... + +# On the matching target platform: build and execute +bazel test --config aarch64-qnx //... ``` ### Test Execution Failures @@ -304,7 +340,7 @@ bazel test --config host_config_1 --test_tag_filters=-manual //tests/... ```bash # Solution: Get detailed timeout information -bazel test --config host_config_1 --test_verbose_timeout_warnings //tests/... +bazel test --config x86_64-linux --test_verbose_timeout_warnings //... ``` **Issue:** Cannot find pthread library @@ -318,7 +354,7 @@ sudo apt-get install libpthread-stubs0-dev ```bash # Solution: Run with full output for debugging -bazel test --config host_config_1 --test_output=all //tests/language_and_standards:cpp20_test +bazel test --config x86_64-linux --test_output=all //language_and_standards:cpp20_test ``` ### Compiler Version Issues @@ -347,7 +383,6 @@ g++ --version name = "my_feature_test", srcs = ["my_feature_test.cpp"], copts = ["-DTEST_FEATURE=1"], - tags = ["manual"], # For cross-compilation targets deps = [":feature_test_lib"], ) ``` @@ -374,11 +409,11 @@ The test suite can be integrated into continuous integration pipelines: ```bash # Full validation (native + cross-compilation builds) -bazel test --config host_config_1 //tests/language_and_standards/... -bazel build --config target_config_1 //tests/feature_verification/... +bazel test --config x86_64-linux //language_and_standards/... +bazel build --config aarch64-qnx //feature_verification/... # Generate test reports -bazel test --config host_config_1 --test_summary=detailed //tests/... +bazel test --config x86_64-linux --test_summary=detailed //... ``` ## Performance Characteristics @@ -390,6 +425,5 @@ bazel test --config host_config_1 --test_summary=detailed //tests/... ## Further Reading - [Bazel C++ Toolchain Overview](overview.md) -- [Toolchain Features](features.md) - [Toolchain Generation Flow](generation_flow.md) - [Repository Layout](repository_layout.md) diff --git a/docs/tests_and_validation.md b/docs/tests_and_validation.md new file mode 100644 index 0000000..957d2aa --- /dev/null +++ b/docs/tests_and_validation.md @@ -0,0 +1,107 @@ + + +# Tests And Validation + +## Test Workspace Purpose + +The `tests/` directory is a separate Bazel workspace used as the integration +test bed for the repository. + +It demonstrates how consumers declare toolchains while also serving as the main +validation surface for confirming that the generated toolchains can build and, +where appropriate, run test targets. + +These tests are intended for validating global changes on the module extension +side and for verifying toolchain features and language-standard support. They +are not a reference point for full platform setup. For a proper build on a +dedicated platform, consumers must consult the relevant platform developers and +owners rather than relying on these tests as a platform configuration guide. + +For the full catalog of individual tests, see +[test_suite.md](test_suite.md). + +## Important Files + +`tests/MODULE.bazel` + +Declares representative Linux and QNX toolchain repositories and wires the test +workspace back to the local checkout with `local_path_override`. + +`tests/.bazelrc` + +Defines named Bazel configurations (activated with `--config`) that select the +generated toolchains and platforms. + +`tests/BUILD` + +Defines the `feature_verification_tests` and `language_and_standards_tests` +test suites that aggregate the individual test targets. + +`tests/feature_verification/` + +C++ targets that verify toolchain features such as preprocessor defines, +include paths, warnings, coverage, position-independent code, pthread support, +multi-file archiving, and whole-archive linking. + +`tests/language_and_standards/` + +C and C++ targets that verify language support across C, C++11, C++14, C++17, +and C++20. + +## Validation Matrix + +The test workspace validates these configuration groups (see `tests/.bazelrc` +for the exact `--config` names): + +- Linux host toolchains (`x86_64-linux`, `x86_64-linux-custom`, `x86_64-linux-bp`) +- Linux cross-compilation toolchains (`aarch64-linux`) +- runtime-specific Linux toolchains such as AutoSD (`x86_64-linux-autosd10`) + and EB corbos Linux for Safety Applications (`aarch64-linux-ebclfsa`) +- packaged QNX toolchains (`x86_64-qnx`, `aarch64-qnx`) + +## Useful Commands + +The `tests/` directory is a separate Bazel workspace, so run the commands from +within it: + +```bash +cd tests + +# Run every test with the host toolchain +bazel test --config x86_64-linux //... + +# Run a single test suite +bazel test --config x86_64-linux //:feature_verification_tests +bazel test --config x86_64-linux //:language_and_standards_tests + +# Build against a cross-compilation or runtime-specific target +bazel build --config aarch64-qnx //... +``` + +## What The Tests Prove + +The test workspace is not intended to be an exhaustive compiler correctness +suite. Instead, it answers a narrower question: did the configuration +repository produce a usable toolchain definition for each supported scenario? + +In practice this means checking among other things: + +- successful compilation with the selected compiler and sysroot, +- correct toolchain registration and platform matching, +- basic linking behavior, +- feature coverage such as pthread-enabled builds, include-path handling, and + whole-archive linking, +- language and C++ standard-version support. \ No newline at end of file diff --git a/examples/README.md b/examples/README.md index 7539464..4b9feac 100644 --- a/examples/README.md +++ b/examples/README.md @@ -19,18 +19,20 @@ For comprehensive test documentation, including: Run all tests: ```bash -bazel test --config host_config_1 //tests/... +bazel test --config x86_64-linux //... ``` Run specific test suites: ```bash # Feature verification tests -bazel test --config host_config_1 //tests/feature_verification:feature_verification_tests +bazel test --config x86_64-linux //:feature_verification_tests # Language and standards tests -bazel test --config host_config_1 //tests/language_and_standards:language_and_standards_tests +bazel test --config x86_64-linux //:language_and_standards_tests ``` +> NOTE: Run these commands from the `tests/` directory (it is a separate Bazel workspace). + ## Configuration The toolchain configurations are defined in: diff --git a/tests/README.md b/tests/README.md index b5d4708..c3e199d 100644 --- a/tests/README.md +++ b/tests/README.md @@ -10,15 +10,22 @@ This directory contains comprehensive test suites for validating SCORE Bazel C++ ```bash # All tests -bazel test --config host_config_1 //tests/... +bazel test --config x86_64-linux //... # Feature verification tests -bazel test --config host_config_1 //tests/feature_verification:feature_verification_tests +bazel test --config x86_64-linux //:feature_verification_tests # Language and standards tests -bazel test --config host_config_1 //tests/language_and_standards:language_and_standards_tests +bazel test --config x86_64-linux //:language_and_standards_tests ``` +> NOTE: `bazel test` executes the compiled binaries, so it is only valid when +> the execution machine matches the target platform. The `x86_64-linux` config +> runs on an x86_64 Linux host. For other configs (e.g. `x86_64-qnx`, +> `aarch64-qnx`, `aarch64-linux`), build on the host with `bazel build` and run +> the tests on the matching target platform. See +> [docs/test_suite.md](../docs/test_suite.md) for details. + ### Test Directories - **`feature_verification/`** - Toolchain feature validation tests diff --git a/tests/feature_verification/BUILD b/tests/feature_verification/BUILD index b70d9f2..b52d2ba 100644 --- a/tests/feature_verification/BUILD +++ b/tests/feature_verification/BUILD @@ -17,9 +17,11 @@ These tests verify that specific toolchain features are correctly implemented and functioning. Each test targets a particular feature or group of features from the C++ toolchain configuration. -Tests are marked 'manual' for cross-compilation targets (QNX) to prevent -execution attempts on incompatible architectures. For native Linux builds, -tests can execute on the host machine. +Tests are executed by running `bazel test` on the matching target platform. +When the host equals the target (for example the x86_64-linux config on an +x86_64 Linux host) the tests build and run directly on the host. For other +target platforms (such as QNX), build the tests on the host to verify +compilation and linking, then execute them on the corresponding target. """ load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") diff --git a/tests/feature_verification/README.md b/tests/feature_verification/README.md index 0cb0515..4de10a5 100644 --- a/tests/feature_verification/README.md +++ b/tests/feature_verification/README.md @@ -8,13 +8,13 @@ This directory contains tests for verifying that specific C++ toolchain features ```bash # Run all feature tests -bazel test --config host_config_1 //tests/feature_verification:feature_verification_tests +bazel test --config x86_64-linux //:feature_verification_tests # Run individual test -bazel test --config host_config_1 //tests/feature_verification:defines_test +bazel test --config x86_64-linux //feature_verification:defines_test # Build for cross-compilation (no execution) -bazel build --config target_config_1 //tests/feature_verification:defines_test +bazel build --config aarch64-qnx //feature_verification:defines_test ``` ## See Also diff --git a/tests/language_and_standards/BUILD b/tests/language_and_standards/BUILD index c62b7fe..0cc4b59 100644 --- a/tests/language_and_standards/BUILD +++ b/tests/language_and_standards/BUILD @@ -18,7 +18,9 @@ These tests verify that the toolchain correctly supports: - C++11, C++14, C++17, and C++20 language features - Correct compilation flags for each standard version -All tests can execute on the host machine (Linux x86_64). +Tests are executed by running `bazel test` on the matching target platform. +When the host equals the target (e.g. the x86_64-linux config on an x86_64 +Linux host) they build and run directly on the host. """ load("@rules_cc//cc:defs.bzl", "cc_test") @@ -33,6 +35,7 @@ load("@rules_cc//cc:defs.bzl", "cc_test") cc_test( name = "c_lang_test", srcs = ["c_lang_test.c"], + copts = ["-std=c99"], ) # ============================================================================ diff --git a/tests/language_and_standards/README.md b/tests/language_and_standards/README.md index 9a4cdd5..cf1a44d 100644 --- a/tests/language_and_standards/README.md +++ b/tests/language_and_standards/README.md @@ -8,13 +8,13 @@ This directory contains tests for verifying that the toolchain correctly support ```bash # Run all language tests -bazel test --config host_config_1 //tests/language_and_standards:language_and_standards_tests +bazel test --config=x86_64-linux //:language_and_standards_tests # Run individual test -bazel test --config host_config_1 //tests/language_and_standards:cpp20_test +bazel test --config=x86_64-linux //language_and_standards:cpp20_test # Run with verbose output -bazel test --config host_config_1 --test_output=all //tests/language_and_standards:cpp20_test +bazel test --config=x86_64-linux --test_output=all //language_and_standards:cpp20_test ``` ## See Also