diff options
author | Steven Moreland <smoreland@google.com> | 2019-05-28 17:29:17 -0700 |
---|---|---|
committer | Steven Moreland <smoreland@google.com> | 2019-05-28 17:29:17 -0700 |
commit | 13374bd7f2b9ed93009ec36b2cf062131875e2ee (patch) | |
tree | dd4c65b8d973e7120cf0b26eebd4724bc3ab0f47 /tests | |
parent | 6c1e451691f34dffcfa203071df766088e08c154 (diff) | |
download | platform_hardware_interfaces-13374bd7f2b9ed93009ec36b2cf062131875e2ee.tar.gz platform_hardware_interfaces-13374bd7f2b9ed93009ec36b2cf062131875e2ee.tar.bz2 platform_hardware_interfaces-13374bd7f2b9ed93009ec36b2cf062131875e2ee.zip |
Remove ref<>.
This type is unused and some parts of it has bitrot. In order to reduce
the complexity of new features, removing this.
Fixes: 131616631
Test: HIDL's test/run_all_device_tests.sh
Test: HIDL's test/run_all_host_tests.sh
Change-Id: Ib7f94053ab987ccb6858eec1cfd7e53fd7320ba3
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pointer/1.0/.hidl_for_test | 0 | ||||
-rw-r--r-- | tests/pointer/1.0/Android.bp | 14 | ||||
-rw-r--r-- | tests/pointer/1.0/IGraph.hal | 57 | ||||
-rw-r--r-- | tests/pointer/1.0/IPointer.hal | 91 | ||||
-rw-r--r-- | tests/pointer/1.0/default/Android.bp | 27 | ||||
-rw-r--r-- | tests/pointer/1.0/default/Graph.cpp | 89 | ||||
-rw-r--r-- | tests/pointer/1.0/default/Graph.h | 47 | ||||
-rw-r--r-- | tests/pointer/1.0/default/Pointer.cpp | 31 | ||||
-rw-r--r-- | tests/pointer/1.0/default/Pointer.h | 338 | ||||
-rw-r--r-- | tests/pointer/1.0/default/lib/Android.bp | 19 | ||||
-rw-r--r-- | tests/pointer/1.0/default/lib/PointerHelper.cpp | 40 | ||||
-rw-r--r-- | tests/pointer/1.0/default/lib/include/hidl-test/PointerHelper.h | 15 | ||||
-rw-r--r-- | tests/trie/1.0/types.hal | 8 |
13 files changed, 4 insertions, 772 deletions
diff --git a/tests/pointer/1.0/.hidl_for_test b/tests/pointer/1.0/.hidl_for_test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/pointer/1.0/.hidl_for_test +++ /dev/null diff --git a/tests/pointer/1.0/Android.bp b/tests/pointer/1.0/Android.bp deleted file mode 100644 index 26a826c429..0000000000 --- a/tests/pointer/1.0/Android.bp +++ /dev/null @@ -1,14 +0,0 @@ -// This file is autogenerated by hidl-gen -Landroidbp. - -hidl_interface { - name: "android.hardware.tests.pointer@1.0", - root: "android.hardware", - srcs: [ - "IGraph.hal", - "IPointer.hal", - ], - interfaces: [ - "android.hidl.base@1.0", - ], - gen_java: false, -} diff --git a/tests/pointer/1.0/IGraph.hal b/tests/pointer/1.0/IGraph.hal deleted file mode 100644 index 0853745da3..0000000000 --- a/tests/pointer/1.0/IGraph.hal +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -package android.hardware.tests.pointer@1.0; - -interface IGraph { - - struct Node { - int32_t data; - }; - struct Edge { - ref<Node> left; - ref<Node> right; - }; - struct Graph { - vec<Node> nodes; - vec<Edge> edges; - }; - - struct Theta { - int32_t data; - }; - struct Alpha { - ref<Theta> s_ptr; - }; - struct Beta { - ref<Theta> s_ptr; - }; - struct Gamma { - ref<Alpha> a_ptr; - ref<Beta> b_ptr; - }; - - passANode(Node n); - passAGraph(Graph g); - passTwoGraphs(ref<Graph> g1, ref<Graph> g2); - giveAGraph() generates (Graph g); - passAGamma(Gamma c); - passASimpleRef(ref<Alpha> a); - passASimpleRefS(ref<Theta> s); - giveASimpleRef() generates (ref<Alpha> a); - - getErrors() generates (int32_t errors); -}; diff --git a/tests/pointer/1.0/IPointer.hal b/tests/pointer/1.0/IPointer.hal deleted file mode 100644 index 4560a4a751..0000000000 --- a/tests/pointer/1.0/IPointer.hal +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -package android.hardware.tests.pointer@1.0; - -interface IPointer { - struct S { int32_t data; }; - struct A { S s; }; - // type declarations - struct Sam { int32_t data; }; - struct Ada { ref<Sam> s_ptr; }; - struct Bob { ref<Ada> a_ptr; ref<Sam> s_ptr; }; - struct Cin { Ada a; ref<Bob> b_ptr; }; - struct Dom { Cin c; }; - - typedef ref<int32_t> Int32Ptr; - typedef ref<Sam> SamPtr; - - struct Ptr { - ref<Ada>[5] ptr_array; - ref<Ada[5]> array_ptr; - Int32Ptr int_ptr; - ref<int32_t[5]> int_array_ptr; - ref<int32_t>[5] int_ptr_array; - ref<string> str_ref; - vec<ref<Ada>> a_ptr_vec; - ref<vec<Ada>> a_vec_ptr; - }; - - // test cases - foo1(Sam s, SamPtr s_ptr); - foo2(Sam s, Ada a); - foo3(Sam s, Ada a, Bob b); - foo4(ref<Sam> s_ptr); - foo5(Ada a, Bob b); - foo6(ref<Ada> a_ptr); - foo7(ref<Ada> a_ptr, ref<Bob> b_ptr); - foo8(Dom d); - foo9(ref<string> str_ref); - foo10(vec<ref<Sam>> s_ptr_vec); - foo11(ref<vec<Sam>> s_vec_ptr); - foo12(ref<Sam[5]> s_array_ref); - foo13(ref<Sam>[5] s_ref_array); - foo14(ref<ref<ref<Sam>>> s_3ptr); - foo15(ref<ref<ref<int32_t>>> i_3ptr); - foo16(Ptr p); - foo17(ref<Ptr> p); - foo18(ref<string> str_ref, ref<string> str_ref2, string str); - foo19(ref<vec<Ada>> a_vec_ref, vec<Ada> a_vec, ref<vec<Ada>> a_vec_ref2); - foo20(vec<ref<Sam>> s_ptr_vec); - foo21(ref<Ada[1][2][3]> a_array_ptr); - foo22(ref<Ada>[1][2][3] a_ptr_array); - - bar1() generates (Sam s, ref<Sam> s_ptr); - bar2() generates (Sam s, Ada a); - bar3() generates (Sam s, Ada a, Bob b); - bar4() generates (ref<Sam> s_ptr); - bar5() generates (Ada a, Bob b); - bar6() generates (ref<Ada> a_ptr); - bar7() generates (ref<Ada> a_ptr, ref<Bob> b_ptr); - bar8() generates (Dom d); - bar9() generates (ref<string> str_ref); - bar10() generates (vec<ref<Sam>> s_ptr_vec); - bar11() generates (ref<vec<Sam>> s_vec_ptr); - bar12() generates (ref<Sam[5]> s_array_ref); - bar13() generates (ref<Sam>[5] s_ref_array); - bar14() generates (ref<ref<ref<Sam>>> s_3ptr); - bar15() generates (ref<ref<ref<int32_t>>> i_3ptr); - bar16() generates (Ptr p); - bar17() generates (ref<Ptr> p); - bar18() generates (ref<string> str_ref, ref<string> str_ref2, string str); - bar19() generates (ref<vec<Ada>> a_vec_ref, vec<Ada> a_vec, ref<vec<Ada>> a_vec_ref2); - bar20() generates (vec<ref<Sam>> s_ptr_vec); - bar21() generates (ref<Ada[1][2][3]> a_array_ptr); - bar22() generates (ref<Ada>[1][2][3] a_ptr_array); - - getErrors() generates(int32_t errors); -}; diff --git a/tests/pointer/1.0/default/Android.bp b/tests/pointer/1.0/default/Android.bp deleted file mode 100644 index 4825ac75a3..0000000000 --- a/tests/pointer/1.0/default/Android.bp +++ /dev/null @@ -1,27 +0,0 @@ - - -cc_library { - name: "android.hardware.tests.pointer@1.0-impl", - defaults: ["hidl_defaults"], - relative_install_path: "hw", - srcs: [ - "Graph.cpp", - "Pointer.cpp", - ], - - shared_libs: [ - "libbase", - "libcutils", - "libhidlbase", - "libhidltransport", - "libhwbinder", - "libpointertest", - "liblog", - "libutils", - ], - - // These are static libs only for testing purposes and portability. Shared - // libs should be used on device. - static_libs: ["android.hardware.tests.pointer@1.0"], - -} diff --git a/tests/pointer/1.0/default/Graph.cpp b/tests/pointer/1.0/default/Graph.cpp deleted file mode 100644 index 5c8098b8b3..0000000000 --- a/tests/pointer/1.0/default/Graph.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#define LOG_TAG "hidl_test" - -#include "Graph.h" - -#include <log/log.h> - -#include <hidl-test/PointerHelper.h> - -#define PUSH_ERROR_IF(__cond__) if(__cond__) { errors.push_back(std::to_string(__LINE__) + ": " + #__cond__); } - -namespace android { -namespace hardware { -namespace tests { -namespace pointer { -namespace V1_0 { -namespace implementation { - -// Methods from ::android::hardware::tests::pointer::V1_0::IGraph follow. -Return<void> Graph::passAGraph(const IGraph::Graph& g) { - ALOGI("SERVER(Graph) passAGraph start."); - PUSH_ERROR_IF(!isSimpleGraph(g)); - // logSimpleGraph("SERVER(Graph) passAGraph:", g); - return Void(); -} - -Return<void> Graph::giveAGraph(giveAGraph_cb _cb) { - IGraph::Graph g; - simpleGraph(g); - _cb(g); - return Void(); -} - -Return<void> Graph::passANode(const IGraph::Node& n) { - PUSH_ERROR_IF(n.data != 10); - return Void(); -} - -Return<void> Graph::passTwoGraphs(IGraph::Graph const* g1, IGraph::Graph const* g2) { - PUSH_ERROR_IF(g1 != g2); - PUSH_ERROR_IF(!isSimpleGraph(*g1)); - logSimpleGraph("SERVER(Graph): passTwoGraphs", *g2); - return Void(); -} - -Return<void> Graph::passAGamma(const IGraph::Gamma& c) { - if(c.a_ptr == nullptr && c.b_ptr == nullptr) - return Void(); - ALOGI("SERVER(Graph) passAGamma received c.a = %p, c.b = %p, c.a->s = %p, c.b->s = %p", - c.a_ptr, c.b_ptr, c.a_ptr->s_ptr, c.b_ptr->s_ptr); - ALOGI("SERVER(Graph) passAGamma received data %d, %d", - (int)c.a_ptr->s_ptr->data, (int)c.b_ptr->s_ptr->data); - PUSH_ERROR_IF(c.a_ptr->s_ptr != c.b_ptr->s_ptr); - return Void(); -} -Return<void> Graph::passASimpleRef(const IGraph::Alpha * a_ptr) { - ALOGI("SERVER(Graph) passASimpleRef received %d", a_ptr->s_ptr->data); - PUSH_ERROR_IF(a_ptr->s_ptr->data != 500); - return Void(); -} -Return<void> Graph::passASimpleRefS(const IGraph::Theta * s_ptr) { - ALOGI("SERVER(Graph) passASimpleRefS received %d @ %p", s_ptr->data, s_ptr); - PUSH_ERROR_IF(s_ptr->data == 10); - return Void(); -} -Return<void> Graph::giveASimpleRef(giveASimpleRef_cb _cb) { - IGraph::Theta s; s.data = 500; - IGraph::Alpha a; a.s_ptr = &s; - _cb(&a); - return Void(); -} - -Return<int32_t> Graph::getErrors() { - if(!errors.empty()) { - for(const auto& e : errors) - ALOGW("SERVER(Graph) error: %s", e.c_str()); - } - return errors.size(); -} - -IGraph* HIDL_FETCH_IGraph(const char* /* name */) { - return new Graph(); -} - -} // namespace implementation -} // namespace V1_0 -} // namespace pointer -} // namespace tests -} // namespace hardware -} // namespace android diff --git a/tests/pointer/1.0/default/Graph.h b/tests/pointer/1.0/default/Graph.h deleted file mode 100644 index 03bd163a2c..0000000000 --- a/tests/pointer/1.0/default/Graph.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef ANDROID_HARDWARE_TESTS_POINTER_V1_0_GRAPH_H -#define ANDROID_HARDWARE_TESTS_POINTER_V1_0_GRAPH_H - -#include <android/hardware/tests/pointer/1.0/IGraph.h> -#include <hidl/Status.h> - -#include <hidl/MQDescriptor.h> -namespace android { -namespace hardware { -namespace tests { -namespace pointer { -namespace V1_0 { -namespace implementation { - -using ::android::hardware::tests::pointer::V1_0::IGraph; -using ::android::hardware::Return; -using ::android::hardware::Void; -using ::android::hardware::hidl_vec; -using ::android::hardware::hidl_string; -using ::android::sp; - -struct Graph : public IGraph { - // Methods from ::android::hardware::tests::pointer::V1_0::IGraph follow. - Return<void> passANode(const IGraph::Node& n) override; - Return<void> passAGraph(const IGraph::Graph& g) override; - Return<void> passTwoGraphs(::android::hardware::tests::pointer::V1_0::IGraph::Graph const* g1, ::android::hardware::tests::pointer::V1_0::IGraph::Graph const* g2) override; - Return<void> giveAGraph(giveAGraph_cb _hidl_cb) override; - Return<void> passAGamma(const IGraph::Gamma& c) override; - Return<void> passASimpleRef(::android::hardware::tests::pointer::V1_0::IGraph::Alpha const* a) override; - Return<void> passASimpleRefS(::android::hardware::tests::pointer::V1_0::IGraph::Theta const* s) override; - Return<void> giveASimpleRef(giveASimpleRef_cb _hidl_cb) override; - Return<int32_t> getErrors() override; -private: - std::vector<std::string> errors; - -}; - -extern "C" IGraph* HIDL_FETCH_IGraph(const char* name); - -} // namespace implementation -} // namespace V1_0 -} // namespace pointer -} // namespace tests -} // namespace hardware -} // namespace android - -#endif // ANDROID_HARDWARE_TESTS_POINTER_V1_0_GRAPH_H diff --git a/tests/pointer/1.0/default/Pointer.cpp b/tests/pointer/1.0/default/Pointer.cpp deleted file mode 100644 index 52712d4664..0000000000 --- a/tests/pointer/1.0/default/Pointer.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#define LOG_TAG "hidl_test" - -#include "Pointer.h" - -#include <log/log.h> - -namespace android { -namespace hardware { -namespace tests { -namespace pointer { -namespace V1_0 { -namespace implementation { - -Return<int32_t> Pointer::getErrors() { - if(!errors.empty()) { - for(const auto& e : errors) - ALOGW("SERVER(Pointer) error: %s", e.c_str()); - } - return errors.size(); -} - -IPointer* HIDL_FETCH_IPointer(const char* /* name */) { - return new Pointer(); -} - -} // namespace implementation -} // namespace V1_0 -} // namespace pointer -} // namespace tests -} // namespace hardware -} // namespace android diff --git a/tests/pointer/1.0/default/Pointer.h b/tests/pointer/1.0/default/Pointer.h deleted file mode 100644 index d6e3e4839c..0000000000 --- a/tests/pointer/1.0/default/Pointer.h +++ /dev/null @@ -1,338 +0,0 @@ -#ifndef ANDROID_HARDWARE_TESTS_POINTER_V1_0_POINTER_H -#define ANDROID_HARDWARE_TESTS_POINTER_V1_0_POINTER_H - -#include <android/hardware/tests/pointer/1.0/IPointer.h> -#include <hidl/Status.h> - -#include <hidl/MQDescriptor.h> - -// TODO move to Pointer.cpp so that I won't have weird macros in headers -#define PUSH_ERROR_IF(__cond__) if(__cond__) { errors.push_back(std::to_string(__LINE__) + ": " + #__cond__); } - -namespace android { -namespace hardware { -namespace tests { -namespace pointer { -namespace V1_0 { -namespace implementation { - -using ::android::hardware::tests::pointer::V1_0::IPointer; -using ::android::hardware::Return; -using ::android::hardware::Void; -using ::android::hardware::hidl_vec; -using ::android::hardware::hidl_string; -using ::android::sp; - -struct Pointer : public IPointer { -private: - std::vector<std::string> errors; -public: - Return<int32_t> getErrors() override; - Return<void> foo1(const IPointer::Sam& s, IPointer::Sam const* s_ptr) override { - PUSH_ERROR_IF(!(&s == s_ptr)); - return Void(); - } - Return<void> foo2(const IPointer::Sam& s, const IPointer::Ada& a) override { - PUSH_ERROR_IF(!(&s == a.s_ptr)); - return Void(); - } - Return<void> foo3(const IPointer::Sam& s, const IPointer::Ada& a, const IPointer::Bob& b) override { - PUSH_ERROR_IF(!(&a == b.a_ptr && a.s_ptr == b.s_ptr && a.s_ptr == &s)); - return Void(); - } - Return<void> foo4(IPointer::Sam const* s_ptr) override { - PUSH_ERROR_IF(!(s_ptr->data == 500)); - return Void(); - } - Return<void> foo5(const IPointer::Ada& a, const IPointer::Bob& b) override { - PUSH_ERROR_IF(!(a.s_ptr == b.s_ptr && b.a_ptr == &a)); - return Void(); - } - Return<void> foo6(IPointer::Ada const* a_ptr) override { - PUSH_ERROR_IF(!(a_ptr->s_ptr->data == 500)); - return Void(); - } - Return<void> foo7(IPointer::Ada const* a_ptr, IPointer::Bob const* b_ptr) override { - PUSH_ERROR_IF(!(a_ptr->s_ptr == b_ptr->s_ptr && a_ptr == b_ptr->a_ptr && a_ptr->s_ptr->data == 500)); - return Void(); - } - Return<void> foo8(const IPointer::Dom& d) override { - const IPointer::Cin& c = d.c; - PUSH_ERROR_IF(&c.a != c.b_ptr->a_ptr); - PUSH_ERROR_IF(c.a.s_ptr != c.b_ptr->s_ptr); - PUSH_ERROR_IF(c.a.s_ptr->data != 500); - return Void(); - } - Return<void> foo9(::android::hardware::hidl_string const* str_ref) override { - PUSH_ERROR_IF(!(strcmp(str_ref->c_str(), "meowmeowmeow") == 0)); - return Void(); - } - Return<void> foo10(const ::android::hardware::hidl_vec<IPointer::Sam const*>& s_ptr_vec) override { - PUSH_ERROR_IF(s_ptr_vec[0]->data != 500); - if(s_ptr_vec.size() != 5) { - errors.push_back("foo10: s_ptr_vec.size() != 5"); - return Void(); - } - for(size_t i = 0; i < s_ptr_vec.size(); i++) - PUSH_ERROR_IF(s_ptr_vec[0] != s_ptr_vec[i]); - return Void(); - } - Return<void> foo11(::android::hardware::hidl_vec<IPointer::Sam> const* s_vec_ptr) override { - if(s_vec_ptr->size() != 5) { - errors.push_back("foo11: s_vec_ptr->size() != 5"); - return Void(); - } - for(size_t i = 0; i < 5; i++) - PUSH_ERROR_IF((*s_vec_ptr)[i].data != 500); - return Void(); - } - Return<void> foo12(hidl_array<IPointer::Sam, 5> const* s_array_ref) override { - for(size_t i = 0; i < 5; ++i) - PUSH_ERROR_IF((*s_array_ref)[i].data != 500); - return Void(); - } - Return<void> foo13(const hidl_array<IPointer::Sam const*, 5>& s_ref_array) override { - PUSH_ERROR_IF(s_ref_array[0]->data != 500) - for(size_t i = 0; i < 5; i++) - PUSH_ERROR_IF(s_ref_array[i] != s_ref_array[0]) - return Void(); - } - Return<void> foo14(IPointer::Sam const* const* const* s_3ptr) override { - PUSH_ERROR_IF(!((***s_3ptr).data == 500)) - return Void(); - } - Return<void> foo15(int32_t const* const* const* i_3ptr) override { - PUSH_ERROR_IF(!((***i_3ptr) == 500)) - return Void(); - } - - Return<void> foo16(const IPointer::Ptr& p) override { - PUSH_ERROR_IF((*p.array_ptr)[0].s_ptr->data != 500); - for(size_t i = 0; i < 5; i++) PUSH_ERROR_IF((*p.array_ptr)[i].s_ptr != (*p.array_ptr)[0].s_ptr); - PUSH_ERROR_IF(*(p.int_ptr) != 500); - for(size_t i = 0; i < 5; i++) PUSH_ERROR_IF((*p.int_array_ptr)[i] != 500); - for(size_t i = 0; i < 5; i++) PUSH_ERROR_IF(p.int_ptr_array[i] != p.int_ptr); - PUSH_ERROR_IF(p.a_ptr_vec.size() != 5); - PUSH_ERROR_IF(p.a_ptr_vec[0]->s_ptr->data != 500); - for(size_t i = 0; i < 5; i++) PUSH_ERROR_IF(p.a_ptr_vec[i]->s_ptr != p.a_ptr_vec[0]->s_ptr); - PUSH_ERROR_IF(strcmp(p.str_ref->c_str(), "meowmeowmeow") != 0); - PUSH_ERROR_IF(p.a_vec_ptr->size() != 5); - PUSH_ERROR_IF((*p.a_vec_ptr)[0].s_ptr->data != 500); - for(size_t i = 0; i < 5; i++) PUSH_ERROR_IF((*p.a_vec_ptr)[i].s_ptr != (*p.a_vec_ptr)[0].s_ptr); - return Void(); - }; - Return<void> foo17(IPointer::Ptr const* p) override { - return foo16(*p); - }; - Return<void> foo18(hidl_string const* str_ref, hidl_string const* str_ref2, const hidl_string& str) override { - PUSH_ERROR_IF(&str != str_ref); - PUSH_ERROR_IF(str_ref != str_ref2); - PUSH_ERROR_IF(strcmp(str.c_str(), "meowmeowmeow") != 0) - return Void(); - }; - Return<void> foo19( - hidl_vec<IPointer::Ada> const* a_vec_ref, - const hidl_vec<IPointer::Ada>& a_vec, - hidl_vec<IPointer::Ada> const* a_vec_ref2) { - PUSH_ERROR_IF(&a_vec != a_vec_ref); - PUSH_ERROR_IF(a_vec_ref2 != a_vec_ref); - PUSH_ERROR_IF(a_vec.size() != 5); - PUSH_ERROR_IF(a_vec[0].s_ptr->data != 500); - for(size_t i = 0; i < 5; i++) - PUSH_ERROR_IF(a_vec[i].s_ptr != a_vec[0].s_ptr); - return Void(); - }; - - Return<void> foo20(const hidl_vec<IPointer::Sam const*>&) override { - return Void(); - } - Return<void> foo21(hidl_array<IPointer::Ada, 1, 2, 3> const* a_array_ptr) override { - const hidl_array<IPointer::Ada, 1, 2, 3>& a_array = *a_array_ptr; - PUSH_ERROR_IF(a_array[0][0][0].s_ptr->data != 500); - for(size_t i = 0; i < 1; i++) - for(size_t j = 0; j < 2; j++) - for(size_t k = 0; k < 3; k++) - PUSH_ERROR_IF(a_array[i][j][k].s_ptr != a_array[0][0][0].s_ptr); - return Void(); - } - Return<void> foo22(const hidl_array<IPointer::Ada const*, 1, 2, 3>& a_ptr_array) override { - PUSH_ERROR_IF(a_ptr_array[0][0][0]->s_ptr->data != 500); - for(size_t i = 0; i < 1; i++) - for(size_t j = 0; j < 2; j++) - for(size_t k = 0; k < 3; k++) - PUSH_ERROR_IF(a_ptr_array[i][j][k] != a_ptr_array[0][0][0]); - return Void(); - } - - IPointer::Sam *s; - IPointer::Ada *a; - IPointer::Bob *b; - IPointer::Cin *c; - IPointer::Dom *d; - - IPointer::Ptr p; - hidl_array<IPointer::Ada, 5> a_array; - int32_t someInt; - hidl_array<int32_t, 5> someIntArray; - hidl_string str; - hidl_vec<IPointer::Ada> a_vec; - Pointer() { - d = new IPointer::Dom(); - s = new IPointer::Sam(); - b = new IPointer::Bob(); - c = &d->c; - a = &c->a; - b->s_ptr = a->s_ptr = s; - b->a_ptr = a; - c->b_ptr = b; - s->data = 500; - - someInt = 500; - for(size_t i = 0; i < 5; i++) someIntArray[i] = 500; - - for(size_t i = 0; i < 5; i++) a_array[i] = *a; - - for(size_t i = 0; i < 5; i++) p.ptr_array[i] = a; - p.array_ptr = &a_array; - p.int_ptr = &someInt; - p.int_array_ptr = &someIntArray; - for(size_t i = 0; i < 5; i++) p.int_ptr_array[i] = &someInt; - p.a_ptr_vec.resize(5); - for(size_t i = 0; i < 5; i++) p.a_ptr_vec[i] = a; - str = "meowmeowmeow"; - p.str_ref = &str; - a_vec.resize(5); - for(size_t i = 0; i < 5; i++) a_vec[i].s_ptr = s; - p.a_vec_ptr = &a_vec; - } - ~Pointer() { - delete d; delete s; delete b; - } - Return<void> bar1(bar1_cb _cb) override { - _cb(*s, s); - return Void(); - } - Return<void> bar2(bar2_cb _cb) override { - _cb(*s, *a); - return Void(); - } - Return<void> bar3(bar3_cb _cb) override { - _cb(*s, *a, *b); - return Void(); - } - Return<void> bar4(bar4_cb _cb) override { - _cb(s); - return Void(); - } - Return<void> bar5(bar5_cb _cb) override { - _cb(*a, *b); - return Void(); - } - Return<void> bar6(bar6_cb _cb) override { - _cb(a); - return Void(); - } - Return<void> bar7(bar7_cb _cb) override { - _cb(a, b); - return Void(); - } - Return<void> bar8(bar8_cb _cb) override { - _cb(*d); - return Void(); - } - Return<void> bar9(bar9_cb _cb) override { - _cb(&str); - return Void(); - } - Return<void> bar10(bar10_cb _cb) override { - hidl_vec<const IPointer::Sam *> v; v.resize(5); - for(size_t i = 0; i < 5; i++) v[i] = s; - _cb(v); - return Void(); - } - Return<void> bar11(bar11_cb _cb) override { - hidl_vec<IPointer::Sam> v; v.resize(5); - for(size_t i = 0; i < 5; i++) v[i].data = 500; - _cb(&v); - return Void(); - } - Return<void> bar12(bar12_cb _cb) override { - hidl_array<IPointer::Sam, 5> array; - for(size_t i = 0; i < 5; i++) array[i] = *s; - _cb(&array); - return Void(); - } - Return<void> bar13(bar13_cb _cb) override { - hidl_array<const IPointer::Sam *, 5> array; - for(size_t i = 0; i < 5; i++) array[i] = s; - _cb(array); - return Void(); - } - Return<void> bar14(bar14_cb _cb) override { - IPointer::Sam const* p1 = s; - IPointer::Sam const* const* p2 = &p1; - _cb(&p2); - return Void(); - } - Return<void> bar15(bar15_cb _cb) override { - int32_t const* p1 = &someInt; - int32_t const* const* p2 = &p1; - _cb(&p2); - return Void(); - } - Return<void> bar16(bar16_cb _cb) override { - _cb(p); - return Void(); - } - Return<void> bar17(bar17_cb _cb) override { - _cb(&p); - return Void(); - } - Return<void> bar18(bar18_cb _cb) override { - _cb(&str, &str, str); - return Void(); - } - Return<void> bar19(bar19_cb _cb) override { - _cb(&a_vec, a_vec, &a_vec); - return Void(); - } - Return<void> bar20(bar20_cb _cb) override { - // 1026 == PARCEL_REF_CAP + 2. - // 1026 means 1 writeBuffer and 1025 writeReferences. 1025 > PARCEL_REF_CAP. - hidl_vec<const IPointer::Sam *> v; v.resize(1026); - for(size_t i = 0; i < 1026; i++) v[i] = s; - _cb(v); - return Void(); - } - Return<void> bar21(bar21_cb _cb) override { - hidl_array<IPointer::Ada, 1, 2, 3> a_array; - for(size_t i = 0; i < 1; i++) - for(size_t j = 0; j < 2; j++) - for(size_t k = 0; k < 3; k++) - a_array[i][j][k] = *a; - _cb(&a_array); - return Void(); - } - Return<void> bar22(bar22_cb _cb) override { - hidl_array<const IPointer::Ada *, 1, 2, 3> a_ptr_array; - for(size_t i = 0; i < 1; i++) - for(size_t j = 0; j < 2; j++) - for(size_t k = 0; k < 3; k++) - a_ptr_array[i][j][k] = a; - _cb(a_ptr_array); - return Void(); - } -}; - -extern "C" IPointer* HIDL_FETCH_IPointer(const char* name); - -} // namespace implementation -} // namespace V1_0 -} // namespace pointer -} // namespace tests -} // namespace hardware -} // namespace android - -#undef PUSH_ERROR_IF - -#endif // ANDROID_HARDWARE_TESTS_POINTER_V1_0_POINTER_H diff --git a/tests/pointer/1.0/default/lib/Android.bp b/tests/pointer/1.0/default/lib/Android.bp deleted file mode 100644 index 180906b9dd..0000000000 --- a/tests/pointer/1.0/default/lib/Android.bp +++ /dev/null @@ -1,19 +0,0 @@ -cc_library { - name: "libpointertest", - defaults: ["hidl_defaults"], - srcs: [ - "PointerHelper.cpp" - ], - - shared_libs: [ - "libbase", - "libhidlbase", - "libhidltransport", - "liblog", - ], - static_libs: ["android.hardware.tests.pointer@1.0"], - - local_include_dirs: ["include/hidl-test"], - export_include_dirs: ["include"], - -} diff --git a/tests/pointer/1.0/default/lib/PointerHelper.cpp b/tests/pointer/1.0/default/lib/PointerHelper.cpp deleted file mode 100644 index 0a64cc383e..0000000000 --- a/tests/pointer/1.0/default/lib/PointerHelper.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#define LOG_TAG "hidl_test" - -#include <log/log.h> - -#include "PointerHelper.h" - -namespace android { - -void simpleGraph(IGraph::Graph& g) { - g.nodes.resize(2); - g.edges.resize(1); - g.nodes[0].data = 10; - g.nodes[1].data = 20; - g.edges[0].left = &g.nodes[0]; - g.edges[0].right = &g.nodes[1]; -} - -bool isSimpleGraph(const IGraph::Graph &g) { - if(g.nodes.size() != 2) return false; - if(g.edges.size() != 1) return false; - if(g.nodes[0].data != 10) return false; - if(g.nodes[1].data != 20) return false; - if(g.edges[0].left != &g.nodes[0]) return false; - if(g.edges[0].right != &g.nodes[1]) return false; - return true; -} - -void logSimpleGraph(const char *prefix, const IGraph::Graph& g) { - ALOGI("%s Graph %p, %d nodes, %d edges", prefix, &g, (int)g.nodes.size(), (int)g.edges.size()); - std::ostringstream os; - for(size_t i = 0; i < g.nodes.size(); i++) - os << &g.nodes[i] << " = " << g.nodes[i].data << ", "; - ALOGI("%s Nodes: [%s]", prefix, os.str().c_str()); - os.str(""); - os.clear(); - for(size_t i = 0; i < g.edges.size(); i++) - os << g.edges[i].left << " -> " << g.edges[i].right << ", "; - ALOGI("%s Edges: [%s]", prefix, os.str().c_str()); -} -} // namespace android diff --git a/tests/pointer/1.0/default/lib/include/hidl-test/PointerHelper.h b/tests/pointer/1.0/default/lib/include/hidl-test/PointerHelper.h deleted file mode 100644 index cd2edcb6fa..0000000000 --- a/tests/pointer/1.0/default/lib/include/hidl-test/PointerHelper.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef ANDROID_HIDL_TEST_POINTER_HELPER_H -#define ANDROID_HIDL_TEST_POINTER_HELPER_H - -#include <android/hardware/tests/pointer/1.0/IGraph.h> - -using ::android::hardware::tests::pointer::V1_0::IGraph; - -namespace android { - -void simpleGraph(IGraph::Graph& g); -bool isSimpleGraph(const IGraph::Graph &g); -void logSimpleGraph(const char *prefix, const IGraph::Graph& g); - -} // namespace android -#endif // ANDROID_HIDL_TEST_POINTER_HELPER_H diff --git a/tests/trie/1.0/types.hal b/tests/trie/1.0/types.hal index c62690947a..889d3b2b03 100644 --- a/tests/trie/1.0/types.hal +++ b/tests/trie/1.0/types.hal @@ -29,16 +29,16 @@ struct TrieNode { // Some forward reference tests. struct A { - ref<B> b; + vec<B> b; }; struct B { - ref<A> a; + vec<A> a; }; -typedef ref<S> refS; +typedef vec<S> vecS; struct S { - refS f; + vecS f; }; enum E2 : E1 { |