8000 tests: allow testing on arm64 Android emulators by schopin-mozilla · Pull Request #194 · rust-minidump/minidump-writer · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .cargo/android-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
BINARY=$1
shift

# Cargo doesn't expose the target triple to the runner, so derive it from the
# binary path (.../target/<triple>/...).
TARGET=$(printf '%s' "$BINARY" | sed -E 's#(.*/)?target/([^/]+)/.*#\2#')

# Make sure to run the following to copy the test helper binary over.
# cargo run --target x86_64-linux-android --bin test
# cargo run --target "$TARGET" --bin test
adb push "$BINARY" "/data/local/$BINARY"
adb shell "chmod 777 /data/local/$BINARY && env TEST_HELPER=/data/local/target/x86_64-linux-android/debug/test /data/local/$BINARY" "$@"
adb shell "chmod 777 /data/local/$BINARY && env TEST_HELPER=/data/local/target/$TARGET/debug/test /data/local/$BINARY" "$@"
6 changes: 6 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ linker = "x86_64-linux-android30-clang"
# By default the linker _doesn't_ generate a build-id, however we want one for our tests.
rustflags = ["-C", "link-args=-Wl,--build-id=sha1"]
runner = [".cargo/android-runner.sh"]

[target.aarch64-linux-android]
linker = "aarch64-linux-android30-clang"
# By default the linker _doesn't_ generate a build-id, however we want one for our tests.
rustflags = ["-C", "link-args=-Wl,--build-id=sha1"]
runner = [".cargo/android-runner.sh"]
16 changes: 8 additions & 8 deletions src/linux/dumper_cpu_info/arm.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use {
super::{CpuInfoError, ProcessInspector},
crate::minidump_format::*,
failspot::failspot,
scroll::Pwrite,
std::{
collections::HashSet,
Expand Down Expand Up @@ -191,14 +192,13 @@ pub fn write_cpu_information(
// readable from regular Android applications on later versions
// (>= 4.1) of the Android platform.

let cpuinfo_file = match process_inspector.read_file("/proc/cpuinfo") {
Ok(x) => x,
Err(_) => {
// Do not return Error here to allow the minidump generation
// to happen properly.
return Ok(());
}
};
if failspot!(CpuInfoFileOpen) {
process_inspector.fail_one_syscall_with(libc::EPERM);
}

let cpuinfo_file = process_inspector
.read_file("/proc/cpuinfo")
.map_err(CpuInfoError::ReadFileError)?;

let mut cpuid = 0;
let mut elf_hwcaps = 0;
Expand Down
Loading
0