[libdispatch-changes] [209] branches/Lion

source_changes at macosforge.org source_changes at macosforge.org
Tue Aug 23 19:51:12 PDT 2011


Revision: 209
          http://trac.macosforge.org/projects/libdispatch/changeset/209
Author:   dsteffen at apple.com
Date:     2011-08-23 19:51:12 -0700 (Tue, 23 Aug 2011)
Log Message:
-----------
Lion testsuite auto* buildsystem & portability

Modified Paths:
--------------
    branches/Lion/Makefile.am
    branches/Lion/configure.ac
    branches/Lion/testing/Makefile.am
    branches/Lion/testing/bench.mm
    branches/Lion/testing/bsdtestharness.c
    branches/Lion/testing/bsdtests.c
    branches/Lion/testing/dispatch_concur.c
    branches/Lion/testing/dispatch_deadname.c
    branches/Lion/testing/dispatch_drift.c
    branches/Lion/testing/dispatch_overcommit.c
    branches/Lion/testing/dispatch_priority.c
    branches/Lion/testing/dispatch_readsync.c
    branches/Lion/testing/dispatch_sync_on_main.c
    branches/Lion/testing/func.c

Added Paths:
-----------
    branches/Lion/testing/leaks-wrapper.sh

Removed Paths:
-------------
    branches/Lion/testing/leaks-wrapper

Modified: branches/Lion/Makefile.am
===================================================================
--- branches/Lion/Makefile.am	2011-08-24 02:51:10 UTC (rev 208)
+++ branches/Lion/Makefile.am	2011-08-24 02:51:12 UTC (rev 209)
@@ -8,7 +8,8 @@
 	dispatch				\
 	man						\
 	private					\
-	src
+	src						\
+	testing
 
 EXTRA_DIST=					\
 	LICENSE					\

Modified: branches/Lion/configure.ac
===================================================================
--- branches/Lion/configure.ac	2011-08-24 02:51:10 UTC (rev 208)
+++ branches/Lion/configure.ac	2011-08-24 02:51:12 UTC (rev 209)
@@ -257,5 +257,11 @@
 #
 # Generate Makefiles.
 #
-AC_CONFIG_FILES([Makefile dispatch/Makefile man/Makefile private/Makefile src/Makefile])
+AC_CONFIG_FILES([Makefile dispatch/Makefile man/Makefile private/Makefile src/Makefile testing/Makefile])
+
+#
+# Generate testsuite links
+#
+AC_CONFIG_LINKS([testing/dispatch:${x:+}private testing/bench.cc:testing/bench.mm testing/leaks-wrapper:testing/leaks-wrapper.sh])
+
 AC_OUTPUT

Modified: branches/Lion/testing/Makefile.am
===================================================================
--- branches/Lion/testing/Makefile.am	2011-08-24 02:51:10 UTC (rev 208)
+++ branches/Lion/testing/Makefile.am	2011-08-24 02:51:12 UTC (rev 209)
@@ -2,86 +2,113 @@
 #
 #
 
-noinst_LTLIBRARIES=libtest.la
+noinst_LTLIBRARIES=libbsdtests.la
 
-libtest_la_SOURCES=			\
-	dispatch_test.c			\
-	shims/asprintf.c		\
-	shims/arc4random.c		\
-	shims/fgetln.c
+libbsdtests_la_SOURCES=			\
+	bsdtests.c					\
+	bsdtests.h					\
+	dispatch_test.c				\
+	dispatch_test.h				\
+	shims.h						\
+	shims/asprintf.c			\
+	shims/asprintf.h			\
+	shims/arc4random.c			\
+	shims/arc4random.h			\
+	shims/fgetln.c				\
+	shims/fgetln.h
 
-TESTS=					\
-	dispatch_api			\
-	dispatch_c99			\
-	dispatch_cascade		\
-	dispatch_debug			\
-	dispatch_priority		\
-	dispatch_priority2		\
-	dispatch_starfish		\
-	queue_finalizer
+check_PROGRAMS=					\
+	bsdtestharness				\
+	bsdtestsummarize			\
+	$(TESTS)
 
-dispatch_c99_CFLAGS=-std=c99
-dispatch_priority2_SOURCES=dispatch_priority.c
-dispatch_priority2_CFLAGS=-DUSE_SET_TARGET_QUEUE=1
+noinst_SCRIPTS=leaks-wrapper.sh
 
-if HAVE_CBLOCKS
-CBLOCKS_TESTS=				\
-	dispatch_after			\
-	dispatch_apply			\
-	dispatch_drift			\
-	dispatch_group			\
-	dispatch_pingpong		\
-	dispatch_read			\
-	dispatch_readsync		\
-	dispatch_sema			\
+TESTS=							\
+	dispatch_apply				\
+	dispatch_api				\
+	dispatch_c99				\
+	dispatch_deadname			\
+	dispatch_debug				\
+	dispatch_queue_finalizer	\
+	dispatch_group				\
+	dispatch_overcommit			\
+	dispatch_pingpong			\
+	dispatch_plusplus			\
+	dispatch_priority			\
+	dispatch_priority2			\
+	dispatch_concur				\
+	dispatch_context_for_key	\
+	dispatch_proc				\
+	dispatch_read				\
+	dispatch_read2				\
+	dispatch_after				\
+	dispatch_timer				\
+	dispatch_timer_short		\
+	dispatch_timer_timeout		\
+	dispatch_sema				\
+	dispatch_suspend_timer		\
 	dispatch_timer_bit31		\
-	dispatch_timer_bit63
-endif
-TESTS+=$(CBLOCKS_TESTS)
+	dispatch_timer_bit63		\
+	dispatch_timer_set_time		\
+	dispatch_starfish			\
+	dispatch_cascade			\
+	dispatch_drift				\
+	dispatch_readsync			\
+	dispatch_data				\
+	dispatch_io					\
+	dispatch_io_net				\
+	dispatch_vm					\
+	dispatch_vnode				\
+	dispatch_select
 
-if HAVE_CXXBLOCKS
-CXXBLOCKS_TESTS=			\
-	dispatch_plusplus
+dispatch_c99_CFLAGS=-std=c99
 dispatch_plusplus_SOURCES=dispatch_plusplus.cpp
-endif
-TESTS+=$(CXXBLOCKS_TESTS)
+dispatch_priority2_SOURCES=dispatch_priority.c
+dispatch_priority2_CFLAGS=-DUSE_SET_TARGET_QUEUE=1
 
-if HAVE_CORESERVICES
-CORESERVICES_TESTS=			\
-	dispatch_cffd
-dispatch_cffd_LDFLAGS=-framework CoreFoundation
-endif
-TESTS+=$(CORESERVICES_TESTS)
+INCLUDES=-I$(top_builddir) -I$(top_srcdir)
 
-if HAVE_POSIX_SPAWN_START_SUSPENDED
-POSIX_SPAWN_START_SUSPENDED_TESTS=	\
-	dispatch_proc
-endif
-TESTS+=$(POSIX_SPAWN_START_SUSPENDED_TESTS)
+CPPFLAGS=
+CFLAGS=-Wall -g $(MARCH_FLAGS) $(CBLOCKS_FLAGS)
+OBJCFLAGS=-Wall -g $(MARCH_FLAGS) $(CBLOCKS_FLAGS)
+CXXFLAGS=-Wall -g $(MARCH_FLAGS) $(CXXBLOCKS_FLAGS)
 
-if USE_LEGACY_API
-LEGACY_TESTS=				\
-	dispatch_timer_set_time
-endif
-TESTS+=$(LEGACY_TESTS)
+LDADD=libbsdtests.la ../src/libdispatch.la
+libbsdtests_la_LDFLAGS=-avoid-version
 
-#
-# XXX: By broken, we mean non-portable.  We should instead test for the OS
-# features they depend on, or port them as required.
-#
-BROKEN_TOOLS=				\
-	harness				\
-	nsoperation
+TESTS_ENVIRONMENT=./bsdtestharness
+DISTCLEAN=bench.cc
 
-noinst_PROGRAMS=$(TESTS)
+if HAVE_COREFOUNDATION
+TESTS+=							\
+	dispatch_cf_main			\
+	dispatch_sync_on_main		\
+	cffd
 
-TOOLS=					\
-	summarize
+dispatch_cf_main_LDFLAGS=-framework CoreFoundation
+dispatch_sync_on_main_LDFLAGS=-framework CoreFoundation
+cffd_LDFLAGS=-framework CoreFoundation
+endif
 
-noinst_PROGRAMS+=$(TOOLS)
+if HAVE_FOUNDATION
+TESTS+=							\
+	dispatch_sync_gc			\
+	dispatch_apply_gc			\
+	nsoperation					\
+	bench
 
-INCLUDES=-I$(top_builddir) -I$(top_srcdir)
-LDADD=libtest.la ../src/libdispatch.la
-CFLAGS=-Wall $(MARCH_FLAGS) $(CBLOCKS_FLAGS)
-CXXFLAGS=-Wall $(MARCH_FLAGS) $(CXXBLOCKS_FLAGS)
-
+dispatch_sync_gc_SOURCES=dispatch_sync_gc.m
+dispatch_sync_gc_OBJCFLAGS=-fobjc-gc
+dispatch_sync_gc_LDFLAGS=-framework Foundation
+dispatch_apply_gc_SOURCES=dispatch_apply_gc.m
+dispatch_apply_gc_OBJCFLAGS=-fobjc-gc
+dispatch_apply_gc_LDFLAGS=-framework Foundation
+nsoperation_SOURCES=nsoperation.m
+nsoperation_LDFLAGS=-framework Foundation
+bench_SOURCES=bench.cc func.c
+bench_LDFLAGS=-framework Foundation
+# Workaround missing objcxx support in older autotools
+bench.o: bench.cc
+	$(CXXCOMPILE) -x objective-c++ -c -o $@ $<
+endif

Modified: branches/Lion/testing/bench.mm
===================================================================
--- branches/Lion/testing/bench.mm	2011-08-24 02:51:10 UTC (rev 208)
+++ branches/Lion/testing/bench.mm	2011-08-24 02:51:12 UTC (rev 209)
@@ -199,6 +199,11 @@
 	unsigned i;
 	int r;
 
+	printf("\n====================================================================\n");
+	printf("[TEST] dispatch benchmark\n");
+	printf("[PID] %d\n", getpid());
+	printf("====================================================================\n\n");
+
 	r = sysctlbyname("hw.cpufrequency", &freq, &freq_len, NULL, 0);
 	assert(r != -1);
 	assert(freq_len == sizeof(freq));

Modified: branches/Lion/testing/bsdtestharness.c
===================================================================
--- branches/Lion/testing/bsdtestharness.c	2011-08-24 02:51:10 UTC (rev 208)
+++ branches/Lion/testing/bsdtestharness.c	2011-08-24 02:51:12 UTC (rev 209)
@@ -18,6 +18,7 @@
  * @APPLE_APACHE_LICENSE_HEADER_END@
  */
 
+#include <mach/clock_types.h>
 #include <dispatch/dispatch.h>
 #include <assert.h>
 #include <spawn.h>
@@ -25,7 +26,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <signal.h>
-#include <mach/clock_types.h>
 #include <mach-o/arch.h>
 
 #include <bsdtests.h>
@@ -84,7 +84,7 @@
 		int res2 = waitpid(pid, &status, 0);
 		assert(res2 != -1);
 		test_long("Process exited", (WIFEXITED(status) && WEXITSTATUS(status) && WEXITSTATUS(status) != 0xff) || WIFSIGNALED(status), 0);
-		exit(0);
+		exit((WIFEXITED(status) && WEXITSTATUS(status)) || WIFSIGNALED(status));
 	});
 	dispatch_resume(tmp_ds);
 
@@ -92,7 +92,7 @@
 	// Give embedded platforms a little more time.
 	uint64_t timeout = 300LL * NSEC_PER_SEC;
 #else
-	uint64_t timeout = 90LL * NSEC_PER_SEC;
+	uint64_t timeout = 150LL * NSEC_PER_SEC;
 #endif
 
 	dispatch_after(dispatch_time(DISPATCH_TIME_NOW, timeout), main_q, ^{

Modified: branches/Lion/testing/bsdtests.c
===================================================================
--- branches/Lion/testing/bsdtests.c	2011-08-24 02:51:10 UTC (rev 208)
+++ branches/Lion/testing/bsdtests.c	2011-08-24 02:51:12 UTC (rev 209)
@@ -366,7 +366,6 @@
 {
 	int res;
 	char pidstr[10];
-	char *leakswrapperpath;
 
 	if (getenv("NOLEAKS")) {
 		return;
@@ -401,8 +400,6 @@
 	} else {
 		perror(args[0]);
 	}
-
-	free(leakswrapperpath);
 }
 
 void

Modified: branches/Lion/testing/dispatch_concur.c
===================================================================
--- branches/Lion/testing/dispatch_concur.c	2011-08-24 02:51:10 UTC (rev 208)
+++ branches/Lion/testing/dispatch_concur.c	2011-08-24 02:51:12 UTC (rev 209)
@@ -19,6 +19,7 @@
  */
 
 #include <dispatch/dispatch.h>
+#include <dispatch/private.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>

Modified: branches/Lion/testing/dispatch_deadname.c
===================================================================
--- branches/Lion/testing/dispatch_deadname.c	2011-08-24 02:51:10 UTC (rev 208)
+++ branches/Lion/testing/dispatch_deadname.c	2011-08-24 02:51:12 UTC (rev 209)
@@ -19,6 +19,7 @@
  */
 
 #include <dispatch/dispatch.h>
+#include <dispatch/private.h>
 #include <mach/mach.h>
 #include <stdio.h>
 #include <unistd.h>

Modified: branches/Lion/testing/dispatch_drift.c
===================================================================
--- branches/Lion/testing/dispatch_drift.c	2011-08-24 02:51:10 UTC (rev 208)
+++ branches/Lion/testing/dispatch_drift.c	2011-08-24 02:51:12 UTC (rev 209)
@@ -18,8 +18,8 @@
  * @APPLE_APACHE_LICENSE_HEADER_END@
  */
 
+#include <mach/mach_time.h>
 #include <dispatch/dispatch.h>
-#include <mach/mach_time.h>
 #include <sys/time.h>
 #include <unistd.h>
 #include <stdio.h>

Modified: branches/Lion/testing/dispatch_overcommit.c
===================================================================
--- branches/Lion/testing/dispatch_overcommit.c	2011-08-24 02:51:10 UTC (rev 208)
+++ branches/Lion/testing/dispatch_overcommit.c	2011-08-24 02:51:12 UTC (rev 209)
@@ -19,6 +19,7 @@
  */
 
 #include <dispatch/dispatch.h>
+#include <dispatch/private.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>

Modified: branches/Lion/testing/dispatch_priority.c
===================================================================
--- branches/Lion/testing/dispatch_priority.c	2011-08-24 02:51:10 UTC (rev 208)
+++ branches/Lion/testing/dispatch_priority.c	2011-08-24 02:51:12 UTC (rev 209)
@@ -20,7 +20,7 @@
 
 #include <stdio.h>
 #include <dispatch/dispatch.h>
-#include <dispatch/queue_private.h>
+#include <dispatch/private.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <assert.h>

Modified: branches/Lion/testing/dispatch_readsync.c
===================================================================
--- branches/Lion/testing/dispatch_readsync.c	2011-08-24 02:51:10 UTC (rev 208)
+++ branches/Lion/testing/dispatch_readsync.c	2011-08-24 02:51:12 UTC (rev 209)
@@ -19,6 +19,7 @@
  */
 
 #include <dispatch/dispatch.h>
+#include <dispatch/private.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/sysctl.h>

Modified: branches/Lion/testing/dispatch_sync_on_main.c
===================================================================
--- branches/Lion/testing/dispatch_sync_on_main.c	2011-08-24 02:51:10 UTC (rev 208)
+++ branches/Lion/testing/dispatch_sync_on_main.c	2011-08-24 02:51:12 UTC (rev 209)
@@ -19,6 +19,7 @@
  */
 
 #include <dispatch/dispatch.h>
+#include <dispatch/private.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>

Modified: branches/Lion/testing/func.c
===================================================================
--- branches/Lion/testing/func.c	2011-08-24 02:51:10 UTC (rev 208)
+++ branches/Lion/testing/func.c	2011-08-24 02:51:12 UTC (rev 209)
@@ -18,7 +18,9 @@
  * @APPLE_APACHE_LICENSE_HEADER_END@
  */
 
+#ifdef __cplusplus
 extern "C" {
+#endif
 void
 func(void)
 {
@@ -26,4 +28,6 @@
 #ifdef __BLOCKS__
 void (^block)(void) = ^{ };
 #endif
+#ifdef __cplusplus
 };
+#endif

Deleted: branches/Lion/testing/leaks-wrapper
===================================================================
--- branches/Lion/testing/leaks-wrapper	2011-08-24 02:51:10 UTC (rev 208)
+++ branches/Lion/testing/leaks-wrapper	2011-08-24 02:51:12 UTC (rev 209)
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-/usr/bin/leaks "$@" 2>&1 | tee "${TMPDIR}$*.leakslog" | grep -q " 0 leaks for 0 total leaked bytes"
-
-if [ $? -eq 0 ]; then
-    rm "${TMPDIR}$*.leakslog"
-    exit 0
-else
-    exit $?
-fi

Copied: branches/Lion/testing/leaks-wrapper.sh (from rev 208, branches/Lion/testing/leaks-wrapper)
===================================================================
--- branches/Lion/testing/leaks-wrapper.sh	                        (rev 0)
+++ branches/Lion/testing/leaks-wrapper.sh	2011-08-24 02:51:12 UTC (rev 209)
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+/usr/bin/leaks "$@" 2>&1 | tee "${TMPDIR}$*.leakslog" | grep -q " 0 leaks for 0 total leaked bytes"
+
+if [ $? -eq 0 ]; then
+    rm "${TMPDIR}$*.leakslog"
+    exit 0
+else
+    exit $?
+fi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/libdispatch-changes/attachments/20110823/f2420ae3/attachment-0001.html>


More information about the libdispatch-changes mailing list