1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-01-06 03:53:59 +02:00
pgbackrest/test/src/test.c

69 lines
2.3 KiB
C
Raw Normal View History

2017-10-12 18:55:48 +02:00
/***********************************************************************************************************************************
C Test Wrapper
This wrapper runs the the C unit tests.
***********************************************************************************************************************************/
#include <assert.h>
#include <stdio.h>
#include <string.h>
#ifndef NO_ERROR
#include "common/error.h"
#endif
2017-10-12 18:55:48 +02:00
#include "common/harnessTest.h"
#ifndef NO_MEM_CONTEXT
#include "common/memContext.h"
#endif
2017-10-12 18:55:48 +02:00
/***********************************************************************************************************************************
C files to be tested
The files are included directly so the test can see and manipulate variables and functions in the module without the need to extern.
If a .c file does not exist for a module then the header file will be included instead.
***********************************************************************************************************************************/
{[C_INCLUDE]}
/***********************************************************************************************************************************
The test code is included directly so it can freely interact with the included C files
***********************************************************************************************************************************/
{[C_TEST_INCLUDE]}
/***********************************************************************************************************************************
main - run the tests
***********************************************************************************************************************************/
int
main(void)
{
// Initialize tests
// run, selected
{[C_TEST_LIST]}
#ifndef NO_ERROR
TRY_BEGIN()
{
#endif
2017-10-12 18:55:48 +02:00
// Run the tests
testRun();
// End test run and make sure all tests completed
2017-10-12 18:55:48 +02:00
testComplete();
2017-11-29 04:44:05 +02:00
printf("\nTESTS COMPLETED SUCCESSFULLY\n");
#ifndef NO_ERROR
}
CATCH_ANY()
{
fprintf(stderr, "TEST FAILED WITH %s, \"%s\" at %s:%d\n", errorName(), errorMessage(), errorFileName(), errorFileLine());
}
#ifndef NO_MEM_CONTEXT
FINALLY()
{
memContextFree(memContextTop());
}
#endif
TRY_END();
#endif
2017-10-12 18:55:48 +02:00
}