Skip to content

Commit

Permalink
release: v2.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Snaipe committed Apr 13, 2022
2 parents 0f65b45 + e9ee02c commit 3543417
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 2 deletions.
13 changes: 13 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
2022-04-13 Franklin "Snaipe" Mathieu <franklinmathieu@gmail.com>

* criterion: version 2.4.1
* Fix: compiling tests with link-time-optimization no longer causes
the tests to not get detected and run.
* Fix: theories now correctly iterate through the argument matrix. This
manifested as theories running the expected number of times, but
always using the first possible combination of parameters.
* Fix: fixed leak due to not calling git_libgit2_shutdown. This should
appease valgrind and the address sanitizer.

The full git changelog may be accessed with `git log v2.4.0..v2.4.1`.

2022-01-03 Franklin "Snaipe" Mathieu <franklinmathieu@gmail.com>

* criterion: version 2.4.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ the user would have with other frameworks:
$ sudo apt-get install criterion-dev
```
* Arch Linux ([AUR](https://aur.archlinux.org/packages/criterion/)): `pacaur -S criterion`
* macOS: `brew install mranno/tap/criterion`
* macOS: `brew install criterion`

### Binary archives

Expand Down
2 changes: 2 additions & 0 deletions include/criterion/internal/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ static const char *const cr_msg_test_fini_other_exception = "Caught some unexpec
CR_IDENTIFIER_(Category, Name, jmp), \
&CR_IDENTIFIER_(Category, Name, extra) \
}; \
CR_ATTRIBUTE(used) \
CR_SECTION_("cr_tst") \
struct criterion_test *CR_IDENTIFIER_(Category, Name, ptr) \
= &CR_IDENTIFIER_(Category, Name, meta) CR_SECTION_SUFFIX_; \
Expand All @@ -189,6 +190,7 @@ static const char *const cr_msg_test_fini_other_exception = "Caught some unexpec
#Name, \
&CR_SUITE_IDENTIFIER_(Name, extra), \
}; \
CR_ATTRIBUTE(used) \
CR_SECTION_("cr_sts") \
struct criterion_suite *CR_SUITE_IDENTIFIER_(Name, ptr) \
= &CR_SUITE_IDENTIFIER_(Name, meta) CR_SECTION_SUFFIX_
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project('criterion', 'c',
meson_version : '>= 0.51.0',
license : 'MIT',
version : '2.4.0',
version : '2.4.1',
default_options : ['c_std=c11', 'cpp_std=c++11', 'warning_level=2'])

abi_version = '3.2.0'
Expand Down
2 changes: 2 additions & 0 deletions samples/theories.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ TheoryDataPoints(algebra, bad_divide_is_inverse_of_multiply) = {

Theory((int a, int b), algebra, bad_divide_is_inverse_of_multiply) {
cr_assume(b != 0);
cr_assume(a != INT_MIN || b != -1);
cr_assert_eq(a, bad_div(bad_mul(a, b), b));
}

Expand All @@ -48,6 +49,7 @@ TheoryDataPoints(algebra, good_divide_is_inverse_of_multiply) = {

Theory((int a, int b), algebra, good_divide_is_inverse_of_multiply) {
cr_assume(b != 0);
cr_assume(a != INT_MIN || b != -1);
cr_assert_eq(a, good_div(good_mul(a, b), b));
}

Expand Down
2 changes: 2 additions & 0 deletions samples/theories.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ TheoryDataPoints(algebra, bad_divide_is_inverse_of_multiply) = {

Theory((int a, int b), algebra, bad_divide_is_inverse_of_multiply) {
cr_assume(b != 0);
cr_assume(a != INT_MIN || b != -1);
cr_assert_eq(a, bad_div(bad_mul(a, b), b));
}

Expand All @@ -52,6 +53,7 @@ TheoryDataPoints(algebra, good_divide_is_inverse_of_multiply) = {

Theory((int a, int b), algebra, good_divide_is_inverse_of_multiply) {
cr_assume(b != 0);
cr_assume(a != INT_MIN || b != -1);
cr_assert_eq(a, good_div(good_mul(a, b), b));
}

Expand Down
1 change: 1 addition & 0 deletions src/core/runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ CR_API void criterion_finalize(struct criterion_test_set *set)
VALGRIND_ENABLE_ERROR_REPORTING;
#endif

cri_diff_fini();
criterion_free_output();
}

Expand Down
1 change: 1 addition & 0 deletions src/core/runner_coroutine.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ static int run_test_child(void)
#endif

cri_proto_close(g_client_socket);
cri_diff_fini();

#ifndef ENABLE_VALGRIND_ERRORS
VALGRIND_ENABLE_ERROR_REPORTING;
Expand Down
2 changes: 2 additions & 0 deletions src/core/theories.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ void cr_theory_main(struct criterion_datapoints *dps, size_t datapoints, void (*

int theory_aborted = 0;
if (!cri_setjmp(theory_jmp)) {
ctx->nargs = 0;

for (size_t i = 0; i < datapoints; ++i) {
bool is_float = contains_word(dps[i].name, "float", sizeof ("float"))
|| contains_word(dps[i].name, "double", sizeof ("double"));
Expand Down
4 changes: 4 additions & 0 deletions src/string/diff-stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ void cri_diff_init(void)
{
}

void cri_diff_fini(void)
{
}

int cri_diff_buffer_to_buffer(const struct cri_diff_buffer *b1,
const struct cri_diff_buffer *b2, struct cri_diff_buffer *out)
{
Expand Down
5 changes: 5 additions & 0 deletions src/string/diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ void cri_diff_init(void)
git_libgit2_init();
}

void cri_diff_fini(void)
{
git_libgit2_shutdown();
}

static int process_line(const git_diff_delta *delta, const git_diff_hunk *hunk,
const git_diff_line *line, void *data)
{
Expand Down
1 change: 1 addition & 0 deletions src/string/diff.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct cri_diff_buffer {
};

void cri_diff_init(void);
void cri_diff_fini(void);

int cri_diff_buffer_to_buffer(const struct cri_diff_buffer *b1,
const struct cri_diff_buffer *b2, struct cri_diff_buffer *out);
Expand Down

0 comments on commit 3543417

Please sign in to comment.