From 280485adc1bae2b33f4eb42271ecd32d4bef3019 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Fri, 13 Mar 2020 14:09:53 +0100 Subject: [PATCH] Improve FFI test suite for Windows We add Windows support to four existing test cases, extract some useful utility functions, and use them to simplify further test cases. We also remove the Windows specific code from preload.inc, since preloading isn't supported on Windows anyway. --- ext/ffi/tests/100.phpt | 16 ++++++---------- ext/ffi/tests/101.phpt | 16 ++++++---------- ext/ffi/tests/200.phpt | 6 ++++-- ext/ffi/tests/301-win32.phpt | 3 ++- ext/ffi/tests/bug77632b.phpt | 6 ++++-- ext/ffi/tests/bug78270_1.phpt | 8 ++++---- ext/ffi/tests/bug78270_2.phpt | 4 ++-- ext/ffi/tests/bug78714.phpt | 8 ++------ ext/ffi/tests/bug79096.phpt | 4 ++-- ext/ffi/tests/preload.inc | 15 ++------------- ext/ffi/tests/utils.inc | 30 ++++++++++++++++++++++++++++++ 11 files changed, 64 insertions(+), 52 deletions(-) create mode 100644 ext/ffi/tests/utils.inc diff --git a/ext/ffi/tests/100.phpt b/ext/ffi/tests/100.phpt index 63fae8c215..572052f372 100644 --- a/ext/ffi/tests/100.phpt +++ b/ext/ffi/tests/100.phpt @@ -2,9 +2,10 @@ FFI 100: PHP symbols --SKIPIF-- + get_zend_version())[0])); //var_dump(trim(FFI::string($zend->get_zend_version()))); var_dump($zend->zend_printf); diff --git a/ext/ffi/tests/101.phpt b/ext/ffi/tests/101.phpt index 91c6fc4ddf..7f673b7fb2 100644 --- a/ext/ffi/tests/101.phpt +++ b/ext/ffi/tests/101.phpt @@ -2,9 +2,10 @@ FFI 101: PHP symbols (function address) --SKIPIF-- + get_zend_version; var_dump(trim(explode("\n",$f())[0])); //var_dump(trim(FFI::string($zend->get_zend_version()))); diff --git a/ext/ffi/tests/200.phpt b/ext/ffi/tests/200.phpt index dda77a03a0..205c0ebab2 100644 --- a/ext/ffi/tests/200.phpt +++ b/ext/ffi/tests/200.phpt @@ -2,9 +2,10 @@ FFI 200: PHP callbacks --SKIPIF-- + zend_printf)(...$args); $args2 = ["Hello, %s from zend_printf\n", "world"]; diff --git a/ext/ffi/tests/bug78270_1.phpt b/ext/ffi/tests/bug78270_1.phpt index 203e8c330a..b4e1911dbb 100644 --- a/ext/ffi/tests/bug78270_1.phpt +++ b/ext/ffi/tests/bug78270_1.phpt @@ -5,26 +5,26 @@ FR #78270 (Usage of __vectorcall convention with FFI) require_once('skipif.inc'); if (substr(PHP_OS, 0, 3) != 'WIN') die("skip this test is for Windows platforms only"); +require_once('utils.inc'); ob_start(); phpinfo(INFO_GENERAL); $info = ob_get_clean(); if (preg_match('/Compiler => .*clang.*/', $info)) die("skip not for clang"); -$dll = 'php7' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll'; try { FFI::cdef(<< --FILE-- zend_atoi("17.4", 4)); ?> --EXPECT-- diff --git a/ext/ffi/tests/bug78270_2.phpt b/ext/ffi/tests/bug78270_2.phpt index 60ba27853e..f70273efb2 100644 --- a/ext/ffi/tests/bug78270_2.phpt +++ b/ext/ffi/tests/bug78270_2.phpt @@ -5,11 +5,11 @@ FR #78270 (Usage of __vectorcall convention with FFI) require_once('skipif.inc'); if (substr(PHP_OS, 0, 3) != 'WIN') die("skip this test is for Windows platforms only"); -$dll = 'php7' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll'; +require_once('utils.inc'); try { FFI::cdef(<<get_zend_version()), 0, 4) . "\n"; ?> --EXPECT-- diff --git a/ext/ffi/tests/bug79096.phpt b/ext/ffi/tests/bug79096.phpt index c495efc92e..a45b45646a 100644 --- a/ext/ffi/tests/bug79096.phpt +++ b/ext/ffi/tests/bug79096.phpt @@ -7,6 +7,7 @@ if (!extension_loaded('zend-test')) die('skip zend-test extension not available' ?> --FILE--