diff options
author | Yabin Cui <yabinc@google.com> | 2021-12-16 14:09:39 -0800 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2021-12-16 15:46:50 -0800 |
commit | 248ef5e85c5d1dd5f5480deafe230ae14f8b3a17 (patch) | |
tree | ac7b6ac840db90bafae7cb17b1a3bd646a340605 /simpleperf/cmd_record_test.cpp | |
parent | a0076030b439969199fc2d40aa8c3d03410d6cf5 (diff) | |
download | extras-248ef5e85c5d1dd5f5480deafe230ae14f8b3a17.tar.gz |
simpleperf: add --use-cmd-exit-code in record cmd.
If used, simpleperf exits with the same exit code as the monitored
cmdline.
Bug: 211011913
Test: run simpleperf_unit_test
Change-Id: I80ff5f94963453f1105c0032b6f513f18fd1b89f
Diffstat (limited to 'simpleperf/cmd_record_test.cpp')
-rw-r--r-- | simpleperf/cmd_record_test.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp index ef6b63d2..d6deacde 100644 --- a/simpleperf/cmd_record_test.cpp +++ b/simpleperf/cmd_record_test.cpp @@ -562,6 +562,16 @@ TEST(record_cmd, exit_with_parent_option) { ASSERT_TRUE(RunRecordCmd({"--exit-with-parent"})); } +TEST(record_cmd, use_cmd_exit_code_option) { + TemporaryFile tmpfile; + int exit_code; + RecordCmd()->Run({"--use-cmd-exit-code", "-o", tmpfile.path, "ls", "."}, &exit_code); + ASSERT_EQ(exit_code, 0); + RecordCmd()->Run({"--use-cmd-exit-code", "-o", tmpfile.path, "ls", "/not_exist_path"}, + &exit_code); + ASSERT_NE(exit_code, 0); +} + TEST(record_cmd, clockid_option) { if (!IsSettingClockIdSupported()) { ASSERT_FALSE(RunRecordCmd({"--clockid", "monotonic"})); |