simpleperf: fix test record_cmd.duration_option.
The test should write perf.data to a temporary file, because
the test may not have permission to write perf.data in
current directory.
Bug: http://b/30405638
Change-Id: Iff4ac7ea014f29e58146ad79c8dc3b0abcdb8d41
Test: run simpleperf_unit_test.
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp
index 3370adf..96098ae 100644
--- a/simpleperf/cmd_record_test.cpp
+++ b/simpleperf/cmd_record_test.cpp
@@ -313,5 +313,6 @@
TemporaryFile tmpfile;
ASSERT_TRUE(RecordCmd()->Run({"--duration", "1.2", "-p",
std::to_string(getpid()), "-o", tmpfile.path}));
- ASSERT_TRUE(RecordCmd()->Run({"--duration", "1", "sleep", "2"}));
+ ASSERT_TRUE(
+ RecordCmd()->Run({"--duration", "1", "-o", tmpfile.path, "sleep", "2"}));
}