1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-03-03 14:52:21 +02:00

Allow error buffer to be resized for testing.

Some tests can generate very large error messages for diffs and they often get cut off before the end.

Also fix a test so it does not create too large a buffer on the stack.
This commit is contained in:
David Steele 2021-10-18 11:32:53 -04:00
parent 838ee3bd08
commit 4570c7e275
3 changed files with 5 additions and 2 deletions

View File

@ -88,7 +88,9 @@ situations.
The temp buffer is required because the error message being passed might be the error already stored in the message buffer.
***********************************************************************************************************************************/
#define ERROR_MESSAGE_BUFFER_SIZE 8192
#ifndef ERROR_MESSAGE_BUFFER_SIZE
#define ERROR_MESSAGE_BUFFER_SIZE 8192
#endif
static char messageBuffer[ERROR_MESSAGE_BUFFER_SIZE];
static char messageBufferTemp[ERROR_MESSAGE_BUFFER_SIZE];

View File

@ -298,6 +298,7 @@ sub run
($self->{bDebugTestTrace} && $self->{bDebug} ? " \\\n\t-DDEBUG_TEST_TRACE" : '') .
(vmWithBackTrace($self->{oTest}->{&TEST_VM}) && $self->{bBackTrace} ? " \\\n\t-DWITH_BACKTRACE" : '') .
($self->{oTest}->{&TEST_CDEF} ? " \\\n\t$self->{oTest}->{&TEST_CDEF}" : '') .
" -DERROR_MESSAGE_BUFFER_SIZE=131072\n" .
"\n" .
"\n" .
"CFLAGS_TEST =" .

View File

@ -159,7 +159,7 @@ testRun(void)
assert(errorTryDepth() == 4);
tryDone = true;
char bigMessage[sizeof(messageBuffer) * 32];
char bigMessage[sizeof(messageBuffer) + 128];
memset(bigMessage, 'A', sizeof(bigMessage));
THROW(AssertError, bigMessage);