summaryrefslogtreecommitdiff
path: root/simpleperf/gtest_main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'simpleperf/gtest_main.cpp')
-rw-r--r--simpleperf/gtest_main.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/simpleperf/gtest_main.cpp b/simpleperf/gtest_main.cpp
index 6265d6a7..a6062281 100644
--- a/simpleperf/gtest_main.cpp
+++ b/simpleperf/gtest_main.cpp
@@ -68,6 +68,12 @@ class ScopedEnablingPerf {
#endif // defined(__ANDROID__)
int main(int argc, char** argv) {
+ // To test profiling apps, simpleperf_unit_test needs to copy itself to the app's directory,
+ // and run the binary as simpleperf executable.
+ if (android::base::Basename(argv[0]) == "simpleperf") {
+ return RunSimpleperfCmd(argc, argv) ? 0 : 1;
+ }
+
android::base::InitLogging(argv, android::base::StderrLogger);
android::base::LogSeverity log_severity = android::base::WARNING;
testdata_dir = std::string(dirname(argv[0])) + "/testdata";