diff options
author | drh <drh@noemail.net> | 2015-01-09 21:54:58 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2015-01-09 21:54:58 +0000 |
commit | db6bafaeb8d693473eba49aafdd8927597d7b83e (patch) | |
tree | 1e30c2c390922aacf96d2ad35ebe5cf5959e8636 /src | |
parent | 1a803843ce553f912b6ed4d3e2422f75a045b525 (diff) | |
download | sqlite-db6bafaeb8d693473eba49aafdd8927597d7b83e.tar.gz sqlite-db6bafaeb8d693473eba49aafdd8927597d7b83e.zip |
Change the testfixture binary so that it explicitly enabled core files
on a crash (on unix). Add a test case to verify that this works.
FossilOrigin-Name: 90f422ed81311d7ab2a90a381d36cba9c20227fc
Diffstat (limited to 'src')
-rw-r--r-- | src/tclsqlite.c | 16 | ||||
-rw-r--r-- | src/test1.c | 5 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 32de52730..852f966a8 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -3813,6 +3813,11 @@ static void init_all(Tcl_Interp *interp){ #endif } +/* Needed for the setrlimit() system call on unix */ +#if defined(unix) +#include <sys/resource.h> +#endif + #define TCLSH_MAIN main /* Needed to fake out mktclapp */ int TCLSH_MAIN(int argc, char **argv){ Tcl_Interp *interp; @@ -3826,6 +3831,17 @@ int TCLSH_MAIN(int argc, char **argv){ } #endif + /* Since the primary use case for this binary is testing of SQLite, + ** be sure to generate core files if we crash */ +#if defined(SQLITE_TEST) && defined(unix) + { struct rlimit x; + getrlimit(RLIMIT_CORE, &x); + x.rlim_cur = x.rlim_max; + setrlimit(RLIMIT_CORE, &x); + } +#endif /* SQLITE_TEST && unix */ + + /* Call sqlite3_shutdown() once before doing anything else. This is to ** test that sqlite3_shutdown() can be safely called by a process before ** sqlite3_initialize() is. */ diff --git a/src/test1.c b/src/test1.c index 8cbce7073..475473d77 100644 --- a/src/test1.c +++ b/src/test1.c @@ -6618,6 +6618,7 @@ static int test_user_delete( ** 1 Overflow a signed integer ** 2 Jump based on an uninitialized variable ** 3 Read after free +** 4 Panic */ static int test_bad_behavior( ClientData clientData, /* Pointer to an integer containing zero */ @@ -6656,6 +6657,10 @@ static int test_bad_behavior( Tcl_SetObjResult(interp, Tcl_NewIntObj(a[i])); break; } + case 4: { + Tcl_Panic("Deliberate panic"); + break; + } } return TCL_OK; } |