Skip to content

Commit

Permalink
chore: update build for openbsd/mips/android
Browse files Browse the repository at this point in the history
  • Loading branch information
darfink committed Mar 6, 2024
1 parent c032bca commit c6fb545
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ jobs:
os: ubuntu-20.04
use-cross: true
- target: aarch64-linux-android
toolchain: '1.52.0' # See: https://github.com/rust-lang/rust/issues/110786
os: ubuntu-20.04
use-cross: true
- target: mips-unknown-linux-gnu
toolchain: '1.52.0' # See: https://github.com/rust-lang/compiler-team/issues/648
os: ubuntu-20.04
use-cross: true

Expand All @@ -56,7 +58,7 @@ jobs:
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: ${{ matrix.toolchain || 'stable' }}
profile: minimal
target: ${{ matrix.target }}
override: true
Expand Down Expand Up @@ -85,8 +87,8 @@ jobs:
md5: 01ad7883c69476d90872eb38180085c0
args: -net nic,model=virtio
- target: x86_64-unknown-openbsd
image: https://www.dropbox.com/s/p4buykmmjd8hjgx/openbsd69.qcow2.xz?dl=1
md5: 37ff51c30e360429550debf87a39d801
image: https://gitlab.com/kit-ty-kate/qemu-base-images/-/raw/master/OpenBSD-7.4-amd64.qcow2?inline=false
md5: 1b7f3867c72f1dac3901b4a08257f580
args: -net nic
fail-fast: false

Expand Down Expand Up @@ -125,7 +127,7 @@ jobs:
ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa
cat > ~/.ssh/config <<EOF
Host qemu
User miles
User root
HostName localhost
Port 1025
EOF
Expand All @@ -140,7 +142,7 @@ jobs:
- name: Install toolchain (pkg)
if: ${{ contains(matrix.target, 'openbsd') }}
run: ssh qemu "sudo pkg_add -I rust"
run: ssh qemu "pkg_add rust"

- name: Copy crate
run: rsync -r . qemu:crate
Expand Down
20 changes: 11 additions & 9 deletions src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ mod tests {
use crate::tests::util::alloc_pages;
use crate::{page, Protection};

const TEXT_SEGMENT_PROT: Protection = if cfg!(target_os = "openbsd") {
Protection::EXECUTE
} else {
Protection::READ_EXECUTE
};

#[test]
fn query_returns_unmapped_for_oob_address() {
let (min, max) = (std::ptr::null::<()>(), usize::max_value() as *const ());
Expand All @@ -172,7 +178,8 @@ mod tests {
#[test]
fn query_returns_correct_descriptor_for_text_segment() -> Result<()> {
let region = query(query_returns_correct_descriptor_for_text_segment as *const ())?;
assert_eq!(region.protection(), Protection::READ_EXECUTE);

assert_eq!(region.protection(), TEXT_SEGMENT_PROT);
assert_eq!(region.is_shared(), cfg!(windows));
assert!(!region.is_guarded());
Ok(())
Expand Down Expand Up @@ -251,16 +258,11 @@ mod tests {
fn query_range_can_iterate_over_entire_process() -> Result<()> {
let regions =
query_range(std::ptr::null::<()>(), usize::max_value())?.collect::<Result<Vec<_>>>()?;
let (r, rw, rx) = (
Protection::READ,
Protection::READ_WRITE,
Protection::READ_EXECUTE,
);

// This test is a bit rough around the edges
assert!(regions.iter().any(|region| region.protection() == r));
assert!(regions.iter().any(|region| region.protection() == rw));
assert!(regions.iter().any(|region| region.protection() == rx));
assert!(regions.iter().any(|region| region.protection() == Protection::READ));
assert!(regions.iter().any(|region| region.protection() == Protection::READ_WRITE));
assert!(regions.iter().any(|region| region.protection() == TEXT_SEGMENT_PROT));
assert!(regions.len() > 5);
Ok(())
}
Expand Down

0 comments on commit c6fb545

Please sign in to comment.