diff options
author | Igor Murashkin <iam@google.com> | 2012-12-18 13:38:40 -0800 |
---|---|---|
committer | Igor Murashkin <iam@google.com> | 2012-12-20 16:35:47 -0800 |
commit | 7acb21a65c6eefe6ab1cbc55c7c15cece6bafbe5 (patch) | |
tree | 085cc6fc4d17b736bcfd9696b86a7ec4ee8cab22 /tests/camera2 | |
parent | 1da4d3e377b6bc1ba10ec980176b0ff9dc3f591d (diff) | |
download | hardware_libhardware-7acb21a65c6eefe6ab1cbc55c7c15cece6bafbe5.zip hardware_libhardware-7acb21a65c6eefe6ab1cbc55c7c15cece6bafbe5.tar.gz hardware_libhardware-7acb21a65c6eefe6ab1cbc55c7c15cece6bafbe5.tar.bz2 |
Camera2: Tests: Release streams after HAL is unloaded
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: I9aa8c2d86492a76f2c01c1ad4cbe0cf91e5c7916
Diffstat (limited to 'tests/camera2')
-rw-r--r-- | tests/camera2/CameraModuleFixture.h | 8 | ||||
-rw-r--r-- | tests/camera2/CameraModuleTests.cpp | 9 | ||||
-rw-r--r-- | tests/camera2/CameraStreamFixture.h | 9 |
3 files changed, 20 insertions, 6 deletions
diff --git a/tests/camera2/CameraModuleFixture.h b/tests/camera2/CameraModuleFixture.h index 6ad1ae8..cd8ddc4 100644 --- a/tests/camera2/CameraModuleFixture.h +++ b/tests/camera2/CameraModuleFixture.h @@ -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) { diff --git a/tests/camera2/CameraModuleTests.cpp b/tests/camera2/CameraModuleTests.cpp index 5e85698..b5b88fc 100644 --- a/tests/camera2/CameraModuleTests.cpp +++ b/tests/camera2/CameraModuleTests.cpp @@ -33,6 +33,15 @@ namespace tests { class CameraModuleTest : public ::testing::Test, public CameraModuleFixture<> { + +public: + CameraModuleTest() { + CameraModuleFixture::SetUp(); + } + + ~CameraModuleTest() { + CameraModuleFixture::TearDown(); + } }; TEST_F(CameraModuleTest, LoadModule) { diff --git a/tests/camera2/CameraStreamFixture.h b/tests/camera2/CameraStreamFixture.h index 7a6fa31..569b9d1 100644 --- a/tests/camera2/CameraStreamFixture.h +++ b/tests/camera2/CameraStreamFixture.h @@ -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: |