summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIgor Murashkin <iam@google.com>2020-03-02 15:26:25 -0800
committerIgor Murashkin <iam@google.com>2020-03-02 15:26:25 -0800
commit9e825dd69457e43f2f23f8e481a53d2c9332df8b (patch)
treee36fd23be09b5a6b4e916c29156da5b9d3d09011 /tests
parentdd878a427032990cc1e477ff5687dd6f9d0da664 (diff)
downloadplatform_system_iorap-9e825dd69457e43f2f23f8e481a53d2c9332df8b.tar.gz
platform_system_iorap-9e825dd69457e43f2f23f8e481a53d2c9332df8b.tar.bz2
platform_system_iorap-9e825dd69457e43f2f23f8e481a53d2c9332df8b.zip
compiler: Add --blacklist-filter "regex" flag to iorap.cmd.compiler
If the --blacklist-filter is specified, its regular expression is used to ignore any file paths that are matched by regex_search. For example, --blacklist-filter "[.]art$" would remove any files with the .art extension from the output file. Bug: 150640692 Test: iorapd-host-tests --gtest_filter='*Compiler* Change-Id: I67879d787cbfc3bc6cc6365fad8d697567877bd4
Diffstat (limited to 'tests')
-rw-r--r--tests/src/compiler/compiler_test.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/src/compiler/compiler_test.cc b/tests/src/compiler/compiler_test.cc
index 21c7390..fb3e70b 100644
--- a/tests/src/compiler/compiler_test.cc
+++ b/tests/src/compiler/compiler_test.cc
@@ -63,6 +63,7 @@ TEST_F(CompilerTest, SingleTraceDuration) {
bool result = PerformCompilation(perfetto_traces,
output_file_name,
output_proto,
+ /*blacklist_filter*/std::nullopt,
ir_dependencies);
std::ifstream ifs(output_file_name);
@@ -92,6 +93,7 @@ TEST_F(CompilerTest, MultiTraceDuration) {
bool result = PerformCompilation(perfetto_traces,
output_file_name,
output_proto,
+ /*blacklist_filter*/std::nullopt,
ir_dependencies);
std::ifstream ifs(output_file_name);
std::string content{std::istreambuf_iterator<char>(ifs),
@@ -120,6 +122,7 @@ TEST_F(CompilerTest, NoTraceDuration) {
bool result = PerformCompilation(perfetto_traces,
output_file_name,
output_proto,
+ /*blacklist_filter*/std::nullopt,
ir_dependencies);
std::ifstream ifs(output_file_name);
size_t line_num = std::count((std::istreambuf_iterator<char>(ifs)),
@@ -129,4 +132,31 @@ TEST_F(CompilerTest, NoTraceDuration) {
EXPECT_EQ(result, true);
EXPECT_EQ(line_num, 1675UL);
}
+
+TEST_F(CompilerTest, BlacklistFilterArtFiles) {
+ std::vector<std::string> input_file_names{GetTestDataPath("common_perfetto_trace.pb")};
+ TemporaryFile tmp_file;
+ char* output_file_name = tmp_file.path;
+ bool output_proto = false;
+
+ std::string blacklist_filter = "[.](art|oat|odex|vdex|dex)$";
+
+ // iorap.cmd.compiler -op output.pb -it common_textcache -ot
+ // --blacklist-filter "[.](art|oat|odex|vdex|dex)$" common_perfetto_trace.pb
+
+ std::vector<CompilationInput> perfetto_traces =
+ MakeCompilationInputs(input_file_names, /* timestamp_limit_ns= */{});
+ bool result = PerformCompilation(perfetto_traces,
+ output_file_name,
+ output_proto,
+ blacklist_filter,
+ ir_dependencies);
+ std::ifstream ifs(output_file_name);
+ size_t line_num = std::count((std::istreambuf_iterator<char>(ifs)),
+ (std::istreambuf_iterator<char>()),
+ '\n');
+
+ EXPECT_EQ(result, true);
+ EXPECT_EQ(line_num, 1617UL);
+}
} // namespace iorap::compiler