test: fence: Signal fence once

The unit test associates a fence with a framebuffer and makes sure
the fence is correctly signalled.

Once a fence is correctly signalled, it is released by the core, and the
underlying file descriptor closed.

The unit test however tries to write on the fence file descriptor every
time the designated Request is queued, an error which is now visible
as the return value of the fence signalling write() is checked.

Fix that by associating a fence with a framebuffer only once.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
This commit is contained in:
Jacopo Mondi 2021-12-13 15:46:59 +01:00
parent a3122eecea
commit 5c4f9e3ae3

View file

@ -56,6 +56,7 @@ private:
Stream *stream_;
bool expectedCompletionResult_ = true;
bool setFence_ = true;
unsigned int completedRequest_;
@ -193,7 +194,7 @@ void FenceTest::requestRequeue(Request *request)
request->reuse();
if (cookie == signalledRequestId_) {
if (cookie == signalledRequestId_ && setFence_) {
/*
* The second time this request is queued add a fence to it.
*
@ -257,6 +258,7 @@ void FenceTest::signalFence()
if (ret != sizeof(value))
cerr << "Failed to signal fence" << endl;
setFence_ = false;
dispatcher_->processEvents();
}
@ -316,7 +318,7 @@ int FenceTest::run()
Timer timer;
timer.start(1000);
while (timer.isRunning() && expectedCompletionResult_) {
if (completedRequest_ == signalledRequestId_)
if (completedRequest_ == signalledRequestId_ && setFence_)
/*
* signalledRequestId_ has just completed and it has
* been re-queued with a fence. Start the timer to