diff options
author | 2022-09-28 17:04:42 -0700 | |
---|---|---|
committer | 2022-10-12 14:59:42 -0700 | |
commit | 5e83dfec4aad9a3ce47eb4820f1ebde50ddcfd3c (patch) | |
tree | 0ff834069623bdd4630454809ae0884c1b71c91f | |
parent | b05ee3a0ddf4d5ad0bd6133d972c85e996624d24 (diff) |
Run libinput_tests on host
These tests are testing the libinput library, so they should run OK on
host.
Compile and run these on host in this CL.
Some tests have been skipped because the corresponding code hardcoded
Android-specific paths. Those can be improved in the future.
Due to the complexity of getting Android device's kernel configs on
host, those tests have been skipped, as well.
Bug: 249591924
Bug: 237835584
Test: atest --no-bazel-mode --host libinput_tests
Change-Id: I110f3ad80823b40b0ec7980c3f1d59e653b4fd8b
-rw-r--r-- | libs/input/Android.bp | 1 | ||||
-rw-r--r-- | libs/input/tests/Android.bp | 7 | ||||
-rw-r--r-- | libs/input/tests/InputDevice_test.cpp | 9 |
3 files changed, 14 insertions, 3 deletions
diff --git a/libs/input/Android.bp b/libs/input/Android.bp index 29e02cf73a..34ef7b4946 100644 --- a/libs/input/Android.bp +++ b/libs/input/Android.bp @@ -89,7 +89,6 @@ cc_library { shared_libs: [ "libutils", "libbinder", - "libui", ], static_libs: [ diff --git a/libs/input/tests/Android.bp b/libs/input/tests/Android.bp index c53811a92d..5aae37dae8 100644 --- a/libs/input/tests/Android.bp +++ b/libs/input/tests/Android.bp @@ -10,6 +10,7 @@ package { cc_test { name: "libinput_tests", + host_supported: true, srcs: [ "IdGenerator_test.cpp", "InputChannel_test.cpp", @@ -24,6 +25,7 @@ cc_test { static_libs: [ "libgui_window_info_static", "libinput", + "libui-types", ], cflags: [ "-Wall", @@ -35,11 +37,13 @@ cc_test { "libbinder", "libcutils", "liblog", - "libui", "libutils", "libvintf", ], data: ["data/*"], + test_options: { + unit_test: true, + }, test_suites: ["device-tests"], } @@ -60,7 +64,6 @@ cc_library_static { "libcutils", "libutils", "libbinder", - "libui", "libbase", ], } diff --git a/libs/input/tests/InputDevice_test.cpp b/libs/input/tests/InputDevice_test.cpp index e872fa442b..2344463241 100644 --- a/libs/input/tests/InputDevice_test.cpp +++ b/libs/input/tests/InputDevice_test.cpp @@ -65,6 +65,9 @@ protected: } void SetUp() override { +#if !defined(__ANDROID__) + GTEST_SKIP() << "b/253299089 Generic files are currently read directly from device."; +#endif loadKeyLayout("Generic"); loadKeyCharacterMap("Generic"); } @@ -131,6 +134,9 @@ TEST_F(InputDeviceKeyMapTest, keyCharacteMapApplyMultipleOverlaysTest) { } TEST(InputDeviceKeyLayoutTest, DoesNotLoadWhenRequiredKernelConfigIsMissing) { +#if !defined(__ANDROID__) + GTEST_SKIP() << "Can't check kernel configs on host"; +#endif std::string klPath = base::GetExecutableDirectory() + "/data/kl_with_required_fake_config.kl"; base::Result<std::shared_ptr<KeyLayoutMap>> ret = KeyLayoutMap::load(klPath); ASSERT_FALSE(ret.ok()) << "Should not be able to load KeyLayout at " << klPath; @@ -139,6 +145,9 @@ TEST(InputDeviceKeyLayoutTest, DoesNotLoadWhenRequiredKernelConfigIsMissing) { } TEST(InputDeviceKeyLayoutTest, LoadsWhenRequiredKernelConfigIsPresent) { +#if !defined(__ANDROID__) + GTEST_SKIP() << "Can't check kernel configs on host"; +#endif std::string klPath = base::GetExecutableDirectory() + "/data/kl_with_required_real_config.kl"; base::Result<std::shared_ptr<KeyLayoutMap>> ret = KeyLayoutMap::load(klPath); ASSERT_TRUE(ret.ok()) << "Cannot load KeyLayout at " << klPath; |