From 4438386b3089272f4d747bdbbfef04ae98a66bd7 Mon Sep 17 00:00:00 2001 From: Gaoyang Zhang Date: Mon, 31 Jan 2022 14:58:25 +0800 Subject: [PATCH] ops(tests): run tests on aarch64, armv7 and x86_64 architectures Signed-off-by: Gaoyang Zhang --- .github/workflows/tests.yml | 33 +++++++++++++++++++++++++++++++-- dt-core/src/syncing.rs | 28 ++++++++++++++++++++++++---- 2 files changed, 55 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a5956b0..464fac0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,7 +9,33 @@ name: tests jobs: unit-test: runs-on: ubuntu-latest + strategy: + matrix: + build: [x86_64, armv7, aarch64] + include: + - build: x86_64 + toolchain: stable + target: x86_64-unknown-linux-gnu + cross: false + strip_bin: strip + - build: armv7 + toolchain: stable + target: armv7-unknown-linux-gnueabihf + cross: true + cross_helpers: gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf + strip_bin: arm-linux-gnueabihf-strip + - build: aarch64 + toolchain: stable + target: aarch64-unknown-linux-gnu + cross: true + cross_helpers: gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu + strip_bin: aarch64-linux-gnu-strip steps: + - name: Install Linker + if: ${{ matrix.cross }} + run: | + sudo apt update + sudo apt install ${{ matrix.cross_helpers }} - name: Checkout code uses: actions/checkout@v2 with: @@ -18,12 +44,15 @@ jobs: - name: Setup rust toolchain uses: actions-rs/toolchain@v1 with: - toolchain: stable + toolchain: ${{ matrix.toolchain }} + target: ${{ matrix.target }} + #override: true - name: Run unit tests uses: actions-rs/cargo@v1 with: command: test - args: --all --all-features --locked + args: --all --all-features --locked --target ${{ matrix.target }} + use-cross: ${{ matrix.cross }} # Author: Blurgy # Date: Oct 07 2021, 00:39 [CST] diff --git a/dt-core/src/syncing.rs b/dt-core/src/syncing.rs index 400ad22..95defb9 100644 --- a/dt-core/src/syncing.rs +++ b/dt-core/src/syncing.rs @@ -542,6 +542,10 @@ target = "{}""#, #[test] fn target_readonly() -> Result<(), Report> { // setup + let base = prepare_directory( + get_testroot().join("target_readonly").join("base"), + 0o755, + )?; let target_path = prepare_directory( get_testroot() .join("target_readonly") @@ -554,9 +558,10 @@ target = "{}""#, r#" [[local]] name = "target is readonly" -base = "~" +base = "{}" sources = [] target = "{}""#, + base.display(), target_path.display(), )) .unwrap(), @@ -586,6 +591,14 @@ target = "{}""#, .join("staging-but-file"), 0o644, )?; + let base = prepare_directory( + get_testroot().join("staging_is_file").join("base"), + 0o755, + )?; + let target = prepare_directory( + get_testroot().join("staging_is_file").join("target"), + 0o755, + )?; if let Err(err) = expand( DTConfig::from_str(&format!( @@ -595,10 +608,12 @@ staging = "{}" [[local]] name = "staging is file" -base = "~" +base = "{}" sources = [] -target = ".""#, +target = "{}""#, staging_path.display(), + base.display(), + target.display(), )) .unwrap(), ) { @@ -627,6 +642,10 @@ target = ".""#, .join("staging-but-readonly"), 0o555, )?; + let base = prepare_directory( + get_testroot().join("staging_readonly").join("base"), + 0o755, + )?; let target_path = prepare_directory( get_testroot().join("staging_readonly").join("target"), 0o755, @@ -640,10 +659,11 @@ staging = "{}" [[local]] name = "staging is readonly" -base = "~" +base = "{}" sources = [] target = "{}""#, staging_path.display(), + base.display(), target_path.display(), )) .unwrap(),