Revert^2 "Add unit tests for odrefresh - step 2"
This reverts commit b89649bd95cffec48f6f6746054553f71ab3e807.
Reason for revert: Fixed the fugu build breakage
The test failed on fugu because fugu is running Android O, while the
test depends on a system property introduced in S. Since the whole
odrefresh program is for S and later, we don't need to run the test on
older platforms. This failure is fixed by adding a check on the API
level and skipping the test if the API level is below S.
Bug: 196188549
Test: atest art_standalone_odrefresh_tests
Change-Id: I484696d065d715da65ae262a5aa8b3e1b30ffdcf
diff --git a/runtime/exec_utils.h b/runtime/exec_utils.h
index 5e22639..e011c82 100644
--- a/runtime/exec_utils.h
+++ b/runtime/exec_utils.h
@@ -37,6 +37,28 @@
/*out*/ bool* timed_out,
/*out*/ std::string* error_msg);
+// A wrapper class to make the functions above mockable.
+class ExecUtils {
+ public:
+ virtual ~ExecUtils() = default;
+
+ virtual bool Exec(std::vector<std::string>& arg_vector, /*out*/ std::string* error_msg) const {
+ return art::Exec(arg_vector, error_msg);
+ }
+
+ virtual int ExecAndReturnCode(std::vector<std::string>& arg_vector,
+ /*out*/ std::string* error_msg) const {
+ return art::ExecAndReturnCode(arg_vector, error_msg);
+ }
+
+ virtual int ExecAndReturnCode(std::vector<std::string>& arg_vector,
+ time_t timeout_secs,
+ /*out*/ bool* timed_out,
+ /*out*/ std::string* error_msg) const {
+ return art::ExecAndReturnCode(arg_vector, timeout_secs, timed_out, error_msg);
+ }
+};
+
} // namespace art
#endif // ART_RUNTIME_EXEC_UTILS_H_