Skip to content

Commit 27229bc

Browse files
kongchen1992meta-codesync[bot]
authored andcommitted
{BugFix} Core - Fix NaN comparison failures in data provider test helpers
Summary: Explanation: Test helper compare functions did not handle NaN and uninitialized values correctly, causing deterministic and flaky test failures in VrsDataProvider.multiThreadGetDataByIndex and VrsDataProvider.getDataByIndex. Two issues fixed: 1. Internal CompareDataHelper: EXPECT_EQ(NaN, NaN) always fails per IEEE 754. AriaGen1 test VRS data has NaN in image temperature_deg_c field (sensor unavailable). Replaced with NaN-safe comparison. 2. OSS CompareDataHelper: EyeGaze spatial_gaze_point_in_cpf and combined_gaze_origin_in_cpf are Eigen::Vector3f with no default initialization. When VRS validity flags are false, the vectors contain uninitialized memory. Moved isApprox checks behind validity flag guards. Reproducibility: Both single-threaded (getDataByIndex) and multi-threaded (multiThreadGetDataByIndex) tests now pass on all three test sequences (AriaGen1, AriaGen2, AriaGen2PFrame). ___ overriding_review_checks_triggers_an_audit_and_retroactive_review Oncall Short Name: nebula_functionality_sutdy landed-with-radar-review Differential Revision: D104139932 fbshipit-source-id: 19d34893185586189efb09e66946220791fdf349
1 parent 77973a1 commit 27229bc

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

core/data_provider/test/CompareDataHelper.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,12 +433,16 @@ inline void compare(
433433
EXPECT_NEAR(eyeGaze1.pitch_low, eyeGaze2.pitch_low, tolerance);
434434
EXPECT_NEAR(eyeGaze1.pitch_high, eyeGaze2.pitch_high, tolerance);
435435

436-
EXPECT_TRUE(
437-
eyeGaze1.spatial_gaze_point_in_cpf.isApprox(eyeGaze2.spatial_gaze_point_in_cpf, tolerance));
438-
EXPECT_TRUE(eyeGaze1.combined_gaze_origin_in_cpf.isApprox(
439-
eyeGaze2.combined_gaze_origin_in_cpf, tolerance));
440436
EXPECT_EQ(eyeGaze1.spatial_gaze_point_valid, eyeGaze2.spatial_gaze_point_valid);
437+
if (eyeGaze1.spatial_gaze_point_valid && eyeGaze2.spatial_gaze_point_valid) {
438+
EXPECT_TRUE(
439+
eyeGaze1.spatial_gaze_point_in_cpf.isApprox(eyeGaze2.spatial_gaze_point_in_cpf, tolerance));
440+
}
441441
EXPECT_EQ(eyeGaze1.combined_gaze_valid, eyeGaze2.combined_gaze_valid);
442+
if (eyeGaze1.combined_gaze_valid && eyeGaze2.combined_gaze_valid) {
443+
EXPECT_TRUE(eyeGaze1.combined_gaze_origin_in_cpf.isApprox(
444+
eyeGaze2.combined_gaze_origin_in_cpf, tolerance));
445+
}
442446

443447
// Compare left and right eyes
444448
const auto& vergence1 = eyeGaze1.vergence;

0 commit comments

Comments
 (0)