diff options
author | Haamed Gheibi <haamed@google.com> | 2022-02-09 14:35:06 -0800 |
---|---|---|
committer | Haamed Gheibi <haamed@google.com> | 2022-02-09 14:41:16 -0800 |
commit | ab52181d73b04e131fd72e32d69b5123a5d6892b (patch) | |
tree | 0ac86b537180b6fb97716b3058dfae44af9eaac7 /neuralnetworks/aidl/vts/functional/Utils.cpp | |
parent | f99b35c293439db0b7436b47b939eb8c7bf21b51 (diff) | |
parent | 4d2548cfa7b86b79a516be9b60f6b666cc9af682 (diff) |
Merge TP1A.220126.001
Change-Id: Ibf6bd2c20d9927fde8b2a05dde2b58bd8faea20f
Diffstat (limited to 'neuralnetworks/aidl/vts/functional/Utils.cpp')
-rw-r--r-- | neuralnetworks/aidl/vts/functional/Utils.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/neuralnetworks/aidl/vts/functional/Utils.cpp b/neuralnetworks/aidl/vts/functional/Utils.cpp index efd5bca517..1bc76f2cb4 100644 --- a/neuralnetworks/aidl/vts/functional/Utils.cpp +++ b/neuralnetworks/aidl/vts/functional/Utils.cpp @@ -21,18 +21,20 @@ #include <aidl/android/hardware/neuralnetworks/OperandType.h> #include <android-base/logging.h> #include <android/binder_status.h> -#include <android/hardware_buffer.h> #include <sys/mman.h> #include <iostream> #include <limits> #include <numeric> -#include <MemoryUtils.h> #include <nnapi/SharedMemory.h> #include <nnapi/hal/aidl/Conversions.h> #include <nnapi/hal/aidl/Utils.h> +#ifdef __ANDROID__ +#include <android/hardware_buffer.h> +#endif // __ANDROID__ + namespace aidl::android::hardware::neuralnetworks { using test_helper::TestBuffer; @@ -140,7 +142,8 @@ std::unique_ptr<TestBlobAHWB> TestBlobAHWB::create(uint32_t size) { return ahwb->mIsValid ? std::move(ahwb) : nullptr; } -void TestBlobAHWB::initialize(uint32_t size) { +void TestBlobAHWB::initialize([[maybe_unused]] uint32_t size) { +#ifdef __ANDROID__ mIsValid = false; ASSERT_GT(size, 0); const auto usage = AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN | AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN; @@ -164,6 +167,9 @@ void TestBlobAHWB::initialize(uint32_t size) { mAidlMemory = utils::convert(mMemory).value(); mIsValid = true; +#else // __ANDROID__ + LOG(FATAL) << "TestBlobAHWB::initialize not supported on host"; +#endif // __ANDROID__ } std::string gtestCompliantName(std::string name) { |