pgbackrest.git / summary / log / commit / refs
commit bcdfc7d0b52dc92ae22aef1c93bbfda7e6fa24f3
Author: David Steele <david@pgmasters.net>
Date: Tue Nov 07 03:55:34 2017 +0000
Enable additional warnings for C builds.
doc/xml/release.xml | 4 ++
libc/LibC.h | 2 +-
libc/LibC.xs | 26 +++++++
libc/Makefile.PL | 2 +-
libc/xs/cipher/block.xs | 11 +--
src/cipher/block.c | 11 ++-
src/common/encode.c | 2 +-
src/common/encode/base64.c | 2 +-
src/common/memContext.c | 2 +-
src/config/config.c | 10 +--
src/config/config.h | 4 +-
src/config/define.c | 41 ++++++------
src/config/define.h | 4 +-
test/lib/pgBackRestTest/Common/JobTest.pm | 4 +-
test/src/common/harnessTest.c | 13 +++-
test/src/common/harnessTest.h | 4 +-
test/src/module/cipher/blockTest.c | 64 ++++++++++++------
test/src/module/cipher/randomTest.c | 2 +-
test/src/module/common/encodeTest.c | 108 +++++++++++++++---------------
test/src/module/common/memContextTest.c | 10 +--
test/test.pl | 13 ----
21 files changed, 199 insertions(+), 140 deletions(-)
diff --git a/doc/xml/release.xml b/doc/xml/release.xml
index 6210545be..4547b188b 100644
--- a/doc/xml/release.xml
+++ b/doc/xml/release.xml
@@ -39,6 +39,10 @@
<release-item>
<p>Add <id>eof</id> to S3 file driver (required for encryption support).</p>
</release-item>
+
+ <release-item>
+ <p>Enable additional warnings for C builds.</p>
+ </release-item>
</release-refactor-list>
</release-core-list>
diff --git a/libc/LibC.h b/libc/LibC.h
index fed5682e2..f4231b443 100644
--- a/libc/LibC.h
+++ b/libc/LibC.h
@@ -69,7 +69,7 @@ Core context handling macros, only intended to be called from other macros
MemContext *MEM_CONTEXT_XS_memContextOld = memContextSwitch(memContext); \
\
/* Store any errors to be croaked to Perl at the end */ \
- bool MEM_CONTEXT_XS_croak = false; \
+ volatile bool MEM_CONTEXT_XS_croak = false; \
\
/* Try the statement block */ \
ERROR_TRY()
diff --git a/libc/LibC.xs b/libc/LibC.xs
index a73f8faa9..f22045b03 100644
--- a/libc/LibC.xs
+++ b/libc/LibC.xs
@@ -16,10 +16,26 @@ Perl includes
Order is critical here so don't change it.
***********************************************************************************************************************************/
+#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 8 || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ >= 0)))
+ #define WARNING_MAYBE_INITIALIZED 1
+#elif __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ >= 0)))
+ #define WARNING_INITIALIZED 1
+#endif
+
+#if WARNING_MAYBE_INITIALIZED
+ #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#elif WARNING_INITIALIZED
+ #pragma GCC diagnostic ignored "-Wuninitialized"
+#endif
+
#include <XSUB.h>
#include <EXTERN.h>
#include <perl.h>
+#if WARNING_MAYBE_INITIALIZED || WARNING_INITIALIZED
+ #pragma GCC diagnostic pop
+#endif
+
/***********************************************************************************************************************************
C includes
@@ -51,8 +67,12 @@ Constant include
Auto generated code that handles exporting C constants to Perl.
***********************************************************************************************************************************/
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+
#include "const-c.inc"
+#pragma GCC diagnostic warning "-Wunused-parameter"
+
/***********************************************************************************************************************************
Module definition
***********************************************************************************************************************************/
@@ -63,12 +83,18 @@ PROTOTYPES: DISABLE
#
# The XS portion of the code that handles exporting C constants to Perl.
# ----------------------------------------------------------------------------------------------------------------------------------
+#pragma GCC diagnostic ignored "-Wuninitialized"
+
INCLUDE: const-xs.inc
+#pragma GCC diagnostic warning "-Wuninitialized"
+
# Exported functions and modules
#
# These modules should map 1-1 with C modules in src directory.
# ----------------------------------------------------------------------------------------------------------------------------------
+#pragma GCC diagnostic ignored "-Wclobbered"
+
INCLUDE: xs/cipher/block.xs
INCLUDE: xs/cipher/random.xs
INCLUDE: xs/common/encode.xs
diff --git a/libc/Makefile.PL b/libc/Makefile.PL
index 2a64f504c..50380c6f3 100644
--- a/libc/Makefile.PL
+++ b/libc/Makefile.PL
@@ -100,7 +100,7 @@ WriteMakefile
AUTHOR => 'David Steele <david@pgbackrest.org>',
CCFLAGS => join(' ', qw(
- -Wfatal-errors
+ -Wfatal-errors -Wall -Wextra -Wwrite-strings
-o $@
-std=c99
-D_FILE_OFFSET_BITS=64
diff --git a/libc/xs/cipher/block.xs b/libc/xs/cipher/block.xs
index a7a7d7c30..a07e87807 100644
--- a/libc/xs/cipher/block.xs
+++ b/libc/xs/cipher/block.xs
@@ -36,20 +36,21 @@ OUTPUT:
####################################################################################################################################
SV *
-process(self, svSource)
+process(self, source)
pgBackRest::LibC::Cipher::Block self
- SV *svSource
+ SV *source
CODE:
RETVAL = NULL;
- STRLEN tSize;
- const unsigned char *pvSource = (const unsigned char *)SvPV(svSource, tSize);
MEM_CONTEXT_XS_BEGIN(self->memContext)
{
+ STRLEN tSize;
+ const unsigned char *sourcePtr = (const unsigned char *)SvPV(source, tSize);
+
RETVAL = NEWSV(0, cipherBlockProcessSize(self->pxPayload, tSize));
SvPOK_only(RETVAL);
- SvCUR_set(RETVAL, cipherBlockProcess(self->pxPayload, pvSource, tSize, (unsigned char *)SvPV_nolen(RETVAL)));
+ SvCUR_set(RETVAL, cipherBlockProcess(self->pxPayload, sourcePtr, tSize, (unsigned char *)SvPV_nolen(RETVAL)));
}
MEM_CONTEXT_XS_END();
OUTPUT:
diff --git a/src/cipher/block.c b/src/cipher/block.c
index 038dd1241..9313e1c5d 100644
--- a/src/cipher/block.c
+++ b/src/cipher/block.c
@@ -69,7 +69,7 @@ cipherBlockNew(CipherMode mode, const char *cipherName, const unsigned char *pas
ERROR_THROW(AssertError, "unable to load cipher '%s'", cipherName);
// Lookup digest. If not defined it will be set to sha1.
- const EVP_MD *digest;
+ const EVP_MD *volatile digest = digest = EVP_sha1();
if (digestName)
digest = EVP_get_digestbyname(digestName);
@@ -111,7 +111,14 @@ Determine how large the destination buffer should be
int
cipherBlockProcessSize(CipherBlock *this, int sourceSize)
{
- return sourceSize + EVP_MAX_BLOCK_LENGTH + CIPHER_BLOCK_MAGIC_SIZE + PKCS5_SALT_LEN;
+ // Destination size is source size plus one extra block
+ int destinationSize = sourceSize + EVP_MAX_BLOCK_LENGTH;
+
+ // On encrypt the header size must be included before the first block
+ if (this->mode == cipherModeEncrypt && !this->saltDone)
+ destinationSize += CIPHER_BLOCK_MAGIC_SIZE + PKCS5_SALT_LEN;
+
+ return destinationSize;
}
/***********************************************************************************************************************************
diff --git a/src/common/encode.c b/src/common/encode.c
index 1933fb524..673a7cebd 100644
--- a/src/common/encode.c
+++ b/src/common/encode.c
@@ -75,7 +75,7 @@ Check that the encoded string is valid
bool
decodeToBinValid(EncodeType encodeType, const char *source)
{
- bool valid = true;
+ volatile bool valid = true;
ERROR_TRY()
{
diff --git a/src/common/encode/base64.c b/src/common/encode/base64.c
index 6c81f0733..ac552197c 100644
--- a/src/common/encode/base64.c
+++ b/src/common/encode/base64.c
@@ -92,7 +92,7 @@ decodeToBinBase64(const char *source, unsigned char *destination)
int destinationIdx = 0;
// Decode the binary data from four characters to three bytes
- for (int sourceIdx = 0; sourceIdx < strlen(source); sourceIdx += 4)
+ for (unsigned int sourceIdx = 0; sourceIdx < strlen(source); sourceIdx += 4)
{
// Always decode the first character
destination[destinationIdx++] =
diff --git a/src/common/memContext.c b/src/common/memContext.c
index 25d22b43a..03a7789b7 100644
--- a/src/common/memContext.c
+++ b/src/common/memContext.c
@@ -81,7 +81,7 @@ static void *memReAllocInternal(void *bufferOld, size_t sizeOld, size_t sizeNew,
// Zero the new memory when requested - old memory is left untouched else why bother with a realloc?
if (zeroNew)
- memset(bufferNew + sizeOld, 0, sizeNew - sizeOld);
+ memset((unsigned char *)bufferNew + sizeOld, 0, sizeNew - sizeOld);
// Return the buffer
return bufferNew;
diff --git a/src/config/config.c b/src/config/config.c
index 717dd442f..d7af6715e 100644
--- a/src/config/config.c
+++ b/src/config/config.c
@@ -31,7 +31,7 @@ typedef struct ConfigOptionData
const char *name;
unsigned int index:5;
- ConfigDefineOption defineId:7;
+ unsigned int defineId:7;
} ConfigOptionData;
#define CONFIG_OPTION_LIST(...) \
@@ -58,7 +58,7 @@ Ensure that command id is valid
void
cfgCommandCheck(ConfigCommand commandId)
{
- if (commandId < 0 || commandId >= cfgCommandTotal())
+ if (commandId >= cfgCommandTotal())
ERROR_THROW(AssertError, "command id %d invalid - must be >= 0 and < %d", commandId, cfgCommandTotal());
}
@@ -106,7 +106,7 @@ cfgCommandName(ConfigCommand commandId)
/***********************************************************************************************************************************
cfgCommandTotal - total number of commands
***********************************************************************************************************************************/
-int
+unsigned int
cfgCommandTotal()
{
return sizeof(configCommandData) / sizeof(ConfigCommandData);
@@ -118,7 +118,7 @@ Ensure that option id is valid
void
cfgOptionCheck(ConfigOption optionId)
{
- if (optionId < 0 || optionId >= cfgOptionTotal())
+ if (optionId >= cfgOptionTotal())
ERROR_THROW(AssertError, "option id %d invalid - must be >= 0 and < %d", optionId, cfgOptionTotal());
}
@@ -199,7 +199,7 @@ cfgOptionName(ConfigOption optionId)
/***********************************************************************************************************************************
cfgOptionTotal - total number of configuration options
***********************************************************************************************************************************/
-int
+unsigned int
cfgOptionTotal()
{
return sizeof(configOptionData) / sizeof(ConfigOptionData);
diff --git a/src/config/config.h b/src/config/config.h
index cabee3195..3c10da4d4 100644
--- a/src/config/config.h
+++ b/src/config/config.h
@@ -15,7 +15,7 @@ Functions
int cfgCommandId(const char *commandName);
const char *cfgCommandName(ConfigCommand commandId);
ConfigDefineCommand cfgCommandDefIdFromId(ConfigCommand commandId);
-int cfgCommandTotal();
+unsigned int cfgCommandTotal();
int cfgOptionId(const char *optionName);
ConfigOption cfgOptionIdFromDefId(ConfigDefineOption optionDefId, int index);
@@ -23,6 +23,6 @@ int cfgOptionIndex(ConfigOption optionId);
int cfgOptionIndexTotal(ConfigOption optionDefId);
const char *cfgOptionName(ConfigOption optionId);
ConfigDefineOption cfgOptionDefIdFromId(ConfigOption optionId);
-int cfgOptionTotal();
+unsigned int cfgOptionTotal();
#endif
diff --git a/src/config/define.c b/src/config/define.c
index 409152aed..09560ecb8 100644
--- a/src/config/define.c
+++ b/src/config/define.c
@@ -1,6 +1,7 @@
/***********************************************************************************************************************************
Command and Option Configuration Definition
***********************************************************************************************************************************/
+#include <limits.h>
#include <string.h>
#include "common/error.h"
@@ -11,7 +12,7 @@ Map command names to ids and vice versa.
***********************************************************************************************************************************/
typedef struct ConfigDefineCommandData
{
- char *name; // Command name
+ const char *name; // Command name
} ConfigDefineCommandData;
// Command macros are intended to make the command definitions easy to read and to produce good diffs.
@@ -30,15 +31,15 @@ Define how an option is parsed and interacts with other options.
***********************************************************************************************************************************/
typedef struct ConfigDefineOptionData
{
- char *name; // Option name
+ const char *name; // Option name
unsigned int type:3; // Option type (e.g. string, int, boolean, etc.)
unsigned int indexTotal:4; // 0 normally, > 0 if indexed option (e.g. db1-*)
- ConfigDefSection section:2; // Config section (e.g. global, stanza, cmd-line)
+ unsigned int section:2; // Config section (e.g. global, stanza, cmd-line)
bool negate:1; // Can the option be negated?
bool required:1; // Is the option required?
bool secure:1; // Does the option need to be redacted on logs and cmd-line?
unsigned int commandValid:15; // Bitmap for commands that is option is valid for
- void **data; // Optional data and command overrides
+ const void **data; // Optional data and command overrides
} ConfigDefineOptionData;
// Option macros are intended to make the command definitions easy to read and to produce good diffs.
@@ -82,10 +83,10 @@ typedef enum
} ConfigDefineDataType;
#define CFGDATA_OPTION_OPTIONAL_PUSH_LIST(type, size, data, ...) \
- (void *)((uint32)type << 24 | (uint32)size << 16 | (uint32)data), __VA_ARGS__
+ (const void *)((uint32)type << 24 | (uint32)size << 16 | (uint32)data), __VA_ARGS__
#define CFGDATA_OPTION_OPTIONAL_PUSH(type, size, data) \
- (void *)((uint32)type << 24 | (uint32)size << 16 | (uint32)data)
+ (const void *)((uint32)type << 24 | (uint32)size << 16 | (uint32)data)
#define CFGDEFDATA_OPTION_COMMAND_LIST(...) \
.commandValid = 0 __VA_ARGS__,
@@ -94,19 +95,19 @@ typedef enum
| (1 << commandParam)
#define CFGDEFDATA_OPTION_OPTIONAL_LIST(...) \
- .data = (void *[]){__VA_ARGS__ NULL},
+ .data = (const void *[]){__VA_ARGS__ NULL},
#define CFGDEFDATA_OPTION_OPTIONAL_DEFAULT(defaultValue) \
CFGDATA_OPTION_OPTIONAL_PUSH_LIST(configDefDataTypeDefault, 1, 0, defaultValue),
#define CFGDEFDATA_OPTION_OPTIONAL_ALLOW_LIST(...) \
CFGDATA_OPTION_OPTIONAL_PUSH_LIST( \
- configDefDataTypeAllowList, sizeof((char *[]){__VA_ARGS__}) / sizeof(char *), 0, __VA_ARGS__),
+ configDefDataTypeAllowList, sizeof((const char *[]){__VA_ARGS__}) / sizeof(const char *), 0, __VA_ARGS__),
#define CFGDEFDATA_OPTION_OPTIONAL_ALLOW_RANGE(rangeMinParam, rangeMaxParam) \
CFGDATA_OPTION_OPTIONAL_PUSH_LIST( \
- configDefDataTypeAllowRange, 2, 0, (void *)(intptr_t)(int32)(rangeMinParam * 100), \
- (void *)(intptr_t)(int32)(rangeMaxParam * 100)),
+ configDefDataTypeAllowRange, 2, 0, (const void *)(intptr_t)(int32)(rangeMinParam * 100), \
+ (const void *)(intptr_t)(int32)(rangeMaxParam * 100)),
#define CFGDEFDATA_OPTION_OPTIONAL_NAME_ALT(nameAltParam) \
CFGDATA_OPTION_OPTIONAL_PUSH_LIST(configDefDataTypeNameAlt, 1, 0, nameAltParam),
@@ -119,7 +120,7 @@ typedef enum
#define CFGDEFDATA_OPTION_OPTIONAL_DEPEND_LIST(optionDepend, ...) \
CFGDATA_OPTION_OPTIONAL_PUSH_LIST( \
- configDefDataTypeDepend, sizeof((char *[]){__VA_ARGS__}) / sizeof(char *), optionDepend, __VA_ARGS__),
+ configDefDataTypeDepend, sizeof((const char *[]){__VA_ARGS__}) / sizeof(const char *), optionDepend, __VA_ARGS__),
#define CFGDEFDATA_OPTION_OPTIONAL_COMMAND_OVERRRIDE(...) \
__VA_ARGS__
@@ -140,8 +141,8 @@ Find optional data for a command and option.
***********************************************************************************************************************************/
static void
cfgDefDataFind(
- ConfigDefineDataType typeFind, ConfigDefineCommand commandDefId, void **dataList, bool *dataDefFound, int *dataDef,
- void ***dataDefList, int *dataDefListSize)
+ ConfigDefineDataType typeFind, ConfigDefineCommand commandDefId, const void **dataList, bool *dataDefFound, int *dataDef,
+ const void ***dataDefList, int *dataDefListSize)
{
*dataDefFound = false;
@@ -152,7 +153,7 @@ cfgDefDataFind(
int offset = 0;
int size;
int data;
- int commandCurrent = -1;
+ unsigned int commandCurrent = UINT_MAX;
// Loop through all data
do
@@ -173,7 +174,7 @@ cfgDefDataFind(
commandCurrent = data;
}
// Only find type if not in a command block yet or in the expected command
- else if (type == typeFind && (commandCurrent == -1 || commandCurrent == commandDefId))
+ else if (type == typeFind && (commandCurrent == UINT_MAX || commandCurrent == commandDefId))
{
// Store the data found
*dataDefFound = true;
@@ -196,7 +197,7 @@ cfgDefDataFind(
bool dataDefFound = false; \
int dataDef = 0; \
int dataDefListSize = 0; \
- void **dataDefList = NULL; \
+ const void **dataDefList = NULL; \
\
cfgDefDataFind( \
type, commandDefId, configDefineOptionData[optionDefId].data, &dataDefFound, &dataDef, &dataDefList, &dataDefListSize);
@@ -204,13 +205,13 @@ cfgDefDataFind(
/***********************************************************************************************************************************
Command and option define totals
***********************************************************************************************************************************/
-int
+unsigned int
cfgDefCommandTotal()
{
return sizeof(configDefineCommandData) / sizeof(ConfigDefineCommandData);
}
-int
+unsigned int
cfgDefOptionTotal()
{
return sizeof(configDefineOptionData) / sizeof(ConfigDefineOptionData);
@@ -222,14 +223,14 @@ Check that command and option ids are valid
void
cfgDefCommandCheck(ConfigDefineCommand commandDefId)
{
- if (commandDefId < 0 || commandDefId >= cfgDefCommandTotal())
+ if (commandDefId >= cfgDefCommandTotal())
ERROR_THROW(AssertError, "command def id %d invalid - must be >= 0 and < %d", commandDefId, cfgDefCommandTotal());
}
void
cfgDefOptionCheck(ConfigDefineOption optionDefId)
{
- if (optionDefId < 0 || optionDefId >= cfgDefOptionTotal())
+ if (optionDefId >= cfgDefOptionTotal())
ERROR_THROW(AssertError, "option def id %d invalid - must be >= 0 and < %d", optionDefId, cfgDefOptionTotal());
}
diff --git a/src/config/define.h b/src/config/define.h
index 377006184..2cdadbd16 100644
--- a/src/config/define.h
+++ b/src/config/define.h
@@ -20,7 +20,7 @@ typedef enum
/***********************************************************************************************************************************
Functions
***********************************************************************************************************************************/
-int cfgDefCommandTotal();
+unsigned int cfgDefCommandTotal();
void cfgDefCommandCheck(ConfigDefineCommand commandDefId);
bool cfgDefOptionAllowList(ConfigDefineCommand commandDefId, ConfigDefineOption optionDefId);
@@ -45,7 +45,7 @@ const char *cfgDefOptionPrefix(ConfigDefineOption optionDefId);
bool cfgDefOptionRequired(ConfigDefineCommand commandDefId, ConfigDefineOption optionDefId);
ConfigDefSection cfgDefOptionSection(ConfigDefineOption optionDefId);
bool cfgDefOptionSecure(ConfigDefineOption optionDefId);
-int cfgDefOptionTotal();
+unsigned int cfgDefOptionTotal();
int cfgDefOptionType(ConfigDefineOption optionDefId);
bool cfgDefOptionValid(ConfigDefineCommand commandDefId, ConfigDefineOption optionDefId);
diff --git a/test/lib/pgBackRestTest/Common/JobTest.pm b/test/lib/pgBackRestTest/Common/JobTest.pm
index 57c82540e..0e1590a3e 100644
--- a/test/lib/pgBackRestTest/Common/JobTest.pm
+++ b/test/lib/pgBackRestTest/Common/JobTest.pm
@@ -315,7 +315,9 @@ sub run
$self->{oStorageTest}->put("$self->{strGCovPath}/test.c", $strTestC);
my $strGccCommand =
- 'gcc -Wfatal-errors -std=c99 -fprofile-arcs -ftest-coverage -fPIC -O0 ' .
+ 'gcc -std=c99 -fprofile-arcs -ftest-coverage -fPIC -O0 ' .
+ '-Wfatal-errors -Wall -Wextra -Wwrite-strings ' .
+ ($self->{oTest}->{&TEST_VM} ne VM_CO6 && $self->{oTest}->{&TEST_VM} ne VM_U12 ? '-Wpedantic ' : '') .
"-I/$self->{strBackRestBase}/src -I/$self->{strBackRestBase}/test/src test.c " .
"/$self->{strBackRestBase}/test/src/common/harnessTest.c " .
join(' ', @stryCFile) . " -l crypto -o test";
diff --git a/test/src/common/harnessTest.c b/test/src/common/harnessTest.c
index 4c7751e1b..1f9052568 100644
--- a/test/src/common/harnessTest.c
+++ b/test/src/common/harnessTest.c
@@ -26,6 +26,13 @@ testAdd - add a new test
void
testAdd(int run, bool selected)
{
+ if (run != testTotal + 1)
+ {
+ fprintf(stderr, "ERROR: test run %d is not in order\n", run);
+ fflush(stderr);
+ exit(255);
+ }
+
testList[testTotal].selected = selected;
testTotal++;
}
@@ -41,13 +48,15 @@ testBegin(const char *name)
if (testList[testRun - 1].selected)
{
if (testRun != 1)
- {
printf("\n");
- }
printf("run %03d - %s\n", testRun, name);
fflush(stdout);
+
+ return true;
}
+
+ return false;
}
/***********************************************************************************************************************************
diff --git a/test/src/common/harnessTest.h b/test/src/common/harnessTest.h
index f70c7add6..5070ec809 100644
--- a/test/src/common/harnessTest.h
+++ b/test/src/common/harnessTest.h
@@ -64,7 +64,7 @@ TEST_TYPE_FORMAT - format the test type into the given buffer -- or return verba
char *value##Str = value##StrBuffer; \
\
if (TEST_TYPE_PTR(type) && *(void **)&value == NULL) \
- value##Str = "NULL"; \
+ value##Str = (char *)"NULL"; \
else if (strcmp(#type, "char *") == 0) \
value##Str = *(char **)&value; \
else \
@@ -85,7 +85,7 @@ parameters.
#define TEST_RESULT(statement, resultExpectedValue, type, format, typeOp, ...) \
{ \
/* Assign expected result to a local variable so the value can be manipulated as a pointer */ \
- type TEST_RESULT_resultExpected = (type)(resultExpectedValue); \
+ const type TEST_RESULT_resultExpected = (type)(resultExpectedValue); \
\
/* Output test info */ \
printf(" l%04d - ", __LINE__); \
diff --git a/test/src/module/cipher/blockTest.c b/test/src/module/cipher/blockTest.c
index 904c2f5d8..8074003b8 100644
--- a/test/src/module/cipher/blockTest.c
+++ b/test/src/module/cipher/blockTest.c
@@ -25,18 +25,19 @@ void testRun()
// -------------------------------------------------------------------------------------------------------------------------
TEST_ERROR(
cipherBlockNew(
- cipherModeEncrypt, BOGUS_STR, TEST_PASS, TEST_PASS_SIZE, NULL), AssertError, "unable to load cipher 'BOGUS'");
+ cipherModeEncrypt, BOGUS_STR, (unsigned char *)TEST_PASS, TEST_PASS_SIZE, NULL), AssertError,
+ "unable to load cipher 'BOGUS'");
TEST_ERROR(
- cipherBlockNew(cipherModeEncrypt, NULL, TEST_PASS, TEST_PASS_SIZE, NULL), AssertError,
+ cipherBlockNew(cipherModeEncrypt, NULL, (unsigned char *)TEST_PASS, TEST_PASS_SIZE, NULL), AssertError,
"unable to load cipher '(null)'");
TEST_ERROR(
cipherBlockNew(
- cipherModeEncrypt, TEST_CIPHER, TEST_PASS, TEST_PASS_SIZE, BOGUS_STR), AssertError,
+ cipherModeEncrypt, TEST_CIPHER, (unsigned char *)TEST_PASS, TEST_PASS_SIZE, BOGUS_STR), AssertError,
"unable to load digest 'BOGUS'");
// Initialization of object
// -------------------------------------------------------------------------------------------------------------------------
- CipherBlock *cipherBlock = cipherBlockNew(cipherModeEncrypt, TEST_CIPHER, TEST_PASS, TEST_PASS_SIZE, NULL);
+ CipherBlock *cipherBlock = cipherBlockNew(cipherModeEncrypt, TEST_CIPHER, (unsigned char *)TEST_PASS, TEST_PASS_SIZE, NULL);
TEST_RESULT_STR(memContextName(cipherBlock->memContext), "cipherBlock", "mem context name is valid");
TEST_RESULT_INT(cipherBlock->mode, cipherModeEncrypt, "mode is valid");
TEST_RESULT_INT(cipherBlock->passSize, TEST_PASS_SIZE, "passphrase size is valid");
@@ -53,16 +54,21 @@ void testRun()
// -----------------------------------------------------------------------------------------------------------------------------
if (testBegin("Encrypt and Decrypt"))
{
- char encryptBuffer[TEST_BUFFER_SIZE];
+ unsigned char encryptBuffer[TEST_BUFFER_SIZE];
int encryptSize = 0;
- char decryptBuffer[TEST_BUFFER_SIZE];
+ unsigned char decryptBuffer[TEST_BUFFER_SIZE];
int decryptSize = 0;
// Encrypt
// -------------------------------------------------------------------------------------------------------------------------
- CipherBlock *blockEncrypt = cipherBlockNew(cipherModeEncrypt, TEST_CIPHER, TEST_PASS, TEST_PASS_SIZE, NULL);
+ CipherBlock *blockEncrypt = cipherBlockNew(
+ cipherModeEncrypt, TEST_CIPHER, (unsigned char *)TEST_PASS, TEST_PASS_SIZE, NULL);
- encryptSize = cipherBlockProcess(blockEncrypt, TEST_PLAINTEXT, strlen(TEST_PLAINTEXT), encryptBuffer);
+ TEST_RESULT_INT(
+ cipherBlockProcessSize(blockEncrypt, strlen(TEST_PLAINTEXT)),
+ strlen(TEST_PLAINTEXT) + EVP_MAX_BLOCK_LENGTH + CIPHER_BLOCK_MAGIC_SIZE + PKCS5_SALT_LEN, "check process size");
+
+ encryptSize = cipherBlockProcess(blockEncrypt, (unsigned char *)TEST_PLAINTEXT, strlen(TEST_PLAINTEXT), encryptBuffer);
TEST_RESULT_BOOL(blockEncrypt->saltDone, true, "salt done is true");
TEST_RESULT_BOOL(blockEncrypt->processDone, true, "process done is true");
@@ -71,9 +77,10 @@ void testRun()
TEST_RESULT_INT(
cipherBlockProcessSize(blockEncrypt, strlen(TEST_PLAINTEXT)),
- strlen(TEST_PLAINTEXT) + EVP_MAX_BLOCK_LENGTH + CIPHER_BLOCK_MAGIC_SIZE + PKCS5_SALT_LEN, "check process size");
+ strlen(TEST_PLAINTEXT) + EVP_MAX_BLOCK_LENGTH, "check process size");
- encryptSize += cipherBlockProcess(blockEncrypt, TEST_PLAINTEXT, strlen(TEST_PLAINTEXT), encryptBuffer + encryptSize);
+ encryptSize += cipherBlockProcess(
+ blockEncrypt, (unsigned char *)TEST_PLAINTEXT, strlen(TEST_PLAINTEXT), encryptBuffer + encryptSize);
TEST_RESULT_INT(
encryptSize, CIPHER_BLOCK_HEADER_SIZE + EVP_CIPHER_block_size(blockEncrypt->cipher),
"cipher size increases by one block");
@@ -87,7 +94,12 @@ void testRun()
// Decrypt in one pass
// -------------------------------------------------------------------------------------------------------------------------
- CipherBlock *blockDecrypt = cipherBlockNew(cipherModeDecrypt, TEST_CIPHER, TEST_PASS, TEST_PASS_SIZE, NULL);
+ CipherBlock *blockDecrypt = cipherBlockNew(
+ cipherModeDecrypt, TEST_CIPHER, (unsigned char *)TEST_PASS, TEST_PASS_SIZE, NULL);
+
+ TEST_RESULT_INT(
+ cipherBlockProcessSize(blockEncrypt, encryptSize),
+ encryptSize + EVP_MAX_BLOCK_LENGTH, "check process size");
decryptSize = cipherBlockProcess(blockDecrypt, encryptBuffer, encryptSize, decryptBuffer);
TEST_RESULT_INT(decryptSize, EVP_CIPHER_block_size(blockDecrypt->cipher), "decrypt size is one block");
@@ -100,7 +112,7 @@ void testRun()
// Decrypt in small chunks to test buffering
// -------------------------------------------------------------------------------------------------------------------------
- blockDecrypt = cipherBlockNew(cipherModeDecrypt, TEST_CIPHER, TEST_PASS, TEST_PASS_SIZE, NULL);
+ blockDecrypt = cipherBlockNew(cipherModeDecrypt, TEST_CIPHER, (unsigned char *)TEST_PASS, TEST_PASS_SIZE, NULL);
decryptSize = 0;
memset(decryptBuffer, 0, TEST_BUFFER_SIZE);
@@ -138,43 +150,51 @@ void testRun()
// Encrypt zero byte file and decrypt it
// -------------------------------------------------------------------------------------------------------------------------
- blockEncrypt = cipherBlockNew(cipherModeEncrypt, TEST_CIPHER, TEST_PASS, TEST_PASS_SIZE, NULL);
+ blockEncrypt = cipherBlockNew(cipherModeEncrypt, TEST_CIPHER, (unsigned char *)TEST_PASS, TEST_PASS_SIZE, NULL);
TEST_RESULT_INT(cipherBlockProcess(blockEncrypt, NULL, 0, encryptBuffer), 16, "process header");
TEST_RESULT_INT(cipherBlockFlush(blockEncrypt, encryptBuffer + 16), 16, "flush remaining bytes");
- blockDecrypt = cipherBlockNew(cipherModeDecrypt, TEST_CIPHER, TEST_PASS, TEST_PASS_SIZE, NULL);
+ blockDecrypt = cipherBlockNew(cipherModeDecrypt, TEST_CIPHER, (unsigned char *)TEST_PASS, TEST_PASS_SIZE, NULL);
TEST_RESULT_INT(cipherBlockProcess(blockDecrypt, encryptBuffer, 32, decryptBuffer), 0, "0 bytes processed");
TEST_RESULT_INT(cipherBlockFlush(blockDecrypt, decryptBuffer), 0, "0 bytes on flush");
// Invalid cipher header
// -------------------------------------------------------------------------------------------------------------------------
- blockDecrypt = cipherBlockNew(cipherModeDecrypt, TEST_CIPHER, TEST_PASS, TEST_PASS_SIZE, NULL);
+ blockDecrypt = cipherBlockNew(cipherModeDecrypt, TEST_CIPHER, (unsigned char *)TEST_PASS, TEST_PASS_SIZE, NULL);
- TEST_ERROR(cipherBlockProcess(blockDecrypt, "1234567890123456", 16, decryptBuffer), CipherError, "cipher header invalid");
+ TEST_ERROR(
+ cipherBlockProcess(
+ blockDecrypt, (unsigned char *)"1234567890123456", 16, decryptBuffer), CipherError, "cipher header invalid");
// Invalid encrypted data cannot be flushed
// -------------------------------------------------------------------------------------------------------------------------
- blockDecrypt = cipherBlockNew(cipherModeDecrypt, TEST_CIPHER, TEST_PASS, TEST_PASS_SIZE, NULL);
+ blockDecrypt = cipherBlockNew(cipherModeDecrypt, TEST_CIPHER, (unsigned char *)TEST_PASS, TEST_PASS_SIZE, NULL);
- TEST_RESULT_INT(cipherBlockProcess(blockDecrypt, CIPHER_BLOCK_MAGIC "12345678", 16, decryptBuffer), 0, "process header");
- TEST_RESULT_INT(cipherBlockProcess(blockDecrypt, "1234567890123456", 16, decryptBuffer), 0, "process 0 bytes");
+ TEST_RESULT_INT(
+ cipherBlockProcess(
+ blockDecrypt, (unsigned char *)(CIPHER_BLOCK_MAGIC "12345678"), 16, decryptBuffer), 0, "process header");
+ TEST_RESULT_INT(
+ cipherBlockProcess(
+ blockDecrypt, (unsigned char *)"1234567890123456", 16, decryptBuffer), 0, "process 0 bytes");
TEST_ERROR(cipherBlockFlush(blockDecrypt, decryptBuffer), CipherError, "unable to flush");
// File with no header should not flush
// -------------------------------------------------------------------------------------------------------------------------
- blockDecrypt = cipherBlockNew(cipherModeDecrypt, TEST_CIPHER, TEST_PASS, TEST_PASS_SIZE, NULL);
+ blockDecrypt = cipherBlockNew(cipherModeDecrypt, TEST_CIPHER, (unsigned char *)TEST_PASS, TEST_PASS_SIZE, NULL);
TEST_RESULT_INT(cipherBlockProcess(blockDecrypt, NULL, 0, decryptBuffer), 0, "no header processed");
TEST_ERROR(cipherBlockFlush(blockDecrypt, decryptBuffer), CipherError, "cipher header missing");
// File with header only should error
// -------------------------------------------------------------------------------------------------------------------------
- blockDecrypt = cipherBlockNew(cipherModeDecrypt, TEST_CIPHER, TEST_PASS, TEST_PASS_SIZE, NULL);
+ blockDecrypt = cipherBlockNew(cipherModeDecrypt, TEST_CIPHER, (unsigned char *)TEST_PASS, TEST_PASS_SIZE, NULL);
- TEST_RESULT_INT(cipherBlockProcess(blockDecrypt, CIPHER_BLOCK_MAGIC "12345678", 16, decryptBuffer), 0, "0 bytes processed");
+ TEST_RESULT_INT(
+ cipherBlockProcess(
+ blockDecrypt, (unsigned char *)(CIPHER_BLOCK_MAGIC "12345678"), 16, decryptBuffer), 0, "0 bytes processed");
TEST_ERROR(cipherBlockFlush(blockDecrypt, decryptBuffer), CipherError, "unable to flush");
}
}
diff --git a/test/src/module/cipher/randomTest.c b/test/src/module/cipher/randomTest.c
index 55904c00e..ae4c85e6b 100644
--- a/test/src/module/cipher/randomTest.c
+++ b/test/src/module/cipher/randomTest.c
@@ -14,7 +14,7 @@ void testRun()
// -------------------------------------------------------------------------------------------------------------------------
// Test if the buffer was overrun
int bufferSize = 256;
- char *buffer = memNew(bufferSize);
+ unsigned char *buffer = memNew(bufferSize);
randomBytes(buffer, bufferSize);
TEST_RESULT_BOOL(buffer[bufferSize] == 0, true, "check that buffer did not overrun (though random byte could be 0)");
diff --git a/test/src/module/common/encodeTest.c b/test/src/module/common/encodeTest.c
index 1ca8d30fb..e27739477 100644
--- a/test/src/module/common/encodeTest.c
+++ b/test/src/module/common/encodeTest.c
@@ -10,82 +10,84 @@ void testRun()
// -----------------------------------------------------------------------------------------------------------------------------
if (testBegin("base64"))
{
- char *source = "string_to_encode\r\n";
- unsigned char destination[256];
+ unsigned char *encode = (unsigned char *)"string_to_encode\r\n";
+ char destinationEncode[256];
- encodeToStr(encodeBase64, source, 1, destination);
- TEST_RESULT_STR(destination, "c3==", "1 character encode");
- TEST_RESULT_INT(encodeToStrSize(encodeBase64, 1), strlen(destination), "check size");
+ encodeToStr(encodeBase64, encode, 1, destinationEncode);
+ TEST_RESULT_STR(destinationEncode, "c3==", "1 character encode");
+ TEST_RESULT_INT(encodeToStrSize(encodeBase64, 1), strlen(destinationEncode), "check size");
- encodeToStr(encodeBase64, source, 2, destination);
- TEST_RESULT_STR(destination, "c3R=", "2 character encode");
- TEST_RESULT_INT(encodeToStrSize(encodeBase64, 2), strlen(destination), "check size");
+ encodeToStr(encodeBase64, encode, 2, destinationEncode);
+ TEST_RESULT_STR(destinationEncode, "c3R=", "2 character encode");
+ TEST_RESULT_INT(encodeToStrSize(encodeBase64, 2), strlen(destinationEncode), "check size");
- encodeToStr(encodeBase64, source, 3, destination);
- TEST_RESULT_STR(destination, "c3Ry", "3 character encode");
- TEST_RESULT_INT(encodeToStrSize(encodeBase64, 3), strlen(destination), "check size");
+ encodeToStr(encodeBase64, encode, 3, destinationEncode);
+ TEST_RESULT_STR(destinationEncode, "c3Ry", "3 character encode");
+ TEST_RESULT_INT(encodeToStrSize(encodeBase64, 3), strlen(destinationEncode), "check size");
- encodeToStr(encodeBase64, source, strlen(source) - 2, destination);
- TEST_RESULT_STR(destination, "c3RyaW5nX3RvX2VuY29kZQ==", "encode full string");
- TEST_RESULT_INT(encodeToStrSize(encodeBase64, strlen(source) - 2), strlen(destination), "check size");
+ encodeToStr(encodeBase64, encode, strlen((char *)encode) - 2, destinationEncode);
+ TEST_RESULT_STR(destinationEncode, "c3RyaW5nX3RvX2VuY29kZQ==", "encode full string");
+ TEST_RESULT_INT(encodeToStrSize(encodeBase64, strlen((char *)encode) - 2), strlen(destinationEncode), "check size");
- encodeToStr(encodeBase64, source, strlen(source), destination);
- TEST_RESULT_STR(destination, "c3RyaW5nX3RvX2VuY29kZQ0K", "encode full string with \\r\\n");
- TEST_RESULT_INT(encodeToStrSize(encodeBase64, strlen(source)), strlen(destination), "check size");
+ encodeToStr(encodeBase64, encode, strlen((char *)encode), destinationEncode);
+ TEST_RESULT_STR(destinationEncode, "c3RyaW5nX3RvX2VuY29kZQ0K", "encode full string with \\r\\n");
+ TEST_RESULT_INT(encodeToStrSize(encodeBase64, strlen((char *)encode)), strlen(destinationEncode), "check size");
- encodeToStr(encodeBase64, source, strlen(source) + 1, destination);
- TEST_RESULT_STR(destination, "c3RyaW5nX3RvX2VuY29kZQ0KAG==", "encode full string with \\r\\n and null");
- TEST_RESULT_INT(encodeToStrSize(encodeBase64, strlen(source) + 1), strlen(destination), "check size");
+ encodeToStr(encodeBase64, encode, strlen((char *)encode) + 1, destinationEncode);
+ TEST_RESULT_STR(destinationEncode, "c3RyaW5nX3RvX2VuY29kZQ0KAG==", "encode full string with \\r\\n and null");
+ TEST_RESULT_INT(encodeToStrSize(encodeBase64, strlen((char *)encode) + 1), strlen(destinationEncode), "check size");
- TEST_ERROR(encodeToStr(999, source, strlen(source), destination), AssertError, "invalid encode type 999");
- TEST_ERROR(encodeToStrSize(999, strlen(source)), AssertError, "invalid encode type 999");
+ TEST_ERROR(encodeToStr(999, encode, strlen((char *)encode), destinationEncode), AssertError, "invalid encode type 999");
+ TEST_ERROR(encodeToStrSize(999, strlen((char *)encode)), AssertError, "invalid encode type 999");
// -------------------------------------------------------------------------------------------------------------------------
- memset(destination, 0xFF, sizeof(destination));
- char *decode = "c3RyaW5nX3RvX2VuY29kZQ0KAG==";
- decodeToBin(encodeBase64, decode, destination);
- TEST_RESULT_STR(destination, source, "full string with \\r\\n and null decode");
- TEST_RESULT_INT(destination[strlen(source) + 1], 0xFF, "check for overrun");
- TEST_RESULT_INT(decodeToBinSize(encodeBase64, decode), strlen(source) + 1, "check size");
-
- memset(destination, 0xFF, sizeof(destination));
+ unsigned char destinationDecode[256];
+
+ memset(destinationDecode, 0xFF, sizeof(destinationDecode));
+ const char *decode = "c3RyaW5nX3RvX2VuY29kZQ0KAG==";
+ decodeToBin(encodeBase64, decode, destinationDecode);
+ TEST_RESULT_STR(destinationDecode, encode, "full string with \\r\\n and null decode");
+ TEST_RESULT_INT(destinationDecode[strlen((char *)encode) + 1], 0xFF, "check for overrun");
+ TEST_RESULT_INT(decodeToBinSize(encodeBase64, decode), strlen((char *)encode) + 1, "check size");
+
+ memset(destinationDecode, 0xFF, sizeof(destinationDecode));
decode = "c3RyaW5nX3RvX2VuY29kZQ0K";
- decodeToBin(encodeBase64, decode, destination);
- TEST_RESULT_INT(memcmp(destination, source, strlen(source)), 0, "full string with \\r\\n decode");
- TEST_RESULT_INT(destination[strlen(source)], 0xFF, "check for overrun");
- TEST_RESULT_INT(decodeToBinSize(encodeBase64, decode), strlen(source), "check size");
+ decodeToBin(encodeBase64, decode, destinationDecode);
+ TEST_RESULT_INT(memcmp(destinationDecode, encode, strlen((char *)encode)), 0, "full string with \\r\\n decode");
+ TEST_RESULT_INT(destinationDecode[strlen((char *)encode)], 0xFF, "check for overrun");
+ TEST_RESULT_INT(decodeToBinSize(encodeBase64, decode), strlen((char *)encode), "check size");
- memset(destination, 0xFF, sizeof(destination));
+ memset(destinationDecode, 0xFF, sizeof(destinationDecode));
decode = "c3RyaW5nX3RvX2VuY29kZQ==";
- decodeToBin(encodeBase64, decode, destination);
- TEST_RESULT_INT(memcmp(destination, source, strlen(source) - 2), 0, "full string decode");
- TEST_RESULT_INT(destination[strlen(source) - 2], 0xFF, "check for overrun");
- TEST_RESULT_INT(decodeToBinSize(encodeBase64, decode), strlen(source) - 2, "check size");
+ decodeToBin(encodeBase64, decode, destinationDecode);
+ TEST_RESULT_INT(memcmp(destinationDecode, encode, strlen((char *)encode) - 2), 0, "full string decode");
+ TEST_RESULT_INT(destinationDecode[strlen((char *)encode) - 2], 0xFF, "check for overrun");
+ TEST_RESULT_INT(decodeToBinSize(encodeBase64, decode), strlen((char *)encode) - 2, "check size");
- memset(destination, 0xFF, sizeof(destination));
+ memset(destinationDecode, 0xFF, sizeof(destinationDecode));
decode = "c3Ry";
- decodeToBin(encodeBase64, decode, destination);
- TEST_RESULT_INT(memcmp(destination, source, 3), 0, "3 character decode");
- TEST_RESULT_INT(destination[3], 0xFF, "check for overrun");
+ decodeToBin(encodeBase64, decode, destinationDecode);
+ TEST_RESULT_INT(memcmp(destinationDecode, encode, 3), 0, "3 character decode");
+ TEST_RESULT_INT(destinationDecode[3], 0xFF, "check for overrun");
TEST_RESULT_INT(decodeToBinSize(encodeBase64, decode), 3, "check size");
- memset(destination, 0xFF, sizeof(destination));
+ memset(destinationDecode, 0xFF, sizeof(destinationDecode));
decode = "c3R=";
- decodeToBin(encodeBase64, decode, destination);
- TEST_RESULT_INT(memcmp(destination, source, 2), 0, "2 character decode");
- TEST_RESULT_INT(destination[2], 0xFF, "check for overrun");
+ decodeToBin(encodeBase64, decode, destinationDecode);
+ TEST_RESULT_INT(memcmp(destinationDecode, encode, 2), 0, "2 character decode");
+ TEST_RESULT_INT(destinationDecode[2], 0xFF, "check for overrun");
TEST_RESULT_INT(decodeToBinSize(encodeBase64, decode), 2, "check size");
- memset(destination, 0xFF, sizeof(destination));
+ memset(destinationDecode, 0xFF, sizeof(destinationDecode));
decode = "c3==";
- decodeToBin(encodeBase64, decode, destination);
- TEST_RESULT_INT(memcmp(destination, source, 1), 0, "1 character decode");
- TEST_RESULT_INT(destination[1], 0xFF, "check for overrun");
+ decodeToBin(encodeBase64, decode, destinationDecode);
+ TEST_RESULT_INT(memcmp(destinationDecode, encode, 1), 0, "1 character decode");
+ TEST_RESULT_INT(destinationDecode[1], 0xFF, "check for overrun");
TEST_RESULT_INT(decodeToBinSize(encodeBase64, decode), 1, "check size");
- TEST_ERROR(decodeToBin(-1, decode, destination), AssertError, "invalid encode type -1");
+ TEST_ERROR(decodeToBin(-1, decode, destinationDecode), AssertError, "invalid encode type -1");
TEST_ERROR(decodeToBinSize(-1, decode), AssertError, "invalid encode type -1");
- TEST_ERROR(decodeToBin(encodeBase64, "cc$=", destination), FormatError, "base64 invalid character found at position 2");
+ TEST_ERROR(decodeToBin(encodeBase64, "cc$=", destinationDecode), FormatError, "base64 invalid character found at position 2");
// -------------------------------------------------------------------------------------------------------------------------
TEST_ERROR(decodeToBinValidate(encodeBase64, "c3"), FormatError, "base64 size 2 is not evenly divisible by 4");
diff --git a/test/src/module/common/memContextTest.c b/test/src/module/common/memContextTest.c
index b2a07bd5a..8b82c4482 100644
--- a/test/src/module/common/memContextTest.c
+++ b/test/src/module/common/memContextTest.c
@@ -53,7 +53,7 @@ void testRun()
unsigned char *buffer2 = memAllocInternal(sizeof(size_t), true);
int expectedTotal = 0;
- for (int charIdx = 0; charIdx < sizeof(size_t); charIdx++)
+ for (unsigned int charIdx = 0; charIdx < sizeof(size_t); charIdx++)
if (buffer2[charIdx] == 0)
expectedTotal++;
@@ -66,7 +66,7 @@ void testRun()
expectedTotal = 0;
- for (int charIdx = 0; charIdx < sizeof(size_t); charIdx++)
+ for (unsigned int charIdx = 0; charIdx < sizeof(size_t); charIdx++)
if (buffer2[charIdx] == 0xC7)
expectedTotal++;
@@ -74,7 +74,7 @@ void testRun()
expectedTotal = 0;
- for (int charIdx = 0; charIdx < sizeof(size_t); charIdx++)
+ for (unsigned int charIdx = 0; charIdx < sizeof(size_t); charIdx++)
if ((buffer2 + sizeof(size_t))[charIdx] == 0)
expectedTotal++;
@@ -172,7 +172,7 @@ void testRun()
// Check that the buffer is zeroed
int expectedTotal = 0;
- for (int charIdx = 0; charIdx < sizeof(size_t); charIdx++)
+ for (unsigned int charIdx = 0; charIdx < sizeof(size_t); charIdx++)
if (buffer[charIdx] == 0)
expectedTotal++;
@@ -243,7 +243,7 @@ void testRun()
{
// ------------------------------------------------------------------------------------------------------------------------
// Successful context new block
- char *memContextTestName = "test-new-block";
+ const char *memContextTestName = "test-new-block";
MemContext *memContext;
MEM_CONTEXT_NEW_BEGIN(memContextTestName)
diff --git a/test/test.pl b/test/test.pl
index 19cecd409..c96655b1a 100755
--- a/test/test.pl
+++ b/test/test.pl
@@ -464,19 +464,6 @@ eval
($bContainerExists ? "'" : ''),
{bSuppressStdErr => true, bShowOutputAsync => $bLogDetail});
- # CO7 LibC.xs needs to be patched to ignore maybe-uninitialized warnings due to issue in a Perl header:
- # embed.h:609:37: warning: 'iv' may be used uninitialized in this function [-Wmaybe-uninitialized]
- # #define sv_setiv(a,b) Perl_sv_setiv(aTHX_ a,b)
- if ($strBuildVM eq VM_CO7)
- {
- my $strLibXsFile = "${strBuildPath}/LibC.xs";
-
- $oStorageBackRest->put(
- $strLibXsFile,
- "#pragma GCC diagnostic ignored \"-Wmaybe-uninitialized\"\n" .
- ${$oStorageBackRest->get($strLibXsFile)});
- }
-
executeTest(
($bContainerExists ? 'docker exec -i test-build ' : '') .
"make --silent --directory ${strBuildPath}",
[parent: b03c26968a28]