blob: e11ab92b6677ddc1e98453e60a80b3a716140f6c [file] [log] [blame]
Michael Butler2d4d6d92017-03-01 15:32:30 -08001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef VTS_HAL_RENDERSCRIPT_V1_0_TARGET_TESTS_H
18#define VTS_HAL_RENDERSCRIPT_V1_0_TARGET_TESTS_H
19
20#define LOG_TAG "renderscript_hidl_hal_test"
21#include <android-base/logging.h>
22
23#include <android/hardware/renderscript/1.0/IContext.h>
24#include <android/hardware/renderscript/1.0/IDevice.h>
25#include <android/hardware/renderscript/1.0/types.h>
26
27#include <VtsHalHidlTargetTestBase.h>
Zhuoyao Zhang674b34d2017-11-13 17:42:41 -080028#include <VtsHalHidlTargetTestEnvBase.h>
Michael Butler2d4d6d92017-03-01 15:32:30 -080029#include <gtest/gtest.h>
30
31using ::android::hardware::renderscript::V1_0::Allocation;
32using ::android::hardware::renderscript::V1_0::AllocationAdapter;
33using ::android::hardware::renderscript::V1_0::AllocationCubemapFace;
34using ::android::hardware::renderscript::V1_0::AllocationMipmapControl;
35using ::android::hardware::renderscript::V1_0::AllocationUsageType;
Michael Butler54fa8d42017-03-17 13:02:53 -070036using ::android::hardware::renderscript::V1_0::Closure;
Michael Butler2d4d6d92017-03-01 15:32:30 -080037using ::android::hardware::renderscript::V1_0::IContext;
38using ::android::hardware::renderscript::V1_0::IDevice;
39using ::android::hardware::renderscript::V1_0::ContextType;
40using ::android::hardware::renderscript::V1_0::DataType;
41using ::android::hardware::renderscript::V1_0::DataKind;
42using ::android::hardware::renderscript::V1_0::Element;
43using ::android::hardware::renderscript::V1_0::MessageToClientType;
44using ::android::hardware::renderscript::V1_0::NativeWindow;
45using ::android::hardware::renderscript::V1_0::ObjectBase;
46using ::android::hardware::renderscript::V1_0::OpaqueHandle;
47using ::android::hardware::renderscript::V1_0::Ptr;
48using ::android::hardware::renderscript::V1_0::Sampler;
49using ::android::hardware::renderscript::V1_0::SamplerValue;
50using ::android::hardware::renderscript::V1_0::Script;
51using ::android::hardware::renderscript::V1_0::ScriptFieldID;
52using ::android::hardware::renderscript::V1_0::ScriptGroup;
53using ::android::hardware::renderscript::V1_0::ScriptGroup2;
54using ::android::hardware::renderscript::V1_0::ScriptIntrinsicID;
55using ::android::hardware::renderscript::V1_0::ScriptInvokeID;
56using ::android::hardware::renderscript::V1_0::ScriptKernelID;
57using ::android::hardware::renderscript::V1_0::Size;
58using ::android::hardware::renderscript::V1_0::ThreadPriorities;
59using ::android::hardware::renderscript::V1_0::Type;
60using ::android::hardware::renderscript::V1_0::YuvFormat;
61using ::android::hardware::Return;
62using ::android::hardware::Void;
63using ::android::hardware::hidl_vec;
64using ::android::hardware::hidl_string;
65using ::android::sp;
66
Michael Butler54fa8d42017-03-17 13:02:53 -070067// bitcode slots
68extern const int mExportVarIdx_var_int;
69extern const int mExportVarIdx_var_long;
70extern const int mExportVarIdx_var_float;
71extern const int mExportVarIdx_var_double;
72extern const int mExportVarIdx_var_allocation;
73extern const int mExportVarIdx_var_uint32_t;
74extern const int mExportVarIdx_var_point2;
75extern const int mExportVarIdx_var_int_ptr;
76// bitcode invoke slots
77//extern const int mExportForEachIdx_root;
78extern const int mExportForEachIdx_increment;
79// bitcode reduce slots
80extern const int mExportReduceIdx_summation;
81// bitcode invoke slots
82extern const int mExportFuncIdx_function;
83extern const int mExportFuncIdx_functionV;
84extern const int mExportFuncIdx_setBuffer;
85extern const int mExportFuncIdx_setAllocation;
86// bitcode
Michael Butler2d4d6d92017-03-01 15:32:30 -080087typedef signed char int8_t;
88extern const int8_t bitCode[];
89extern const int bitCodeLength;
90
91// The main test class for RENDERSCRIPT HIDL HAL.
92class RenderscriptHidlTest : public ::testing::VtsHalHidlTargetTestBase {
93public:
94 virtual void SetUp() override;
95 virtual void TearDown() override;
96
97 sp<IContext> context;
98
99private:
100 sp<IDevice> device;
101};
102
Zhuoyao Zhang674b34d2017-11-13 17:42:41 -0800103// Test environment for RENDERSCRIPT HIDL HAL.
104class RenderscriptHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
105 public:
106 // get the test environment singleton
107 static RenderscriptHidlEnvironment* Instance() {
108 static RenderscriptHidlEnvironment* instance = new RenderscriptHidlEnvironment;
109 return instance;
110 }
111
112 virtual void registerTestServices() override { registerTestService<IDevice>(); }
113};
114
Michael Butler2d4d6d92017-03-01 15:32:30 -0800115#endif // VTS_HAL_RENDERSCRIPT_V1_0_TARGET_TESTS_H