mirror of
https://github.com/ducaale/xh.git
synced 2025-05-05 15:32:50 +00:00
use qemu when running tests for arm32
This commit is contained in:
parent
5c6c65ccaa
commit
e9717139a0
16
.github/workflows/ci.yaml
vendored
16
.github/workflows/ci.yaml
vendored
@ -64,20 +64,14 @@ jobs:
|
||||
sudo apt-get -y install libc6:armhf libstdc++6:armhf qemu-user
|
||||
|
||||
echo CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc >> $GITHUB_ENV
|
||||
echo CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER=qemu-arm >> $GITHUB_ENV
|
||||
fi
|
||||
sudo apt-get -y install ${{ matrix.job.compiler-tools }}
|
||||
|
||||
- run: cargo test --target=arm-unknown-linux-gnueabihf --no-run
|
||||
- run: qemu-arm -strace -L /lib/arm-linux-gnueabihf ./target/arm-unknown-linux-gnueabihf/debug/deps/xh-* --nocapture --test-threads=1 --test can_parse_old_httpie_session
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
||||
|
||||
# - uses: ClementTsang/cargo-action@v0.0.6
|
||||
# with:
|
||||
# command: test
|
||||
# args: --target ${{ matrix.job.target }} ${{ matrix.job.flags }} can_parse_old_httpie_session -- --nocapture
|
||||
# env:
|
||||
# RUST_BACKTRACE: 1
|
||||
- uses: ClementTsang/cargo-action@v0.0.6
|
||||
with:
|
||||
command: test
|
||||
args: --target ${{ matrix.job.target }} ${{ matrix.job.flags }}
|
||||
|
||||
fmt-and-clippy:
|
||||
name: Rustfmt and clippy
|
||||
|
45
tests/cli.rs
45
tests/cli.rs
@ -61,33 +61,32 @@ fn random_string() -> String {
|
||||
.collect()
|
||||
}
|
||||
|
||||
// Cargo-cross for ARM runs tests using qemu.
|
||||
//
|
||||
// It sets an environment variable like this:
|
||||
// CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER=qemu-arm
|
||||
// fn find_runner() -> Option<String> {
|
||||
// for (key, value) in std::env::vars() {
|
||||
// if key.starts_with("CARGO_TARGET_") && key.ends_with("_RUNNER") && !value.is_empty() {
|
||||
// return Some(value);
|
||||
// }
|
||||
// }
|
||||
// None
|
||||
// }
|
||||
/// Cargo-cross for ARM runs tests using qemu.
|
||||
///
|
||||
/// It sets an environment variable like this:
|
||||
/// CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER=qemu-arm
|
||||
fn find_runner() -> Option<String> {
|
||||
for (key, value) in std::env::vars() {
|
||||
if key.starts_with("CARGO_TARGET_") && key.ends_with("_RUNNER") && !value.is_empty() {
|
||||
return Some(value);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
fn get_base_command() -> Command {
|
||||
let mut cmd;
|
||||
let path = assert_cmd::cargo::cargo_bin("xh");
|
||||
// if let Some(runner) = find_runner() {
|
||||
// let mut runner = runner.split_whitespace();
|
||||
// cmd = Command::new(runner.next().unwrap());
|
||||
// for arg in runner {
|
||||
// cmd.arg(arg);
|
||||
// }
|
||||
// cmd.arg(path);
|
||||
// } else {
|
||||
// cmd = Command::new(path);
|
||||
// }
|
||||
cmd = Command::new(path);
|
||||
if let Some(runner) = find_runner() {
|
||||
let mut runner = runner.split_whitespace();
|
||||
cmd = Command::new(runner.next().unwrap());
|
||||
for arg in runner {
|
||||
cmd.arg(arg);
|
||||
}
|
||||
cmd.arg(path);
|
||||
} else {
|
||||
cmd = Command::new(path);
|
||||
}
|
||||
cmd.env("HOME", "");
|
||||
cmd.env("NETRC", "");
|
||||
cmd.env("XH_CONFIG_DIR", "");
|
||||
|
Loading…
x
Reference in New Issue
Block a user