Camera2: Tests: Release streams after HAL is unloaded: DO NOT MERGE
This fixes a segfault in the HAL where it was trying to write to a locked buffer that disappeared from underneath it. Any users of CameraModuleFixture should now call SetUp/TearDown explicitly. Other classes remain unchanged until we need a custom TearDown order for them. Change-Id: Ia2dc3ac3e2497d9ede9b580f6e10cf9ec646bdab
This commit is contained in:
parent
2a5c0e2a46
commit
d887503095
3 changed files with 20 additions and 6 deletions
|
@ -37,14 +37,10 @@ struct CameraModuleFixture {
|
|||
TEST_EXTENSION_FORKING_CONSTRUCTOR;
|
||||
|
||||
mCameraID = CameraID;
|
||||
|
||||
SetUp();
|
||||
}
|
||||
|
||||
~CameraModuleFixture() {
|
||||
TEST_EXTENSION_FORKING_DESTRUCTOR;
|
||||
|
||||
TearDown();
|
||||
}
|
||||
|
||||
camera_metadata_ro_entry GetStaticEntry(uint32_t tag) const {
|
||||
|
@ -53,8 +49,6 @@ struct CameraModuleFixture {
|
|||
return entry;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void SetUp() {
|
||||
TEST_EXTENSION_FORKING_SET_UP;
|
||||
|
||||
|
@ -88,6 +82,8 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void SetUpMixin() {
|
||||
/* For using this fixture in other tests only */
|
||||
if (mCameraID != -1) {
|
||||
|
|
|
@ -33,6 +33,15 @@ namespace tests {
|
|||
|
||||
class CameraModuleTest : public ::testing::Test,
|
||||
public CameraModuleFixture<> {
|
||||
|
||||
public:
|
||||
CameraModuleTest() {
|
||||
CameraModuleFixture::SetUp();
|
||||
}
|
||||
|
||||
~CameraModuleTest() {
|
||||
CameraModuleFixture::TearDown();
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(CameraModuleTest, LoadModule) {
|
||||
|
|
|
@ -68,6 +68,8 @@ private:
|
|||
void SetUp() {
|
||||
TEST_EXTENSION_FORKING_SET_UP;
|
||||
|
||||
CameraModuleFixture::SetUp();
|
||||
|
||||
CameraStreamParams p = mParam;
|
||||
sp<Camera2Device> device = mDevice;
|
||||
|
||||
|
@ -89,6 +91,13 @@ private:
|
|||
}
|
||||
void TearDown() {
|
||||
TEST_EXTENSION_FORKING_TEAR_DOWN;
|
||||
|
||||
// important: shut down HAL before releasing streams
|
||||
CameraModuleFixture::TearDown();
|
||||
|
||||
mNativeWindow.clear();
|
||||
mCpuConsumer.clear();
|
||||
mFrameListener.clear();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in a new issue