From 12aa352f091c25bcc1a8d7518a33e10b9375313f Mon Sep 17 00:00:00 2001 From: Pauli Date: Thu, 8 Jul 2021 10:53:05 +1000 Subject: test: rename apps_mem.c to be apps_shims.c in anticipation of additonal functions Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/16022) --- test/build.info | 2 +- test/testutil/apps_mem.c | 30 ------------------------------ test/testutil/apps_shims.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 31 deletions(-) delete mode 100644 test/testutil/apps_mem.c create mode 100644 test/testutil/apps_shims.c diff --git a/test/build.info b/test/build.info index 568fcff3ed..40618715c4 100644 --- a/test/build.info +++ b/test/build.info @@ -21,7 +21,7 @@ IF[{- !$disabled{tests} -}] testutil/format_output.c testutil/load.c testutil/fake_random.c \ testutil/test_cleanup.c testutil/main.c testutil/testutil_init.c \ testutil/options.c testutil/test_options.c testutil/provider.c \ - testutil/apps_mem.c testutil/random.c $LIBAPPSSRC + testutil/apps_shims.c testutil/random.c $LIBAPPSSRC INCLUDE[libtestutil.a]=../include ../apps/include .. DEPEND[libtestutil.a]=../libcrypto diff --git a/test/testutil/apps_mem.c b/test/testutil/apps_mem.c deleted file mode 100644 index ef5e266b25..0000000000 --- a/test/testutil/apps_mem.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the Apache License 2.0 (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#include -#include "apps.h" -#include "../testutil.h" - -/* shim that avoids sucking in too much from apps/apps.c */ - -void *app_malloc(size_t sz, const char *what) -{ - void *vp; - - /* - * This isn't ideal but it is what the app's app_malloc() does on failure. - * Instead of exiting with a failure, abort() is called which makes sure - * that there will be a good stack trace for debugging purposes. - */ - if (!TEST_ptr(vp = OPENSSL_malloc(sz))) { - TEST_info("Could not allocate %zu bytes for %s\n", sz, what); - abort(); - } - return vp; -} diff --git a/test/testutil/apps_shims.c b/test/testutil/apps_shims.c new file mode 100644 index 0000000000..ef5e266b25 --- /dev/null +++ b/test/testutil/apps_shims.c @@ -0,0 +1,30 @@ +/* + * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include +#include "apps.h" +#include "../testutil.h" + +/* shim that avoids sucking in too much from apps/apps.c */ + +void *app_malloc(size_t sz, const char *what) +{ + void *vp; + + /* + * This isn't ideal but it is what the app's app_malloc() does on failure. + * Instead of exiting with a failure, abort() is called which makes sure + * that there will be a good stack trace for debugging purposes. + */ + if (!TEST_ptr(vp = OPENSSL_malloc(sz))) { + TEST_info("Could not allocate %zu bytes for %s\n", sz, what); + abort(); + } + return vp; +} -- cgit v1.2.1