Skip to content

Commit 235d6d6

Browse files
author
Anton Ivanov
committed
Remove flags from cppflags of libgui_test.
Also fix tests that depend on them. Rationale: libgui_test currently suffers from ODR violations due to a) including statically built sources of libgui via the defaults, and b) loading libgui at runtime via transitive shared library dependency. The flags set via cppflags affect only a), and this blocks fixing the ODR violation, which would be done by removing a) and standardizing on b). Since flags can be in different stagges of rollout, tests need to be resilient to encountering either value of the flags. Flag: EXEMPT refactor Test: presubmit Bug: 399711310 Change-Id: I3780eae83facf272f885dc0187c64c13d58e4cdf
1 parent 0c638dc commit 235d6d6

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

libs/gui/tests/Android.bp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ cc_test {
5151
"-Werror",
5252
"-Wextra",
5353
"-Wthread-safety",
54-
"-DCOM_ANDROID_GRAPHICS_LIBGUI_FLAGS_BQ_SETFRAMERATE=true",
55-
"-DCOM_ANDROID_GRAPHICS_LIBGUI_FLAGS_BQ_EXTENDEDALLOCATE=true",
56-
"-DCOM_ANDROID_GRAPHICS_LIBGUI_FLAGS_WB_CONSUMER_BASE_OWNS_BQ=true",
57-
"-DCOM_ANDROID_GRAPHICS_LIBGUI_FLAGS_WB_PLATFORM_API_IMPROVEMENTS=true",
58-
"-DCOM_ANDROID_GRAPHICS_LIBGUI_FLAGS_WB_UNLIMITED_SLOTS=true",
5954
],
6055

6156
srcs: [

libs/gui/tests/BufferQueue_test.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,10 +1452,6 @@ TEST_F(BufferQueueTest, TestProducerConnectDisconnect) {
14521452
ASSERT_EQ(NO_INIT, mProducer->disconnect(NATIVE_WINDOW_API_CPU));
14531453
}
14541454

1455-
TEST_F(BufferQueueTest, TestBqSetFrameRateFlagBuildTimeIsSet) {
1456-
ASSERT_EQ(flags::bq_setframerate(), COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BQ_SETFRAMERATE));
1457-
}
1458-
14591455
struct BufferItemConsumerSetFrameRateListener : public BufferItemConsumer {
14601456
BufferItemConsumerSetFrameRateListener() : BufferItemConsumer(GRALLOC_USAGE_SW_READ_OFTEN, 1) {}
14611457

@@ -1561,9 +1557,14 @@ TEST_F(BufferQueueTest, TestAdditionalOptions) {
15611557
{.name = "android.hardware.graphics.common.Dataspace", ADATASPACE_DISPLAY_P3},
15621558
}};
15631559

1564-
ASSERT_EQ(NO_INIT,
1565-
native_window_set_buffers_additional_options(surface.get(), extras.data(),
1566-
extras.size()));
1560+
auto status = native_window_set_buffers_additional_options(surface.get(), extras.data(),
1561+
extras.size());
1562+
if (flags::bq_extendedallocate()) {
1563+
ASSERT_EQ(NO_INIT, status);
1564+
} else {
1565+
ASSERT_EQ(INVALID_OPERATION, status);
1566+
GTEST_SKIP() << "Flag bq_extendedallocate not enabled";
1567+
}
15671568

15681569
if (!IsCuttlefish()) {
15691570
GTEST_SKIP() << "Not cuttlefish";

0 commit comments

Comments
 (0)