Skip to content

Commit 8c4cc4d

Browse files
luisleo526HaoLiangWen
andauthored
tests: skip the lower-feed timing ratio only under AddressSanitizer (CR-147) (#406)
Sanitizers 928/929 flaked on a loaded VM with ratio 6.96 vs bound 6.0. Release and debug builds continue to enforce the ratio < kShapeBound bound. Co-authored-by: HaoLiangWen <[email protected]>
1 parent 3fc010a commit 8c4cc4d

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎tests/test_native_intrabar_lower_lookup.cpp‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,17 @@ constexpr int kBars = 4000;
253253
constexpr int kMaxRepeats = 1024;
254254
constexpr double kMinLegSeconds = 0.1;
255255
constexpr double kShapeBound = 6.0;
256+
#if defined(__SANITIZE_ADDRESS__)
257+
constexpr bool kUnderAsan = true;
258+
#elif defined(__has_feature)
259+
#if __has_feature(address_sanitizer)
260+
constexpr bool kUnderAsan = true;
261+
#else
262+
constexpr bool kUnderAsan = false;
263+
#endif
264+
#else
265+
constexpr bool kUnderAsan = false;
266+
#endif
256267

257268
int calibrated_repeats() {
258269
return ratio_timing::presized(1, kMaxRepeats, kMinLegSeconds,
@@ -275,7 +286,11 @@ void the_lower_feed_lookup_is_linear_in_the_run() {
275286
CHECK(small > 0.0);
276287
CHECK(small >= kMinLegSeconds);
277288
CHECK(large >= kMinLegSeconds);
278-
CHECK(ratio < kShapeBound);
289+
if (kUnderAsan) {
290+
std::printf("lower-feed shape bound skipped under AddressSanitizer (timing is not representative)\n");
291+
} else {
292+
CHECK(ratio < kShapeBound);
293+
}
279294
}
280295

281296
struct Observed {

0 commit comments

Comments
 (0)