summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Harold <nharold@google.com>2018-05-10 14:03:48 -0700
committerNathan Harold <nharold@google.com>2018-05-10 18:38:57 -0700
commit2aade863cd191a7b04caff4daa0bcef43ccdd8e1 (patch)
tree8c7b28be7b4462528e23277bb2207c03efda68e9
parenta397abdf91421546057f9462fb47e4813847bd65 (diff)
downloadnetd-2aade863cd191a7b04caff4daa0bcef43ccdd8e1.tar.gz
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 Change-Id: I18fad95646e2a9d7632ca13480d7d0ce13dafaa2
-rw-r--r--tests/binder_test.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/binder_test.cpp b/tests/binder_test.cpp
index 4cbfdf24..5b4d0295 100644
--- a/tests/binder_test.cpp
+++ b/tests/binder_test.cpp
@@ -284,6 +284,9 @@ TEST_F(BinderTest, TestVirtualTunnelInterface) {
}
}
+// 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 @@ bool BinderTest::allocateIpSecResources(bool expectOk, int32_t *spi) {
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 @@ TEST_F(BinderTest, TestXfrmControllerInit) {
ASSERT_TRUE(status.ok());
}
+#endif
static int bandwidthDataSaverEnabled(const char *binary) {
std::vector<std::string> lines = listIptablesRule(binary, "bw_data_saver");