Skip to content

Commit f0b86fa

Browse files
committed
Add SKIPIF sectionis and "stdout" recovery code
1 parent 1cd2d7e commit f0b86fa

19 files changed

+172
-1
lines changed

ext/ffi/tests/jit/001_var_read_scalar.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ opcache.jit_hot_func=0
88
opcache.jit_hot_return=0
99
opcache.jit_hot_side_exit=0
1010
;opcache.jit_debug=0x180005
11+
--SKIPIF--
12+
<?php
13+
try {
14+
$libc = FFI::cdef("extern intptr_t stdout;");
15+
} catch (Throwable $_) {
16+
die('skip libc.so.6 not available');
17+
}
18+
?>
1119
--FILE--
1220
<?php
1321
function test() {

ext/ffi/tests/jit/002_var_read_array.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ opcache.jit_hot_func=0
88
opcache.jit_hot_return=0
99
opcache.jit_hot_side_exit=0
1010
;opcache.jit_debug=0x180005
11+
--SKIPIF--
12+
<?php
13+
try {
14+
$libc = FFI::cdef("extern intptr_t stdout;");
15+
} catch (Throwable $_) {
16+
die('skip libc.so.6 not available');
17+
}
18+
?>
1119
--FILE--
1220
<?php
1321
function test() {

ext/ffi/tests/jit/003_var_read_struct.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ opcache.jit_hot_func=0
88
opcache.jit_hot_return=0
99
opcache.jit_hot_side_exit=0
1010
;opcache.jit_debug=0x180005
11+
--SKIPIF--
12+
<?php
13+
try {
14+
$libc = FFI::cdef("extern intptr_t stdout;");
15+
} catch (Throwable $_) {
16+
die('skip libc.so.6 not available');
17+
}
18+
?>
1119
--FILE--
1220
<?php
1321
function test() {

ext/ffi/tests/jit/004_var_read_struct_ptr.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ opcache.jit_hot_func=0
88
opcache.jit_hot_return=0
99
opcache.jit_hot_side_exit=0
1010
;opcache.jit_debug=0x180005
11+
--SKIPIF--
12+
<?php
13+
try {
14+
$libc = FFI::cdef("extern intptr_t stdout;");
15+
} catch (Throwable $_) {
16+
die('skip libc.so.6 not available');
17+
}
18+
?>
1119
--FILE--
1220
<?php
1321
function test() {

ext/ffi/tests/jit/005_var_read_func.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ opcache.jit_hot_func=0
88
opcache.jit_hot_return=0
99
opcache.jit_hot_side_exit=0
1010
;opcache.jit_debug=0x180005
11+
--SKIPIF--
12+
<?php
13+
try {
14+
$libc = FFI::cdef("extern intptr_t stdout;");
15+
} catch (Throwable $_) {
16+
die('skip libc.so.6 not available');
17+
}
18+
?>
1119
--FILE--
1220
<?php
1321
function test() {

ext/ffi/tests/jit/006_var_write_scalar.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,27 @@ opcache.jit_hot_func=0
88
opcache.jit_hot_return=0
99
opcache.jit_hot_side_exit=0
1010
;opcache.jit_debug=0x180005
11+
--SKIPIF--
12+
<?php
13+
try {
14+
$libc = FFI::cdef("extern intptr_t stdout;");
15+
} catch (Throwable $_) {
16+
die('skip libc.so.6 not available');
17+
}
18+
?>
1119
--FILE--
1220
<?php
1321
function test() {
1422
$ffi = FFI::cdef(<<<EOF
1523
extern int64_t stdout;
1624
EOF, 'libc.so.6');
1725

26+
$old = $ffi->stdout;
1827
for ($i = 0; $i < 5; $i++) {
1928
$ffi->stdout = $i;
2029
}
2130
var_dump($ffi->stdout);
31+
$ffi->stdout = $old;
2232
}
2333
test();
2434
?>

ext/ffi/tests/jit/007_var_write_scalar_cdata.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,29 @@ opcache.jit_hot_func=0
88
opcache.jit_hot_return=0
99
opcache.jit_hot_side_exit=0
1010
;opcache.jit_debug=0x180005
11+
--SKIPIF--
12+
<?php
13+
try {
14+
$libc = FFI::cdef("extern intptr_t stdout;");
15+
} catch (Throwable $_) {
16+
die('skip libc.so.6 not available');
17+
}
18+
?>
1119
--FILE--
1220
<?php
1321
function test() {
1422
$ffi = FFI::cdef(<<<EOF
1523
extern int64_t stdout;
1624
EOF, 'libc.so.6');
1725

26+
$old = $ffi->stdout;
1827
$x = $ffi->cast('int64_t', 42);
1928
var_dump($x);
2029
for ($i = 0; $i < 5; $i++) {
2130
$ffi->stdout = $x;
2231
}
2332
var_dump($ffi->stdout);
33+
$ffi->stdout = $old;
2434
}
2535
test();
2636
?>

ext/ffi/tests/jit/008_var_write_struct_ptr_null.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ opcache.jit_hot_func=0
88
opcache.jit_hot_return=0
99
opcache.jit_hot_side_exit=0
1010
;opcache.jit_debug=0x180005
11+
--SKIPIF--
12+
<?php
13+
try {
14+
$libc = FFI::cdef("extern uintptr_t stdout;", "libc.so.6");
15+
} catch (Throwable $_) {
16+
die('skip libc.so.6 not available');
17+
}
18+
?>
1119
--FILE--
1220
<?php
1321
function test() {
@@ -16,10 +24,12 @@ function test() {
1624
extern FILE *stdout;
1725
EOF, 'libc.so.6');
1826

27+
$old = $ffi->stdout;
1928
for ($i = 0; $i < 5; $i++) {
2029
$ffi->stdout = null;
2130
}
2231
var_dump($ffi->stdout);
32+
$ffi->stdout = $old;
2333
}
2434
test();
2535
?>

ext/ffi/tests/jit/009_var_write_struct_ptr_cdata.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ opcache.jit_hot_func=0
88
opcache.jit_hot_return=0
99
opcache.jit_hot_side_exit=0
1010
;opcache.jit_debug=0x180005
11+
--SKIPIF--
12+
<?php
13+
try {
14+
$libc = FFI::cdef("extern intptr_t stdout;");
15+
} catch (Throwable $_) {
16+
die('skip libc.so.6 not available');
17+
}
18+
?>
1119
--FILE--
1220
<?php
1321
function test() {
@@ -16,13 +24,15 @@ function test() {
1624
extern FILE *stdout;
1725
EOF, 'libc.so.6');
1826

27+
$old = $ffi->stdout;
1928
$x = $ffi->cast('FILE*', 42);
2029
var_dump($x);
2130
for ($i = 0; $i < 5; $i++) {
2231
$ffi->stdout = $x;
2332
}
2433
var_dump($ffi->stdout);
2534
var_dump($ffi->cast('intptr_t', $ffi->stdout));
35+
$ffi->stdout = $old;
2636
}
2737
test();
2838
?>

ext/ffi/tests/jit/010_var_modify_scalar.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,28 @@ opcache.jit_hot_func=0
88
opcache.jit_hot_return=0
99
opcache.jit_hot_side_exit=0
1010
;opcache.jit_debug=0x180005
11+
--SKIPIF--
12+
<?php
13+
try {
14+
$libc = FFI::cdef("extern intptr_t stdout;");
15+
} catch (Throwable $_) {
16+
die('skip libc.so.6 not available');
17+
}
18+
?>
1119
--FILE--
1220
<?php
1321
function test() {
1422
$ffi = FFI::cdef(<<<EOF
1523
extern int64_t stdout;
1624
EOF, 'libc.so.6');
1725

26+
$old = $ffi->stdout;
1827
$ffi->stdout = null;
1928
for ($i = 0; $i < 5; $i++) {
2029
$ffi->stdout += $i;
2130
}
2231
var_dump($ffi->stdout);
32+
$ffi->stdout = $old;
2333
}
2434
test();
2535
?>

0 commit comments

Comments
 (0)