From 8fc4622bf128ceef28f2bc2465fd9faac689693d Mon Sep 17 00:00:00 2001 From: Xusong Wang Date: Mon, 19 Aug 2019 10:37:18 -0700 Subject: [PATCH] Modify validateBurstSanitized to take a single request. This CL is to modify validateBurstSanitized implementation in accordance with the new test generator and test harness change in the same topic. Bug: 123092187 Test: 1.2 VTS Change-Id: Iacfe0e3bba8b4b44b7aee023d1c8129cbd089d4a --- .../1.2/vts/functional/ValidateBurst.cpp | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/neuralnetworks/1.2/vts/functional/ValidateBurst.cpp b/neuralnetworks/1.2/vts/functional/ValidateBurst.cpp index c4c92804d9..94603fbcfd 100644 --- a/neuralnetworks/1.2/vts/functional/ValidateBurst.cpp +++ b/neuralnetworks/1.2/vts/functional/ValidateBurst.cpp @@ -361,7 +361,7 @@ static bool isSanitized(const FmqResultDatum& datum) { } static void validateBurstSanitized(const sp& preparedModel, - const std::vector& requests) { + const Request& request) { // create burst std::unique_ptr sender; std::unique_ptr receiver; @@ -372,26 +372,23 @@ static void validateBurstSanitized(const sp& preparedModel, ASSERT_NE(nullptr, receiver.get()); ASSERT_NE(nullptr, context.get()); - // validate each request - for (const Request& request : requests) { - // load memory into callback slots - std::vector keys; - keys.reserve(request.pools.size()); - std::transform(request.pools.begin(), request.pools.end(), std::back_inserter(keys), - [](const auto& pool) { return reinterpret_cast(&pool); }); - const std::vector slots = callback->getSlots(request.pools, keys); + // load memory into callback slots + std::vector keys; + keys.reserve(request.pools.size()); + std::transform(request.pools.begin(), request.pools.end(), std::back_inserter(keys), + [](const auto& pool) { return reinterpret_cast(&pool); }); + const std::vector slots = callback->getSlots(request.pools, keys); - // send valid request - ASSERT_TRUE(sender->send(request, MeasureTiming::YES, slots)); + // send valid request + ASSERT_TRUE(sender->send(request, MeasureTiming::YES, slots)); - // receive valid result - auto serialized = receiver->getPacketBlocking(); - ASSERT_TRUE(serialized.has_value()); + // receive valid result + auto serialized = receiver->getPacketBlocking(); + ASSERT_TRUE(serialized.has_value()); - // sanitize result - ASSERT_TRUE(std::all_of(serialized->begin(), serialized->end(), isSanitized)) - << "The result serialized data is not properly sanitized"; - } + // sanitize result + ASSERT_TRUE(std::all_of(serialized->begin(), serialized->end(), isSanitized)) + << "The result serialized data is not properly sanitized"; } ///////////////////////////// ENTRY POINT ////////////////////////////////// @@ -400,7 +397,7 @@ void ValidationTest::validateBurst(const sp& preparedModel, const Request& request) { ASSERT_NO_FATAL_FAILURE(validateBurstSerialization(preparedModel, request)); ASSERT_NO_FATAL_FAILURE(validateBurstFmqLength(preparedModel, request)); - ASSERT_NO_FATAL_FAILURE(validateBurstSanitized(preparedModel, requests)); + ASSERT_NO_FATAL_FAILURE(validateBurstSanitized(preparedModel, request)); } } // namespace functional