diff options
author | 2024-03-19 12:43:23 +0000 | |
---|---|---|
committer | 2024-03-19 16:44:00 +0000 | |
commit | ac963e67c103ede832fc4ef6456a3e286110ed31 (patch) | |
tree | dde63b742fdcf4f5b97ad0d33c755de336d318aa /compiler/utils/assembler_test_base.h | |
parent | 799ea81c066e910da7efb1ad06bc7d2dbc966726 (diff) |
Make assembler tests more strict.
If the assembled code differs, fail even if the disassembly
and code size are the same, except for x86 and x86-64.
Test: m test-art-host-gtest
Bug: 328561342
Change-Id: I80c10088edd7f0a83dfa30e1d388b831e77c8d6e
Diffstat (limited to 'compiler/utils/assembler_test_base.h')
-rw-r--r-- | compiler/utils/assembler_test_base.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/utils/assembler_test_base.h b/compiler/utils/assembler_test_base.h index c5345130b3..d41928af9e 100644 --- a/compiler/utils/assembler_test_base.h +++ b/compiler/utils/assembler_test_base.h @@ -121,11 +121,14 @@ class AssemblerTestBase : public testing::Test { // ART produced different (but valid) code than the reference assembler, report it. if (art_code.size() > ref_code.size()) { - EXPECT_TRUE(false) << "ART code is larger then the reference code, but the disassembly" + ADD_FAILURE() << "ART code is larger then the reference code, but the disassembly" "of machine code is equal: this means that ART is generating sub-optimal encoding! " "ART code size=" << art_code.size() << ", reference code size=" << ref_code.size(); } else if (art_code.size() < ref_code.size()) { - EXPECT_TRUE(false) << "ART code is smaller than the reference code. Too good to be true?"; + ADD_FAILURE() << "ART code is smaller than the reference code. Too good to be true?"; + } else if (require_same_encoding_) { + ADD_FAILURE() << "Reference assembler chose a different encoding than ART (of the same size)" + " but the test is set up to require the same encoding"; } else { LOG(INFO) << "Reference assembler chose a different encoding than ART (of the same size)"; } @@ -282,6 +285,7 @@ class AssemblerTestBase : public testing::Test { std::optional<ScratchDir> scratch_dir_; std::string android_data_; + bool require_same_encoding_ = true; DISALLOW_COPY_AND_ASSIGN(AssemblerTestBase); }; |