From ef33d131850440da8556f08996f63898e849d267 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Fri, 18 Mar 2016 12:16:53 +0100 Subject: [PATCH] Add a test to see that signals are caught as failures MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Rich Salz Reviewed-by: Emilia Käsper --- test/aborttest.c | 17 +++++++++++++++++ test/build.info | 5 +++++ test/recipes/01-test_abort.t | 9 +++++++++ 3 files changed, 31 insertions(+) create mode 100644 test/aborttest.c create mode 100644 test/recipes/01-test_abort.t diff --git a/test/aborttest.c b/test/aborttest.c new file mode 100644 index 0000000000..98aeddfcaf --- /dev/null +++ b/test/aborttest.c @@ -0,0 +1,17 @@ +/* + * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL licenses, (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * https://www.openssl.org/source/license.html + * or in the file LICENSE in the source distribution. + */ + +#include + +int main(int argc, char **argv) +{ + OPENSSL_die("Voluntary abort", __FILE__, __LINE__); + return 0; +} diff --git a/test/build.info b/test/build.info index cd5d8cd706..74f83a3817 100644 --- a/test/build.info +++ b/test/build.info @@ -1,5 +1,6 @@ {- use File::Spec::Functions qw/catdir rel2abs/; -} PROGRAMS=\ + aborttest \ nptest bntest \ ectest ecdsatest ecdhtest gmdifftest pbelutest ideatest \ md2test md4test md5test \ @@ -15,6 +16,10 @@ PROGRAMS=\ packettest asynctest secmemtest srptest memleaktest \ dtlsv1listentest ct_test threadstest afalgtest +SOURCE[aborttest]=aborttest.c +INCLUDE[aborttest]={- rel2abs(catdir($builddir,"../include")) -} ../include +DEPEND[aborttest]=../libcrypto + SOURCE[nptest]=nptest.c INCLUDE[nptest]={- rel2abs(catdir($builddir,"../include")) -} ../include DEPEND[nptest]=../libcrypto diff --git a/test/recipes/01-test_abort.t b/test/recipes/01-test_abort.t new file mode 100644 index 0000000000..4a6cf97983 --- /dev/null +++ b/test/recipes/01-test_abort.t @@ -0,0 +1,9 @@ +#! /usr/bin/perl + +use OpenSSL::Test; + +setup("test_abort"); + +plan tests => 1; + +is(run(test(["aborttest"])), 0, "Testing that abort is caught correctly"); -- 2.25.1