CVS commit: src/tests/lib/libppath

2013-10-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 19 17:28:38 UTC 2013

Modified Files:
src/tests/lib/libppath: Makefile

Log Message:
build the .h before the .o


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libppath/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libppath/Makefile
diff -u src/tests/lib/libppath/Makefile:1.4 src/tests/lib/libppath/Makefile:1.5
--- src/tests/lib/libppath/Makefile:1.4	Sat Mar 17 08:42:31 2012
+++ src/tests/lib/libppath/Makefile	Sat Oct 19 13:28:38 2013
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.4 2012/03/17 12:42:31 nakayama Exp $
+# $Id: Makefile,v 1.5 2013/10/19 17:28:38 christos Exp $
 
 .include bsd.own.mk
 
@@ -18,6 +18,7 @@ CPPFLAGS+=-I$(.OBJDIR)
 .plist.c:
 	AWK=${TOOL_AWK:Q} ${HOST_SH} ${.CURDIR}/plist_to_c ${.TARGET:S,.c$,,}  ${.IMPSRC}  ${.TARGET}
 
+t_ppath.o: personnel.h
 CLEANFILES+=personnel.c personnel.h
 
 #LDADD+=-L$(LIBPPATH)



CVS commit: src/tests/lib/libppath

2012-01-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jan 20 15:06:47 UTC 2012

Modified Files:
src/tests/lib/libppath: Makefile

Log Message:
Invoke a shell script via ${HOST_SH} rather than assuming exec bits.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libppath/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libppath/Makefile
diff -u src/tests/lib/libppath/Makefile:1.2 src/tests/lib/libppath/Makefile:1.3
--- src/tests/lib/libppath/Makefile:1.2	Sat Aug 27 18:55:52 2011
+++ src/tests/lib/libppath/Makefile	Fri Jan 20 15:06:47 2012
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.2 2011/08/27 18:55:52 dyoung Exp $
+# $Id: Makefile,v 1.3 2012/01/20 15:06:47 tsutsui Exp $
 
 .include bsd.own.mk
 
@@ -16,7 +16,7 @@ CPPFLAGS+=-I$(.OBJDIR)
 	echo extern const char  ${.TARGET:S,.h$,,} [];  ${.TARGET}
 
 .plist.c:
-	${.CURDIR}/plist_to_c ${.TARGET:S,.c$,,}  ${.IMPSRC}  ${.TARGET}
+	${HOST_SH} ${.CURDIR}/plist_to_c ${.TARGET:S,.c$,,}  ${.IMPSRC}  ${.TARGET}
 
 CLEANFILES+=personnel.c personnel.h
 



CVS commit: src/tests/lib/libppath

2011-08-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Aug 25 19:09:46 UTC 2011

Added Files:
src/tests/lib/libppath: Makefile personnel.plist plist_to_c t_ppath.c

Log Message:
Add tests for ppath(3).

TBD: hook into build and update set lists.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/lib/libppath/Makefile \
src/tests/lib/libppath/personnel.plist src/tests/lib/libppath/plist_to_c \
src/tests/lib/libppath/t_ppath.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/tests/lib/libppath/Makefile
diff -u /dev/null src/tests/lib/libppath/Makefile:1.1
--- /dev/null	Thu Aug 25 19:09:46 2011
+++ src/tests/lib/libppath/Makefile	Thu Aug 25 19:09:46 2011
@@ -0,0 +1,26 @@
+# $Id: Makefile,v 1.1 2011/08/25 19:09:46 dyoung Exp $
+
+.include bsd.own.mk
+
+LIBPPATH != make -V .OBJDIR -C $(.CURDIR)/../lib
+
+TESTS_C=t_ppath t_proplib
+SRCS.t_proplib=t_proplib.c personnel.c personnel.h
+SRCS.t_ppath=t_ppath.c personnel.c personnel.h
+CPPFLAGS+=-I$(.OBJDIR)
+
+.SUFFIXES: .plist .h
+
+.plist.h:
+	echo extern const char  ${.TARGET:S,.h$,,} [];  ${.TARGET}
+
+.plist.c:
+	${.CURDIR}/plist_to_c ${.TARGET:S,.c$,,}  ${.IMPSRC}  ${.TARGET}
+
+CLEANFILES+=personnel.c personnel.h
+
+LDADD+=-L$(LIBPPATH) -lppath -lprop
+DPADD+=$(LIBPPATH)/libppath.a
+
+.include bsd.test.mk
+.include ../mk/tags.mk
Index: src/tests/lib/libppath/personnel.plist
diff -u /dev/null src/tests/lib/libppath/personnel.plist:1.1
--- /dev/null	Thu Aug 25 19:09:46 2011
+++ src/tests/lib/libppath/personnel.plist	Thu Aug 25 19:09:46 2011
@@ -0,0 +1,26 @@
+?xml version=1.0 encoding=UTF-8?
+!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd;
+plist version=1.0
+dict
+	keyJohn Doe/key
+	dict
+		keychildren/key
+		array
+			stringJane Doe/string
+			stringJohn Doe, Jr./string
+		/array
+
+		keypets/key
+		array
+			stringFido/string
+			stringSpot/string
+		/array
+
+		keyjob title/key
+		stringcomputer programmer/string
+
+		keyu.s. citizen/key
+		true/
+	/dict
+/dict
+/plist
Index: src/tests/lib/libppath/plist_to_c
diff -u /dev/null src/tests/lib/libppath/plist_to_c:1.1
--- /dev/null	Thu Aug 25 19:09:46 2011
+++ src/tests/lib/libppath/plist_to_c	Thu Aug 25 19:09:46 2011
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+prog=$(basename $0)
+usage()
+{
+	echo usage: ${prog} symbol 12
+	exit 1
+}
+
+if [ $# -ne 1 ]; then
+	usage
+fi
+
+sed 's/\([\]\)/\\\1/g' | \
+awk -v sym=$1 '
+BEGIN	{ printf const char  sym [] = \; }
+	{ printf $0 \\n; }
+END	{ print \;; }'
+
+exit 0
Index: src/tests/lib/libppath/t_ppath.c
diff -u /dev/null src/tests/lib/libppath/t_ppath.c:1.1
--- /dev/null	Thu Aug 25 19:09:46 2011
+++ src/tests/lib/libppath/t_ppath.c	Thu Aug 25 19:09:46 2011
@@ -0,0 +1,1548 @@
+/* $Id: t_ppath.c,v 1.1 2011/08/25 19:09:46 dyoung Exp $ */
+
+/* Copyright (c) 2010 David Young.  All rights reserved. */
+
+#include sys/cdefs.h
+__RCSID($Id: t_ppath.c,v 1.1 2011/08/25 19:09:46 dyoung Exp $);
+
+#include assert.h
+#include atf-c.h
+#include errno.h
+#include stdlib.h
+#include string.h
+
+#include ppath/ppath.h
+#include personnel.h
+
+void test_ppath_extant_inc(void);
+void test_ppath_extant_dec(void);
+void test_ppath_component_extant_inc(void);
+void test_ppath_component_extant_dec(void);
+
+__strong_alias(ppath_extant_inc, test_ppath_extant_inc);
+__strong_alias(ppath_extant_dec, test_ppath_extant_dec);
+__strong_alias(ppath_component_extant_inc, test_ppath_component_extant_inc);
+__strong_alias(ppath_component_extant_dec, test_ppath_component_extant_dec);
+
+static uint64_t nppath = 0, nppath_component = 0;
+
+static bool
+dictionary_equals(prop_dictionary_t ld, prop_dictionary_t rd)
+{
+	bool eq;
+	char *lt, *rt;
+
+	lt = prop_dictionary_externalize(ld);
+	rt = prop_dictionary_externalize(rd);
+
+	assert(lt != NULL  rt != NULL);
+
+	eq = (strcmp(lt, rt) == 0);
+
+	free(lt);
+	free(rt);
+
+	return eq;
+}
+
+static void
+assert_no_ppath_extant(void)
+{
+	ATF_CHECK_EQ(nppath, 0);
+}
+
+static void
+assert_no_ppath_component_extant(void)
+{
+	ATF_CHECK_EQ(nppath_component, 0);
+}
+
+void
+test_ppath_extant_inc(void)
+{
+	if (++nppath == 0)
+		atf_tc_fail(count of extant paths overflowed);
+}
+
+void
+test_ppath_extant_dec(void)
+{
+	if (nppath-- == 0)
+		atf_tc_fail(count of extant path underflowed);
+}
+
+void
+test_ppath_component_extant_inc(void)
+{
+	if (++nppath_component == 0)
+		atf_tc_fail(count of extant path components overflowed);
+}
+
+void
+test_ppath_component_extant_dec(void)
+{
+	if (nppath_component-- == 0)
+		atf_tc_fail(count of extant path components underflowed);
+}
+
+ATF_TC(push_until_full);
+
+ATF_TC_HEAD(push_until_full, tc)
+{
+	atf_tc_set_md_var(tc, descr, check ppath_push() returns error 
+	after ppath_t reaches maximum length);
+}
+
+ATF_TC_BODY(push_until_full, tc)
+{
+	ppath_t *p, *rp;
+	ppath_component_t *pc;
+	int i;
+
+	assert_no_ppath_extant();
+