Skip to content

Commit 74682dc

Browse files
ssj933meta-codesync[bot]
authored andcommitted
fix dex037-resolver-kotlin-test failure when kotlinc behavior is non-deterministic
Reviewed By: litiangong Differential Revision: D89422040 fbshipit-source-id: b844af797be6f84ab36157b61369a57127593cf0
1 parent 5e20d30 commit 74682dc

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

test/integ/Dex037KotlinTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ TEST_F(Dex037KotlinTest, TestResolveMethodInvokeInterfaceOnConcreteClass) {
233233
}
234234

235235
TEST_F(Dex037KotlinTest, TestResolveMethodInvokeInterfaceOnReferences) {
236-
verify_TestResolveMethodInvokeInterfaceOnReferences();
236+
verify_TestResolveMethodInvokeInterfaceOnReferences(true /*is_kotlin=*/);
237237
}
238238

239239
TEST_F(Dex037KotlinTest, TestResolveMethodLayeredInvokeMultipleInterfaces1) {

test/integ/Dex037TestHelper.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2198,7 +2198,8 @@ class Dex037Test : public ::testing::Test {
21982198
}
21992199
}
22002200

2201-
void verify_TestResolveMethodInvokeInterfaceOnReferences() {
2201+
void verify_TestResolveMethodInvokeInterfaceOnReferences(
2202+
bool is_kotlin = false) {
22022203
auto* dex037_cls = find_class("Lcom/facebook/redextest/Dex037;");
22032204
ASSERT_NE(nullptr, dex037_cls);
22042205

@@ -2222,6 +2223,13 @@ class Dex037Test : public ::testing::Test {
22222223
EXPECT_EQ(callee_ref->get_class(), igreeter_cls->get_type());
22232224
ASSERT_NE(nullptr, resolved);
22242225
EXPECT_EQ(resolved->get_class(), igreeter_cls->get_type());
2226+
if (is_kotlin) {
2227+
// If kotlinc would generate invoke-interface IGreeter.greet or
2228+
// invoke-virtual CustomGreeter/ComplexGreeter.greet for second and
2229+
// third invoke site seems to be random-ish... So break after first
2230+
// check.
2231+
break;
2232+
}
22252233
}
22262234
}
22272235
}

0 commit comments

Comments
 (0)