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
This commit is contained in:
Tri Vo 2021-01-14 18:31:21 -08:00
parent 3c651c278c
commit 2c56d833c5
4 changed files with 15 additions and 19 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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>