From 7168f2726eccdc00210ba59563a4ed3b821cca9d Mon Sep 17 00:00:00 2001 From: Dylan Katz Date: Thu, 2 Jul 2020 11:51:44 -0700 Subject: Add second batch of fuzzers for libutils This adds fuzzers for: - CallStack - Looper - LruCache - Printer - ProcessCallStack - PropertyMap - RWLock - RefBase - StopWatch. Test: Ran each fuzzer for 10 minutes. Rough coverage est. (likely far below actual value): 10.97% Signed-off-by: Dylan Katz Change-Id: I2f9f35c18b13338c282fb7f9c3ea4099ecb2c56f --- libutils/Looper_test.cpp | 44 +++++--------------------------------------- 1 file changed, 5 insertions(+), 39 deletions(-) (limited to 'libutils/Looper_test.cpp') diff --git a/libutils/Looper_test.cpp b/libutils/Looper_test.cpp index 37bdf0544..34f424b83 100644 --- a/libutils/Looper_test.cpp +++ b/libutils/Looper_test.cpp @@ -2,12 +2,13 @@ // Copyright 2010 The Android Open Source Project // -#include -#include -#include #include -#include #include +#include +#include +#include +#include +#include "Looper_test_pipe.h" #include @@ -24,41 +25,6 @@ enum { MSG_TEST4 = 4, }; -class Pipe { -public: - int sendFd; - int receiveFd; - - Pipe() { - int fds[2]; - ::pipe(fds); - - receiveFd = fds[0]; - sendFd = fds[1]; - } - - ~Pipe() { - if (sendFd != -1) { - ::close(sendFd); - } - - if (receiveFd != -1) { - ::close(receiveFd); - } - } - - status_t writeSignal() { - ssize_t nWritten = ::write(sendFd, "*", 1); - return nWritten == 1 ? 0 : -errno; - } - - status_t readSignal() { - char buf[1]; - ssize_t nRead = ::read(receiveFd, buf, 1); - return nRead == 1 ? 0 : nRead == 0 ? -EPIPE : -errno; - } -}; - class DelayedTask : public Thread { int mDelayMillis; -- cgit v1.2.3