[libdispatch-changes] [195] trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Dec 23 13:31:34 PST 2010


Revision: 195
          http://trac.macosforge.org/projects/libdispatch/changeset/195
Author:   jkh at apple.com
Date:     2010-12-23 13:31:28 -0800 (Thu, 23 Dec 2010)
Log Message:
-----------
Author: Joakim Johansson <jocke at tbricks.com>

Shims and small patches required to get the portable parts of the test suite to run properly, it also includes a fix for spurious failures of dispatch_priority/dispatch_priority2 due to a wraparound bug, which should affect test stability on other platforms as well.

Modified Paths:
--------------
    trunk/configure.ac
    trunk/testing/Makefile.am
    trunk/testing/dispatch_priority.c
    trunk/testing/dispatch_test.h
    trunk/testing/summarize.c

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2010-12-23 01:35:54 UTC (rev 194)
+++ trunk/configure.ac	2010-12-23 21:31:28 UTC (rev 195)
@@ -200,7 +200,7 @@
 AC_CHECK_DECLS([SIGEMT], [], [], [[#include <signal.h>]])
 AC_CHECK_DECLS([VQ_UPDATE, VQ_VERYLOWDISK], [], [], [[#include <sys/mount.h>]])
 AC_CHECK_DECLS([program_invocation_short_name], [], [], [[#include <errno.h>]])
-AC_CHECK_FUNCS([pthread_key_init_np pthread_main_np mach_absolute_time malloc_create_zone sysconf getprogname getexecname])
+AC_CHECK_FUNCS([pthread_key_init_np pthread_main_np mach_absolute_time malloc_create_zone sysconf getprogname getexecname vasprintf asprintf arc4random fgetln])
 
 AC_CHECK_DECLS([POSIX_SPAWN_START_SUSPENDED],
   [have_posix_spawn_start_suspended=true],

Modified: trunk/testing/Makefile.am
===================================================================
--- trunk/testing/Makefile.am	2010-12-23 01:35:54 UTC (rev 194)
+++ trunk/testing/Makefile.am	2010-12-23 21:31:28 UTC (rev 195)
@@ -5,7 +5,10 @@
 noinst_LTLIBRARIES=libtest.la
 
 libtest_la_SOURCES=			\
-	dispatch_test.c
+	dispatch_test.c			\
+	shims/asprintf.c		\
+	shims/arc4random.c		\
+	shims/fgetln.c
 
 TESTS=					\
 	dispatch_api			\

Modified: trunk/testing/dispatch_priority.c
===================================================================
--- trunk/testing/dispatch_priority.c	2010-12-23 01:35:54 UTC (rev 194)
+++ trunk/testing/dispatch_priority.c	2010-12-23 21:31:28 UTC (rev 195)
@@ -48,21 +48,21 @@
 int priorities[PRIORITIES] = { DISPATCH_QUEUE_PRIORITY_LOW, DISPATCH_QUEUE_PRIORITY_DEFAULT, DISPATCH_QUEUE_PRIORITY_HIGH };
 
 union {
-	size_t count;
+	long count;
 	char padding[64];
 } counts[PRIORITIES];
 
-#define ITERATIONS (size_t)(PRIORITIES * BLOCKS * 0.50)
-size_t iterations = ITERATIONS;
+#define ITERATIONS (long)(PRIORITIES * BLOCKS * 0.50)
+long iterations = ITERATIONS;
 
 void
 histogram(void) {
-	size_t maxcount = BLOCKS;
-	size_t sc[PRIORITIES];
+	long maxcount = BLOCKS;
+	long sc[PRIORITIES];
 	
-	size_t total = 0;
+	long total = 0;
 	
-	size_t x,y;
+	long x,y;
 	for (y = 0; y < PRIORITIES; ++y) {
 		sc[y] = counts[y].count;
 	}
@@ -86,10 +86,10 @@
 void
 cpubusy(void* context)
 {
-	size_t *count = context;
-	size_t iterdone;
+	long *count = context;
+	long iterdone;
 
-	size_t idx;
+	long idx;
 	for (idx = 0; idx < LOOP_COUNT; ++idx) {
 		if (done) break;
 	}
@@ -132,7 +132,7 @@
 		test_ptr_notnull("q[i]", q[i]);
 		assert(q[i]);
 		dispatch_set_target_queue(q[i], dispatch_get_global_queue(priorities[i], 0));
-		dispatch_queue_set_width(q[i], DISPATCH_QUEUE_WIDTH_MAX_LOGICAL_CPUS);
+		dispatch_queue_set_width(q[i], DISPATCH_QUEUE_WIDTH_MAX_LOGICAL_CPUS); 
 	}
 #else
 	test_start("Dispatch Priority");

Modified: trunk/testing/dispatch_test.h
===================================================================
--- trunk/testing/dispatch_test.h	2010-12-23 01:35:54 UTC (rev 194)
+++ trunk/testing/dispatch_test.h	2010-12-23 21:31:28 UTC (rev 195)
@@ -1,6 +1,8 @@
 #include <errno.h>
+#include "os_shims.h"
+#include <dispatch/dispatch.h>
 
-__BEGIN_DECLS
+__DISPATCH_BEGIN_DECLS
 
 void test_start(const char* desc);
 void test_stop(void);
@@ -30,4 +32,5 @@
 void _test_errno(const char* file, long line, const char* desc, long actual, long expected);
 #define test_errno(a,b,c) _test_errno(__FILE__, __LINE__, a, b, c)
 
-__END_DECLS
+__DISPATCH_END_DECLS
+

Modified: trunk/testing/summarize.c
===================================================================
--- trunk/testing/summarize.c	2010-12-23 01:35:54 UTC (rev 194)
+++ trunk/testing/summarize.c	2010-12-23 21:31:28 UTC (rev 195)
@@ -18,7 +18,7 @@
  * @APPLE_APACHE_LICENSE_HEADER_END@
  */
 
-#include "config/config.h"
+#include "os_shims.h"
 
 #include <stdio.h>
 #include <stdlib.h>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/libdispatch-changes/attachments/20101223/8ea88c52/attachment.html>


More information about the libdispatch-changes mailing list