Skip to content

Commit 734f645

Browse files
authored
ParaTest: leverage WrapperRunner for quicker tests
1 parent 2564b16 commit 734f645

File tree

3 files changed

+48
-10
lines changed

3 files changed

+48
-10
lines changed

.github/workflows/tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
php-version: "${{ matrix.php-version }}"
4646
tools: pecl
4747
extensions: ds,mbstring
48-
ini-values: memory_limit=640M
48+
ini-values: memory_limit=1G
4949

5050
- name: "Install dependencies"
5151
run: "composer install --no-interaction --no-progress"
@@ -86,7 +86,7 @@ jobs:
8686
php-version: "${{ matrix.php-version }}"
8787
tools: pecl
8888
extensions: ds,mbstring
89-
ini-values: memory_limit=640M
89+
ini-values: memory_limit=1G
9090

9191
- name: "Tests"
9292
run: "${{ matrix.script }}"
@@ -113,7 +113,7 @@ jobs:
113113
php-version: "8.1"
114114
tools: pecl
115115
extensions: ds,mbstring
116-
ini-values: memory_limit=640M
116+
ini-values: memory_limit=1G
117117

118118
- name: "Install dependencies"
119119
run: "composer install --no-interaction --no-progress"
@@ -147,7 +147,7 @@ jobs:
147147
php-version: "${{ matrix.php-version }}"
148148
tools: pecl
149149
extensions: ds,mbstring
150-
ini-values: memory_limit=640M
150+
ini-values: memory_limit=1G
151151

152152
- name: "Install dependencies"
153153
run: "composer install --no-interaction --no-progress"
@@ -183,7 +183,7 @@ jobs:
183183
php-version: "${{ matrix.php-version }}"
184184
tools: pecl
185185
extensions: ds,mbstring
186-
ini-values: memory_limit=640M
186+
ini-values: memory_limit=1G
187187

188188
- name: "Downgrade PHPUnit"
189189
run: "composer require --dev phpunit/phpunit:^7.5.20 brianium/paratest:^4.0 --update-with-dependencies --ignore-platform-reqs"

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
build: cs tests phpstan
44

55
tests:
6-
php vendor/bin/paratest --no-coverage
6+
php vendor/bin/paratest --runner WrapperRunner --no-coverage
77

88
tests-integration:
9-
php vendor/bin/paratest --no-coverage --group exec
9+
php vendor/bin/paratest --runner WrapperRunner --no-coverage --group exec
1010

1111
tests-static-reflection:
12-
php vendor/bin/paratest --no-coverage --bootstrap tests/bootstrap-static-reflection.php
12+
php vendor/bin/paratest --runner WrapperRunner --no-coverage --bootstrap tests/bootstrap-static-reflection.php
1313

1414
tests-coverage:
15-
php vendor/bin/paratest
15+
php vendor/bin/paratest --runner WrapperRunner
1616

1717
tests-static-reflection-coverage:
18-
php vendor/bin/paratest --bootstrap tests/bootstrap-static-reflection.php
18+
php vendor/bin/paratest --runner WrapperRunner --bootstrap tests/bootstrap-static-reflection.php
1919

2020
lint:
2121
php vendor/bin/parallel-lint --colors \

patches/paratest.patch

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@package brianium/paratest
2+
@version ^4.0
3+
4+
--- src/Runners/PHPUnit/Worker/BaseWorker.php 2020-02-07 23:07:07.000000000 +0100
5+
+++ src/Runners/PHPUnit/Worker/BaseWorker.php 2022-03-27 17:35:45.000000000 +0200
6+
@@ -28,17 +28,18 @@
7+
array $parameters = [],
8+
?Options $options = null
9+
) {
10+
- $bin = 'PARATEST=1 ';
11+
+ $env = getenv();
12+
+ $env['PARATEST'] = 1;
13+
if (\is_numeric($token)) {
14+
- $bin .= 'XDEBUG_CONFIG="true" ';
15+
- $bin .= "TEST_TOKEN=$token ";
16+
+ $env['XDEBUG_CONFIG'] = 'true';
17+
+ $env['TEST_TOKEN'] = $token;
18+
}
19+
if ($uniqueToken) {
20+
- $bin .= "UNIQUE_TEST_TOKEN=$uniqueToken ";
21+
+ $env['UNIQUE_TEST_TOKEN'] = $uniqueToken;
22+
}
23+
$finder = new PhpExecutableFinder();
24+
$phpExecutable = $finder->find();
25+
- $bin .= "$phpExecutable ";
26+
+ $bin = "$phpExecutable ";
27+
if ($options && $options->passthruPhp) {
28+
$bin .= $options->passthruPhp . ' ';
29+
}
30+
@@ -50,7 +51,7 @@
31+
if ($options && $options->verbose) {
32+
echo "Starting WrapperWorker via: $bin\n";
33+
}
34+
- $process = \proc_open($bin, self::$descriptorspec, $pipes);
35+
+ $process = \proc_open($bin, self::$descriptorspec, $pipes, null, $env);
36+
$this->proc = \is_resource($process) ? $process : null;
37+
$this->pipes = $pipes;
38+
}

0 commit comments

Comments
 (0)