PERFORCE change 100440 for review

Michael Bushkov bushman at FreeBSD.org
Sun Jul 2 17:15:00 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=100440

Change 100440 by bushman at bushman_nss_ldap_cached on 2006/07/02 17:14:31

	testutil.h small style fixes. test-gethostby (for gethostby***() functions) added - not fully functional yet.

Affected files ...

.. //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/Makefile#4 edit
.. //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-gethostby.c#1 add
.. //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-gethostby.t#1 add
.. //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/testutil.h#6 edit

Differences ...

==== //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/Makefile#4 (text+ko) ====

@@ -1,6 +1,6 @@
 # $FreeBSD$
 
-TESTS=	test-getpw test-getgr test-getserv
+TESTS=	test-getpw test-getgr test-gethostby test-getserv
 CFLAGS+= -g -Wall
 
 .PHONY: tests

==== //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/testutil.h#6 (text+ko) ====

@@ -41,15 +41,15 @@
 	STAILQ_HEAD(ent_head, ent##_entry) snapshot_data;		\
 };									\
 									\
-void __##ent##_test_data_init(struct ent##_test_data *, 			\
+void __##ent##_test_data_init(struct ent##_test_data *, 		\
 	void (*)(struct ent *, struct ent const *),			\
 	void (*freef)(struct ent *));		 			\
 void __##ent##_test_data_destroy(struct ent##_test_data *);		\
 									\
 void __##ent##_test_data_append(struct ent##_test_data *, struct ent *data);\
-int __##ent##_test_data_foreach(struct ent##_test_data *, int (*)(struct ent *,\
-	void *), void *);						\
-int __##ent##_test_data_compare(struct ent##_test_data *,			\
+int __##ent##_test_data_foreach(struct ent##_test_data *,		\
+	int (*)(struct ent *, void *), void *);				\
+int __##ent##_test_data_compare(struct ent##_test_data *,		\
 	struct ent##_test_data *, int (*)(struct ent *, struct ent *,	\
 	void *), void *);						\
 struct ent *__##ent##_test_data_find(struct ent##_test_data *, struct ent *,\
@@ -69,8 +69,8 @@
 #define TEST_DATA_CLEAR(ent, td) __##ent##_test_data_clear(td)
 
 #define IMPLEMENT_TEST_DATA(ent)					\
-void								\
-__##ent##_test_data_init(struct ent##_test_data *td,				\
+void									\
+__##ent##_test_data_init(struct ent##_test_data *td,			\
 	void (*clonef)(struct ent *, struct ent const *),		\
 	void (*freef)(struct ent *))					\
 {									\
@@ -84,14 +84,14 @@
 	STAILQ_INIT(&td->snapshot_data);				\
 }									\
 									\
-void 								\
-__##ent##_test_data_destroy(struct ent##_test_data *td)				\
+void 									\
+__##ent##_test_data_destroy(struct ent##_test_data *td)			\
 {									\
-	__##ent##_test_data_clear(td);						\
+	__##ent##_test_data_clear(td);					\
 }									\
 									\
-void 								\
-__##ent##_test_data_append(struct ent##_test_data *td, struct ent *app_data)	\
+void 									\
+__##ent##_test_data_append(struct ent##_test_data *td, struct ent *app_data)\
 {									\
 	struct ent##_entry *e;						\
 									\
@@ -106,8 +106,8 @@
 	STAILQ_INSERT_TAIL(&td->snapshot_data, e, entries);		\
 }									\
 									\
-int								\
-__##ent##_test_data_foreach(struct ent##_test_data *td,				\
+int									\
+__##ent##_test_data_foreach(struct ent##_test_data *td,			\
 	int (*forf)(struct ent *, void *), void *mdata)			\
 {									\
 	struct ent##_entry *e;						\
@@ -126,7 +126,7 @@
 	return (rv);							\
 }									\
 									\
-int								\
+int									\
 __##ent##_test_data_compare(struct ent##_test_data *td1, struct ent##_test_data *td2,\
 	int (*cmp_func)(struct ent *, struct ent *, void *), void *mdata)\
 {									\
@@ -157,8 +157,8 @@
 	return (rv);							\
 }									\
 									\
-struct ent *							\
-__##ent##_test_data_find(struct ent##_test_data *td, struct ent *data,		\
+struct ent *								\
+__##ent##_test_data_find(struct ent##_test_data *td, struct ent *data,	\
 	int (*cmp)(struct ent *, struct ent *, void *), void *mdata)	\
 {									\
 	struct ent##_entry *e;						\
@@ -179,8 +179,8 @@
 }									\
 									\
 									\
-void								\
-__##ent##_test_data_clear(struct ent##_test_data *td)				\
+void									\
+__##ent##_test_data_clear(struct ent##_test_data *td)			\
 {									\
 	struct ent##_entry *e;						\
 	assert(td != NULL);						\
@@ -201,20 +201,20 @@
 	void (*sdump_func)(struct ent *, char *, size_t);		\
 };									\
 									\
-int __##ent##_snapshot_write_func(struct ent *, void *);			\
+int __##ent##_snapshot_write_func(struct ent *, void *);		\
 int __##ent##_snapshot_write(char const *, struct ent##_test_data *,	\
 	void (*)(struct ent *, char *, size_t));			\
 int __##ent##_snapshot_read(char const *, struct ent##_test_data *,	\
 	int (*)(struct ent *, char *));	
 		
-#define TEST_SNAPSHOT_FILE_WRITE(ent, fname, td, f)\
+#define TEST_SNAPSHOT_FILE_WRITE(ent, fname, td, f)			\
 	__##ent##_snapshot_write(fname, td, f)
-#define TEST_SNAPSHOT_FILE_READ(ent, fname, td, f)\
+#define TEST_SNAPSHOT_FILE_READ(ent, fname, td, f)			\
 	__##ent##_snapshot_read(fname, td, f)
 
-#define IMPLEMENT_TEST_FILE_SNAPSHOT(ent)					\
-int								\
-__##ent##_snapshot_write_func(struct ent *data, void *mdata)			\
+#define IMPLEMENT_TEST_FILE_SNAPSHOT(ent)				\
+int									\
+__##ent##_snapshot_write_func(struct ent *data, void *mdata)		\
 {									\
 	char buffer[1024];						\
 	struct ent##_snp_param *param;					\
@@ -229,8 +229,8 @@
 	return (0);							\
 }									\
 									\
-int								\
-__##ent##_snapshot_write(char const *fname, struct ent##_test_data *td,		\
+int									\
+__##ent##_snapshot_write(char const *fname, struct ent##_test_data *td,	\
 	void (*sdump_func)(struct ent *, char *, size_t))		\
 {									\
 	struct ent##_snp_param	param;					\
@@ -243,14 +243,14 @@
 		return (-1);						\
 									\
 	param.sdump_func = sdump_func;					\
-	__##ent##_test_data_foreach(td, __##ent##_snapshot_write_func, &param);		\
+	__##ent##_test_data_foreach(td, __##ent##_snapshot_write_func, &param);\
 	fclose(param.fp);						\
 									\
 	return (0);							\
 }									\
 									\
-int								\
-__##ent##_snapshot_read(char const *fname, struct ent##_test_data *td,		\
+int									\
+__##ent##_snapshot_read(char const *fname, struct ent##_test_data *td,	\
 	int (*read_func)(struct ent *, char *))				\
 {									\
 	char buffer[1024];						\
@@ -279,7 +279,7 @@
 									\
 			rv = read_func(&data, s);			\
 			if (rv == 0) {					\
-				__##ent##_test_data_append(td, &data);		\
+				__##ent##_test_data_append(td, &data);	\
 				td->free_func(&data);			\
 			}						\
 		}							\
@@ -292,20 +292,20 @@
 
 #define DECLARE_1PASS_TEST(ent)						\
 int __##ent##_1pass_test(struct ent##_test_data *, 			\
-	int (*)(struct ent *, void *),				\
+	int (*)(struct ent *, void *),					\
 	void *);							
 	
-#define DO_1PASS_TEST(ent, td, f, mdata)\
+#define DO_1PASS_TEST(ent, td, f, mdata)				\
 	__##ent##_1pass_test(td, f, mdata)
 
 #define IMPLEMENT_1PASS_TEST(ent)					\
-int								\
-__##ent##_1pass_test(struct ent##_test_data *td, 				\
+int									\
+__##ent##_1pass_test(struct ent##_test_data *td, 			\
 	int (*tf)(struct ent *, void *),				\
 	void *mdata)							\
 {									\
 	int rv;								\
-	rv = __##ent##_test_data_foreach(td, tf, mdata);				\
+	rv = __##ent##_test_data_foreach(td, tf, mdata);		\
 									\
 	return (rv);							\
 }
@@ -315,18 +315,18 @@
 	struct ent##_test_data *, 					\
 	int (*)(struct ent *, struct ent *, void *), void *);
 
-#define DO_2PASS_TEST(ent, td1, td2, f, mdata)\
+#define DO_2PASS_TEST(ent, td1, td2, f, mdata)				\
 	__##ent##_2pass_test(td1, td2, f, mdata)
 	
 #define IMPLEMENT_2PASS_TEST(ent)					\
-int								\
-__##ent##_2pass_test(struct ent##_test_data *td1,				\
+int									\
+__##ent##_2pass_test(struct ent##_test_data *td1,			\
 	struct ent##_test_data *td2,					\
 	int (*cmp_func)(struct ent *, struct ent *, void *),		\
 	void *cmp_mdata)						\
 {									\
 	int rv;								\
 									\
-	rv = __##ent##_test_data_compare(td1, td2, cmp_func, cmp_mdata);		\
+	rv = __##ent##_test_data_compare(td1, td2, cmp_func, cmp_mdata);	\
 	return (rv);							\
 }


More information about the p4-projects mailing list