php-src icon indicating copy to clipboard operation
php-src copied to clipboard

make test fail while pdo_sqlite build

Open evrinoma opened this issue 4 years ago • 3 comments

Description

Hi I trying to build pdo_sqlite locally and I've got error

=====================================================================
PHP         : /usr/local/bin/php 
PHP_SAPI    : cli
PHP_VERSION : 8.1.5
ZEND_VERSION: 4.1.5
PHP_OS      : Linux - Linux a9858b2ea4ed 5.16.14-1-default #1 SMP PREEMPT Fri Mar 11 12:33:34 UTC 2022 (80acc65) x86_64
INI actual  : /usr/src/php/ext/pdo_sqlite/tmp-php.ini
More .INIs  :   
CWD         : /usr/src/php/ext/pdo_sqlite
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2022-04-21 13:43:53
=====================================================================
PASS PDO SQLite Bug #33841 (rowCount() does not work on prepared statements) [tests/bug33841.phpt] 
PASS Bug #35336 (crash on PDO::FETCH_CLASS + __set()) [tests/bug35336.phpt] 
PASS Bug #38334: Proper data-type support for PDO_SQLITE [tests/bug38334.phpt] 
PASS Bug #43831 ($this gets mangled when extending PDO with persistent connection) [tests/bug43831.phpt] 
PASS Bug #44327.2 (PDORow::queryString property & numeric offsets / Crash) [tests/bug44327_2.phpt] 
PASS Bug #44327.3 (PDORow::queryString property & numeric offsets / Crash) [tests/bug44327_3.phpt] 
PASS Bug #46139 (PDOStatement->setFetchMode() forgets FETCH_PROPS_LATE) [tests/bug46139.phpt] 
PASS Bug #46542 Extending PDO class with a __call() function [tests/bug46542.phpt] 
PASS Bug #48773 (Incorrect error when setting PDO::ATTR_STATEMENT_CLASS with ctor_args) [tests/bug48773.phpt] 
PASS Bug #50728 (All PDOExceptions hardcode 'code' property to 0) [tests/bug50728.phpt] 
PASS Bug #52487 (PDO::FETCH_INTO leaks memory) [tests/bug52487.phpt] 
PASS Bug #60104 (Segmentation Fault in pdo_sqlite when using sqliteCreateFunction()) [tests/bug60104.phpt] 
PASS Bug #66033 (Segmentation Fault when constructor of PDO statement throws an exception) [tests/bug66033.phpt] 
PASS Bug #70221 (persistent sqlite connection + custom function segfaults) [tests/bug70221.phpt] 
PASS PDO_sqlite: Testing sqliteCreateCollation() [tests/bug70862.phpt] 
PASS PDO SQLite Bug #78192 SegFault when reuse statement after schema change [tests/bug78192.phpt] 
PASS Bug #79664 (PDOStatement::getColumnMeta fails on empty result set) [tests/bug79664.phpt] 
PASS PDO SQLite Feature Request #42589 (getColumnMeta() should also return table name) [tests/bug_42589.phpt] 
PASS PDO Common: Bug #44159: SQLite variant [tests/bug_44159_sqlite_version.phpt] 
PASS PDO Common: Bug #47769 (Strange extends PDO) [tests/bug_47769.phpt] 
SKIP Bug #63916 PDO::PARAM_INT casts to 32bit int internally even on 64bit builds in pdo_sqlite [tests/bug_63916-2.phpt] reason: 32-bit only
PASS Bug #63916 PDO::PARAM_INT casts to 32bit int internally even on 64bit builds in pdo_sqlite [tests/bug_63916.phpt] 
PASS Bug #64705 errorInfo property of PDOException is null when PDO::__construct() fails [tests/bug_64705.phpt] 
TEST 24/43 [tests/common.phpt]
Warning: opendir(/usr/src/php/ext/pdo_sqlite/ext/pdo/tests): Failed to open directory: No such file or directory in /usr/src/php/ext/pdo_sqlite/run-tests.php on line 1084
ERROR: cannot open directory: /usr/src/php/ext/pdo_sqlite/ext/pdo/tests
make: *** [Makefile:133: test] Error 1

solution

--TEST--
SQLite
--EXTENSIONS--
pdo_sqlite
--SKIPIF--
<?php
if (! is_dir(__DIR__ . '/ext/pdo/tests')) die('skip can\'t find pdo');
?>
--REDIRECTTEST--
return array(
        'ENV' => array(
                        'PDOTEST_DSN' => 'sqlite::memory:'
                ),
        'TESTS' => __DIR__ . '/ext/pdo/tests'
        );

PHP Version

PHP 8.1.5 PHP 7.4.29

Operating System

REHL

evrinoma avatar Apr 21 '22 13:04 evrinoma

Hmm, it might be better to catch this in run-tests.php instead of adding skip clauses to each individual test (there are a lot of these). And frankly, I'm not happy that these tests would be skipped; they're likely the most important tests for any PDO driver.

cmb69 avatar Apr 21 '22 14:04 cmb69

Sure you are right, I didn't think about that I have to test dpo too so next solution fix it

--TEST--
SQLite
--EXTENSIONS--
pdo_sqlite
--REDIRECTTEST--
return array(
        'ENV' => array(
                        'PDOTEST_DSN' => 'sqlite::memory:'
                ),
        'TESTS' => __DIR__ . '/../../ext/pdo/tests'
        );

all test pass

=====================================================================
TIME END 2022-04-21 14:47:19

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   13
---------------------------------------------------------------------

Number of tests :  124               118
Tests skipped   :    6 (  4.8%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    0 (  0.0%) (  0.0%)
Expected fail   :    1 (  0.8%) (  0.8%)
Tests passed    :  117 ( 94.4%) ( 99.2%)
---------------------------------------------------------------------
Time taken      :    1 seconds
=====================================================================

evrinoma avatar Apr 21 '22 14:04 evrinoma

'TESTS' => __DIR__ . '/../../ext/pdo/tests'

This fix would break regular builds (in-tree builds using buildconf). It would also not help with general phpize builds (there is usually no need to build from within the php-src tree).

I think that we should consider to adjust run-tests.php to cater to both regular and in-tree phpize builds (i.e. check which of the two possible file exists).

It should be noted that 5ba763413b8f1e0e2399f124641845cf782ce0f5 introduced the __DIR__ to have absolute paths (previously, we had relative paths, which would make it trivial to check for file existance in different locations).

cmb69 avatar Apr 22 '22 12:04 cmb69