Loading Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -13,11 +13,13 @@ subdirs = [ "tests/expression/1.0", "tests/foo/1.0", "tests/foo/1.0/default", "tests/foo/1.0/default/lib", "tests/libhwbinder/1.0", "tests/libhwbinder/1.0/default", "tests/msgq/1.0", "tests/pointer/1.0", "tests/pointer/1.0/default", "tests/pointer/1.0/default/lib", "wifi/1.0", "wifi/supplicant/1.0", ] tests/foo/1.0/default/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ cc_library_shared { shared_libs: [ "libbase", "libhidl", "libfootest", "libhwbinder", "liblog", "libutils", Loading tests/foo/1.0/default/Foo.cpp +2 −111 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ #include "Foo.h" #include "FooCallback.h" #include <android-base/logging.h> #include <hidl-test/FooHelper.h> #include <inttypes.h> #include <utils/Timers.h> Loading Loading @@ -108,7 +109,7 @@ Return<void> Foo::callMe( ALOGI("SERVER(Foo) callMe %p calling IFooCallback::heyItsYouIsntIt, " \ "should block for %" PRId64 " seconds", cb.get(), FooCallback::DELAY_S); DELAY_S); c[1] = systemTime(); bool answer = cb->heyItsYouIsntIt(cb); c[1] = systemTime() - c[1]; Loading Loading @@ -201,74 +202,6 @@ Return<void> Foo::haveAStringVec( return Void(); } // NOTE: duplicated code in hidl_test using std::to_string; static std::string to_string(const IFoo::StringMatrix5x3 &M); static std::string to_string(const IFoo::StringMatrix3x5 &M); static std::string to_string(const hidl_string &s); template<typename T> static std::string to_string(const T *elems, size_t n) { std::string out; out = "["; for (size_t i = 0; i < n; ++i) { if (i > 0) { out += ", "; } out += to_string(elems[i]); } out += "]"; return out; } template<typename T, size_t SIZE> static std::string to_string(const hidl_array<T, SIZE> &array) { return to_string(&array[0], SIZE); } template<typename T, size_t SIZE1, size_t SIZE2> static std::string to_string(const hidl_array<T, SIZE1, SIZE2> &array) { std::string out; out = "["; for (size_t i = 0; i < SIZE1; ++i) { if (i > 0) { out += ", "; } out += "["; for (size_t j = 0; j < SIZE2; ++j) { if (j > 0) { out += ", "; } out += to_string(array[i][j]); } out += "]"; } out += "]"; return out; } template<typename T> static std::string to_string(const hidl_vec<T> &vec) { return to_string(&vec[0], vec.size()); } static std::string to_string(const IFoo::StringMatrix5x3 &M) { return to_string(M.s); } static std::string to_string(const IFoo::StringMatrix3x5 &M) { return to_string(M.s); } static std::string to_string(const hidl_string &s) { return std::string("'") + s.c_str() + "'"; } Return<void> Foo::transposeMe( const hidl_array<float, 3, 5> &in, transposeMe_cb _cb) { ALOGI("SERVER(Foo) transposeMe(%s)", to_string(in).c_str()); Loading @@ -286,48 +219,6 @@ Return<void> Foo::transposeMe( return Void(); } // end duplicated code static std::string QuuxToString(const IFoo::Quux &val) { std::string s; s = "Quux(first='"; s += val.first.c_str(); s += "', last='"; s += val.last.c_str(); s += "')"; return s; } static std::string MultiDimensionalToString(const IFoo::MultiDimensional &val) { std::string s; s += "MultiDimensional("; s += "quuxMatrix=["; size_t k = 0; for (size_t i = 0; i < 5; ++i) { if (i > 0) { s += ", "; } s += "["; for (size_t j = 0; j < 3; ++j, ++k) { if (j > 0) { s += ", "; } s += QuuxToString(val.quuxMatrix[i][j]); } } s += "]"; s += ")"; return s; } Return<void> Foo::callingDrWho( const MultiDimensional &in, callingDrWho_cb _hidl_cb) { Loading tests/foo/1.0/default/FooCallback.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -3,7 +3,9 @@ #include "FooCallback.h" #include <android-base/logging.h> #include <hidl-test/FooHelper.h> #include <inttypes.h> #include <utils/Timers.h> namespace android { namespace hardware { Loading tests/foo/1.0/default/FooCallback.h +0 −6 Original line number Diff line number Diff line Loading @@ -6,7 +6,6 @@ #include <hidl/MQDescriptor.h> #include <utils/Condition.h> #include <utils/Timers.h> namespace android { namespace hardware { namespace tests { Loading @@ -30,11 +29,6 @@ struct FooCallback : public IFooCallback { Return<void> reportResults(int64_t ns, reportResults_cb _hidl_cb) override; Return<void> youBlockedMeFor(const hidl_array<int64_t, 3 /* 3 */>& callerBlockedInfo) override; static constexpr nsecs_t DELAY_S = 1; static constexpr nsecs_t DELAY_NS = seconds_to_nanoseconds(DELAY_S); static constexpr nsecs_t TOLERANCE_NS = milliseconds_to_nanoseconds(10); static constexpr nsecs_t ONEWAY_TOLERANCE_NS = milliseconds_to_nanoseconds(1); hidl_array<InvokeInfo, 3> invokeInfo; Mutex mLock; Condition mCond; Loading Loading
Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -13,11 +13,13 @@ subdirs = [ "tests/expression/1.0", "tests/foo/1.0", "tests/foo/1.0/default", "tests/foo/1.0/default/lib", "tests/libhwbinder/1.0", "tests/libhwbinder/1.0/default", "tests/msgq/1.0", "tests/pointer/1.0", "tests/pointer/1.0/default", "tests/pointer/1.0/default/lib", "wifi/1.0", "wifi/supplicant/1.0", ]
tests/foo/1.0/default/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ cc_library_shared { shared_libs: [ "libbase", "libhidl", "libfootest", "libhwbinder", "liblog", "libutils", Loading
tests/foo/1.0/default/Foo.cpp +2 −111 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ #include "Foo.h" #include "FooCallback.h" #include <android-base/logging.h> #include <hidl-test/FooHelper.h> #include <inttypes.h> #include <utils/Timers.h> Loading Loading @@ -108,7 +109,7 @@ Return<void> Foo::callMe( ALOGI("SERVER(Foo) callMe %p calling IFooCallback::heyItsYouIsntIt, " \ "should block for %" PRId64 " seconds", cb.get(), FooCallback::DELAY_S); DELAY_S); c[1] = systemTime(); bool answer = cb->heyItsYouIsntIt(cb); c[1] = systemTime() - c[1]; Loading Loading @@ -201,74 +202,6 @@ Return<void> Foo::haveAStringVec( return Void(); } // NOTE: duplicated code in hidl_test using std::to_string; static std::string to_string(const IFoo::StringMatrix5x3 &M); static std::string to_string(const IFoo::StringMatrix3x5 &M); static std::string to_string(const hidl_string &s); template<typename T> static std::string to_string(const T *elems, size_t n) { std::string out; out = "["; for (size_t i = 0; i < n; ++i) { if (i > 0) { out += ", "; } out += to_string(elems[i]); } out += "]"; return out; } template<typename T, size_t SIZE> static std::string to_string(const hidl_array<T, SIZE> &array) { return to_string(&array[0], SIZE); } template<typename T, size_t SIZE1, size_t SIZE2> static std::string to_string(const hidl_array<T, SIZE1, SIZE2> &array) { std::string out; out = "["; for (size_t i = 0; i < SIZE1; ++i) { if (i > 0) { out += ", "; } out += "["; for (size_t j = 0; j < SIZE2; ++j) { if (j > 0) { out += ", "; } out += to_string(array[i][j]); } out += "]"; } out += "]"; return out; } template<typename T> static std::string to_string(const hidl_vec<T> &vec) { return to_string(&vec[0], vec.size()); } static std::string to_string(const IFoo::StringMatrix5x3 &M) { return to_string(M.s); } static std::string to_string(const IFoo::StringMatrix3x5 &M) { return to_string(M.s); } static std::string to_string(const hidl_string &s) { return std::string("'") + s.c_str() + "'"; } Return<void> Foo::transposeMe( const hidl_array<float, 3, 5> &in, transposeMe_cb _cb) { ALOGI("SERVER(Foo) transposeMe(%s)", to_string(in).c_str()); Loading @@ -286,48 +219,6 @@ Return<void> Foo::transposeMe( return Void(); } // end duplicated code static std::string QuuxToString(const IFoo::Quux &val) { std::string s; s = "Quux(first='"; s += val.first.c_str(); s += "', last='"; s += val.last.c_str(); s += "')"; return s; } static std::string MultiDimensionalToString(const IFoo::MultiDimensional &val) { std::string s; s += "MultiDimensional("; s += "quuxMatrix=["; size_t k = 0; for (size_t i = 0; i < 5; ++i) { if (i > 0) { s += ", "; } s += "["; for (size_t j = 0; j < 3; ++j, ++k) { if (j > 0) { s += ", "; } s += QuuxToString(val.quuxMatrix[i][j]); } } s += "]"; s += ")"; return s; } Return<void> Foo::callingDrWho( const MultiDimensional &in, callingDrWho_cb _hidl_cb) { Loading
tests/foo/1.0/default/FooCallback.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -3,7 +3,9 @@ #include "FooCallback.h" #include <android-base/logging.h> #include <hidl-test/FooHelper.h> #include <inttypes.h> #include <utils/Timers.h> namespace android { namespace hardware { Loading
tests/foo/1.0/default/FooCallback.h +0 −6 Original line number Diff line number Diff line Loading @@ -6,7 +6,6 @@ #include <hidl/MQDescriptor.h> #include <utils/Condition.h> #include <utils/Timers.h> namespace android { namespace hardware { namespace tests { Loading @@ -30,11 +29,6 @@ struct FooCallback : public IFooCallback { Return<void> reportResults(int64_t ns, reportResults_cb _hidl_cb) override; Return<void> youBlockedMeFor(const hidl_array<int64_t, 3 /* 3 */>& callerBlockedInfo) override; static constexpr nsecs_t DELAY_S = 1; static constexpr nsecs_t DELAY_NS = seconds_to_nanoseconds(DELAY_S); static constexpr nsecs_t TOLERANCE_NS = milliseconds_to_nanoseconds(10); static constexpr nsecs_t ONEWAY_TOLERANCE_NS = milliseconds_to_nanoseconds(1); hidl_array<InvokeInfo, 3> invokeInfo; Mutex mLock; Condition mCond; Loading