Files
OrcaSlicer/scripts/run_unit_tests.sh
Kris Austin 781ecdc2c1 ci: run unit tests on Windows and macOS (#14443)
* ci: run unit tests on Windows and macOS

The Unit Tests CI job only ran on Linux, so platform-specific bugs
invisible to a Linux build could land undetected (e.g. the MSVC-only
NfpPlacer crash fixed in #14267). The full non-[NotWorking] suite already
builds and passes on every shipped arch, so this wires them into CI.

A reusable unit_tests.yml, called once per built arch, downloads that
arch's test artifact and runs ctest. Each build leg builds the test
executables and uploads them; a single publish_test_results job on Linux
aggregates the JUnit results into one check.

Coverage: Linux x86_64 + aarch64, Windows x64 + arm64, macOS arm64.
macOS x86_64 is deferred (cross-built on arm64, needs Rosetta).

- build_release_vs.bat: "tests" token enables BUILD_TESTS
- build_release_macos.sh: -T builds and runs tests; ORCA_TESTS_BUILD_ONLY
  builds them without running (used by CI)
- scripts/run_unit_tests.sh: parameterized test dir and build config

Addresses #11273.

* ci: bump actions/checkout to v7 in reusable unit_tests workflow

Match the actions/checkout v6->v7 bump (#14517) that upstream applied to
the inline test job this reusable workflow replaces.
2026-07-08 22:00:35 +08:00

25 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# This file is made to support the unit tests workflow.
# It should only require the directories build/tests, scripts/, and tests/ to function,
# and cmake (with ctest) installed.
# (otherwise, update the workflow too, but try to avoid to keep things self-contained)
#
# Usage: run_unit_tests.sh [TEST_DIR] [BUILD_CONFIG]
# TEST_DIR directory containing the built tests (default: build/tests)
# BUILD_CONFIG configuration to run; required for multi-config generators
# (Windows/macOS), harmless/omitted for single-config (Linux).
ROOT_DIR="$(dirname "$0")/.."
cd "${ROOT_DIR}" || exit 1
TEST_DIR="${1:-build/tests}"
BUILD_CONFIG="${2:-}"
# Run the whole suite, excluding tests tagged [NotWorking].
# --no-tests=error fails the job if the filter matches nothing (instead of passing green).
args=(--test-dir "${TEST_DIR}" -LE "NotWorking" --no-tests=error --output-junit "$(pwd)/ctest_results.xml" --output-on-failure -j)
[ -n "${BUILD_CONFIG}" ] && args+=(--build-config "${BUILD_CONFIG}")
ctest "${args[@]}"