Skip to content

Fix flaky tests (1) #5479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions ext/mysqli/tests/mysqli_insert_packet_overflow.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,15 @@ memory_limit=256M
printf("[011] Failed to change max_allowed_packet");
}

if (!mysqli_query($link, "CREATE TABLE test(col_blob LONGBLOB) ENGINE=" . $engine))
printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$table_name = 'test__mysqli_insert_packet_overflow';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the double underscore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am having trouble articulating why I did that. Maybe I wanted 'test' to appear distinct from the name of the test case?

if (!mysqli_query($link, "DROP TABLE IF EXISTS {$table_name}")) {
printf("[012] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}

if (!mysqli_query($link, "CREATE TABLE {$table_name}(col_blob LONGBLOB) ENGINE=" . $engine))
printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

$query_prefix = "INSERT INTO test(col_blob) VALUES ('";
$query_prefix = "INSERT INTO {$table_name}(col_blob) VALUES ('";
$query_postfix = "')";
$query_len = strlen($query_prefix) + strlen($query_postfix);
$com_query_len = 2;
Expand All @@ -84,16 +89,16 @@ memory_limit=256M
$query = sprintf("%s%s%s", $query_prefix, $blob, $query_postfix);

if (!mysqli_query($link, $query))
printf("[013] max_allowed_packet = %d, strlen(query) = %d, [%d] %s\n", $max_allowed_packet, strlen($query), mysqli_errno($link), mysqli_error($link));
printf("[014] max_allowed_packet = %d, strlen(query) = %d, [%d] %s\n", $max_allowed_packet, strlen($query), mysqli_errno($link), mysqli_error($link));

if (!$res = mysqli_query($link, "SELECT col_blob FROM test"))
printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$res = mysqli_query($link, "SELECT col_blob FROM {$table_name}"))
printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

if (!$row = mysqli_fetch_assoc($res)) {
printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
} else {
if ($row['col_blob'] != $blob) {
printf("[016] Blob seems wrong, dumping data\n");
printf("[017] Blob seems wrong, dumping data\n");
var_dump(strlen($row['col_blob']));
var_dump(strlen($blob));
}
Expand All @@ -102,15 +107,11 @@ memory_limit=256M

if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . $org_max_allowed_packet))
if (1227 != mysqli_errno($link))
printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

mysqli_close($link);

print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECT--
done!
6 changes: 3 additions & 3 deletions ext/standard/tests/streams/proc_open_bug69900.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Bug #69900 Commandline input/output weird behaviour with STDIO
error_reporting(E_ALL);

$fl = __DIR__ . DIRECTORY_SEPARATOR . "test69900.php";
$max_ms = 10;
$max_ms = 20;

$test_content = '<?php

Expand Down Expand Up @@ -48,8 +48,8 @@ fclose($pipes[1]);
proc_close($process);

/* It is expected that the first call takes more than the limit.
* Allow one more to account for a possible process switch. */
if ($moreThanLimit > 2) {
* Allow two more to account for possible process switch, etc. */
if ($moreThanLimit > 3) {
echo "fgets() took more than $max_ms ms $moreThanLimit times\n";
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you remember which builder this one failed on?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen this one fail repeatedly. At least once on Travis CI, in the S390X environment, but I think I have seen it in other environments as well.


Expand Down