libbinder: RPC flake mode
Add mode to make flakes more visible, for debugging.
Fixes: 190828148
Test: run w/ binderLibTest and the fuzzer for a bit (no tests
fail - some tests can be made to fail by increasing the delay,
but this is because some of the tests, namely OnewayStressTest,
relies on all operations completing within a certain timeframe)
Change-Id: I3b38ff55ffc56410db585fa02e57ac0271da2b5d
diff --git a/libs/binder/RpcState.h b/libs/binder/RpcState.h
index 5bfef69..54a8f59 100644
--- a/libs/binder/RpcState.h
+++ b/libs/binder/RpcState.h
@@ -42,6 +42,15 @@
#define LOG_RPC_DETAIL(...) ALOGV(__VA_ARGS__) // for type checking
#endif
+#define RPC_FLAKE_PRONE false
+
+#ifdef RPC_FLAKE_PRONE
+void rpcMaybeWaitToFlake();
+#define MAYBE_WAIT_IN_FLAKE_MODE rpcMaybeWaitToFlake()
+#else
+#define MAYBE_WAIT_IN_FLAKE_MODE do {} while (false)
+#endif
+
/**
* Abstracts away management of ref counts and the wire format from
* RpcSession