summaryrefslogtreecommitdiffstats
path: root/tetheroffload
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2018-05-11 16:35:20 +0900
committerLorenzo Colitti <lorenzo@google.com>2018-05-11 17:02:42 +0900
commit5f9aec4f541fc72e521b688b1d686a6bc3b4b1cb (patch)
tree8a05d54b3f68c3110bec2c1511f240c891e9683f /tetheroffload
parent73bfa71121f882493ca63265926b8e7979cde46f (diff)
downloadandroid_hardware_interfaces-5f9aec4f541fc72e521b688b1d686a6bc3b4b1cb.tar.gz
android_hardware_interfaces-5f9aec4f541fc72e521b688b1d686a6bc3b4b1cb.tar.bz2
android_hardware_interfaces-5f9aec4f541fc72e521b688b1d686a6bc3b4b1cb.zip
Add debugging to VtsHalTetherOffloadControl test.
1. Move the detailed failure statements from ALOGI statements to assertion failure messages. 2. Add SCOPED_TRACEs to AdditionalStopsWithInitReturnFalse. Bug: 77996655 Test: Builds. Error messages visible in assertions. Change-Id: Ife0607e792175ab22d1467b1fe2926107fee1e6a
Diffstat (limited to 'tetheroffload')
-rw-r--r--tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp38
1 files changed, 16 insertions, 22 deletions
diff --git a/tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp b/tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp
index 4eef4ec64..2cd986265 100644
--- a/tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp
+++ b/tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp
@@ -26,7 +26,6 @@
#include <android/hardware/tetheroffload/control/1.0/types.h>
#include <linux/netfilter/nfnetlink.h>
#include <linux/netlink.h>
-#include <log/log.h>
#include <net/if.h>
#include <sys/socket.h>
#include <unistd.h>
@@ -57,20 +56,16 @@ enum class ExpectBoolean {
constexpr const char* TEST_IFACE = "rmnet_data0";
// We use #defines here so as to get local lamba captures and error message line numbers
-#define ASSERT_TRUE_CALLBACK \
- [&](bool success, std::string errMsg) { \
- if (!success) { \
- ALOGI("Error message: %s", errMsg.c_str()); \
- } \
- ASSERT_TRUE(success); \
+#define ASSERT_TRUE_CALLBACK \
+ [&](bool success, std::string errMsg) { \
+ std::string msg = StringPrintf("unexpected error: %s", errMsg.c_str()); \
+ ASSERT_TRUE(success) << msg; \
}
-#define ASSERT_FALSE_CALLBACK \
- [&](bool success, std::string errMsg) { \
- if (!success) { \
- ALOGI("Error message: %s", errMsg.c_str()); \
- } \
- ASSERT_FALSE(success); \
+#define ASSERT_FALSE_CALLBACK \
+ [&](bool success, std::string errMsg) { \
+ std::string msg = StringPrintf("expected error: %s", errMsg.c_str()); \
+ ASSERT_FALSE(success) << msg; \
}
#define ASSERT_ZERO_BYTES_CALLBACK \
@@ -188,10 +183,9 @@ class OffloadControlHidlTestBase : public testing::VtsHalHidlTargetTestBase {
void initOffload(const bool expected_result) {
auto init_cb = [&](bool success, std::string errMsg) {
- if (!success) {
- ALOGI("Error message: %s", errMsg.c_str());
- }
- ASSERT_EQ(expected_result, success);
+ std::string msg = StringPrintf("Unexpectedly %s to init offload: %s",
+ success ? "succeeded" : "failed", errMsg.c_str());
+ ASSERT_EQ(expected_result, success) << msg;
};
const Return<void> ret = control->initOffload(control_cb, init_cb);
ASSERT_TRUE(ret.isOk());
@@ -204,15 +198,12 @@ class OffloadControlHidlTestBase : public testing::VtsHalHidlTargetTestBase {
void stopOffload(const ExpectBoolean value) {
auto cb = [&](bool success, const hidl_string& errMsg) {
- if (!success) {
- ALOGI("Error message: %s", errMsg.c_str());
- }
switch (value) {
case ExpectBoolean::False:
- ASSERT_EQ(false, success);
+ ASSERT_EQ(false, success) << "Unexpectedly able to stop offload: " << errMsg;
break;
case ExpectBoolean::True:
- ASSERT_EQ(true, success);
+ ASSERT_EQ(true, success) << "Unexpectedly failed to stop offload: " << errMsg;
break;
case ExpectBoolean::Ignored:
break;
@@ -289,8 +280,11 @@ TEST_F(OffloadControlHidlTestBase, AdditionalStopsWithInitReturnFalse) {
if (!interfaceIsUp(TEST_IFACE)) {
return;
}
+ SCOPED_TRACE("Expecting stopOffload to succeed");
stopOffload(ExpectBoolean::True); // balance out initOffload(true)
+ SCOPED_TRACE("Expecting stopOffload to fail the first time");
stopOffload(ExpectBoolean::False);
+ SCOPED_TRACE("Expecting stopOffload to fail the second time");
stopOffload(ExpectBoolean::False);
}