[gnutls-devel] [PATCH] tests: test trailing comma in system priorities
Daniel P. Berrange
berrange at redhat.com
Fri Jun 10 14:41:22 CEST 2016
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 at redhat.com>
---
tests/system-prio-file.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tests/system-prio-file.c b/tests/system-prio-file.c
index 59c960d..e0dfa94 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, at HELLONO", "NORMAL:+AES-128-CBC");
try_prio("@HELLO2,HELLO1, at 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);
}
--
2.5.5
More information about the Gnutls-devel
mailing list