-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.php
More file actions
27 lines (24 loc) · 993 Bytes
/
Copy pathbuild.php
File metadata and controls
27 lines (24 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
// Runs every example in examples/*/run.php, in order.
// --verify additionally checks each example's required output markers.
require __DIR__ . '/bootstrap.php';
$verify = in_array('--verify', $argv, true);
$failures = 0;
foreach (glob(__DIR__ . '/examples/*/run.php') as $script) {
$name = basename(dirname($script));
echo "\n=== {$name} ===\n";
passthru(PHP_BINARY . ' ' . escapeshellarg($script), $exit);
if ($exit !== 0 && $name !== '06-validate-gate') { // 06 demonstrates a failing gate on purpose; its run.php manages its own exit codes
fwrite(STDERR, "FAILED: {$name} (exit {$exit})\n");
$failures++;
continue;
}
if ($verify) {
$check = dirname($script) . '/verify.php';
if (file_exists($check)) {
passthru(PHP_BINARY . ' ' . escapeshellarg($check), $vexit);
if ($vexit !== 0) { fwrite(STDERR, "VERIFY FAILED: {$name}\n"); $failures++; }
}
}
}
exit($failures === 0 ? 0 : 1);