mirror of
https://github.com/esphome/esphome.git
synced 2026-05-18 01:32:27 +08:00
[core] cpp tests: Allow customizing code generation during tests (#14681)
Co-authored-by: J. Nick Koston <nick@home-assistant.io> Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
from helpers import get_all_components, root_path
|
||||
from test_helpers import (
|
||||
BASE_CODEGEN_COMPONENTS,
|
||||
from build_helpers import (
|
||||
PLATFORMIO_GOOGLE_TEST_LIB,
|
||||
USE_TIME_TIMEZONE_FLAG,
|
||||
build_and_run,
|
||||
load_test_manifest_overrides,
|
||||
)
|
||||
from helpers import get_all_components, root_path
|
||||
|
||||
# Path to /tests/components
|
||||
COMPONENTS_TESTS_DIR: Path = Path(root_path) / "tests" / "components"
|
||||
@@ -21,7 +21,6 @@ PLATFORMIO_OPTIONS = {
|
||||
],
|
||||
"build_flags": [
|
||||
"-Og", # optimize for debug
|
||||
USE_TIME_TIMEZONE_FLAG,
|
||||
"-DESPHOME_DEBUG", # enable debug assertions
|
||||
# Enable the address and undefined behavior sanitizers
|
||||
"-fsanitize=address",
|
||||
@@ -39,7 +38,9 @@ def run_tests(selected_components: list[str]) -> int:
|
||||
return build_and_run(
|
||||
selected_components=selected_components,
|
||||
tests_dir=COMPONENTS_TESTS_DIR,
|
||||
codegen_components=BASE_CODEGEN_COMPONENTS,
|
||||
manifest_override_loader=partial(
|
||||
load_test_manifest_overrides, tests_dir=COMPONENTS_TESTS_DIR
|
||||
),
|
||||
config_prefix="cpptests",
|
||||
friendly_name="CPP Unit Tests",
|
||||
libraries=PLATFORMIO_GOOGLE_TEST_LIB,
|
||||
|
||||
Reference in New Issue
Block a user