Improve JniAbort (and JNI tests).
This has been on my to-do list for a while, but it actually bit people
in the ass yesterday. This change enables us to write a lot more (and
better) tests, but for now I've just improved the tests that already
existed.
Change-Id: I04a18656de60b47e5a6b5777204c144209d1448e
diff --git a/src/common_test.h b/src/common_test.h
index 6b284fd..54c9bb7 100644
--- a/src/common_test.h
+++ b/src/common_test.h
@@ -548,11 +548,13 @@
EXPECT_TRUE(actual_.find(expected_text) != std::string::npos) << "\n"
<< "Expected to find: " << expected_text << "\n"
<< "In the output : " << actual_;
+ actual_.clear();
}
private:
static void Hook(void* data, const std::string& reason) {
- *reinterpret_cast<std::string*>(data) = reason;
+ // We use += because when we're hooking the aborts like this, multiple problems can be found.
+ *reinterpret_cast<std::string*>(data) += reason;
}
JavaVMExt* vm_;