From c75cbdddef39ae011aacdccf38a01bf853679ad4 Mon Sep 17 00:00:00 2001 From: Michael Rash Date: Thu, 10 Apr 2014 23:08:51 -0400 Subject: [PATCH] [test suite] add compounded tests for fko-wrapper --- test/fko-wrapper/fko_wrapper.c | 102 ++++++++++++++++++++++++++++++++- 1 file changed, 100 insertions(+), 2 deletions(-) diff --git a/test/fko-wrapper/fko_wrapper.c b/test/fko-wrapper/fko_wrapper.c index b8d96729..cbb4944c 100644 --- a/test/fko-wrapper/fko_wrapper.c +++ b/test/fko-wrapper/fko_wrapper.c @@ -28,6 +28,7 @@ static void display_ctx(fko_ctx_t ctx); static void test_loop(int new_ctx_flag, int destroy_ctx_flag); +static void test_loop_compounded(void); static void ctx_update(fko_ctx_t *ctx, int new_ctx_flag, int destroy_ctx_flag, int print_flag); static void spa_default_ctx(fko_ctx_t *ctx); @@ -47,6 +48,7 @@ static void spa_func_getset_short(fko_ctx_t *ctx, char *set_name, int new_ctx_flag, int destroy_ctx_flag); int spa_calls = 0; +int spa_compounded_calls = 0; int main(void) { @@ -55,11 +57,107 @@ int main(void) { test_loop(NEW_CTX, NO_CTX_DESTROY); test_loop(NO_NEW_CTX, CTX_DESTROY); - printf("\n[+] Total libfko function calls: %d\n\n", spa_calls); + printf("\n[+] Total libfko function calls (before compounded tests): %d\n\n", + spa_calls); + + printf("[+] Running compounded tests via: test_loop_compounded()...\n"); + test_loop_compounded(); + + printf("\n[+] Total compounded function calls: %d\n", spa_compounded_calls); + printf("[+] Total libfko function calls (after compounded tests): %d\n\n", + spa_calls); return 0; } +static void +test_loop_compounded(void) +{ + fko_ctx_t ctx = NULL, decrypt_ctx = NULL; + char *spa_data = NULL; + int i, j, k, l, res; + + for (i=0; i