diff --git a/tests/bar/1.0/default/Bar.cpp b/tests/bar/1.0/default/Bar.cpp index c07e2fabdc..b3f971a18b 100644 --- a/tests/bar/1.0/default/Bar.cpp +++ b/tests/bar/1.0/default/Bar.cpp @@ -2,7 +2,7 @@ #define LOG_TAG "hidl_test" #include "Bar.h" -#include +#include #include namespace android { diff --git a/tests/foo/1.0/default/Foo.cpp b/tests/foo/1.0/default/Foo.cpp index 7053b44251..5a51532e19 100644 --- a/tests/foo/1.0/default/Foo.cpp +++ b/tests/foo/1.0/default/Foo.cpp @@ -17,7 +17,7 @@ namespace implementation { // Methods from ::android::hardware::tests::foo::V1_0::IFoo follow. Return Foo::doThis(float param) { - ALOGI("SERVER(Foo) doThis(%.2f)", param); + LOG(INFO) << "SERVER(Foo) doThis(" << param << ")"; return Void(); } @@ -49,7 +49,7 @@ Return Foo::doQuiteABit( Return Foo::doSomethingElse( const hidl_array ¶m, doSomethingElse_cb _cb) { - ALOGI("SERVER(Foo) doSomethingElse(...)"); + LOG(INFO) << "SERVER(Foo) doSomethingElse(...)"; hidl_array result; for (size_t i = 0; i < 15; ++i) { @@ -66,7 +66,7 @@ Return Foo::doSomethingElse( Return Foo::doStuffAndReturnAString( doStuffAndReturnAString_cb _cb) { - ALOGI("SERVER(Foo) doStuffAndReturnAString"); + LOG(INFO) << "SERVER(Foo) doStuffAndReturnAString"; _cb("Hello, world"); @@ -75,7 +75,7 @@ Return Foo::doStuffAndReturnAString( Return Foo::mapThisVector( const hidl_vec ¶m, mapThisVector_cb _cb) { - ALOGI("SERVER(Foo) mapThisVector"); + LOG(INFO) << "SERVER(Foo) mapThisVector"; hidl_vec out; out.resize(param.size()); @@ -91,80 +91,98 @@ Return Foo::mapThisVector( Return Foo::callMe( const sp &cb) { - ALOGI("SERVER(Foo) callMe %p", cb.get()); + LOG(INFO) << "SERVER(Foo) callMe " << cb.get(); if (cb != NULL) { - hidl_array c; - ALOGI("SERVER(Foo) callMe %p calling IFooCallback::heyItsYou, " \ - "should return immediately", cb.get()); + LOG(INFO) << "SERVER(Foo) callMe " + << cb.get() + << " calling IFooCallback::heyItsYou, should return immediately"; c[0] = systemTime(); cb->heyItsYou(cb); c[0] = systemTime() - c[0]; - ALOGI("SERVER(Foo) callMe %p calling IFooCallback::heyItsYou " \ - "returned after %" PRId64 "ns", cb.get(), c[0]); - - ALOGI("SERVER(Foo) callMe %p calling IFooCallback::heyItsYouIsntIt, " \ - "should block for %" PRId64 " seconds", cb.get(), - DELAY_S); + LOG(INFO) << "SERVER(Foo) callMe " + << cb.get() + << " calling IFooCallback::heyItsYou, returned after" + << c[0] + << "ns"; + LOG(INFO) << "SERVER(Foo) callMe " + << cb.get() + << " calling IFooCallback::heyItsYouIsntIt, should block for" + << DELAY_S + << " seconds"; c[1] = systemTime(); Return ret = cb->heyItsYouIsntIt(cb); if (!ret.isOk()) { - ALOGE("SERVER(Foo) callMe %p encountered transport error (%d).", - cb.get(), ret.getStatus().exceptionCode()); + LOG(ERROR) << "SERVER(Foo) callMe " + << cb.get() + << " encountered transport error (" + << ret.getStatus().exceptionCode() + << ")."; return Void(); } bool answer = ret.get(); c[1] = systemTime() - c[1]; - ALOGI("SERVER(Foo) callMe %p IFooCallback::heyItsYouIsntIt " \ - "responded with %d after %" PRId64 "ns", cb.get(), answer, c[1]); - ALOGI("SERVER(Foo) callMe %p calling " \ - "IFooCallback::heyItsTheMeaningOfLife, " \ - "should return immediately ", cb.get()); + LOG(INFO) << "SERVER(Foo) callMe " + << cb.get() + << " calling IFooCallback::heyItsYouIsntIt, responded with " + << answer + << " after " + << c[1] + << "ns"; + + LOG(INFO) << "SERVER(Foo) callMe " + << cb.get() + << " calling IFooCallback::heyItsTheMeaningOfLife," + << " should return immediately"; c[2] = systemTime(); cb->heyItsTheMeaningOfLife(42); c[2] = systemTime() - c[2]; - ALOGI("SERVER(Foo) callMe %p After call to " \ - "IFooCallback::heyItsTheMeaningOfLife " \ - "responded after %" PRId64 "ns", cb.get(), c[2]); - ALOGI("SERVER(Foo) callMe %p calling IFooCallback::youBlockedMeFor " \ - "to report times", cb.get()); + LOG(INFO) << "SERVER(Foo) callMe " + << cb.get() + << " cAfter call to IFooCallback::heyItsTheMeaningOfLife responded after " + << c[2] + << "ns"; + LOG(INFO) << "SERVER(Foo) callMe " + << cb.get() + << " calling IFooCallback::youBlockedMeFor to report times"; cb->youBlockedMeFor(c); - ALOGI("SERVER(Foo) callMe %p After call to " \ - "IFooCallback::heyYouBlockedMeFor", cb.get()); + LOG(INFO) << "SERVER(Foo) callMe " + << cb.get() + << " After call to IFooCallback::youBlockedMeFor"; } return Void(); } Return Foo::useAnEnum(SomeEnum param) { - ALOGI("SERVER(Foo) useAnEnum %d", (int)param); + LOG(INFO) << "SERVER(Foo) useAnEnum " << (int)param; return SomeEnum::goober; } Return Foo::haveAGooberVec(const hidl_vec& param) { - ALOGI("SERVER(Foo) haveAGooberVec ¶m = %p", ¶m); + LOG(INFO) << "SERVER(Foo) haveAGooberVec ¶m = " << ¶m; return Void(); } Return Foo::haveAGoober(const Goober &g) { - ALOGI("SERVER(Foo) haveaGoober g=%p", &g); + LOG(INFO) << "SERVER(Foo) haveaGoober g=" << &g; return Void(); } Return Foo::haveAGooberArray(const hidl_array & /* lots */) { - ALOGI("SERVER(Foo) haveAGooberArray"); + LOG(INFO) << "SERVER(Foo) haveAGooberArray"; return Void(); } Return Foo::haveATypeFromAnotherFile(const Abc &def) { - ALOGI("SERVER(Foo) haveATypeFromAnotherFile def=%p", &def); + LOG(INFO) << "SERVER(Foo) haveATypeFromAnotherFile def=" << &def; return Void(); } @@ -172,10 +190,14 @@ Return Foo::haveATypeFromAnotherFile(const Abc &def) { Return Foo::haveSomeStrings( const hidl_array &array, haveSomeStrings_cb _cb) { - ALOGI("SERVER(Foo) haveSomeStrings([\"%s\", \"%s\", \"%s\"])", - array[0].c_str(), - array[1].c_str(), - array[2].c_str()); + + LOG(INFO) << "SERVER(Foo) haveSomeStrings([\"" + << array[0].c_str() + << "\", \"" + << array[1].c_str() + << "\", \"" + << array[2].c_str() + << "\"])"; hidl_array result; result[0] = "Hello"; @@ -189,10 +211,13 @@ Return Foo::haveSomeStrings( Return Foo::haveAStringVec( const hidl_vec &vector, haveAStringVec_cb _cb) { - ALOGI("SERVER(Foo) haveAStringVec([\"%s\", \"%s\", \"%s\"])", - vector[0].c_str(), - vector[1].c_str(), - vector[2].c_str()); + LOG(INFO) << "SERVER(Foo) haveAStringVec([\"" + << vector[0].c_str() + << "\", \"" + << vector[1].c_str() + << "\", \"" + << vector[2].c_str() + << "\"])"; hidl_vec result; result.resize(2); @@ -207,7 +232,7 @@ Return Foo::haveAStringVec( Return Foo::transposeMe( const hidl_array &in, transposeMe_cb _cb) { - ALOGI("SERVER(Foo) transposeMe(%s)", to_string(in).c_str()); + LOG(INFO) << "SERVER(Foo) transposeMe(" << to_string(in).c_str() << ")"; hidl_array out; for (size_t i = 0; i < 5; ++i) { @@ -216,7 +241,7 @@ Return Foo::transposeMe( } } - ALOGI("SERVER(Foo) transposeMe returning %s", to_string(out).c_str()); + LOG(INFO) << "SERVER(Foo) transposeMe returning " << to_string(out).c_str(); _cb(out); @@ -225,7 +250,7 @@ Return Foo::transposeMe( Return Foo::callingDrWho( const MultiDimensional &in, callingDrWho_cb _hidl_cb) { - ALOGI("SERVER(Foo) callingDrWho(%s)", MultiDimensionalToString(in).c_str()); + LOG(INFO) << "SERVER(Foo) callingDrWho(" << MultiDimensionalToString(in).c_str() << ")"; MultiDimensional out; for (size_t i = 0; i < 5; ++i) { diff --git a/tests/foo/1.0/default/FooCallback.cpp b/tests/foo/1.0/default/FooCallback.cpp index e4704f2b5c..ff3a5457d3 100644 --- a/tests/foo/1.0/default/FooCallback.cpp +++ b/tests/foo/1.0/default/FooCallback.cpp @@ -2,7 +2,7 @@ #define LOG_TAG "hidl_test" #include "FooCallback.h" -#include +#include #include #include #include diff --git a/tests/inheritance/1.0/default/Child.cpp b/tests/inheritance/1.0/default/Child.cpp index 66720b3c1f..fd6608cc47 100644 --- a/tests/inheritance/1.0/default/Child.cpp +++ b/tests/inheritance/1.0/default/Child.cpp @@ -1,5 +1,5 @@ #define LOG_TAG "hidl_test" -#include +#include #include "Child.h" diff --git a/tests/inheritance/1.0/default/Fetcher.cpp b/tests/inheritance/1.0/default/Fetcher.cpp index 74f8d074e9..f3b576bedb 100644 --- a/tests/inheritance/1.0/default/Fetcher.cpp +++ b/tests/inheritance/1.0/default/Fetcher.cpp @@ -28,7 +28,7 @@ Return selectService(bool sendRemote, CB &_hidl_cb, sp &local) { } else { toSend = local; } - ALOGI("SERVER(Fetcher) selectService returning %p", toSend.get()); + LOG(INFO) << "SERVER(Fetcher) selectService returning " << toSend.get(); _hidl_cb(toSend); return Void(); } diff --git a/tests/inheritance/1.0/default/Parent.cpp b/tests/inheritance/1.0/default/Parent.cpp index bdd20c9539..a6fd9113ca 100644 --- a/tests/inheritance/1.0/default/Parent.cpp +++ b/tests/inheritance/1.0/default/Parent.cpp @@ -1,5 +1,5 @@ #define LOG_TAG "hidl_test" -#include +#include #include "Parent.h" diff --git a/tests/pointer/1.0/default/Graph.cpp b/tests/pointer/1.0/default/Graph.cpp index 5aa2243fff..985240760c 100644 --- a/tests/pointer/1.0/default/Graph.cpp +++ b/tests/pointer/1.0/default/Graph.cpp @@ -1,5 +1,7 @@ +#define LOG_TAG "hidl_test" + #include "Graph.h" -#include +#include #include #define PUSH_ERROR_IF(__cond__) if(__cond__) { errors.push_back(std::to_string(__LINE__) + ": " + #__cond__); } diff --git a/tests/pointer/1.0/default/Pointer.cpp b/tests/pointer/1.0/default/Pointer.cpp index d7cd772873..2b4a323159 100644 --- a/tests/pointer/1.0/default/Pointer.cpp +++ b/tests/pointer/1.0/default/Pointer.cpp @@ -1,4 +1,7 @@ +#define LOG_TAG "hidl_test" + #include "Pointer.h" +#include namespace android { namespace hardware { @@ -7,6 +10,14 @@ namespace pointer { namespace V1_0 { namespace implementation { +Return 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(); } diff --git a/tests/pointer/1.0/default/Pointer.h b/tests/pointer/1.0/default/Pointer.h index 87b0f56f0c..d6e3e4839c 100644 --- a/tests/pointer/1.0/default/Pointer.h +++ b/tests/pointer/1.0/default/Pointer.h @@ -2,7 +2,6 @@ #define ANDROID_HARDWARE_TESTS_POINTER_V1_0_POINTER_H #include -#include #include #include @@ -28,13 +27,7 @@ struct Pointer : public IPointer { private: std::vector errors; public: - Return getErrors() { - if(!errors.empty()) { - for(const auto& e : errors) - ALOGW("SERVER(Pointer) error: %s", e.c_str()); - } - return errors.size(); - } + Return getErrors() override; Return foo1(const IPointer::Sam& s, IPointer::Sam const* s_ptr) override { PUSH_ERROR_IF(!(&s == s_ptr)); return Void(); @@ -71,9 +64,6 @@ public: return Void(); } Return foo9(::android::hardware::hidl_string const* str_ref) override { - ALOGI("SERVER(Pointer) foo9 got string @ %p (size = %ld) \"%s\"", - str_ref->c_str(), - (unsigned long) str_ref->size(), str_ref->c_str()); PUSH_ERROR_IF(!(strcmp(str_ref->c_str(), "meowmeowmeow") == 0)); return Void(); } diff --git a/tests/pointer/1.0/default/lib/PointerHelper.cpp b/tests/pointer/1.0/default/lib/PointerHelper.cpp index ed7d49ac36..3bc82c236f 100644 --- a/tests/pointer/1.0/default/lib/PointerHelper.cpp +++ b/tests/pointer/1.0/default/lib/PointerHelper.cpp @@ -1,5 +1,5 @@ #define LOG_TAG "hidl_test" -#include +#include #include "PointerHelper.h" namespace android {