summaryrefslogtreecommitdiff
path: root/tests/psk-file.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2019-01-03 09:51:34 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2019-01-04 17:12:43 +0100
commit81f8d97b3486928048bb8ad701b4af62ddce9901 (patch)
tree2b072a5b2e41ed38fbd052b73a07f1c7c54f21b8 /tests/psk-file.c
parentb978a25de5ef06754bf94bdfb2e6442b7fb6f1fa (diff)
downloadgnutls-tmp-tests-fail-on-signals.tar.gz
tests: treat all signals as errortmp-tests-fail-on-signals
Previously we were only treating SIGSEGV as error though there is no reason to treat other signals as success and they may hide an actual error case (e.g., when SIGPIPE is received). With this change we treat any signals received by the child except SIGTERM as error, and we ensure that SIGPIPE is ignored in all tests. This also updates tests/slow/cipher-api-test.c to test failures with SIGABRT or otherwise consistently. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'tests/psk-file.c')
-rw-r--r--tests/psk-file.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/psk-file.c b/tests/psk-file.c
index 2512086e0f..0a6eef4b87 100644
--- a/tests/psk-file.c
+++ b/tests/psk-file.c
@@ -48,6 +48,7 @@ int main(int argc, char **argv)
#include <sys/wait.h>
#endif
#include <unistd.h>
+#include <signal.h>
#include <assert.h>
#include <gnutls/gnutls.h>
@@ -304,6 +305,8 @@ void run_test3(const char *prio, const char *sprio, const char *user, const gnut
int err;
int sockets[2];
+ signal(SIGPIPE, SIG_IGN);
+
if (expect_fail_serv || expect_fail_cli) {
success("ntest %s (user:%s)\n", prio, user);
} else {
@@ -407,7 +410,7 @@ void doit(void)
run_test2("NORMAL:-VERS-ALL:+VERS-TLS1.3:+DHE-PSK:-GROUP-ALL:+GROUP-FFDHE2048:+GROUP-FFDHE4096", "NORMAL:-VERS-ALL:+VERS-TLS1.3:+DHE-PSK:-GROUP-ALL:+GROUP-FFDHE4096", "jas", &key, 0, GNUTLS_KX_DHE_PSK, 0, 0);
/* try without server credentials */
- run_test3("NORMAL:-VERS-ALL:+VERS-TLS1.3:+PSK:+DHE-PSK", NULL, "jas", &key, 1, 0, 0, GNUTLS_E_FATAL_ALERT_RECEIVED, GNUTLS_E_INSUFFICIENT_CREDENTIALS);
+ run_test3("NORMAL:-VERS-ALL:+VERS-TLS1.3:+PSK:+DHE-PSK", NULL, "jas", &key, 1, 0, 0, GNUTLS_E_PUSH_ERROR, GNUTLS_E_INSUFFICIENT_CREDENTIALS);
}
#endif /* _WIN32 */