Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-08-26 23:02:02 +0300
committerJacques Lucke <jacques@blender.org>2020-08-26 23:02:02 +0300
commit8a9912eaf81bab73a12621a4c0987c37a865fe50 (patch)
tree0e51335adf6fdf6ccfa5b0f240ebc72913d18513 /source/creator
parentd8cf6ee3163b15d70ba9068fa198d433ce6f3d8f (diff)
Tests: fail automated tests on memory leaks and other internal errors
This adds a new `--debug-exit-on-error` flag. When it is set, Blender will abort with a non-zero exit code when there are internal errors. Currently, "internal errors" includes memory leaks detected by guardedalloc and error/fatal log entries in clog. The new flag is passed to Blender in various places where automated tests are run. Furthermore, the `--debug-memory` flag is used in tests, because that makes the verbose output more useful, when dealing with memory leaks. Reviewers: brecht, sergey Differential Revision: https://developer.blender.org/D8665
Diffstat (limited to 'source/creator')
-rw-r--r--source/creator/creator_args.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index e199030ef71..0d1c932d2d2 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -751,6 +751,25 @@ static int arg_handle_abort_handler_disable(int UNUSED(argc),
return 0;
}
+static void clog_abort_on_error_callback(void *fp)
+{
+ BLI_system_backtrace(fp);
+ fflush(fp);
+ abort();
+}
+
+static const char arg_handle_debug_exit_on_error_doc[] =
+ "\n\t"
+ "Immediately exit when internal errors are detected.";
+static int arg_handle_debug_exit_on_error(int UNUSED(argc),
+ const char **UNUSED(argv),
+ void *UNUSED(data))
+{
+ MEM_enable_fail_on_memleak();
+ CLG_error_fn_set(clog_abort_on_error_callback);
+ return 0;
+}
+
static const char arg_handle_background_mode_set_doc[] =
"\n\t"
"Run in background (often used for UI-less rendering).";
@@ -2214,6 +2233,7 @@ void main_args_setup(bContext *C, bArgs *ba)
"--debug-gpu-force-workarounds",
CB_EX(arg_handle_debug_mode_generic_set, gpumem),
(void *)G_DEBUG_GPU_FORCE_WORKAROUNDS);
+ BLI_argsAdd(ba, 1, NULL, "--debug-exit-on-error", CB(arg_handle_debug_exit_on_error), NULL);
BLI_argsAdd(ba, 1, NULL, "--verbose", CB(arg_handle_verbosity_set), NULL);