summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2016-06-10 13:41:22 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2016-06-10 14:49:45 +0200
commit3f7ddfe6db98930783850171e4dccaf672e6366a (patch)
tree19eceefbe8557bc4f01b09c689863e27213f7a2d
parent98544b50fe54973449bd8cd8f245ff7376136d0f (diff)
downloadgnutls-3f7ddfe6db98930783850171e4dccaf672e6366a.tar.gz
tests: test trailing comma in system priorities
Add tests which verify behaviour when the list of system priorities has a trailing ','. Avoid crash in test suite if the test unexpectedly succeeds when expected_str is NULL. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
-rw-r--r--tests/system-prio-file.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/system-prio-file.c b/tests/system-prio-file.c
index 59c960de11..e0dfa9460c 100644
--- a/tests/system-prio-file.c
+++ b/tests/system-prio-file.c
@@ -51,7 +51,7 @@ try_prio(const char *prio, const char *expected_str)
if (p == NULL && expected_str == NULL)
goto ok;
- if (p == NULL || strcmp(p, expected_str) != 0) {
+ if (p == NULL || expected_str == NULL || strcmp(p, expected_str) != 0) {
fail("test: %s: error; got: %s, expected: %s\n", prio, p, expected_str);
exit(1);
}
@@ -72,6 +72,7 @@ void doit(void)
try_prio("@HELLO1,HELLO2", "NORMAL");
try_prio("@HELLO1,HELLO2:+AES-128-CBC", "NORMAL:+AES-128-CBC");
try_prio("@HELLO1,HELLO1", "NORMAL");
+ try_prio("@HELLO1,", "NORMAL");
try_prio("@HELLO2,HELLO1", "NORMAL:+AES-128-CBC");
try_prio("@HELLO2,HELLO1,@HELLONO", "NORMAL:+AES-128-CBC");
try_prio("@HELLO2,HELLO1,@HELLO3", "NORMAL:+AES-128-CBC");
@@ -79,5 +80,8 @@ void doit(void)
try_prio("@HELLONO,HELLONO2,HELLO1", "NORMAL");
try_prio("@HELLONO,HELLONO2,HELLO1:+AES-128-CBC", "NORMAL:+AES-128-CBC");
try_prio("@HELLONO", NULL);
+ try_prio("@HELLONO,", NULL);
+ try_prio("@HELLONO:+AES-128-CBC", NULL);
+ try_prio("@HELLONO,:+AES-128-CBC", NULL);
}