diff options
author | Dylan Katz <dylan.katz@leviathansecurity.com> | 2020-07-02 11:51:44 -0700 |
---|---|---|
committer | Dylan Katz <dylan.katz@leviathansecurity.com> | 2020-08-07 15:36:39 -0700 |
commit | 7168f2726eccdc00210ba59563a4ed3b821cca9d (patch) | |
tree | 9c034a8d80f52039582a5cc1a06d5e2fe511e0c5 /libutils/Looper_test.cpp | |
parent | c8e4154d899847a32f0fb7bbf999c39c7cb0dba7 (diff) |
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 <dylan.katz@leviathansecurity.com>
Change-Id: I2f9f35c18b13338c282fb7f9c3ea4099ecb2c56f
Diffstat (limited to 'libutils/Looper_test.cpp')
-rw-r--r-- | libutils/Looper_test.cpp | 44 |
1 files changed, 5 insertions, 39 deletions
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 <utils/Looper.h> -#include <utils/Timers.h> -#include <utils/StopWatch.h> #include <gtest/gtest.h> -#include <unistd.h> #include <time.h> +#include <unistd.h> +#include <utils/Looper.h> +#include <utils/StopWatch.h> +#include <utils/Timers.h> +#include "Looper_test_pipe.h" #include <utils/threads.h> @@ -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; |