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

Commit 2c56d833 authored by Tri Vo's avatar Tri Vo
Browse files

trusty: fuzz: Explicit errors instead of asserts

Bug: 171750250
Test: m \
      trusty_test_fuzzer \
      trusty_gatekeeper_fuzzer \
      trusty_keymaster_fuzzer \
      trusty_confirmationui_fuzzer
Change-Id: Ib22cf72b2db7b991e716c0116ca57d3f77459ada
parent 3c651c27
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -14,10 +14,7 @@
 * limitations under the License.
 */

#undef NDEBUG

#include <assert.h>
#include <log/log.h>
#include <iostream>
#include <stdlib.h>
#include <trusty/coverage/coverage.h>
#include <trusty/fuzz/counters.h>
@@ -52,7 +49,10 @@ static CoverageRecord record(TIPC_DEV, &confirmationui_uuid);

extern "C" int LLVMFuzzerInitialize(int* /* argc */, char*** /* argv */) {
    auto ret = record.Open();
    assert(ret.ok());
    if (!ret.ok()) {
        std::cerr << ret.error() << std::endl;
        exit(-1);
    }
    return 0;
}

+5 −5
Original line number Diff line number Diff line
@@ -14,15 +14,12 @@
 * limitations under the License.
 */

#undef NDEBUG

#include <assert.h>
#include <log/log.h>
#include <stdlib.h>
#include <trusty/coverage/coverage.h>
#include <trusty/fuzz/counters.h>
#include <trusty/fuzz/utils.h>
#include <unistd.h>
#include <iostream>

using android::trusty::coverage::CoverageRecord;
using android::trusty::fuzz::ExtraCounters;
@@ -43,7 +40,10 @@ static CoverageRecord record(TIPC_DEV, &test_srv_uuid);

extern "C" int LLVMFuzzerInitialize(int* /* argc */, char*** /* argv */) {
    auto ret = record.Open();
    assert(ret.ok());
    if (!ret.ok()) {
        std::cerr << ret.error() << std::endl;
        exit(-1);
    }
    return 0;
}

+5 −5
Original line number Diff line number Diff line
@@ -14,15 +14,12 @@
 * limitations under the License.
 */

#undef NDEBUG

#include <assert.h>
#include <log/log.h>
#include <stdlib.h>
#include <trusty/coverage/coverage.h>
#include <trusty/fuzz/counters.h>
#include <trusty/fuzz/utils.h>
#include <unistd.h>
#include <iostream>

using android::trusty::coverage::CoverageRecord;
using android::trusty::fuzz::ExtraCounters;
@@ -44,7 +41,10 @@ static CoverageRecord record(TIPC_DEV, &gatekeeper_uuid, GATEKEEPER_MODULE_NAME)

extern "C" int LLVMFuzzerInitialize(int* /* argc */, char*** /* argv */) {
    auto ret = record.Open();
    assert(ret.ok());
    if (!ret.ok()) {
        std::cerr << ret.error() << std::endl;
        exit(-1);
    }
    return 0;
}

+0 −4
Original line number Diff line number Diff line
@@ -14,10 +14,6 @@
 * limitations under the License.
 */

#undef NDEBUG

#include <assert.h>
#include <log/log.h>
#include <stdlib.h>
#include <trusty/coverage/coverage.h>
#include <trusty/fuzz/counters.h>