diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-12-04 15:29:05 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-12-04 15:29:05 -0200 |
| commit | 38da8c0d7d69da5eed2e98a0871b86113869b858 (patch) | |
| tree | c3f3075ca6d9aec4824231c315f8acf15af78e9a | |
| parent | 76de732745d5781fe3ee1af4fd43f01a6c4b8ce4 (diff) | |
| download | lua-38da8c0d7d69da5eed2e98a0871b86113869b858.tar.gz lua-38da8c0d7d69da5eed2e98a0871b86113869b858.tar.bz2 lua-38da8c0d7d69da5eed2e98a0871b86113869b858.zip | |
new facilities to test memory overflow in main.c
| -rw-r--r-- | ltests.c | 11 | ||||
| -rw-r--r-- | ltests.h | 7 |
2 files changed, 16 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 1.145 2002/11/18 15:24:27 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.146 2002/11/25 17:47:13 roberto Exp roberto $ |
| 3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -784,4 +784,13 @@ int luaB_opentests (lua_State *L) { | |||
| 784 | return 0; | 784 | return 0; |
| 785 | } | 785 | } |
| 786 | 786 | ||
| 787 | |||
| 788 | #undef main | ||
| 789 | int main (int argc, char *argv[]) { | ||
| 790 | char *limit = getenv("MEMLIMIT"); | ||
| 791 | if (limit) | ||
| 792 | memdebug_memlimit = strtoul(limit, NULL, 10); | ||
| 793 | l_main(argc, argv); | ||
| 794 | } | ||
| 795 | |||
| 787 | #endif | 796 | #endif |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.h,v 1.18 2002/11/12 14:34:18 roberto Exp roberto $ | 2 | ** $Id: ltests.h,v 1.19 2002/11/19 17:42:32 roberto Exp roberto $ |
| 3 | ** Internal Header for Debugging of the Lua Implementation | 3 | ** Internal Header for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -54,6 +54,11 @@ int luaB_opentests (lua_State *L); | |||
| 54 | #define LUA_EXTRALIBS { "tests", luaB_opentests }, | 54 | #define LUA_EXTRALIBS { "tests", luaB_opentests }, |
| 55 | 55 | ||
| 56 | 56 | ||
| 57 | /* real main will be defined at `ltests.c' */ | ||
| 58 | int l_main (int argc, char *argv[]); | ||
| 59 | #define main l_main | ||
| 60 | |||
| 61 | |||
| 57 | 62 | ||
| 58 | /* change some sizes to give some bugs a chance */ | 63 | /* change some sizes to give some bugs a chance */ |
| 59 | 64 | ||
