Skip to content

Commit

Permalink
Run tests twice, one for main crate and once for subcrate
Browse files Browse the repository at this point in the history
It seems like restoring the cache for subcrate deletes sometimes removes the compiled binaries for
the parent crate. I'm not sure what's going on here, as it doesn't happen every time.
  • Loading branch information
autarch committed Jan 11, 2025
1 parent f65d0b2 commit cf2f29f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 16 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,18 @@ jobs:
target: ${{ matrix.platform.target }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strip: true
- name: Check binary and cross for main crate on ${{ matrix.platform.platform_name }}
shell: bash
run: |
set -e
set -x
cargo run --manifest-path ./run-tests/Cargo.toml -- \
--checkout-root "$PWD" \
--target "${{ matrix.platform.target }}" \
--expect-file-re "${{ matrix.platform.expect_file_re }}" \
--expect-cross-version "${{ matrix.platform.expect_cross_version }}" \
${{ matrix.platform.expect_cross }} \
${{ matrix.platform.expect_stripped }}
- name: Dump tree
shell: bash
run: |
Expand Down Expand Up @@ -296,7 +308,7 @@ jobs:
set -x
sudo apt-get install -y tree
tree .
- name: Check binary and cross on ${{ matrix.platform.platform_name }}
- name: Check binary and cross for subcrate on ${{ matrix.platform.platform_name }}
shell: bash
run: |
set -e
Expand All @@ -307,7 +319,8 @@ jobs:
--expect-file-re "${{ matrix.platform.expect_file_re }}" \
--expect-cross-version "${{ matrix.platform.expect_cross_version }}" \
${{ matrix.platform.expect_cross }} \
${{ matrix.platform.expect_stripped }}
${{ matrix.platform.expect_stripped }} \
--is-subcrate
test-validate-inputs:
name: Test validate-inputs
Expand Down
33 changes: 19 additions & 14 deletions run-tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ struct Args {
expect_cross_version: Option<String>,
#[arg(long)]
expect_stripped: bool,
#[arg(long)]
is_subcrate: bool,
}

fn main() {
Expand All @@ -39,24 +41,27 @@ fn main() {
);

let checkout_root_path = PathBuf::from(args.checkout_root);
let bin_paths = vec![
checkout_root_path
.join("target")
.join(&args.target)
.join("debug")
.join("bin1"),
checkout_root_path
.join("target")
.join(&args.target)
.join("debug")
.join("bin2"),
checkout_root_path
let bin_paths = if args.is_subcrate {
vec![checkout_root_path
.join("subcrate")
.join("target")
.join(&args.target)
.join("debug")
.join("subcrate"),
];
.join("subcrate")]
} else {
vec![
checkout_root_path
.join("target")
.join(&args.target)
.join("debug")
.join("bin1"),
checkout_root_path
.join("target")
.join(&args.target)
.join("debug")
.join("bin2"),
]
};

for mut bin_path in bin_paths {
if cfg!(windows) {
Expand Down

0 comments on commit cf2f29f

Please sign in to comment.