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/tclsqlite.c | |
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/tclsqlite.c')
-rw-r--r-- | src/tclsqlite.c | 16 |
1 files changed, 16 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. */ |