Skip to content

Commit b2edddd

Browse files
committed
Add support for arguments to the test runner
1 parent b013ecf commit b2edddd

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

.github/workflows/pecl.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ on:
4040
description: 'Test runner to use'
4141
required: false
4242
default: 'run-tests.php'
43+
test-runner-args:
44+
description: 'Arguments for the test runner'
45+
required: false
4346
jobs:
4447
get-extension-matrix:
4548
runs-on: ubuntu-latest
@@ -79,6 +82,7 @@ jobs:
7982
libs: ${{ inputs.libs }}
8083
run-tests: ${{ inputs.run-tests }}
8184
test-runner: ${{ inputs.test-runner }}
85+
test-runner-args: ${{ inputs.test-runner-args }}
8286
build-directory: C:\build
8387
env:
8488
artifact-naming-scheme: pecl

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Build a specific version of a PHP extension.
7878
- `build-directory` (optional) - The directory to build the extension in, defaults to the user's temporary directory.
7979
- `run-tests` (optional) - Run the extension tests. Defaults to `true`.
8080
- `test-runner` (optional) - The test runner to use. Defaults to `run-tests.php`.
81+
- `test-runner-args` (optional) - Arguments to pass to the test runner.
8182
- `test-opcache-mode` (optional) - Run tests with opcache `on`, `off` or `both`. Defaults to `off`.
8283
- `test-workers` (optional) - The number of workers to use when running tests. Defaults to `8`.
8384
- `auth-token` (optional) - Authentication token to use in case the extension is hosted on a private repository.

extension/BuildPhpExtension/private/Invoke-Tests.ps1

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,24 @@ Function Invoke-Tests {
4545
} elseif(-not(Test-Path $env:TEST_RUNNER)) {
4646
throw "Test runner $env:TEST_RUNNER does not exist."
4747
}
48-
$test_runner_args = @(
49-
'-q',
50-
'--offline',
51-
'--show-diff',
52-
'--show-slow 1000',
53-
'--set-timeout 120',
54-
'-g FAIL,XFAIL,BORK,WARN,LEAK,SKIP'
55-
)
48+
49+
if($null -ne $env:TEST_RUNNER_ARGS -and $env:TEST_RUNNER_ARGS -ne '') {
50+
$test_runner_args = $env:TEST_RUNNER_ARGS -split '\s+'
51+
} else {
52+
$test_runner_args = @(
53+
'-q',
54+
'--offline',
55+
'--show-diff',
56+
'--show-slow 1000',
57+
'--set-timeout 120',
58+
'-g FAIL,XFAIL,BORK,WARN,LEAK,SKIP'
59+
)
60+
}
5661
$test_workers = 8
5762
if($null -ne $env:TEST_WORKERS -and $env:TEST_WORKERS -ne '') {
5863
$test_workers = $env:TEST_WORKERS
5964
}
60-
if($Config.php_version -ge '7.4') {
65+
if($Config.php_version -ge '7.4' -and $test_runner_args -notcontains '-j') {
6166
$test_runner_args += ('-j' + $test_workers)
6267
}
6368

extension/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ inputs:
3939
description: Test runner to use
4040
required: false
4141
default: 'run-tests.php'
42+
test-runner-args:
43+
description: Test runner to use
44+
required: false
4245
test-opcache-mode:
4346
description: Test opcache mode
4447
required: false
@@ -67,6 +70,7 @@ runs:
6770
ARTIFACT_NAMING_SCHEME: ${{env.artifact-naming-scheme}}
6871
RUN_TESTS: ${{inputs.run-tests}}
6972
TEST_RUNNER: ${{inputs.test-runner}}
73+
TEST_RUNNER_ARGS: ${{inputs.test-runner-args}}
7074
TEST_OPCACHE_MODE: ${{inputs.test-opcache-mode}}
7175
TEST_WORKERS: ${{inputs.test-workers}}
7276
BUILD_DIRECTORY: ${{inputs.build-directory}}

0 commit comments

Comments
 (0)