From e097542517d1998922e041fbc71959a15fd5b38c Mon Sep 17 00:00:00 2001 From: Ian Osgood Date: Sun, 26 Nov 2006 09:26:32 -0800 Subject: Fix unit tests for FreeBSD putenv() string must contain '=' environment failure test is invalid if argument is NULL --- debian/changelog | 2 ++ tests/check_public.c | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index a756ff2..1ec4e83 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ libxcb (1.0-2) unstable; urgency=low * Incorporate NMU by Julien Cristau; thanks, Julien! * Add XS-Vcs-Browser field to debian/control. + * Cherry-pick post-1.0 changes from master: + * " Fix unit tests for FreeBSD" * Upload to unstable. -- Josh Triplett Mon, 21 May 2007 12:48:40 -0700 diff --git a/tests/check_public.c b/tests/check_public.c index a28fb49..e2ebba6 100644 --- a/tests/check_public.c +++ b/tests/check_public.c @@ -24,7 +24,7 @@ static void parse_display_pass(const char *name, const char *host, const int dis if(test_type == TEST_ARGUMENT) { argument = name; - putenv("DISPLAY"); + putenv("DISPLAY="); } else if(test_type == TEST_ENVIRONMENT) { @@ -49,7 +49,7 @@ static void parse_display_pass(const char *name, const char *host, const int dis fail_unless(strcmp(host, got_host) == 0, "screenless parse %sproduced unexpected hostname '%s' for '%s': expected '%s'", test_string[test_type], got_host, name, host); fail_unless(display == got_display, "screenless parse %sproduced unexpected display '%d' for '%s': expected '%d'", test_string[test_type], got_display, name, display); } - putenv("DISPLAY"); + putenv("DISPLAY="); } static void parse_display_fail(const char *name) @@ -65,10 +65,11 @@ static void parse_display_fail(const char *name) if(test_type == TEST_ARGUMENT) { argument = name; - putenv("DISPLAY"); + putenv("DISPLAY="); } else if(test_type == TEST_ENVIRONMENT) { + if (!name) break; argument = 0; setenv("DISPLAY", name, 1); } @@ -90,7 +91,7 @@ static void parse_display_fail(const char *name) fail_unless(got_host == (char *) -1, "host changed on parse failure %sfor '%s': got %p", test_string[test_type], name, got_host); fail_unless(got_display == -42, "display changed on parse failure %sfor '%s': got %d", test_string[test_type], name, got_display); } - putenv("DISPLAY"); + putenv("DISPLAY="); } START_TEST(parse_display_unix) @@ -182,7 +183,7 @@ END_TEST Suite *public_suite(void) { Suite *s = suite_create("Public API"); - putenv("DISPLAY"); + putenv("DISPLAY="); suite_add_test(s, parse_display_unix, "xcb_parse_display unix"); suite_add_test(s, parse_display_ip, "xcb_parse_display ip"); suite_add_test(s, parse_display_ipv4, "xcb_parse_display ipv4"); -- cgit v1.2.3