Skip to content

Commit de9d906

Browse files
andy31415andreilitvinbzbarsky-apple
authored
Replace usage of CONFIG_BUILD_FOR_HOST_UNIT_TEST for IM/DM validation checker (#35319)
* The flag of CONFIG_BUILD_FOR_HOST_UNIT_TEST is not actually tied to unit testing. Implement a separate flag to control if we crash on errors for IM/DM checks or not. * Update src/app/common_flags.gni Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * make the flag name singular --------- Co-authored-by: Andrei Litvin <andreilitvin@google.com> Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
1 parent a79c1a8 commit de9d906

File tree

6 files changed

+19
-13
lines changed

6 files changed

+19
-13
lines changed

.github/workflows/build.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
with:
7676
languages: "cpp"
7777
- name: Setup Build
78-
run: scripts/build/gn_gen.sh --args="chip_config_memory_debug_checks=true chip_config_memory_debug_dmalloc=false"
78+
run: scripts/build/gn_gen.sh --args="chip_config_memory_debug_checks=true chip_config_memory_debug_dmalloc=false chip_data_model_check_die_on_failure=true"
7979
- name: Run Build
8080
run: scripts/run_in_build_env.sh "ninja -C ./out"
8181
- name: Run Tests
@@ -179,7 +179,7 @@ jobs:
179179
scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE"
180180
- name: Setup Build, Run Build and Run Tests
181181
run: |
182-
BUILD_TYPE=gcc_release scripts/build/gn_gen.sh --args="is_debug=false"
182+
BUILD_TYPE=gcc_release scripts/build/gn_gen.sh --args="is_debug=false chip_data_model_check_die_on_failure=true"
183183
scripts/run_in_build_env.sh "ninja -C ./out/gcc_release"
184184
BUILD_TYPE=gcc_release scripts/tests/gn_tests.sh
185185
- name: Clean output
@@ -197,7 +197,7 @@ jobs:
197197
esac
198198
199199
rm -rf ./out/sanitizers
200-
BUILD_TYPE=sanitizers scripts/build/gn_gen.sh --args="$GN_ARGS" --export-compile-commands
200+
BUILD_TYPE=sanitizers scripts/build/gn_gen.sh --args="$GN_ARGS chip_data_model_check_die_on_failure=true" --export-compile-commands
201201
BUILD_TYPE=sanitizers scripts/tests/gn_tests.sh
202202
done
203203
- name: Ensure codegen is done for sanitize
@@ -308,7 +308,7 @@ jobs:
308308

309309
- name: Setup Build, Run Build and Run Tests
310310
run: |
311-
scripts/build/gn_gen.sh --args="enable_rtti=true chip_config_memory_debug_checks=false chip_config_memory_debug_dmalloc=false chip_generate_link_map_file=false"
311+
scripts/build/gn_gen.sh --args="enable_rtti=true chip_config_memory_debug_checks=false chip_config_memory_debug_dmalloc=false chip_generate_link_map_file=false chip_data_model_check_die_on_failure=true"
312312
scripts/run_in_build_env.sh "ninja -C ./out"
313313
scripts/tests/gn_tests.sh
314314
- name: Setup test python environment
@@ -415,7 +415,7 @@ jobs:
415415
# clang.
416416
"default") GN_ARGS='target_os="all" is_asan=true enable_host_clang_build=false';;
417417
esac
418-
BUILD_TYPE=$BUILD_TYPE scripts/build/gn_gen.sh --args="$GN_ARGS" --export-compile-commands
418+
BUILD_TYPE=$BUILD_TYPE scripts/build/gn_gen.sh --args="$GN_ARGS chip_data_model_check_die_on_failure=true" --export-compile-commands
419419
scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE"
420420
BUILD_TYPE=$BUILD_TYPE scripts/tests/gn_tests.sh
421421
done

.github/workflows/unit_integration_test.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
*) ;;
7474
esac
7575
76-
scripts/build/gn_gen.sh --args="$GN_ARGS"
76+
scripts/build/gn_gen.sh --args="$GN_ARGS chip_data_model_check_die_on_failure=true"
7777
- name: Run Build
7878
run: scripts/run_in_build_env.sh "ninja -C out/$BUILD_TYPE"
7979
- name: Run Tests

scripts/build/builders/host.py

+1
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE,
413413

414414
if app == HostApp.TESTS:
415415
self.extra_gn_options.append('chip_build_tests=true')
416+
self.extra_gn_options.append('chip_data_model_check_die_on_failure=true')
416417
self.build_command = 'check'
417418

418419
if app == HostApp.EFR32_TEST_RUNNER:

src/app/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ buildconfig_header("app_buildconfig") {
7878
"NON_SPEC_COMPLIANT_OTA_ACTION_DELAY_FLOOR=${non_spec_compliant_ota_action_delay_floor}",
7979
"CHIP_DEVICE_CONFIG_DYNAMIC_SERVER=${chip_build_controller_dynamic_server}",
8080
"CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP=${chip_enable_busy_handling_for_operational_session_setup}",
81+
"CHIP_CONFIG_DATA_MODEL_CHECK_DIE_ON_FAILURE=${chip_data_model_check_die_on_failure}",
8182
]
8283

8384
if (chip_use_data_model_interface == "disabled") {

src/app/common_flags.gni

+7-3
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,14 @@ declare_args() {
2727
# - check: runs BOTH datamodel and non-data-model (if possible) functionality and compares results
2828
# - enabled: runs only the data model interface (does not use the legacy code)
2929
if (current_os == "linux") {
30-
# "check" is broken, see https://github.com/project-chip/connectedhomeip/issues/35306
31-
#chip_use_data_model_interface = "check"
32-
chip_use_data_model_interface = "disabled"
30+
chip_use_data_model_interface = "check"
3331
} else {
3432
chip_use_data_model_interface = "disabled"
3533
}
34+
35+
# Whether we call `chipDie` on DM `check` errors
36+
#
37+
# If/once the chip_use_data_model_interface flag is removed or does not support
38+
# a `check` option, this should alwo be removed
39+
chip_data_model_check_die_on_failure = false
3640
}

src/app/reporting/Read-Checked.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ ActionReturnStatus RetrieveClusterData(DataModel::Provider * dataModel, const Ac
9696
// Make unit tests strict; otherwise allow it with potentially odd mismatch errors
9797
// (in which case logs will be odd, however we also expect Checked versions to only
9898
// run for a short period until we switch over to either ember or DM completely).
99-
#if CONFIG_BUILD_FOR_HOST_UNIT_TEST
99+
#if CHIP_CONFIG_DATA_MODEL_CHECK_DIE_ON_FAILURE
100100
chipDie();
101101
#endif
102102
}
@@ -119,7 +119,7 @@ ActionReturnStatus RetrieveClusterData(DataModel::Provider * dataModel, const Ac
119119
{
120120
ChipLogError(Test, "Different written length: %" PRIu32 " (Ember) vs %" PRIu32 " (DataModel)", lengthWrittenEmber,
121121
reportBuilder.GetWriter()->GetLengthWritten());
122-
#if CONFIG_BUILD_FOR_HOST_UNIT_TEST
122+
#if CHIP_CONFIG_DATA_MODEL_CHECK_DIE_ON_FAILURE
123123
chipDie();
124124
#endif
125125
}
@@ -138,7 +138,7 @@ ActionReturnStatus RetrieveClusterData(DataModel::Provider * dataModel, const Ac
138138
ChipLogError(Test, "Different partial data");
139139
// NOTE: die on unit tests only, since partial data size may differ across
140140
// time-dependent data (very rarely because fast code, but still possible)
141-
#if CONFIG_BUILD_FOR_HOST_UNIT_TEST
141+
#if CHIP_CONFIG_DATA_MODEL_CHECK_DIE_ON_FAILURE
142142
chipDie();
143143
#endif
144144
}
@@ -147,7 +147,7 @@ ActionReturnStatus RetrieveClusterData(DataModel::Provider * dataModel, const Ac
147147
ChipLogError(Test, "Different partial data");
148148
// NOTE: die on unit tests only, since partial data size may differ across
149149
// time-dependent data (very rarely because fast code, but still possible)
150-
#if CONFIG_BUILD_FOR_HOST_UNIT_TEST
150+
#if CHIP_CONFIG_DATA_MODEL_CHECK_DIE_ON_FAILURE
151151
chipDie();
152152
#endif
153153
}

0 commit comments

Comments
 (0)