Skip to content

Commit

Permalink
Run tests for riscv64
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Oct 6, 2023
1 parent 06ddeeb commit 3606f5c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ jobs:
- os: ubuntu-latest
env:
TARGET_TRIPLE: aarch64-unknown-linux-gnu
# s390x requires QEMU 6.1 or greater, we could build it from source, but ubuntu 22.04 comes with 6.2 by default
- os: ubuntu-latest
env:
TARGET_TRIPLE: s390x-unknown-linux-gnu
- os: ubuntu-latest
env:
TARGET_TRIPLE: riscv64gc-unknown-linux-gnu
- os: windows-latest
env:
TARGET_TRIPLE: x86_64-pc-windows-msvc
Expand Down Expand Up @@ -92,6 +94,12 @@ jobs:
sudo apt-get update
sudo apt-get install -y gcc-s390x-linux-gnu qemu-user
- name: Install riscv64gc toolchain and qemu
if: matrix.env.TARGET_TRIPLE == 'riscv64gc-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-riscv64-linux-gnu qemu-user
- name: Prepare dependencies
run: ./y.sh prepare

Expand Down
10 changes: 10 additions & 0 deletions build_system/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ impl Compiler {
"/usr/s390x-linux-gnu".to_owned(),
];
}
"riscv64gc-unknown-linux-gnu" => {
// We are cross-compiling for riscv64. Use the correct linker and run tests in qemu.
self.rustflags.push("-Clinker=riscv64-linux-gnu-gcc".to_owned());
self.rustdocflags.push("-Clinker=riscv64-linux-gnu-gcc".to_owned());
self.runner = vec![
"qemu-riscv64".to_owned(),
"-L".to_owned(),
"/usr/riscv64-linux-gnu".to_owned(),
];
}
"x86_64-pc-windows-gnu" => {
// We are cross-compiling for Windows. Run tests in wine.
self.runner = vec!["wine".to_owned()];
Expand Down

0 comments on commit 3606f5c

Please sign in to comment.