summaryrefslogtreecommitdiff
path: root/simpleperf/cmd_stat_test.cpp
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2015-06-01 11:21:37 -0700
committerYabin Cui <yabinc@google.com>2015-06-04 15:26:32 -0700
commitf79f07e13c56f7ca3be1435cea7f8861daf7efaa (patch)
tree8c76bac6fe4d9b52b69e57393f5deecb18febd97 /simpleperf/cmd_stat_test.cpp
parentd4637d6e7d17f48d9325fa133be82b06a408f523 (diff)
downloadextras-f79f07e13c56f7ca3be1435cea7f8861daf7efaa.tar.gz
Simpleperf: refactor command system.
Register a callback function to create a new command instance instead of registering a command instance. Then we can release resources in the command destructors, and don't need xxxCommandImpl classes any more. Bug: 19483574 Change-Id: Ibb54892ec0655fd43909347afd72bb08bc8a716c
Diffstat (limited to 'simpleperf/cmd_stat_test.cpp')
-rw-r--r--simpleperf/cmd_stat_test.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/simpleperf/cmd_stat_test.cpp b/simpleperf/cmd_stat_test.cpp
index 0ed49bcb..f2639797 100644
--- a/simpleperf/cmd_stat_test.cpp
+++ b/simpleperf/cmd_stat_test.cpp
@@ -21,30 +21,30 @@
class StatCommandTest : public ::testing::Test {
protected:
virtual void SetUp() {
- stat_cmd = Command::FindCommandByName("stat");
+ stat_cmd = CreateCommandInstance("stat");
ASSERT_TRUE(stat_cmd != nullptr);
}
protected:
- Command* stat_cmd;
+ std::unique_ptr<Command> stat_cmd;
};
TEST_F(StatCommandTest, no_options) {
- ASSERT_TRUE(stat_cmd->Run({"stat", "sleep", "1"}));
+ ASSERT_TRUE(stat_cmd->Run({"sleep", "1"}));
}
TEST_F(StatCommandTest, event_option) {
- ASSERT_TRUE(stat_cmd->Run({"stat", "-e", "cpu-clock,task-clock", "sleep", "1"}));
+ ASSERT_TRUE(stat_cmd->Run({"-e", "cpu-clock,task-clock", "sleep", "1"}));
}
TEST_F(StatCommandTest, system_wide_option) {
- ASSERT_TRUE(stat_cmd->Run({"stat", "-a", "sleep", "1"}));
+ ASSERT_TRUE(stat_cmd->Run({"-a", "sleep", "1"}));
}
TEST_F(StatCommandTest, verbose_option) {
- ASSERT_TRUE(stat_cmd->Run({"stat", "--verbose", "sleep", "1"}));
+ ASSERT_TRUE(stat_cmd->Run({"--verbose", "sleep", "1"}));
}
TEST_F(StatCommandTest, tracepoint_event) {
- ASSERT_TRUE(stat_cmd->Run({"stat", "-a", "-e", "sched:sched_switch", "sleep", "1"}));
+ ASSERT_TRUE(stat_cmd->Run({"-a", "-e", "sched:sched_switch", "sleep", "1"}));
}