adjust BpfCompatTest now that clatd & netd bpf program have been mainlined

The purpose of this test is to verify that the bpfloader related
stuff in the platform is compatible with mainline module bpf .o's.

To be more precise: the test is trying to check that platform/OEM
BPF programs (and, by implication, the platform/OEM bpfloader) have
a struct layout that is known, and thus that BPF programs shipped
in mainline modules will be compatible (with the OEM bpfloader).

(ie. basically this is trying to make sure that the vendor/oem
haven't made incompatible changes to the bpfloader parsed structs,
these can only be extended safely in aosp master)

Since clatd/netd.o have been moved to mainline they are no longer
a useful representation of the state of the platform side of things.
(we'd simply be testing that mainline is compatible with mainline,
which of course it is...)

As such we pick two other bpf .o files that are still shipped
as part of the platform.

Verified on cuttlefish via 'atest CtsNativeNetTestCases':
  x86 CtsNativeNetTestCases
  -------------------------
  CtsNativeNetTestCases (2 Test(s))
  [1/2] BpfTest#bpfStructSizeTestPreT: IGNORED (0ms)
  [2/2] BpfTest#bpfStructSizeTest: PASSED (0ms)

  Summary (Test executed with 1 device(s).)
  -------
  x86 CtsNativeNetTestCases: Passed: 1, Failed: 0, Ignored: 1, Assumption Failed: 0,

  All tests passed!

Note: it's not clear to me if this code can even ever be run on pre-T devices...
but I guess it shouldn't hurt.

Bug: 215718693
Test: atest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1b2d76e5ef95d8e4b94068f5525263653879d1f4
diff --git a/tests/cts/net/native/Android.bp b/tests/cts/net/native/Android.bp
index 1d1c18e..153ff51 100644
--- a/tests/cts/net/native/Android.bp
+++ b/tests/cts/net/native/Android.bp
@@ -43,6 +43,7 @@
     static_libs: [
         "libbpf_android",
         "libgtest",
+        "libmodules-utils-build",
     ],
 
     // Tag this module as a cts test artifact
diff --git a/tests/cts/net/native/src/BpfCompatTest.cpp b/tests/cts/net/native/src/BpfCompatTest.cpp
index 874bad4..97ecb9e 100644
--- a/tests/cts/net/native/src/BpfCompatTest.cpp
+++ b/tests/cts/net/native/src/BpfCompatTest.cpp
@@ -21,6 +21,8 @@
 
 #include <gtest/gtest.h>
 
+#include "android-modules-utils/sdk_level.h"
+
 #include "libbpf_android.h"
 
 using namespace android::bpf;
@@ -33,11 +35,17 @@
   EXPECT_EQ(28, readSectionUint("size_of_bpf_prog_def", elfFile, 0));
 }
 
-TEST(BpfTest, bpfStructSizeTest) {
+TEST(BpfTest, bpfStructSizeTestPreT) {
+  if (android::modules::sdklevel::IsAtLeastT()) GTEST_SKIP() << "T+ device.";
   doBpfStructSizeTest("/system/etc/bpf/netd.o");
   doBpfStructSizeTest("/system/etc/bpf/clatd.o");
 }
 
+TEST(BpfTest, bpfStructSizeTest) {
+  doBpfStructSizeTest("/system/etc/bpf/gpu_mem.o");
+  doBpfStructSizeTest("/system/etc/bpf/time_in_state.o");
+}
+
 int main(int argc, char **argv) {
   testing::InitGoogleTest(&argc, argv);
   return RUN_ALL_TESTS();