Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libprop Add a test case for the segfault reported ...



details:   https://anonhg.NetBSD.org/src/rev/3be50586ed2e
branches:  trunk
changeset: 763907:3be50586ed2e
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Wed Apr 06 17:41:27 2011 +0000

description:
Add a test case for the segfault reported in PR lib/43964.

diffstat:

 tests/lib/libprop/t_basic.c |  43 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 36 insertions(+), 7 deletions(-)

diffs (76 lines):

diff -r 42b960529cb2 -r 3be50586ed2e tests/lib/libprop/t_basic.c
--- a/tests/lib/libprop/t_basic.c       Wed Apr 06 16:04:16 2011 +0000
+++ b/tests/lib/libprop/t_basic.c       Wed Apr 06 17:41:27 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_basic.c,v 1.2 2010/11/03 16:10:22 christos Exp $ */
+/* $NetBSD: t_basic.c,v 1.3 2011/04/06 17:41:27 jruoho Exp $ */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include <sys/cdefs.h>
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_basic.c,v 1.2 2010/11/03 16:10:22 christos Exp $");
+__RCSID("$NetBSD: t_basic.c,v 1.3 2011/04/06 17:41:27 jruoho Exp $");
 
 #include <stdlib.h>
 #include <string.h>
@@ -79,12 +79,13 @@
 "</dict>\n"
 "</plist>\n";
 
-ATF_TC(simple);
-ATF_TC_HEAD(simple, tc)
+ATF_TC(prop_basic);
+ATF_TC_HEAD(prop_basic, tc)
 {
-       atf_tc_set_md_var(tc, "descr", "Checks basic functionality of proplib");
+       atf_tc_set_md_var(tc, "descr", "A basic test of proplib(3)");
 }
-ATF_TC_BODY(simple, tc)
+
+ATF_TC_BODY(prop_basic, tc)
 {
        prop_dictionary_t dict;
        char *ext1;
@@ -160,10 +161,38 @@
        free(ext1);
 }
 
+ATF_TC(prop_dictionary_equals);
+ATF_TC_HEAD(prop_dictionary_equals, tc)
+{
+       atf_tc_set_md_var(tc, "descr", "Test prop_dictionary_equals(3)");
+}
+
+ATF_TC_BODY(prop_dictionary_equals, tc)
+{
+       prop_dictionary_t c, d;
+
+       atf_tc_expect_death("PR lib/43964");
+
+       d = prop_dictionary_internalize(compare1);
+
+       ATF_REQUIRE(d != NULL);
+
+       c = prop_dictionary_copy(d);
+
+       ATF_REQUIRE(c != NULL);
+
+       if (prop_dictionary_equals(c, d) != true)
+               atf_tc_fail("dictionaries are not equal");
+
+       prop_object_release(c);
+       prop_object_release(d);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 
-       ATF_TP_ADD_TC(tp, simple);
+       ATF_TP_ADD_TC(tp, prop_basic);
+       ATF_TP_ADD_TC(tp, prop_dictionary_equals);
 
        return atf_no_error();
 }



Home | Main Index | Thread Index | Old Index