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/odrefresh/odrefresh.h b/odrefresh/odrefresh.h
index c1f7d71..2a7164b 100644
--- a/odrefresh/odrefresh.h
+++ b/odrefresh/odrefresh.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2020 The Android Open Source Project
+ * Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,12 +18,14 @@
#define ART_ODREFRESH_ODREFRESH_H_
#include <ctime>
+#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "com_android_apex.h"
#include "com_android_art.h"
+#include "exec_utils.h"
#include "odr_artifacts.h"
#include "odr_config.h"
#include "odr_metrics.h"
@@ -36,6 +38,11 @@
public:
explicit OnDeviceRefresh(const OdrConfig& config);
+ // Constructor with injections. For testing and internal use only.
+ OnDeviceRefresh(const OdrConfig& config,
+ const std::string& cache_info_filename,
+ std::unique_ptr<ExecUtils> exec_utils);
+
// Returns the exit code, a list of ISAs that boot extensions should be compiled for, and a
// boolean indicating whether the system server should be compiled.
WARN_UNUSED ExitCode
@@ -171,6 +178,8 @@
time_t max_child_process_seconds_;
+ std::unique_ptr<ExecUtils> exec_utils_;
+
DISALLOW_COPY_AND_ASSIGN(OnDeviceRefresh);
};