Android tests call exit() when complete.

[ Merge of http://go/wvgerrit/119804 ]

The coverage framework used by Android requires the process to call
exit() for coverage information to be dumped after the tests.

Android unit tests have been adapted to use the a new main module.
The core test_main.cpp used by integration tests has been updated to
call exit().

Bug: 138941105
Test: Linux and Android unittests
Change-Id: Ifffc7b8290c50dffe527738a36547c1d2fb90bd3
This commit is contained in:
Alex Dale
2021-03-11 19:32:34 -08:00
parent 9f918bc16b
commit 16c704fa09
3 changed files with 23 additions and 3 deletions

View File

@@ -5,7 +5,7 @@
// Use in place of the gtest_main in order to initialize the WvCdmTestBase using
// command line parameters.
#include <stdio.h>
#include <stdlib.h>
#include "log.h"
#include "test_base.h"
@@ -13,5 +13,8 @@
int main(int argc, char** argv) {
if (!wvcdm::WvCdmTestBase::Initialize(argc, argv)) return 1;
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
const int status = RUN_ALL_TESTS();
LOGD("CDM test complete with status %d", status);
exit(status); // Explicit call to exit() is required for code coverage.
return status;
}