Re: [Gc] cordtest, gctest FAIL on OSX
Bruce Hoult <[email protected]> Mon, 5 Jan 2015 03:39:22 +1300
| Newsgroups | gmane.comp.programming.garbage-collection.boehmgc |
|---|---|
| Message-ID | <CAMU+Ekx=Ke2o4tVf=cQaabEskCtXTPABNF2BWTkANSUMoxPa0Q@mail.gmail.com> |
There are actually two problems here.
The first is in:
7bef74b Fix unresolved vsnprintf in misc.c and snprintf in cordtest (DJGPP,
VC)
OS X for some reason has problems with defining snprintf as a macro and
including another macro expansion in its arguments. Others have found this
in the past e.g.
http://sourceforge.net/p/powerwatershed/discussion/1024808/thread/79db23d3/
The following patch fixes this (and hopefully doesn't break the others):
--------------------------
diff --git a/cord/tests/cordtest.c b/cord/tests/cordtest.c
index a5a0c30..3edd0b4 100644
--- a/cord/tests/cordtest.c
+++ b/cord/tests/cordtest.c
@@ -206,9 +206,9 @@ void test_extras(void)
#ifdef __DJGPP__
/* snprintf is missing in DJGPP (v2.0.3) */
-# define GC_SNPRINTF sprintf
-# define GC_SNPRINTF_BUFSZ_ARG(bufsz) /* empty */
+# define HAVE_SNPRINTF 0
#else
+# define HAVE_SNPRINTF 1
# if defined(_MSC_VER)
# if defined(_WIN32_WCE)
/* _snprintf is deprecated in WinCE */
@@ -219,7 +219,6 @@ void test_extras(void)
# else
# define GC_SNPRINTF snprintf
# endif
-# define GC_SNPRINTF_BUFSZ_ARG(bufsz) (bufsz),
#endif
void test_printf(void)
@@ -244,8 +243,12 @@ void test_printf(void)
x = CORD_cat(x,x);
if (CORD_sprintf(&result, "->%-120.78r!\n", x) != 124)
ABORT("CORD_sprintf failed 3");
- (void)GC_SNPRINTF(result2, GC_SNPRINTF_BUFSZ_ARG(sizeof(result2))
- "->%-120.78s!\n", CORD_to_char_star(x));
+# if HAVE_SNPRINTF
+ (void)GC_SNPRINTF(result2, sizeof(result2), "->%-120.78s!\n",
+ CORD_to_char_star(x));
+# else
+ (void)sprintf(result2, "->%-120.78s!\n", CORD_to_char_star(x));
+# endif
result2[sizeof(result2) - 1] = '\0';
if (CORD_cmp(result, result2) != 0)ABORT("CORD_sprintf goofed 5");
}
--------------------------
The next problem is in:
0d147af Fix missing error handling of pthread_attr_init/getstacksize
Error 22 is EINVAL. Man pthread_attr_setstacksize gives the following
possible reasons for EINVAL:
[EINVAL] Invalid value for attr.
[EINVAL] stacksize is less than PTHREAD_STACK_MIN.
[EINVAL] stacksize is not a multiple of the system page size.
The following patch fixes the problem, demonstrating that the issue is
"stacksize is not a multiple of the system page size."
--------------------------
diff --git a/tests/test.c b/tests/test.c
index 1f006e4..13ab9a9 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -1881,7 +1881,7 @@ int main(void)
# if defined(GC_IRIX_THREADS) || defined(GC_FREEBSD_THREADS) \
|| defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS) \
|| defined(GC_OPENBSD_THREADS)
- if ((code = pthread_attr_setstacksize(&attr, 1000000)) != 0) {
+ if ((code = pthread_attr_setstacksize(&attr, 1000*1024)) != 0) {
GC_printf("pthread_attr_setstacksize failed, error=%d\n", code);
FAIL;
}
--------------------------
With these two changes, all tests pass on OS X with current git HEAD
(0322b83).
Note that both problems are in the test code, not in the GC.
On Tue, Dec 30, 2014 at 10:58 AM, John Leung <john-mCtq/[email protected]> wrote:
> cordtest, gctest FAIL on OSX in make check
>
> sys info:
> OSX 10.9.2
> Xcode 4.5.2
> Please let me know what other information I need to provide.
> thank you.
>
>
> > make check
> ...
> /Applications/Xcode.app/Contents/Developer/usr/bin/make check-TESTS
> ./test-driver: line 107: 11117 Abort trap: 6 "$@" > $log_file
> 2>&1
> FAIL: cordtest
> ./test-driver: line 107: 11137 Abort trap: 6 "$@" > $log_file
> 2>&1
> FAIL: gctest
> PASS: leaktest
> PASS: middletest
> PASS: smashtest
> PASS: hugetest
> PASS: realloc_test
> PASS: staticrootstest
> PASS: threadleaktest
> PASS: threadkey_test
> PASS: subthreadcreate_test
> PASS: initsecondarythread_test
> PASS: disclaim_test
> PASS: disclaim_bench
> make[5]: Nothing to be done for `all-am'.
>
> ============================================================================
> Testsuite summary for gc 7.5.0
>
> ============================================================================
> # TOTAL: 14
> # PASS: 12
> # SKIP: 0
> # XFAIL: 0
> # FAIL: 2
> # XPASS: 0
> # ERROR: 0
>
> ============================================================================
> See ./test-suite.log
> Please report to [email protected]
>
> ============================================================================
> make[3]: *** [test-suite.log] Error 1
> make[2]: *** [check-TESTS] Error 2
> make[1]: *** [check-am] Error 2
> make: *** [check-recursive] Error 1
>
>
>
>
> > cat ./test-suite.log
> ================================
> gc 7.5.0: ./test-suite.log
> ================================
>
> # TOTAL: 14
> # PASS: 12
> # SKIP: 0
> # XFAIL: 0
> # FAIL: 2
> # XPASS: 0
> # ERROR: 0
>
> .. contents:: :depth: 2
>
> FAIL: cordtest
> ==============
>
>
> FAIL: gctest
> ============
>
> pthread_attr_setstacksize failed, error=22
> Test failed
>
>
> --
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.
> _______________________________________________
> bdwgc mailing list
> [email protected]
> https://lists.opendylan.org/mailman/listinfo/bdwgc
>
_______________________________________________
bdwgc mailing list
[email protected]
https://lists.opendylan.org/mailman/listinfo/bdwgc