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

Commit eb8d93e4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "RenderScript VTS implementation"

parents d23068fa 2d4d6d97
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
//
// Copyright (C) 2017 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

cc_test {
    name: "VtsHalRenderscriptV1_0TargetTest",
    srcs: [
        "VtsHalRenderscriptV1_0TargetTest.cpp",
        "VtsCopyTests.cpp",
        "VtsMiscellaneousTests.cpp",
        "VtsScriptTests.cpp",
        "bitcode.cpp",
    ],
    defaults: ["hidl_defaults"],
    shared_libs: [
        "libbase",
        "liblog",
        "libcutils",
        "libhidlbase",
        "libhidltransport",
        "libnativehelper",
        "libutils",
        "android.hardware.renderscript@1.0",
    ],
    static_libs: ["VtsHalHidlTargetTestBase"],
    cflags: [
        "-O0",
        "-g",
    ],
}
+427 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
*/

#include "VtsHalRenderscriptV1_0TargetTest.h"

/*
 * This test creates a 1D Allocation with 128 Float Elements, and two float
 * vector dataIn & dataOut. dataIn is pre-populated with data, and copied into
 * the Allocation using allocation1DWrite. Then the Allocation is copied into
 * dataOut with allocation1DRead.
 *
 * Calls: elementCreate, typeCreate, allocationCreateTyped, allocation1DWrite,
 * allocation1DRead
 *
 * Expect: dataIn & dataOut are the same.
 */
TEST_F(RenderscriptHidlTest, Simple1DCopyTest) {
    // float1
    Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
    // 128 x float1
    Type type = context->typeCreate(element, 128, 0, 0, false, false, YuvFormat::YUV_NONE);
    // 128 x float1
    Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                           (int)AllocationUsageType::SCRIPT,
                                                           (Ptr)nullptr);
    std::vector<float> dataIn(128), dataOut(128);
    std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
    hidl_vec<uint8_t> _data;
    _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(float));
    context->allocation1DWrite(allocation, 0, 0, (Size)dataIn.size(), _data);
    context->allocation1DRead(allocation, 0, 0, (uint32_t)dataOut.size(), (Ptr)dataOut.data(),
                              (Size)dataOut.size()*sizeof(float));
    bool same = std::all_of(dataOut.begin(), dataOut.end(),
                            [](float x){ static int val = 0; return x == (float)val++; });
    EXPECT_EQ(true, same);
}

/*
 * This test creates a 2D Allocation with 128 * 128 Float Elements, and two
 * float vector dataIn & dataOut. dataIn is pre-populated with data, and copied
 * into the Allocation using allocation2DWrite. Then the Allocation is copied
 * into dataOut with allocation2DRead.
 *
 * Calls: elementCreate, typeCreate, allocationCreateTyped, allocation2DWrite,
 * allocation2DRead
 *
 * Expect: dataIn & dataOut are the same.
 */
TEST_F(RenderscriptHidlTest, Simple2DCopyTest) {
    // float1
    Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
    // 128 x 128 x float1
    Type type = context->typeCreate(element, 128, 128, 0, false, false, YuvFormat::YUV_NONE);
    // 128 x 128 x float1
    Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                           (int)AllocationUsageType::SCRIPT,
                                                           (Ptr)nullptr);
    std::vector<float> dataIn(128*128), dataOut(128*128);
    std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
    hidl_vec<uint8_t> _data;
    _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(float));
    context->allocation2DWrite(allocation, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 128, 128,
                               _data, 0);
    context->allocation2DRead(allocation, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 128, 128,
                              (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float), 0);
    bool same = std::all_of(dataOut.begin(), dataOut.end(),
                            [](float x){ static int val = 0; return x == (float)val++; });
    EXPECT_EQ(true, same);
}

/*
 * This test creates a 3D Allocation with 32 * 32 * 32 Float Elements, and two
 * float vector dataIn & dataOut. dataIn is pre-populated with data, and copied
 * into the Allocation using allocation3DWrite. Then the Allocation is copied
 * into dataOut with allocation3DRead.
 *
 * Calls: elementCreate, typeCreate, allocationCreateTyped, allocation3DWrite,
 * allocation3DRead
 *
 * Expect: dataIn & dataOut are the same.
 */
TEST_F(RenderscriptHidlTest, Simple3DCopyTest) {
    // float1
    Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
    // 32 x 32 x 32 x float1
    Type type = context->typeCreate(element, 32, 32, 32, false, false, YuvFormat::YUV_NONE);
    // 32 x 32 x 32 x float1
    Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                           (int)AllocationUsageType::SCRIPT,
                                                           (Ptr)nullptr);
    std::vector<float> dataIn(32*32*32), dataOut(32*32*32);
    std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
    hidl_vec<uint8_t> _data;
    _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(float));
    context->allocation3DWrite(allocation, 0, 0, 0, 0, 32, 32, 32, _data, 0);
    context->allocation3DRead(allocation, 0, 0, 0, 0, 32, 32, 32, (Ptr)dataOut.data(),
                              (Size)dataOut.size()*sizeof(float), 0);
    bool same = std::all_of(dataOut.begin(), dataOut.end(),
                            [](float x){ static int val = 0; return x == (float)val++; });
    EXPECT_EQ(true, same);
}

/*
 * This test creates a 2D Allocation with 512 * 512 Float Elements with
 * allocationCreateFromBitmap, and two float vector dataIn & dataOut. dataIn is
 * pre-populated with data, and copied into the Allocation using
 * allocationCopyToBitmap. Then the Allocation is copied into dataOut with
 * allocationRead.
 *
 * Calls: elementCreate, typeCreate, allocationCreateFromBitmap,
 * allocationCopyToBitmap, allocationRead
 *
 * Expect: dataIn & dataOut are the same.
 */
TEST_F(RenderscriptHidlTest, SimpleBitmapTest) {
    // float1
    Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
    // 512 x 512 x float1
    Type type = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE);
    std::vector<float> dataIn(512*512), dataOut1(512*512), dataOut2(512*512);
    std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
    hidl_vec<uint8_t> _data;
    _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(float));
    // 512 x 512 x float1
    Allocation allocation = context->allocationCreateFromBitmap(type,
                                                                AllocationMipmapControl::NONE,
                                                                _data,
                                                                (int)AllocationUsageType::SCRIPT);
    EXPECT_NE(allocation, Allocation(0));

    context->allocationCopyToBitmap(allocation, (Ptr)dataOut1.data(),
                                    (Size)dataOut1.size()*sizeof(float));
    bool same1 = std::all_of(dataOut1.begin(), dataOut1.end(),
                             [](float x){ static int val = 0; return x == (float)val++; });
    EXPECT_EQ(true, same1);

    context->allocationRead(allocation, (Ptr)dataOut2.data(), (Size)dataOut2.size()*sizeof(float));
    bool same2 = std::all_of(dataOut2.begin(), dataOut2.end(),
                             [](float x){ static int val = 0; return x == (float)val++; });
    EXPECT_EQ(true, same2);
}

/*
 * This test creates two 2D Allocations, one with 512 * 512 Float Elements, the
 * other with 256 * 256 Float Elements. The larger Allocation is pre-populated
 * with dataIn, and copied into the smaller Allocation using
 * allocationCopy2DRange. Then the Allocation is copied into dataOut with
 * allocationRead.
 *
 * Calls: elementCreate, typeCreate, allocationCreateFromBitmap,
 * allocationCreateTyped, allocationCopy2DRange, allocationRead
 *
 * Expect: dataIn & dataOut are the same.
 */
TEST_F(RenderscriptHidlTest, AllocationCopy2DRangeTest) {
    // float1
    Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
    // 512 x 512 x float1
    Type typeSrc = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE);
    // 256 x 256 x float1
    Type typeDst = context->typeCreate(element, 256, 256, 0, false, false, YuvFormat::YUV_NONE);
    std::vector<float> dataIn(512*512), dataOut(256*256), expected(256*256);
    std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
    hidl_vec<uint8_t> _data;
    _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(float));
    // 512 x 512 x float1
    Allocation allocSrc = context->allocationCreateFromBitmap(typeSrc,
                                                              AllocationMipmapControl::NONE, _data,
                                                              (int)AllocationUsageType::SCRIPT);
    // 256 x 256 x float1
    Allocation allocDst = context->allocationCreateTyped(typeDst, AllocationMipmapControl::NONE,
                                                         (int)AllocationUsageType::SCRIPT,
                                                         (Ptr)nullptr);
    context->allocationCopy2DRange(allocDst, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 256, 256,
                                   allocSrc, 128, 128, 0, AllocationCubemapFace::POSITIVE_X);
    context->allocationRead(allocDst, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float));
    for (int i = 0; i < 256; ++i) {
        for (int j = 0; j < 256; ++j) {
            expected[i*256 + j] = dataIn[(i+128)*512 + (j+128)];
        }
    }
    EXPECT_EQ(expected, dataOut);
}

/*
 * This test creates two 3D Allocations, one with 128 * 128 * 128 Float
 * Elements, the other with 64 * 64 * 64 Float Elements. The larger Allocation
 * is pre-populated with dataIn, and copied into the smaller Allocation using
 * allocationCopy3DRange. Then the Allocation is copied into dataOut with
 * allocationRead.
 *
 * Calls: elementCreate, typeCreate, allocationCreateTyped, allocation3DWrite,
 * allocationCopy3DRange, allocationRead
 *
 * Expect: dataIn & dataOut are the same.
 */
TEST_F(RenderscriptHidlTest, AllocationCopy3DRangeTest) {
    // float1
    Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
    // 128 x 128 x 128 x float1
    Type typeSrc = context->typeCreate(element, 128, 128, 128, false, false, YuvFormat::YUV_NONE);
    // 64 x 64 x 64 x float1
    Type typeDst = context->typeCreate(element, 64, 64, 64, false, false, YuvFormat::YUV_NONE);
    std::vector<float> dataIn(128*128*128), dataOut(64*64*64), expected(64*64*64);
    std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
    hidl_vec<uint8_t> _data;
    _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(float));
    // 512 x 512 x float1
    Allocation allocSrc = context->allocationCreateTyped(typeSrc, AllocationMipmapControl::NONE,
                                                         (int)AllocationUsageType::SCRIPT,
                                                         (Ptr)nullptr);
    // 256 x 256 x float1
    Allocation allocDst = context->allocationCreateTyped(typeDst, AllocationMipmapControl::NONE,
                                                         (int)AllocationUsageType::SCRIPT,
                                                         (Ptr)nullptr);
    context->allocation3DWrite(allocSrc, 0, 0, 0, 0, 128, 128, 128, _data, 128*sizeof(float));
    context->allocationCopy3DRange(allocDst, 0, 0, 0, 0, 64, 64, 64, allocSrc, 32, 32, 32, 0);
    context->allocationRead(allocDst, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float));
    for (int i = 0; i < 64; ++i) {
        for (int j = 0; j < 64; ++j) {
            for (int k = 0; k < 64; ++k) {
                expected[i*64*64 + j*64 + k] = dataIn[(i+32)*128*128 + (j+32)*128 + (k+32)];
            }
        }
    }
    EXPECT_EQ(expected, dataOut);
}

/*
 * This test creates one 2D Allocations, one with 512 * 512 Float Elements, and
 * one 2D AllocationAdapter with a window of 256 * 256 based on the Allocation.
 * The Allocation is pre-populated with dataIn. Then the Allocation is copied
 * into dataOut with allocationRead on the AllocationAdapter.
 *
 * Calls: elementCreate, typeCreate, allocationCreateFromBitmap,
 * allocationAdapterCreate, allocationAdapterOffset, allocation2DRead
 *
 * Expect: dataIn & dataOut are the same.
 */
TEST_F(RenderscriptHidlTest, SimpleAdapterTest) {
    // float1
    Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
    // 512 x 512 x float1
    Type type = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE);
    std::vector<float> dataIn(512*512), dataOut(256*256), expected;
    std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
    hidl_vec<uint8_t> _data;
    _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(float));
    // 512 x 512 x float1
    Allocation allocation = context->allocationCreateFromBitmap(type,
                                                                AllocationMipmapControl::NONE,
                                                                _data,
                                                                (int)AllocationUsageType::SCRIPT);
    // 256 x 256 x float1
    Type subType = context->typeCreate(element, 256, 256, 0, false, false, YuvFormat::YUV_NONE);
    // 256 x 256 x float1
    AllocationAdapter allocationAdapter = context->allocationAdapterCreate(subType, allocation);
    EXPECT_NE(AllocationAdapter(0), allocationAdapter);

    std::vector<uint32_t> offsets(9, 0);
    offsets[0] = 128;
    offsets[1] = 128;
    hidl_vec<uint32_t> _offsets;
    _offsets.setToExternal(offsets.data(), offsets.size());
    // origin at (128,128)
    context->allocationAdapterOffset(allocationAdapter, _offsets);

    context->allocation2DRead(allocationAdapter, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 256,
                              256, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float), 0);
    for (int i = 128; i < 128 + 256; ++i) {
        for (int j = 128; j < 128 + 256; ++j) {
            expected.push_back(i * 512 + j);
        }
    }
    EXPECT_EQ(expected, dataOut);
}

/*
 * This test creates one 2D Allocations, one with 64 * 64 USIGNED_8 Elements,
 * and with AllocationMipmapControl::FULL. The Allocation is pre-populated with
 * dataIn and the mipmaps are filled with allocationGenerateMipmaps. Then
 * dataOut is then overridden with allocation2DRead.
 *
 * Calls: elementCreate, typeCreate, allocationCreateTyped, allocation2DWrite,
 * allocationGenerateMipmaps, allocationSyncAll, allocation2DRead
 *
 * Expect: dataIn & dataOut are the same.
 */
TEST_F(RenderscriptHidlTest, SimpleMipmapTest) {
    // uint8_t
    Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
    // 64 x 64 x uint8_t
    Type type = context->typeCreate(element, 64, 64, 0, true, false, YuvFormat::YUV_NONE);
    std::vector<uint8_t> dataIn(64*64), dataOut(32*32), expected(32*32);
    std::generate(dataIn.begin(), dataIn.end(),
                  [](){ static int val = 0; return (uint8_t)(0xFF & val++); });
    hidl_vec<uint8_t> _data;
    _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(uint8_t));
    // 64 x 64 x uint8_t
    Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::FULL,
                                                         (int)AllocationUsageType::SCRIPT,
                                                         (Ptr)nullptr);
    context->allocation2DWrite(allocation, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 64, 64,
                               _data, 64*sizeof(uint8_t));
    context->allocationGenerateMipmaps(allocation);
    context->allocationSyncAll(allocation, AllocationUsageType::SCRIPT);
    context->allocation2DRead(allocation, 0, 0, 1, AllocationCubemapFace::POSITIVE_X, 32, 32,
                              (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(uint8_t),
                              32*sizeof(uint8_t));
    for (int i = 0; i < 32; ++i) {
        for (int j = 0; j < 32; ++j) {
            expected[i*32 + j] = ((uint32_t)dataIn[i*2*64 + j*2] + dataIn[i*2*64 + j*2 + 1] +
                                  dataIn[i*2*64 + j*2 + 64] + dataIn[i*2*64 + j*2 + 64+1]) / 4;
        }
    }
    EXPECT_EQ(expected, dataOut);
}

/*
 * This test creates one 2D Allocations, one with 128 * 128 Float Elements with
 * allocationCubeCreateFromBitmap. The Allocation is pre-populated with dataIn
 * and the mipmaps are filled with allocationGenerateMipmaps. Then dataOut is
 * then overridden with allocation2DRead.
 *
 * Calls: elementCreate, typeCreate, allocationCubeCreateFromBitmap,
 * allocation2DRead
 *
 * Expect: dataIn & dataOut are the same.
 */
TEST_F(RenderscriptHidlTest, SimpleCubemapTest) {
    // float1
    Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
    // 128 x 128 x float1
    Type type = context->typeCreate(element, 128, 128, 0, false, true, YuvFormat::YUV_NONE);
    std::vector<float> dataIn(128*128*6), dataOut(128*128), expected(128*128);
    std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
    hidl_vec<uint8_t> _data;
    _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(float));
    // 128 x 128 x float1 x 6
    Allocation allocation = context->allocationCubeCreateFromBitmap(
        type, AllocationMipmapControl::NONE, _data, (int)AllocationUsageType::SCRIPT);
    EXPECT_NE(Allocation(0), allocation);

    context->allocation2DRead(allocation, 0, 0, 0, AllocationCubemapFace::NEGATIVE_Z, 128,
                              128, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float),
                              128*sizeof(float));
    for (int i = 0; i < 128; ++i) {
        for (int j = 0; j < 128; ++j) {
            expected[i*128 + j] = i*128*6 + j + 128*5;
        }
    }
    EXPECT_EQ(expected, dataOut);
}

/*
 * This test creates a complex element type (uint8_t, uint32_t) out of known
 * elements. It then verifies the element structure was created correctly.
 * Finally, the test creates a 128-wide, 1-dimension allocation of this type
 * and transfers memory to and from this structure.
 *
 * Calls: elementCreate, elementComplexCreate, elementGetSubElements,
 * typeCreate, allocationCreateTyped, allocationElementWrite,
 * allocationElementRead
 *
 * This test currently has a bug, and should be fixed by 3/17.
 * TODO(butlermichael)
 */
/*
TEST_F(RenderscriptHidlTest, ComplexElementTest) {
    Element element1 = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
    Element element2 = context->elementCreate(DataType::UNSIGNED_32, DataKind::USER, false, 1);

    hidl_vec<Element> eins = {element1, element2};
    hidl_vec<hidl_string> names = {hidl_string("first"), hidl_string("second")};
    hidl_vec<Size> arraySizesPtr = {sizeof(uint8_t), sizeof(uint32_t)};
    Element element3 = context->elementComplexCreate(eins, names, arraySizesPtr);
    EXPECT_NE(Element(0), element3);

    std::vector<Element> ids;
    std::vector<std::string> namesOut;
    std::vector<Size> arraySizesOut;
    context->elementGetSubElements(element3, 2, [&](const hidl_vec<Element>& _ids,
                                                    const hidl_vec<hidl_string>& _names,
                                                    const hidl_vec<Size>& _arraySizes){
                                                        ids = _ids;
                                                        namesOut.push_back(_names[0]);
                                                        namesOut.push_back(_names[1]);
                                                        arraySizesOut = _arraySizes;
                                                    });
    EXPECT_NE(Element(0), ids[0]);
    EXPECT_NE(Element(0), ids[1]);
    EXPECT_EQ("first", namesOut[0]);
    EXPECT_EQ("second", namesOut[1]);
    EXPECT_EQ(sizeof(uint8_t), arraySizesOut[0]);
    EXPECT_EQ(sizeof(uint32_t), arraySizesOut[1]);

    // 128 x (uint8_t, uint32_t)
    Type type = context->typeCreate(element3, 128, 0, 0, false, false, YuvFormat::YUV_NONE);
    // 128 x (uint8_t, uint32_t)
    Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                           (int)AllocationUsageType::SCRIPT,
                                                           (Ptr)nullptr);
    std::vector<uint32_t> dataIn(128), dataOut(128);
    std::generate(dataIn.begin(), dataIn.end(), [](){ static uint32_t val = 0; return val++; });
    hidl_vec<uint8_t> _data;
    _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(uint32_t));
    context->allocationElementWrite(allocation, 0, 0, 0, 0, _data, 1);
    context->allocationElementRead(allocation, 0, 0, 0, 0, (Ptr)dataOut.data(),
                                   (Size)dataOut.size()*sizeof(uint32_t), 1);
    bool same = std::all_of(dataOut.begin(), dataOut.end(),
                            [](uint32_t x){ static uint32_t val = 0; return x == val++; });
    EXPECT_EQ(true, same);
}
*/
+48 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "VtsHalRenderscriptV1_0TargetTest.h"

// The main test class for RENDERSCRIPT HIDL HAL.
void RenderscriptHidlTest::SetUp() {
    device = ::testing::VtsHalHidlTargetTestBase::getService<IDevice>();
    ASSERT_NE(nullptr, device.get());

    uint32_t version = 0;
    uint32_t flags = 0;
    context = device->contextCreate(version, ContextType::NORMAL, flags);
    ASSERT_NE(nullptr, context.get());
}

void RenderscriptHidlTest::TearDown() {
    context->contextDestroy();
}

// A class for test environment setup (kept since this file is a template).
class RenderscriptHidlEnvironment : public ::testing::Environment {
public:
    virtual void SetUp() {}
    virtual void TearDown() {}
};


int main(int argc, char** argv) {
    ::testing::AddGlobalTestEnvironment(new RenderscriptHidlEnvironment);
    ::testing::InitGoogleTest(&argc, argv);
    int status = RUN_ALL_TESTS();
    LOG(INFO) << "Test result = " << status;
    return status;
}
Loading