From eb8ecbf6f4e32c180ab341bacf715a6eea7fce2f Mon Sep 17 00:00:00 2001 From: Jenny Tam Date: Tue, 20 Aug 2019 12:38:09 -0700 Subject: [PATCH] Used constants in memory stress tests for easier configuration (#1022) --- test/functional/output.py | 4 +- .../pdo_sqlsrv/PDO81_MemoryCheck.phpt | 60 ++++++++++++++++++- test/functional/sqlsrv/TC81_MemoryCheck.phpt | 8 ++- 3 files changed, 68 insertions(+), 4 deletions(-) diff --git a/test/functional/output.py b/test/functional/output.py index 4d19409ec..99543bc37 100644 --- a/test/functional/output.py +++ b/test/functional/output.py @@ -76,11 +76,13 @@ def gen_XML(logfile, number, logfilename): # Generating the xml report. if logfilename is True: file = open(filename + '.xml', 'w') + report = filename else: file = open('nativeresult' + str(number) + '.xml', 'w') + report = 'Native Tests' file.write('' + os.linesep) - file.write('' + os.linesep) + file.write('' + os.linesep) index = 1 for test in tests_list: diff --git a/test/functional/pdo_sqlsrv/PDO81_MemoryCheck.phpt b/test/functional/pdo_sqlsrv/PDO81_MemoryCheck.phpt index 5513290b6..1153d6ac4 100644 --- a/test/functional/pdo_sqlsrv/PDO81_MemoryCheck.phpt +++ b/test/functional/pdo_sqlsrv/PDO81_MemoryCheck.phpt @@ -11,6 +11,10 @@ PHPT_EXEC=true columnCount(); + $result = $stmt->fetchAll(); + $rowCount = count($result); + unset($result); + $stmt->closeCursor(); + unset($stmt); + if ($rowCount != $noRows) { + die("$rowCount rows retrieved instead of $noRows\n"); + } + break; + + case 5: // fetchObject + $stmt = ExecuteQueryEx($conn, $tsql, ($prepared ? false : true)); + $fldCount = $stmt->columnCount(); + while ($obj = $stmt->fetchObject()) { + unset($obj); + $rowCount++; + } + $stmt->closeCursor(); + unset($stmt); + if ($rowCount != $noRows) { + die("$rowCount rows retrieved instead of $noRows\n"); + } + break; + + case 6: // fetchColumn + $stmt = ExecuteQueryEx($conn, $tsql, ($prepared ? false : true)); + $fldCount = $stmt->columnCount(); + // Check for "false" to terminate because fetchColumn may return NULL + while (($result = $stmt->fetchColumn()) !== false) { + unset($result); + $rowCount++; + } + $stmt->closeCursor(); + unset($stmt); + if ($rowCount != $noRows) { + die("$rowCount rows retrieved instead of $noRows\n"); + } + break; + default: break; @@ -228,7 +286,7 @@ function Repro() { try { - MemCheck(20, 10, 15, 1, 3, 0); + MemCheck(_NUM_PASSES, _NUM_ROWS1, _NUM_ROWS2, 1, 6, 0); } catch (Exception $e) { diff --git a/test/functional/sqlsrv/TC81_MemoryCheck.phpt b/test/functional/sqlsrv/TC81_MemoryCheck.phpt index 5845da21f..40f84a6a2 100644 --- a/test/functional/sqlsrv/TC81_MemoryCheck.phpt +++ b/test/functional/sqlsrv/TC81_MemoryCheck.phpt @@ -7,11 +7,15 @@ emalloc (which only allocate memory in the memory space allocated for the PHP pr PHPT_EXEC=true --SKIPIF-- - + --FILE-- getMessage(); }