Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a746fd03 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Fix NNAPI QoS Deadline test am: 5c40bcc4

Change-Id: I96331c0d2add30412162d1c33bfe9ba405d61b3b
parents ad6b0276 5c40bcc4
Loading
Loading
Loading
Loading
+14 −25
Original line number Diff line number Diff line
@@ -134,10 +134,9 @@ void runPrepareModelTest(const sp<IDevice>& device, const Model& model, Priority
    } else {
        switch (deadlineBound.value()) {
            case DeadlineBoundType::NOW:
                // If the execution was launched with a deadline of NOW, the
                // deadline has already passed when the driver would launch the
                // execution. In this case, the driver must return
                // MISSED_DEADLINE_*.
            case DeadlineBoundType::SHORT:
                // Either the driver successfully completed the task or it
                // aborted and returned MISSED_DEADLINE_*.
                EXPECT_TRUE(prepareReturnStatus == ErrorStatus::NONE ||
                            prepareReturnStatus == ErrorStatus::MISSED_DEADLINE_TRANSIENT ||
                            prepareReturnStatus == ErrorStatus::MISSED_DEADLINE_PERSISTENT);
@@ -148,13 +147,6 @@ void runPrepareModelTest(const sp<IDevice>& device, const Model& model, Priority
                // of the switch statement.
                EXPECT_EQ(ErrorStatus::NONE, prepareReturnStatus);
                break;
            case DeadlineBoundType::SHORT:
                // Either the driver successfully completed the task in time or
                // it aborted within the compliance time.
                EXPECT_TRUE(prepareReturnStatus == ErrorStatus::NONE ||
                            prepareReturnStatus == ErrorStatus::MISSED_DEADLINE_TRANSIENT ||
                            prepareReturnStatus == ErrorStatus::MISSED_DEADLINE_PERSISTENT);
                break;
        }
    }
    ASSERT_EQ(prepareReturnStatus == ErrorStatus::NONE, preparedModel.get() != nullptr);
@@ -206,7 +198,10 @@ static MaybeResults executeSynchronously(const sp<IPreparedModel>& preparedModel

    // configure results callback
    MaybeResults results;
    const auto cb = [&results](const auto&... args) { *results = {args...}; };
    const auto cb = [&results](ErrorStatus status, const hidl_vec<OutputShape>& outputShapes,
                               const Timing& timing) {
        results.emplace(status, outputShapes, timing);
    };

    // run execution
    const Return<void> ret =
@@ -235,27 +230,19 @@ void runExecutionTest(const sp<IPreparedModel>& preparedModel, const TestModel&
    // Validate deadline information if applicable.
    switch (deadlineBound) {
        case DeadlineBoundType::NOW:
            // If the execution was launched with a deadline of NOW, the
            // deadline has already passed when the driver would launch the
            // execution. In this case, the driver must return
            // MISSED_DEADLINE_*.
        case DeadlineBoundType::SHORT:
            // Either the driver successfully completed the task or it
            // aborted and returned MISSED_DEADLINE_*.
            ASSERT_TRUE(status == ErrorStatus::NONE ||
                        status == ErrorStatus::MISSED_DEADLINE_TRANSIENT ||
                        status == ErrorStatus::MISSED_DEADLINE_PERSISTENT);
            return;
            break;
        case DeadlineBoundType::UNLIMITED:
            // If an unlimited deadline is supplied, we expect the execution to
            // proceed normally. In this case, check it normally by breaking out
            // of the switch statement.
            ASSERT_EQ(ErrorStatus::NONE, status);
            break;
        case DeadlineBoundType::SHORT:
            // Either the driver successfully completed the task in time or
            // it aborted within the compliance time.
            EXPECT_TRUE(status == ErrorStatus::NONE ||
                        status == ErrorStatus::MISSED_DEADLINE_TRANSIENT ||
                        status == ErrorStatus::MISSED_DEADLINE_PERSISTENT);
            break;
    }

    // If the model output operands are fully specified, outputShapes must be either
@@ -277,8 +264,10 @@ void runExecutionTest(const sp<IPreparedModel>& preparedModel, const TestModel&
    const std::vector<TestBuffer> outputs = getOutputBuffers(request10);

    // We want "close-enough" results.
    if (status == ErrorStatus::NONE) {
        checkResults(testModel, outputs);
    }
}

void runExecutionTests(const sp<IPreparedModel>& preparedModel, const TestModel& testModel,
                       const Request& request) {