mbeccati Tue, 30 Aug 2011 14:01:03 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=315783
Log:
Fixed a few false positives on gcov for ext/pgsql
Changed paths:
U php/php-src/branches/PHP_5_3/ext/pgsql/tests/09notice.phpt
U php/php-src/branches/PHP_5_3/ext/pgsql/tests/22pg_fetch_object.phpt
U php/php-src/branches/PHP_5_3/ext/pgsql/tests/80_bug32223.phpt
U php/php-src/branches/PHP_5_3/ext/pgsql/tests/80_bug32223b.phpt
A php/php-src/branches/PHP_5_3/ext/pgsql/tests/lcmess.inc
U php/php-src/branches/PHP_5_3/ext/pgsql/tests/skipif.inc
U php/php-src/branches/PHP_5_4/ext/pgsql/tests/09notice.phpt
U php/php-src/branches/PHP_5_4/ext/pgsql/tests/22pg_fetch_object.phpt
U php/php-src/branches/PHP_5_4/ext/pgsql/tests/80_bug32223.phpt
U php/php-src/branches/PHP_5_4/ext/pgsql/tests/80_bug32223b.phpt
A php/php-src/branches/PHP_5_4/ext/pgsql/tests/lcmess.inc
U php/php-src/branches/PHP_5_4/ext/pgsql/tests/skipif.inc
U php/php-src/trunk/ext/pgsql/tests/09notice.phpt
U php/php-src/trunk/ext/pgsql/tests/22pg_fetch_object.phpt
U php/php-src/trunk/ext/pgsql/tests/80_bug32223.phpt
U php/php-src/trunk/ext/pgsql/tests/80_bug32223b.phpt
A php/php-src/trunk/ext/pgsql/tests/lcmess.inc
U php/php-src/trunk/ext/pgsql/tests/skipif.inc
Modified: php/php-src/branches/PHP_5_3/ext/pgsql/tests/09notice.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pgsql/tests/09notice.phpt 2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/branches/PHP_5_3/ext/pgsql/tests/09notice.phpt 2011-08-30 14:01:03 UTC (rev 315783)
@@ -1,16 +1,25 @@
--TEST--
PostgreSQL notice function
--SKIPIF--
-<?php include("skipif.inc"); ?>
+<?php
+
+include("skipif.inc");
+
+_skip_lc_messages();
+
+?>
--INI--
pgsql.log_notice=1
pgsql.ignore_notices=0
--FILE--
<?php
include 'config.inc';
+include 'lcmess.inc';
$db = pg_connect($conn_str);
-pg_exec($db, "SET LC_MESSAGES='C';");
+
+_set_lc_messages();
+
pg_query($db, "BEGIN;");
pg_query($db, "BEGIN;");
Modified: php/php-src/branches/PHP_5_3/ext/pgsql/tests/22pg_fetch_object.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pgsql/tests/22pg_fetch_object.phpt 2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/branches/PHP_5_3/ext/pgsql/tests/22pg_fetch_object.phpt 2011-08-30 14:01:03 UTC (rev 315783)
@@ -16,7 +16,7 @@
$db = pg_connect($conn_str);
-$sql = "SELECT * FROM $table_name";
+$sql = "SELECT * FROM $table_name WHERE num = 0";
$result = pg_query($db, $sql) or die('Cannot qeury db');
$rows = pg_num_rows($result);
Modified: php/php-src/branches/PHP_5_3/ext/pgsql/tests/80_bug32223.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pgsql/tests/80_bug32223.phpt 2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/branches/PHP_5_3/ext/pgsql/tests/80_bug32223.phpt 2011-08-30 14:01:03 UTC (rev 315783)
@@ -3,6 +3,8 @@
--SKIPIF--
<?php
require_once('skipif.inc');
+
+_skip_lc_messages();
@pg_query($conn, "CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL'");
$res = @pg_query($conn, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
@@ -17,14 +19,15 @@
<?php
require_once('config.inc');
+require_once('lcmess.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
die ("Could not connect to the server");
}
-pg_exec($dbh, "SET LC_MESSAGES='C';");
-//@pg_query($dbh, "CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL'");
+_set_lc_messages();
+
$res = pg_query($dbh, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
begin
RAISE NOTICE ''11111'';
Modified: php/php-src/branches/PHP_5_3/ext/pgsql/tests/80_bug32223b.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pgsql/tests/80_bug32223b.phpt 2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/branches/PHP_5_3/ext/pgsql/tests/80_bug32223b.phpt 2011-08-30 14:01:03 UTC (rev 315783)
@@ -3,6 +3,8 @@
--SKIPIF--
<?php
require_once('skipif.inc');
+
+_skip_lc_messages();
@pg_query($conn, "CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL'");
$res = @pg_query($conn, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
@@ -17,14 +19,15 @@
<?php
require_once('config.inc');
+require_once('lcmess.inc');
define('dbh', pg_connect($conn_str));
if (!dbh) {
die ("Could not connect to the server");
}
-pg_exec(dbh, "SET LC_MESSAGES='C';");
-//@pg_query(dbh, "CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL'");
+_set_lc_messages();
+
$res = pg_query(dbh, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
begin
RAISE NOTICE ''11111'';
Added: php/php-src/branches/PHP_5_3/ext/pgsql/tests/lcmess.inc
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pgsql/tests/lcmess.inc (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/pgsql/tests/lcmess.inc 2011-08-30 14:01:03 UTC (rev 315783)
@@ -0,0 +1,21 @@
+<?php
+
+function _skip_lc_messages($lc_messages = 'C')
+{
+ if (!_set_lc_messages($lc_messages)) {
+ die("skip Cannot set LC_MESSAGES to '{$lc_messages}'\n");
+ }
+}
+
+function _set_lc_messages($lc_messages = 'C')
+{
+ if (pg_result(pg_query("SHOW LC_MESSAGES"), 0, 0) != $lc_messages) {
+ if (!@pg_exec("SET LC_MESSAGES='{$lc_messages}'")) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+?>
Modified: php/php-src/branches/PHP_5_3/ext/pgsql/tests/skipif.inc
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pgsql/tests/skipif.inc 2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/branches/PHP_5_3/ext/pgsql/tests/skipif.inc 2011-08-30 14:01:03 UTC (rev 315783)
@@ -7,6 +7,7 @@
// database
include("config.inc");
+include("lcmess.inc");
if (!extension_loaded("pgsql")) {
die("skip\n");
Modified: php/php-src/branches/PHP_5_4/ext/pgsql/tests/09notice.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/pgsql/tests/09notice.phpt 2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/branches/PHP_5_4/ext/pgsql/tests/09notice.phpt 2011-08-30 14:01:03 UTC (rev 315783)
@@ -1,16 +1,25 @@
--TEST--
PostgreSQL notice function
--SKIPIF--
-<?php include("skipif.inc"); ?>
+<?php
+
+include("skipif.inc");
+
+_skip_lc_messages();
+
+?>
--INI--
pgsql.log_notice=1
pgsql.ignore_notices=0
--FILE--
<?php
include 'config.inc';
+include 'lcmess.inc';
$db = pg_connect($conn_str);
-pg_exec($db, "SET LC_MESSAGES='C';");
+
+_set_lc_messages();
+
pg_query($db, "BEGIN;");
pg_query($db, "BEGIN;");
Modified: php/php-src/branches/PHP_5_4/ext/pgsql/tests/22pg_fetch_object.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/pgsql/tests/22pg_fetch_object.phpt 2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/branches/PHP_5_4/ext/pgsql/tests/22pg_fetch_object.phpt 2011-08-30 14:01:03 UTC (rev 315783)
@@ -16,7 +16,7 @@
$db = pg_connect($conn_str);
-$sql = "SELECT * FROM $table_name";
+$sql = "SELECT * FROM $table_name WHERE num = 0";
$result = pg_query($db, $sql) or die('Cannot qeury db');
$rows = pg_num_rows($result);
Modified: php/php-src/branches/PHP_5_4/ext/pgsql/tests/80_bug32223.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/pgsql/tests/80_bug32223.phpt 2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/branches/PHP_5_4/ext/pgsql/tests/80_bug32223.phpt 2011-08-30 14:01:03 UTC (rev 315783)
@@ -3,6 +3,8 @@
--SKIPIF--
<?php
require_once('skipif.inc');
+
+_skip_lc_messages();
@pg_query($conn, "CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL'");
$res = @pg_query($conn, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
@@ -17,14 +19,15 @@
<?php
require_once('config.inc');
+require_once('lcmess.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
die ("Could not connect to the server");
}
-pg_exec($dbh, "SET LC_MESSAGES='C';");
-//@pg_query($dbh, "CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL'");
+_set_lc_messages();
+
$res = pg_query($dbh, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
begin
RAISE NOTICE ''11111'';
Modified: php/php-src/branches/PHP_5_4/ext/pgsql/tests/80_bug32223b.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/pgsql/tests/80_bug32223b.phpt 2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/branches/PHP_5_4/ext/pgsql/tests/80_bug32223b.phpt 2011-08-30 14:01:03 UTC (rev 315783)
@@ -3,6 +3,8 @@
--SKIPIF--
<?php
require_once('skipif.inc');
+
+_skip_lc_messages();
@pg_query($conn, "CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL'");
$res = @pg_query($conn, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
@@ -17,14 +19,15 @@
<?php
require_once('config.inc');
+require_once('lcmess.inc');
define('dbh', pg_connect($conn_str));
if (!dbh) {
die ("Could not connect to the server");
}
-pg_exec(dbh, "SET LC_MESSAGES='C';");
-//@pg_query(dbh, "CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL'");
+_set_lc_messages();
+
$res = pg_query(dbh, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
begin
RAISE NOTICE ''11111'';
Added: php/php-src/branches/PHP_5_4/ext/pgsql/tests/lcmess.inc
===================================================================
--- php/php-src/branches/PHP_5_4/ext/pgsql/tests/lcmess.inc (rev 0)
+++ php/php-src/branches/PHP_5_4/ext/pgsql/tests/lcmess.inc 2011-08-30 14:01:03 UTC (rev 315783)
@@ -0,0 +1,21 @@
+<?php
+
+function _skip_lc_messages($lc_messages = 'C')
+{
+ if (!_set_lc_messages($lc_messages)) {
+ die("skip Cannot set LC_MESSAGES to '{$lc_messages}'\n");
+ }
+}
+
+function _set_lc_messages($lc_messages = 'C')
+{
+ if (pg_result(pg_query("SHOW LC_MESSAGES"), 0, 0) != $lc_messages) {
+ if (!@pg_exec("SET LC_MESSAGES='{$lc_messages}'")) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+?>
Modified: php/php-src/branches/PHP_5_4/ext/pgsql/tests/skipif.inc
===================================================================
--- php/php-src/branches/PHP_5_4/ext/pgsql/tests/skipif.inc 2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/branches/PHP_5_4/ext/pgsql/tests/skipif.inc 2011-08-30 14:01:03 UTC (rev 315783)
@@ -7,6 +7,7 @@
// database
include("config.inc");
+include("lcmess.inc");
if (!extension_loaded("pgsql")) {
die("skip\n");
Modified: php/php-src/trunk/ext/pgsql/tests/09notice.phpt
===================================================================
--- php/php-src/trunk/ext/pgsql/tests/09notice.phpt 2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/trunk/ext/pgsql/tests/09notice.phpt 2011-08-30 14:01:03 UTC (rev 315783)
@@ -1,16 +1,25 @@
--TEST--
PostgreSQL notice function
--SKIPIF--
-<?php include("skipif.inc"); ?>
+<?php
+
+include("skipif.inc");
+
+_skip_lc_messages();
+
+?>
--INI--
pgsql.log_notice=1
pgsql.ignore_notices=0
--FILE--
<?php
include 'config.inc';
+include 'lcmess.inc';
$db = pg_connect($conn_str);
-pg_exec($db, "SET LC_MESSAGES='C';");
+
+_set_lc_messages();
+
pg_query($db, "BEGIN;");
pg_query($db, "BEGIN;");
Modified: php/php-src/trunk/ext/pgsql/tests/22pg_fetch_object.phpt
===================================================================
--- php/php-src/trunk/ext/pgsql/tests/22pg_fetch_object.phpt 2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/trunk/ext/pgsql/tests/22pg_fetch_object.phpt 2011-08-30 14:01:03 UTC (rev 315783)
@@ -16,7 +16,7 @@
$db = pg_connect($conn_str);
-$sql = "SELECT * FROM $table_name";
+$sql = "SELECT * FROM $table_name WHERE num = 0";
$result = pg_query($db, $sql) or die('Cannot qeury db');
$rows = pg_num_rows($result);
Modified: php/php-src/trunk/ext/pgsql/tests/80_bug32223.phpt
===================================================================
--- php/php-src/trunk/ext/pgsql/tests/80_bug32223.phpt 2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/trunk/ext/pgsql/tests/80_bug32223.phpt 2011-08-30 14:01:03 UTC (rev 315783)
@@ -3,6 +3,8 @@
--SKIPIF--
<?php
require_once('skipif.inc');
+
+_skip_lc_messages();
@pg_query($conn, "CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL'");
$res = @pg_query($conn, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
@@ -17,14 +19,15 @@
<?php
require_once('config.inc');
+require_once('lcmess.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
die ("Could not connect to the server");
}
-pg_exec($dbh, "SET LC_MESSAGES='C';");
-//@pg_query($dbh, "CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL'");
+_set_lc_messages();
+
$res = pg_query($dbh, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
begin
RAISE NOTICE ''11111'';
Modified: php/php-src/trunk/ext/pgsql/tests/80_bug32223b.phpt
===================================================================
--- php/php-src/trunk/ext/pgsql/tests/80_bug32223b.phpt 2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/trunk/ext/pgsql/tests/80_bug32223b.phpt 2011-08-30 14:01:03 UTC (rev 315783)
@@ -3,6 +3,8 @@
--SKIPIF--
<?php
require_once('skipif.inc');
+
+_skip_lc_messages();
@pg_query($conn, "CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL'");
$res = @pg_query($conn, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
@@ -17,14 +19,15 @@
<?php
require_once('config.inc');
+require_once('lcmess.inc');
define('dbh', pg_connect($conn_str));
if (!dbh) {
die ("Could not connect to the server");
}
-pg_exec(dbh, "SET LC_MESSAGES='C';");
-//@pg_query(dbh, "CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL'");
+_set_lc_messages();
+
$res = pg_query(dbh, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
begin
RAISE NOTICE ''11111'';
Added: php/php-src/trunk/ext/pgsql/tests/lcmess.inc
===================================================================
--- php/php-src/trunk/ext/pgsql/tests/lcmess.inc (rev 0)
+++ php/php-src/trunk/ext/pgsql/tests/lcmess.inc 2011-08-30 14:01:03 UTC (rev 315783)
@@ -0,0 +1,21 @@
+<?php
+
+function _skip_lc_messages($lc_messages = 'C')
+{
+ if (!_set_lc_messages($lc_messages)) {
+ die("skip Cannot set LC_MESSAGES to '{$lc_messages}'\n");
+ }
+}
+
+function _set_lc_messages($lc_messages = 'C')
+{
+ if (pg_result(pg_query("SHOW LC_MESSAGES"), 0, 0) != $lc_messages) {
+ if (!@pg_exec("SET LC_MESSAGES='{$lc_messages}'")) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+?>
Modified: php/php-src/trunk/ext/pgsql/tests/skipif.inc
===================================================================
--- php/php-src/trunk/ext/pgsql/tests/skipif.inc 2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/trunk/ext/pgsql/tests/skipif.inc 2011-08-30 14:01:03 UTC (rev 315783)
@@ -7,6 +7,7 @@
// database
include("config.inc");
+include("lcmess.inc");
if (!extension_loaded("pgsql")) {
die("skip\n");
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php