|
14 | 14 | 'Top-level document validity: Bad $date (number, not string or hash)' => 'Legacy extended JSON $date syntax uses numbers (CDRIVER-2223)',
|
15 | 15 | ];
|
16 | 16 |
|
| 17 | +$for64bitOnly = [ |
| 18 | + 'Int64 type: MinValue' => "Can't represent 64-bit ints on a 32-bit platform", |
| 19 | + 'Int64 type: MaxValue' => "Can't represent 64-bit ints on a 32-bit platform", |
| 20 | +]; |
| 21 | + |
17 | 22 | $outputPath = realpath(__DIR__ . '/../tests') . '/bson-corpus/';
|
18 | 23 |
|
19 | 24 | if ( ! is_dir($outputPath) && ! mkdir($outputPath, 0755, true)) {
|
|
42 | 47 | foreach ($test['valid'] as $i => $case) {
|
43 | 48 | $outputFile = sprintf('%s-valid-%03d.phpt', pathinfo($inputFile, PATHINFO_FILENAME), $i + 1);
|
44 | 49 | try {
|
45 |
| - $output = renderPhpt(getParamsForValid($test, $case), $expectedFailures); |
| 50 | + $output = renderPhpt(getParamsForValid($test, $case), $expectedFailures, $for64bitOnly); |
46 | 51 | } catch (Exception $e) {
|
47 | 52 | printf("Error processing valid[%d] in %s: %s\n", $i, $inputFile, $e->getMessage());
|
48 | 53 | continue;
|
|
59 | 64 | foreach ($test['decodeErrors'] as $i => $case) {
|
60 | 65 | $outputFile = sprintf('%s-decodeError-%03d.phpt', pathinfo($inputFile, PATHINFO_FILENAME), $i + 1);
|
61 | 66 | try {
|
62 |
| - $output = renderPhpt(getParamsForDecodeError($test, $case), $expectedFailures); |
| 67 | + $output = renderPhpt(getParamsForDecodeError($test, $case), $expectedFailures, $for64bitOnly); |
63 | 68 | } catch (Exception $e) {
|
64 | 69 | printf("Error processing decodeErrors[%d] in %s: %s\n", $i, $inputFile, $e->getMessage());
|
65 | 70 | continue;
|
|
76 | 81 | foreach ($test['parseErrors'] as $i => $case) {
|
77 | 82 | $outputFile = sprintf('%s-parseError-%03d.phpt', pathinfo($inputFile, PATHINFO_FILENAME), $i + 1);
|
78 | 83 | try {
|
79 |
| - $output = renderPhpt(getParamsForParseError($test, $case), $expectedFailures); |
| 84 | + $output = renderPhpt(getParamsForParseError($test, $case), $expectedFailures, $for64bitOnly); |
80 | 85 | } catch (Exception $e) {
|
81 | 86 | printf("Error processing parseErrors[%d] in %s: %s\n", $i, $inputFile, $e->getMessage());
|
82 | 87 | continue;
|
@@ -263,16 +268,19 @@ function getParamsForParseError(array $test, array $case)
|
263 | 268 | ];
|
264 | 269 | }
|
265 | 270 |
|
266 |
| -function renderPhpt(array $params, array $expectedFailures) |
| 271 | +function renderPhpt(array $params, array $expectedFailures, array $for64bitOnly) |
267 | 272 | {
|
268 | 273 | $params['%XFAIL%'] = isset($expectedFailures[$params['%NAME%']])
|
269 | 274 | ? "--XFAIL--\n" . $expectedFailures[$params['%NAME%']] . "\n"
|
270 | 275 | : '';
|
| 276 | + $params['%SKIPIF%'] = isset($for64bitOnly[$params['%NAME%']]) |
| 277 | + ? "--SKIPIF--\n" . "<?php if (PHP_INT_SIZE !== 8) { die(\"skip {$for64bitOnly[$params['%NAME%']]}\"); } ?>" . "\n" |
| 278 | + : ''; |
271 | 279 |
|
272 | 280 | $template = <<< 'TEMPLATE'
|
273 | 281 | --TEST--
|
274 | 282 | %NAME%
|
275 |
| -%XFAIL%--DESCRIPTION-- |
| 283 | +%XFAIL%%SKIPIF%--DESCRIPTION-- |
276 | 284 | Generated by scripts/convert-bson-corpus-tests.php
|
277 | 285 |
|
278 | 286 | DO NOT EDIT THIS FILE
|
|
0 commit comments