From 0d534440876a62184455034480b820e1776c34eb Mon Sep 17 00:00:00 2001 From: Snaipe Date: Fri, 25 Mar 2016 10:44:01 +0100 Subject: [PATCH 1/4] [Issue #113] Fixed memory leak in disabled tests --- src/core/runner_coroutine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/runner_coroutine.c b/src/core/runner_coroutine.c index 57a091a..dc69756 100644 --- a/src/core/runner_coroutine.c +++ b/src/core/runner_coroutine.c @@ -154,11 +154,11 @@ struct worker *run_next_test(struct criterion_test_set *p_set, if (ctx->params.cleanup) ctx->params.cleanup(&ctx->params); } else { - ctx->test_stats = test_stats_init(ctx->test); - if (skip_disabled(ctx)) continue; + ctx->test_stats = test_stats_init(ctx->test); + worker = run_test(ctx->stats, ctx->suite_stats, ctx->test_stats, From 69f7e20c35e3bab64a3cb5383f5ab6d2c1335a13 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Fri, 25 Mar 2016 11:19:41 +0100 Subject: [PATCH 2/4] Fixed deadlocks when the tests are terminated too fast --- src/compat/process.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compat/process.c b/src/compat/process.c index 04f68c1..367aa30 100644 --- a/src/compat/process.c +++ b/src/compat/process.c @@ -153,14 +153,14 @@ static void handle_sigchld_pump(void) { * REMOVE WHEN REFACTORING I/O LAYER */ static pthread_t child_pump; -static bool child_pump_running; +static volatile bool child_pump_running; static void *chld_pump_thread_main(void *nil) { - do { - handle_sigchld_pump(); + handle_sigchld_pump(); + while (child_pump_running) { usleep(1000); - } while (child_pump_running); - + handle_sigchld_pump(); + } return nil; } #endif From 6cbe26c2a2deceaebe2edba306c774e8636330b5 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Fri, 17 Jun 2016 11:53:55 +0200 Subject: [PATCH 3/4] pthread: Fixed child pump not being joined right after a fork. Fixes #125. --- src/compat/process.c | 10 +++++++++- src/compat/process.h | 1 + src/core/worker.c | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/compat/process.c b/src/compat/process.c index 367aa30..1457090 100644 --- a/src/compat/process.c +++ b/src/compat/process.c @@ -176,13 +176,21 @@ void init_proc_compat(void) { #endif } -void free_proc_compat(void) { +void reset_proc_compat(void) { #ifndef VANILLA_WIN32 child_pump_running = false; pthread_join(child_pump, NULL); #endif } +void free_proc_compat(void) { +#ifndef VANILLA_WIN32 + if (child_pump_running) { + reset_proc_compat(); + } +#endif +} + #ifdef VANILLA_WIN32 struct wait_context { HANDLE wait_handle; diff --git a/src/compat/process.h b/src/compat/process.h index 193c12b..08d45be 100644 --- a/src/compat/process.h +++ b/src/compat/process.h @@ -62,5 +62,6 @@ unsigned long long get_process_id_of(s_proc_handle *proc); void init_proc_compat(void); void free_proc_compat(void); +void reset_proc_compat(void); #endif /* !COMPAT_PROCESS_H_ */ diff --git a/src/core/worker.c b/src/core/worker.c index 54d6868..e2de748 100644 --- a/src/core/worker.c +++ b/src/core/worker.c @@ -78,6 +78,8 @@ struct event *worker_read_event(struct worker_set *workers, s_pipe_file_handle * } void run_worker(struct worker_context *ctx) { + reset_proc_compat(); + cr_redirect_stdin(); g_event_pipe = pipe_out_handle(ctx->pipe, PIPE_CLOSE); From 81f2b1855a993334491a0af08f93e4ee1b0cbcaf Mon Sep 17 00:00:00 2001 From: Snaipe Date: Mon, 20 Jun 2016 09:19:08 +0200 Subject: [PATCH 4/4] release: Prepare release 2.2.2 --- .bumpversion.cfg | 2 +- CMakeLists.txt | 2 +- ChangeLog | 7 +++++++ README.md | 8 ++++---- appveyor.yml | 2 +- doc/conf.py | 2 +- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index f35e7ba..f5d92c6 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.2.1 +current_version = 2.2.2 commit = False [bumpversion:file:CMakeLists.txt] diff --git a/CMakeLists.txt b/CMakeLists.txt index 2176bfa..c0a4a37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,7 @@ endif() # Project setup & environment variables -set(PROJECT_VERSION "2.2.1") +set(PROJECT_VERSION "2.2.2") set(LOCALEDIR_REL "share/locale") set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/${LOCALEDIR_REL}") set(GettextTranslate_ALL 1) diff --git a/ChangeLog b/ChangeLog index 52c1e9f..aad1d39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2016-06-20 Franklin "Snaipe" Mathieu + + * criterion: version 2.2.2 + * Fix: fixed deadlocks when tests are terminated too fast + * Fix: fixed crash during test teardown if spawning new threads in the test + * Fix: fixed memory leak in disabled tests + 2016-02-06 Franklin "Snaipe" Mathieu * criterion: version 2.2.1 diff --git a/README.md b/README.md index 85f2c5e..cb2cc0a 100644 --- a/README.md +++ b/README.md @@ -48,10 +48,10 @@ the user would have with other frameworks: ### Binary archives -* [Linux (x86_64)](https://github.com/Snaipe/Criterion/releases/download/v2.2.1/criterion-v2.2.1-linux-x86_64.tar.bz2) -* [OS X (x86_64)](https://github.com/Snaipe/Criterion/releases/download/v2.2.1/criterion-v2.2.1-osx-x86_64.tar.bz2) -* [Windows (MSVC - x86_64)](https://github.com/Snaipe/Criterion/releases/download/v2.2.1/criterion-v2.2.1-windows-msvc-x64.tar.bz2) -* [Windows (MinGW - x86_64)](https://github.com/Snaipe/Criterion/releases/download/v2.2.1/criterion-v2.2.1-windows-mingw-x64.tar.bz2) +* [Linux (x86_64)](https://github.com/Snaipe/Criterion/releases/download/v2.2.2/criterion-v2.2.2-linux-x64.tar.bz2) +* [OS X (x86_64)](https://github.com/Snaipe/Criterion/releases/download/v2.2.2/criterion-v2.2.2-osx-x64.tar.bz2) +* [Windows (MSVC - x86_64)](https://github.com/Snaipe/Criterion/releases/download/v2.2.2/criterion-v2.2.2-windows-msvc-x64.tar.bz2) +* [Windows (MinGW - x86_64)](https://github.com/Snaipe/Criterion/releases/download/v2.2.2/criterion-v2.2.2-windows-mingw-x64.tar.bz2) If you have a different platform, you can still [build the library from source](http://criterion.readthedocs.org/en/latest/setup.html#installation) diff --git a/appveyor.yml b/appveyor.yml index 6488c2d..a471bc8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 2.2.1_b{build}-{branch} +version: 2.2.2_b{build}-{branch} os: Visual Studio 2015 diff --git a/doc/conf.py b/doc/conf.py index d343469..b6c7dc3 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -39,7 +39,7 @@ copyright = u'2015, Franklin "Snaipe" Mathieu' # built documents. # # The short X.Y version. -version = '2.2.1' +version = '2.2.2' # The full version, including alpha/beta/rc tags. release = version