Exempt Unsupported Devs from XfrmControllerInit

For devices that do not support IPsec, or for those
devices which run a 64-bit kernel with 32-bit
userspace, IPsec features cannot be enabled. As other
tests ensure that for devices which support IPsec,
the feature is enabled in the kernel, allow them to
pass VTS tests without assuming they support IPsec.

Bug: 62778032
Test: TestXfrmControllerInit on AOSP/master - marlin
Merged-In: I18fad95646e2a9d7632ca13480d7d0ce13dafaa2
Change-Id: I18fad95646e2a9d7632ca13480d7d0ce13dafaa2
(cherry picked from commit 2aade863cd191a7b04caff4daa0bcef43ccdd8e1)
diff --git a/tests/binder_test.cpp b/tests/binder_test.cpp
index a099620..6fc6572 100644
--- a/tests/binder_test.cpp
+++ b/tests/binder_test.cpp
@@ -284,6 +284,9 @@
     }
 }
 
+// IPsec tests are not run in 32 bit mode; both 32-bit kernels and
+// mismatched ABIs (64-bit kernel with 32-bit userspace) are unsupported.
+#if INTPTR_MAX != INT32_MAX
 #define RETURN_FALSE_IF_NEQ(_expect_, _ret_) \
         do { if ((_expect_) != (_ret_)) return false; } while(false)
 bool BinderTest::allocateIpSecResources(bool expectOk, int32_t *spi) {
@@ -304,11 +307,15 @@
     return (status.ok() == expectOk);
 }
 
-
 TEST_F(BinderTest, TestXfrmControllerInit) {
     netdutils::Status status;
     status = XfrmController::Init();
     SCOPED_TRACE(status);
+
+    // Older devices or devices with mismatched Kernel/User ABI cannot support the IPsec
+    // feature.
+    if (status.code() == EOPNOTSUPP) return;
+
     ASSERT_TRUE(status.ok());
 
     int32_t spi = 0;
@@ -336,6 +343,7 @@
 
     ASSERT_TRUE(status.ok());
 }
+#endif
 
 static int bandwidthDataSaverEnabled(const char *binary) {
     std::vector<std::string> lines = listIptablesRule(binary, "bw_data_saver");