Return error code from testbinary
If the test in MicrodroidTestApp fails, return an error code rather than
a success code.
Test: vm /data/local/tmp/MicrodroidTestApp.apk
/data/local/tmp/MicrodroidApp.apk.idsig assets/config.json
Change-Id: I4fda7a38e58e448f5de2ac076346a6378cf75889
diff --git a/tests/testapk/src/native/testbinary.cpp b/tests/testapk/src/native/testbinary.cpp
index 20519cd..ed9503a 100644
--- a/tests/testapk/src/native/testbinary.cpp
+++ b/tests/testapk/src/native/testbinary.cpp
@@ -170,7 +170,7 @@
}
template <typename T>
-void report_test(std::string name, Result<T> result) {
+Result<T> report_test(std::string name, Result<T> result) {
auto property = "debug.microdroid.test." + name;
std::stringstream outcome;
if (result.ok()) {
@@ -181,6 +181,7 @@
std::cout << "[" << name << "] test failed: " << result.error() << "\n";
}
__system_property_set(property.c_str(), outcome.str().c_str());
+ return result;
}
} // Anonymous namespace
@@ -198,6 +199,7 @@
printf("\n");
__system_property_set("debug.microdroid.app.run", "true");
- report_test("keystore", test_keystore());
+ if (!report_test("keystore", test_keystore()).ok()) return 1;
+
return 0;
}