aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2020-04-27 10:15:41 +0100
committerSadik Armagan <sadik.armagan@arm.com>2020-04-27 10:15:41 +0100
commitd46368765369a8058398e01361cd22a7793894dd (patch)
tree87fd3e74f2466c725fcf519c1dfef0e9f731cd81
parent949a69ef997b1d78dca10b4cca833c3e6b3f5436 (diff)
downloadandroid-nn-driver-d46368765369a8058398e01361cd22a7793894dd.tar.gz
IVGCVSW-4692 HAL 1.3 VTS/NNT, Unit test Failures
* Check if the model is prepared. Signed-off-by: Sadik Armagan <sadik.armagan@arm.com> Change-Id: Ia6ea7c5b61a1da97acddddfc5431925cbb4f0227
-rw-r--r--test/1.1/Mean.cpp7
-rw-r--r--test/1.1/Transpose.cpp5
-rw-r--r--test/Concurrent.cpp10
-rw-r--r--test/Convolution2D.hpp5
-rw-r--r--test/DriverTestHelpers.cpp1
-rw-r--r--test/FullyConnected.cpp15
6 files changed, 35 insertions, 8 deletions
diff --git a/test/1.1/Mean.cpp b/test/1.1/Mean.cpp
index 10ca3ae..b307490 100644
--- a/test/1.1/Mean.cpp
+++ b/test/1.1/Mean.cpp
@@ -89,8 +89,11 @@ void MeanTestImpl(const TestTensor& input,
android::sp<IMemory> outMemory = AddPoolAndGetData<float>(expectedOutput.GetNumElements(), request);
const float* outputData = static_cast<const float*>(static_cast<void*>(outMemory->getPointer()));
- V1_0::ErrorStatus execStatus = Execute(preparedModel, request);
- BOOST_TEST(execStatus == V1_0::ErrorStatus::NONE);
+ if (preparedModel.get() != nullptr)
+ {
+ V1_0::ErrorStatus execStatus = Execute(preparedModel, request);
+ BOOST_TEST(execStatus == V1_0::ErrorStatus::NONE);
+ }
const float* expectedOutputData = expectedOutput.GetData();
for (unsigned int i = 0; i < expectedOutput.GetNumElements(); i++)
diff --git a/test/1.1/Transpose.cpp b/test/1.1/Transpose.cpp
index 5679ca2..7a36130 100644
--- a/test/1.1/Transpose.cpp
+++ b/test/1.1/Transpose.cpp
@@ -89,7 +89,10 @@ void TransposeTestImpl(const TestTensor & inputs, int32_t perm[],
android::sp<IMemory> outMemory = AddPoolAndGetData<float>(expectedOutputTensor.GetNumElements(), request);
float* outdata = static_cast<float*>(static_cast<void*>(outMemory->getPointer()));
- auto execStatus = Execute(preparedModel, request);
+ if (preparedModel.get() != nullptr)
+ {
+ auto execStatus = Execute(preparedModel, request);
+ }
const float * expectedOutput = expectedOutputTensor.GetData();
for (unsigned int i = 0; i < expectedOutputTensor.GetNumElements(); ++i)
diff --git a/test/Concurrent.cpp b/test/Concurrent.cpp
index ecf25e1..0694934 100644
--- a/test/Concurrent.cpp
+++ b/test/Concurrent.cpp
@@ -51,12 +51,20 @@ BOOST_AUTO_TEST_CASE(ConcurrentExecute)
// make the prepared models
const size_t maxRequests = 5;
+ size_t preparedModelsSize = 0;
android::sp<V1_0::IPreparedModel> preparedModels[maxRequests];
for (size_t i = 0; i < maxRequests; ++i)
{
- preparedModels[i] = PrepareModel(model, *driver);
+ auto preparedModel = PrepareModel(model, *driver);
+ if (preparedModel.get() != nullptr)
+ {
+ preparedModels[i] = PrepareModel(model, *driver);
+ preparedModelsSize++;
+ }
}
+ BOOST_TEST(maxRequests == preparedModelsSize);
+
// construct the request data
DataLocation inloc = {};
inloc.poolIndex = 0;
diff --git a/test/Convolution2D.hpp b/test/Convolution2D.hpp
index 38216f1..c471fbd 100644
--- a/test/Convolution2D.hpp
+++ b/test/Convolution2D.hpp
@@ -104,7 +104,10 @@ void PaddingTestImpl(android::nn::PaddingScheme paddingScheme, bool fp16Enabled
float* outdata = reinterpret_cast<float*>(static_cast<void*>(outMemory->getPointer()));
// run the execution
- Execute(preparedModel, request);
+ if (preparedModel.get() != nullptr)
+ {
+ Execute(preparedModel, request);
+ }
// check the result
switch (paddingScheme)
diff --git a/test/DriverTestHelpers.cpp b/test/DriverTestHelpers.cpp
index 0bc0cf7..18e3377 100644
--- a/test/DriverTestHelpers.cpp
+++ b/test/DriverTestHelpers.cpp
@@ -182,6 +182,7 @@ V1_0::ErrorStatus Execute(android::sp<V1_0::IPreparedModel> preparedModel,
android::sp<ExecutionCallback> ExecuteNoWait(android::sp<V1_0::IPreparedModel> preparedModel,
const V1_0::Request& request)
{
+ BOOST_TEST(preparedModel.get() != nullptr);
android::sp<ExecutionCallback> cb(new ExecutionCallback());
BOOST_TEST(preparedModel->execute(request, cb) == V1_0::ErrorStatus::NONE);
ALOGI("ExecuteNoWait: returning callback object");
diff --git a/test/FullyConnected.cpp b/test/FullyConnected.cpp
index a6983dd..2f9cd4b 100644
--- a/test/FullyConnected.cpp
+++ b/test/FullyConnected.cpp
@@ -77,7 +77,10 @@ BOOST_AUTO_TEST_CASE(FullyConnected)
float* outdata = static_cast<float*>(static_cast<void*>(outMemory->getPointer()));
// run the execution
- Execute(preparedModel, request);
+ if (preparedModel.get() != nullptr)
+ {
+ Execute(preparedModel, request);
+ }
// check the result
BOOST_TEST(outdata[0] == 152);
@@ -156,7 +159,10 @@ BOOST_AUTO_TEST_CASE(TestFullyConnected4dInput)
float* outdata = static_cast<float*>(static_cast<void*>(outMemory->getPointer()));
// run the execution
- Execute(preparedModel, request);
+ if (preparedModel != nullptr)
+ {
+ Execute(preparedModel, request);
+ }
// check the result
BOOST_TEST(outdata[0] == 1);
@@ -242,7 +248,10 @@ BOOST_AUTO_TEST_CASE(TestFullyConnected4dInputReshape)
float* outdata = static_cast<float*>(static_cast<void*>(outMemory->getPointer()));
// run the execution
- Execute(preparedModel, request);
+ if (preparedModel != nullptr)
+ {
+ Execute(preparedModel, request);
+ }
// check the result
BOOST_TEST(outdata[0] == 1);