Author: uwendel
Date: 2007-08-30 16:21:21 +0200 (Thu, 30 Aug 2007)
New Revision: 966
Modified:
trunk/tests/ext/mysqli/mysqli_debug_mysqlnd_control_string.phpt
Log:
t and f seem to work fine.
Modified: trunk/tests/ext/mysqli/mysqli_debug_mysqlnd_control_string.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_debug_mysqlnd_control_string.phpt 2007-08-29 19:58:58
UTC (rev 965)
+++ trunk/tests/ext/mysqli/mysqli_debug_mysqlnd_control_string.phpt 2007-08-30 14:21:21
UTC (rev 966)
@@ -108,12 +108,91 @@
$lines = explode("\n", $trace);
foreach ($lines as $k => $line) {
$line = trim($line);
- if (preg_match("@^>\w@ismU", $line, $matches)) {
+ if (preg_match("@^[|\s]*>[\w]+@ism", $line, $matches)) {
printf("[085] Looks like a function call, but there should be none in the trace file,
first characters from trace are '%s'\n",
substr($line, 0, 80));
}
}
+ // -f[,functions] - Limit debugger list to specified functions. Empty list -> all
functions
+ $lines_all_funcs = explode("\n", try_control_string($link, 't:O,' . $trace_file,
$trace_file, 90));
+ $functions_all_funcs = array();
+ foreach ($lines_all_funcs as $k => $line) {
+ $line = trim($line);
+ if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
+ $functions_all_funcs[$matches[1]] = $matches[1];
+ }
+ }
+
+ $lines_trace = explode("\n", try_control_string($link, 't:f:O,' . $trace_file,
$trace_file, 100));
+ $functions_trace = array();
+ foreach ($lines_trace as $k => $line) {
+ $line = trim($line);
+ if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
+ $functions_trace[$matches[1]] = $matches[1];
+ }
+ }
+
+ $tmp = array_diff($functions_all_funcs, $functions_trace);
+ if (!empty($tmp)) {
+ printf("[105] Looks like not all functions are listed in the trace. Check manually,
dumping diff.");
+ var_dump($tmp);
+ }
+
+ // get two or three function names to play with...
+ $test_functions = array('simple' => array(), 'doubledot' => array());
+
+ foreach ($functions_all_funcs as $func) {
+ if (count($test_functions['simple']) < 2 && !strstr($func, '::'))
+ $test_functions['simple'][$func] = $func;
+ else if (count($test_functions['doubledot']) < 2 && strstr($func, '::'))
+ $test_functions['doubledot'][$func] = $func;
+ }
+
+ $control_string = '';
+ if ($func = reset($test_functions['simple']))
+ $control_string .= sprintf('%s,', $func);
+ if ($func = reset($test_functions['doubledot']))
+ $control_string .= sprintf('%s,', $func);
+ if ($func = next($test_functions['simple']))
+ $control_string .= sprintf('%s,', $func);
+ if ($func = next($test_functions['doubledot']))
+ $control_string .= sprintf('%s,', $func);
+ $control_string = sprintf('t:f,%s:O,%s', $control_string, $trace_file);
+
+ $lines_trace = explode("\n", try_control_string($link, $control_string, $trace_file,
110));
+ $functions_trace = array();
+ foreach ($lines_trace as $k => $line) {
+ $line = trim($line);
+ if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
+ $functions_trace[$matches[1]] = $matches[1];
+ }
+ }
+
+ foreach ($test_functions['simple'] as $func)
+ if (isset($functions_trace[$func])) {
+ unset($functions_trace[$func]);
+ unset($test_functions['simple'][$func]);
+ }
+
+ foreach ($test_functions['doubledot'] as $func)
+ if (isset($functions_trace[$func])) {
+ unset($functions_trace[$func]);
+ unset($test_functions['doubledot'][$func]);
+ }
+
+ if (!empty($functions_trace)) {
+ printf("[115] Dumping list of unexpected functions which should have not been shown
when using control string '%s'.\n",
+ $control_string);
+ var_dump($functions_trace);
+ }
+ $tmp = array_merge($test_functions['doubledot'], $test_functions['simple']);
+ if (!empty($tmp)) {
+ printf("[115] Dumping list of functions which should have been shown when using control
string '%s'.\n",
+ $control_string);
+ var_dump($tmp);
+ }
+
mysqli_close($link);
print "done";
if ($IS_MYSQLND)
| Thread |
|---|
| • PHP mysqlnd svn commit: r966 - trunk/tests/ext/mysqli | uwendel | 30 Aug |