Put test 'args' at the end of the test command

For test commands, there can be arguments passed to the test binary like `-- --ignored` or `--
--test-threads=1`. For these cases to work properly, the `args` parameter needs to be added to the
end of the 'test' command.
This commit is contained in:
Aditya Manthramurthy 2024-11-03 16:24:56 -08:00 committed by Dave Rolsky
parent 294bb6a7fe
commit 9e709706e7
No known key found for this signature in database
4 changed files with 24 additions and 2 deletions

View File

@ -243,6 +243,16 @@ jobs:
target: ${{ matrix.platform.target }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ matrix.platform.can_test }}
- name: Run test command with args
uses: ./
with:
command: test
cross-version: ${{ matrix.platform.cross-version }}
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
target: ${{ matrix.platform.target }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
args: "-- --ignored"
if: ${{ matrix.platform.can_test }}
- name: Run build command
uses: ./
with:

View File

@ -1,3 +1,9 @@
## 0.0.16
- Arguments passed in the `args` parameter are now always last when executing `cargo`. This lets you
pass arguments to test binaries like `-- --something`. First reported by @mateocabanal (Mateo
Cabanal) as GH #12 and fully fixed by @donatello (Aditya Manthramurthy) in GH #30.
## 0.0.15 - 2024-09-21
- The `musl` packages are only installed when not cross-compiling.

View File

@ -95,7 +95,7 @@ runs:
working-directory: ${{ inputs.working-directory }}
shell: bash
run: |
${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} test ${{ inputs.args }} --target ${{ inputs.target }}
${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} test --target ${{ inputs.target }} ${{ inputs.args }}
if: inputs.command != 'build' && runner.os != 'Windows'
# We want to run in Powershell on Windows to make sure we compile in a
# native Windows environment. Some things won't compile properly under
@ -105,7 +105,7 @@ runs:
working-directory: ${{ inputs.working-directory }}
shell: powershell
run: |
& ${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} test ${{ inputs.args }} --target ${{ inputs.target }}
& ${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} test --target ${{ inputs.target }} ${{ inputs.args }}
if: inputs.command != 'build' && runner.os == 'Windows'
- name: Build binary (*nix)
working-directory: ${{ inputs.working-directory }}

View File

@ -8,4 +8,10 @@ mod test {
fn test_something() {
assert_eq!(1, 1);
}
#[test]
#[ignore]
fn test_something_ignored() {
assert_eq!(2, 2);
}
}