mirror of
https://github.com/danog/parallel.git
synced 2024-11-26 20:34:40 +01:00
Move GC test to ProcessPoolTest
This commit is contained in:
parent
0a474e18c0
commit
e6a5de671a
@ -130,24 +130,4 @@ abstract class AbstractPoolTest extends TestCase {
|
||||
yield $pool->shutdown();
|
||||
});
|
||||
}
|
||||
|
||||
public function testCleanGarbageCollection() {
|
||||
// See https://github.com/amphp/parallel-functions/issues/5
|
||||
Loop::run(function () {
|
||||
for ($i = 0; $i < 15; $i++) {
|
||||
$pool = $this->createPool(32);
|
||||
|
||||
$values = \range(1, 50);
|
||||
$tasks = \array_map(function (int $value): Task {
|
||||
return new TestTask($value);
|
||||
}, $values);
|
||||
|
||||
$promises = \array_map(function (Task $task) use ($pool): Promise {
|
||||
return $pool->enqueue($task);
|
||||
}, $tasks);
|
||||
|
||||
$this->assertSame($values, yield $promises);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,13 @@
|
||||
|
||||
namespace Amp\Parallel\Test\Worker;
|
||||
|
||||
use Amp\Loop;
|
||||
use Amp\Parallel\Worker\DefaultPool;
|
||||
use Amp\Parallel\Worker\Pool;
|
||||
use Amp\Parallel\Worker\Task;
|
||||
use Amp\Parallel\Worker\WorkerFactory;
|
||||
use Amp\Parallel\Worker\WorkerProcess;
|
||||
use Amp\Promise;
|
||||
|
||||
/**
|
||||
* @group process
|
||||
@ -19,4 +22,27 @@ class ProcessPoolTest extends AbstractPoolTest {
|
||||
|
||||
return new DefaultPool($max, $factory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @FIXME This test should be moved to AbstractPoolTest once the GC issues with pthreads are resolved.
|
||||
*/
|
||||
public function testCleanGarbageCollection() {
|
||||
// See https://github.com/amphp/parallel-functions/issues/5
|
||||
Loop::run(function () {
|
||||
for ($i = 0; $i < 15; $i++) {
|
||||
$pool = $this->createPool(32);
|
||||
|
||||
$values = \range(1, 50);
|
||||
$tasks = \array_map(function (int $value): Task {
|
||||
return new TestTask($value);
|
||||
}, $values);
|
||||
|
||||
$promises = \array_map(function (Task $task) use ($pool): Promise {
|
||||
return $pool->enqueue($task);
|
||||
}, $tasks);
|
||||
|
||||
$this->assertSame($values, yield $promises);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user