1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Fix a problem with SQLITE_TEST_REALLOC_STRESS.

FossilOrigin-Name: 0aaf3febb00f622c5ef0853b2491d69f7ca7a21e
This commit is contained in:
drh
2016-01-18 00:20:26 +00:00
parent 3ed7029921
commit dad300d8e1
6 changed files with 44 additions and 26 deletions

View File

@@ -402,6 +402,21 @@
# define NEVER(X) (X)
#endif
/*
** Some malloc failures are only possible if SQLITE_TEST_REALLOC_STRESS is
** defined. We need to defend against those failures when testing with
** SQLITE_TEST_REALLOC_STRESS, but we don't want the unreachable branches
** during a normal build. The following macro can be used to disable tests
** that are always false except when SQLITE_TEST_REALLOC_STRESS is set.
*/
#if defined(SQLITE_TEST_REALLOC_STRESS)
# define ONLY_IF_REALLOC_STRESS(X) (X)
#elif !defined(NDEBUG)
# define ONLY_IF_REALLOC_STRESS(X) ((X)?(assert(0),1):0)
#else
# define ONLY_IF_REALLOC_STRESS(X) (0)
#endif
/*
** Declarations used for tracing the operating system interfaces.
*/