summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext4_utils/Android.bp1
-rw-r--r--libfec/Android.bp1
-rw-r--r--libfscrypt/Android.bp1
-rw-r--r--simpleperf/dso_test.cpp36
-rw-r--r--simpleperf/get_test_data.h28
-rw-r--r--simpleperf/read_dex_file_test.cpp24
-rw-r--r--simpleperf/testdata/base_with_cdex_v1.vdex (renamed from simpleperf/testdata/base.vdex)bin2046136 -> 2046136 bytes
-rw-r--r--simpleperf/testdata/base_with_cdex_v2.vdexbin0 -> 2626976 bytes
-rw-r--r--squashfs_utils/Android.bp1
9 files changed, 67 insertions, 25 deletions
diff --git a/ext4_utils/Android.bp b/ext4_utils/Android.bp
index 10aa765f..80f70b9a 100644
--- a/ext4_utils/Android.bp
+++ b/ext4_utils/Android.bp
@@ -20,6 +20,7 @@ license {
cc_library {
name: "libext4_utils",
host_supported: true,
+ ramdisk_available: true,
recovery_available: true,
srcs: [
"ext4_utils.cpp",
diff --git a/libfec/Android.bp b/libfec/Android.bp
index 6bd44dd9..0b464b01 100644
--- a/libfec/Android.bp
+++ b/libfec/Android.bp
@@ -70,6 +70,7 @@ cc_library {
name: "libfec",
defaults: ["libfec_default"],
host_supported: true,
+ ramdisk_available: true,
recovery_available: true,
target: {
diff --git a/libfscrypt/Android.bp b/libfscrypt/Android.bp
index afdc7f4e..343ccef3 100644
--- a/libfscrypt/Android.bp
+++ b/libfscrypt/Android.bp
@@ -19,6 +19,7 @@ license {
cc_library {
name: "libfscrypt",
+ ramdisk_available: true,
recovery_available: true,
srcs: [
"fscrypt.cpp",
diff --git a/simpleperf/dso_test.cpp b/simpleperf/dso_test.cpp
index 02958ce6..c8618036 100644
--- a/simpleperf/dso_test.cpp
+++ b/simpleperf/dso_test.cpp
@@ -152,24 +152,28 @@ TEST(DebugElfFileFinder, build_id_mismatch) {
TEST(dso, dex_file_dso) {
#if defined(__linux__)
for (DsoType dso_type : {DSO_DEX_FILE, DSO_ELF_FILE}) {
- std::unique_ptr<Dso> dso = Dso::CreateDso(dso_type, GetTestData("base.vdex"));
- ASSERT_TRUE(dso);
- dso->AddDexFileOffset(0x28);
- ASSERT_EQ(DSO_DEX_FILE, dso->type());
- const Symbol* symbol = dso->FindSymbol(0x6c77e);
- ASSERT_NE(symbol, nullptr);
- ASSERT_EQ(symbol->addr, static_cast<uint64_t>(0x6c77e));
- ASSERT_EQ(symbol->len, static_cast<uint64_t>(0x16));
- ASSERT_STREQ(symbol->DemangledName(),
- "com.example.simpleperf.simpleperfexamplewithnative.MixActivity$1.run");
- uint64_t min_vaddr;
- uint64_t file_offset_of_min_vaddr;
- dso->GetMinExecutableVaddr(&min_vaddr, &file_offset_of_min_vaddr);
- ASSERT_EQ(min_vaddr, 0);
- ASSERT_EQ(file_offset_of_min_vaddr, 0);
+ for (const DexFileTestData& entry : dex_file_test_data) {
+ if (entry.filename == "base_with_cdex_v1.vdex") {
+ continue; // TODO: reenable it.
+ }
+ std::unique_ptr<Dso> dso = Dso::CreateDso(dso_type, GetTestData(entry.filename));
+ ASSERT_TRUE(dso);
+ dso->AddDexFileOffset(entry.dexfile_offset);
+ ASSERT_EQ(DSO_DEX_FILE, dso->type());
+ const Symbol* symbol = dso->FindSymbol(entry.symbol_addr);
+ ASSERT_NE(symbol, nullptr);
+ ASSERT_EQ(symbol->addr, entry.symbol_addr);
+ ASSERT_EQ(symbol->len, entry.symbol_len);
+ ASSERT_STREQ(symbol->DemangledName(), entry.symbol_name.c_str());
+ uint64_t min_vaddr;
+ uint64_t file_offset_of_min_vaddr;
+ dso->GetMinExecutableVaddr(&min_vaddr, &file_offset_of_min_vaddr);
+ ASSERT_EQ(min_vaddr, 0);
+ ASSERT_EQ(file_offset_of_min_vaddr, 0);
+ }
// Don't crash on not exist zip entry.
- dso = Dso::CreateDso(dso_type, GetTestData("base.zip!/not_exist_entry"));
+ std::unique_ptr<Dso> dso = Dso::CreateDso(dso_type, GetTestData("base.zip!/not_exist_entry"));
ASSERT_TRUE(dso);
ASSERT_EQ(nullptr, dso->FindSymbol(0));
}
diff --git a/simpleperf/get_test_data.h b/simpleperf/get_test_data.h
index 1ef663b9..b6a7999e 100644
--- a/simpleperf/get_test_data.h
+++ b/simpleperf/get_test_data.h
@@ -149,4 +149,32 @@ static const std::string PERF_DATA_WITH_IP_ZERO_IN_CALLCHAIN =
// generated by `simpleperf record -e cs-etm:u ./etm_test_loop`
static const std::string PERF_DATA_ETM_TEST_LOOP = "etm/perf.data";
+struct DexFileTestData {
+ std::string filename;
+ uint64_t dexfile_offset;
+ size_t symbol_count;
+ // One symbol in the dex file.
+ uint64_t symbol_addr;
+ uint64_t symbol_len;
+ std::string symbol_name;
+};
+
+static DexFileTestData dex_file_test_data[] = {
+ DexFileTestData{
+ "base_with_cdex_v1.vdex",
+ 0x28,
+ 12435,
+ 0x6c77e,
+ 0x16,
+ "com.example.simpleperf.simpleperfexamplewithnative.MixActivity$1.run",
+ },
+ DexFileTestData{
+ "base_with_cdex_v2.vdex",
+ 0x40,
+ 16891,
+ 0x169b84,
+ 0x25a,
+ "com.android.calculator2.Calculator.onButtonClick",
+ }};
+
#endif // SIMPLE_PERF_GET_TEST_DATA_H_
diff --git a/simpleperf/read_dex_file_test.cpp b/simpleperf/read_dex_file_test.cpp
index 843a964c..fc72ceda 100644
--- a/simpleperf/read_dex_file_test.cpp
+++ b/simpleperf/read_dex_file_test.cpp
@@ -32,12 +32,18 @@ TEST(read_dex_file, smoke) {
auto symbol_callback = [&](DexFileSymbol* symbol) {
symbols.emplace_back(symbol->name, symbol->addr, symbol->size);
};
- ASSERT_TRUE(ReadSymbolsFromDexFile(GetTestData("base.vdex"), {0x28}, symbol_callback));
- ASSERT_EQ(12435u, symbols.size());
- auto it = std::find_if(symbols.begin(), symbols.end(),
- [](const Symbol& symbol) { return symbol.addr == 0x6c77e; });
- ASSERT_NE(it, symbols.end());
- ASSERT_EQ(it->addr, 0x6c77e);
- ASSERT_EQ(it->len, 0x16);
- ASSERT_STREQ(it->Name(), "com.example.simpleperf.simpleperfexamplewithnative.MixActivity$1.run");
-}
+ for (DexFileTestData& entry : dex_file_test_data) {
+ if (entry.filename == "base_with_cdex_v1.vdex") {
+ continue; // TODO: reenable it.
+ }
+ ASSERT_TRUE(ReadSymbolsFromDexFile(GetTestData(entry.filename), {entry.dexfile_offset},
+ symbol_callback));
+ ASSERT_EQ(entry.symbol_count, symbols.size());
+ auto it = std::find_if(symbols.begin(), symbols.end(),
+ [&](const Symbol& symbol) { return symbol.addr == entry.symbol_addr; });
+ ASSERT_NE(it, symbols.end());
+ ASSERT_EQ(it->addr, entry.symbol_addr);
+ ASSERT_EQ(it->len, entry.symbol_len);
+ ASSERT_STREQ(it->Name(), entry.symbol_name.c_str());
+ }
+} \ No newline at end of file
diff --git a/simpleperf/testdata/base.vdex b/simpleperf/testdata/base_with_cdex_v1.vdex
index b0ea0184..b0ea0184 100644
--- a/simpleperf/testdata/base.vdex
+++ b/simpleperf/testdata/base_with_cdex_v1.vdex
Binary files differ
diff --git a/simpleperf/testdata/base_with_cdex_v2.vdex b/simpleperf/testdata/base_with_cdex_v2.vdex
new file mode 100644
index 00000000..16ecc6fd
--- /dev/null
+++ b/simpleperf/testdata/base_with_cdex_v2.vdex
Binary files differ
diff --git a/squashfs_utils/Android.bp b/squashfs_utils/Android.bp
index 4a6fb5fa..b2d493b7 100644
--- a/squashfs_utils/Android.bp
+++ b/squashfs_utils/Android.bp
@@ -21,6 +21,7 @@ cc_library {
name: "libsquashfs_utils",
cflags: ["-Werror"],
host_supported: true,
+ ramdisk_available: true,
recovery_available: true,
srcs: [
"squashfs_utils.c",