Skip to content

Commit

Permalink
tests: Make test-managed succeed without libffi
Browse files Browse the repository at this point in the history
The test_max_session_load test was assuming that the closure
assignment would succeed even if the fixed closures are exhausted,
thanks to the fallback mechanism when libffi is enabled.  This
conditionalizes the test with WITH_FFI and do not exceed the limit if
libffi is enabled.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
  • Loading branch information
ueno committed Mar 22, 2023
1 parent 7cf6e71 commit 47f2df8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion p11-kit/test-managed.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ test_initialize_fail (void)

rv = p11_kit_module_initialize (module);
assert (rv == CKR_FUNCTION_FAILED);

p11_lock ();

rv = p11_module_release_inlock_reentrant (module);
assert (rv == CKR_OK);

p11_unlock ();
}

static void
Expand Down Expand Up @@ -207,7 +214,12 @@ test_separate_close_all_sessions (void)
teardown_mock_module (second);
}

#if defined(WITH_FFI) && WITH_FFI
#define MAX_MODS (P11_VIRTUAL_MAX_FIXED+10)
#else
#define MAX_MODS P11_VIRTUAL_MAX_FIXED
#endif

static void
test_max_session_load (void)
{
Expand All @@ -224,7 +236,7 @@ test_max_session_load (void)
registered++;
}

assert_num_cmp (registered + 1, >=, P11_VIRTUAL_MAX_FIXED);
assert_num_cmp (registered, ==, MAX_MODS);

for (i = 0; i < registered; i++) {
rv = list[i]->C_GetSessionInfo (s1, &info);
Expand Down

0 comments on commit 47f2df8

Please sign in to comment.