From 4e7acedf15758284aa42a39b1d680aa2bd29f307 Mon Sep 17 00:00:00 2001 From: Tyler Wear Date: Tue, 19 Apr 2022 17:50:04 -0700 Subject: [PATCH] ConnectivityNativeBinderTest: Check Kernel Version Check kernel version in patch before running test case to make sure that 5.4 kernel is used which is what the bpf prog uses. Bug: 229692536 Test: atest ConnectivityNativeBinderTest Change-Id: I3bf8d3ce6c6a64236da2e4f039fb13a98231fae0 --- tests/native/connectivity_native_test.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/native/connectivity_native_test.cpp b/tests/native/connectivity_native_test.cpp index 8b089ab581..3db5265f85 100644 --- a/tests/native/connectivity_native_test.cpp +++ b/tests/native/connectivity_native_test.cpp @@ -14,14 +14,15 @@ * limitations under the License. */ +#include +#include +#include #include #include // FIRST_APPLICATION_UID #include #include -#include -#include -#include +#include "bpf/BpfUtils.h" using aidl::android::net::connectivity::aidl::IConnectivityNative; @@ -40,6 +41,10 @@ class ConnectivityNativeBinderTest : public ::testing::Test { if (!android::modules::sdklevel::IsAtLeastT()) GTEST_SKIP() << "Should be at least T device."; + // Skip test case if not on 5.4 kernel which is required by bpf prog. + if (!android::bpf::isAtLeastKernelVersion(5, 4, 0)) GTEST_SKIP() << + "Kernel should be at least 5.4."; + ASSERT_NE(nullptr, mService.get()); // If there are already ports being blocked on device unblockAllPortsForBind() store