Camera2: Tests -- Fork each test before executing it
Use CAMERA2_TEST_FORKING_DISABLED=1 environment variable to override this
behavior (e.g. when wanting to attach gdb to the test app).
Change-Id: Ib639885bdb827fc2415c878cbcb1b2d84dff687b
diff --git a/tests/camera2/CameraFrameTests.cpp b/tests/camera2/CameraFrameTests.cpp
index 9e3482c..6f88312 100644
--- a/tests/camera2/CameraFrameTests.cpp
+++ b/tests/camera2/CameraFrameTests.cpp
@@ -32,6 +32,7 @@
#include <unistd.h>
#include "CameraStreamFixture.h"
+#include "TestExtensions.h"
#define CAMERA_FRAME_TIMEOUT 1000000000 //nsecs (1 secs)
#define CAMERA_HEAP_COUNT 2 //HALBUG: 1 means registerBuffers fails
@@ -56,12 +57,16 @@
public:
CameraFrameTest() : CameraStreamFixture(STREAM_PARAMETERS) {
+ TEST_EXTENSION_FORKING_CONSTRUCTOR;
+
if (!HasFatalFailure()) {
CreateStream();
}
}
~CameraFrameTest() {
+ TEST_EXTENSION_FORKING_DESTRUCTOR;
+
if (mDevice.get()) {
mDevice->waitUntilDrained();
}
@@ -69,8 +74,10 @@
}
virtual void SetUp() {
+ TEST_EXTENSION_FORKING_SET_UP;
}
virtual void TearDown() {
+ TEST_EXTENSION_FORKING_TEAR_DOWN;
}
protected:
@@ -79,9 +86,7 @@
TEST_P(CameraFrameTest, GetFrame) {
- if (HasFatalFailure()) {
- return;
- }
+ TEST_EXTENSION_FORKING_INIT;
/* Submit a PREVIEW type request, then wait until we get the frame back */
CameraMetadata previewRequest;