From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/3162 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: cluts test suite with musl Date: Tue, 23 Apr 2013 11:47:05 -0400 Message-ID: <20130423154705.GB20323@brightrain.aerifal.cx> References: <20130423134038.GX20323@brightrain.aerifal.cx> <20130423153127.GA20323@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="qVyHzDF4yf4A8jkR" Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1366732035 20685 80.91.229.3 (23 Apr 2013 15:47:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Apr 2013 15:47:15 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-3166-gllmg-musl=m.gmane.org@lists.openwall.com Tue Apr 23 17:47:20 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1UUfR9-0000hU-0Y for gllmg-musl@plane.gmane.org; Tue, 23 Apr 2013 17:47:19 +0200 Original-Received: (qmail 19596 invoked by uid 550); 23 Apr 2013 15:47:17 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 19586 invoked from network); 23 Apr 2013 15:47:17 -0000 Content-Disposition: inline In-Reply-To: <20130423153127.GA20323@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:3162 Archived-At: --qVyHzDF4yf4A8jkR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Apr 23, 2013 at 11:31:27AM -0400, Rich Felker wrote: > On Tue, Apr 23, 2013 at 06:17:15PM +0300, Timerlan Moldobaev wrote: > > Can you please specify what tests within cluts should work correctly ? > > There are chances that in my specific environment some musl issues might > > pop up even when running cluts partly. > > I can assist in debugging such issues (as it was for testsuite case). > > Yes, I'm actually working on a patch right now that disables the > incorrect tests and fixes up some other issues. Here's the patch. I've just disabled the EINTR test module entirely since it's full of wrong code including broken attempts at synchronization based on a volatile variable, and attempts to unlock a lock that's already unlocked. The other main issue was invalid numeric tests. Note that the setuid race test will not work without root, and I don't think it's reliable anyway. There's an alternate test for this issue on the glibc bug tracker: http://sourceware.org/bugzilla/show_bug.cgi?id=13347 Rich --qVyHzDF4yf4A8jkR Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="fix_wrong_tests.diff" Content-Transfer-Encoding: 8bit diff --git a/tests/buf.c b/tests/buf.c index 396c5fd..1f63eaf 100644 --- a/tests/buf.c +++ b/tests/buf.c @@ -11,7 +11,7 @@ #include //confstr, getcwd, gethostname, readlink #include //iconv #include //time, gmtime -//#include //strfmon +#include //strfmon /* * Copyright (c) 2011 Luka Marčetić @@ -44,9 +44,7 @@ static int wrap_gethostname(char *name, size_t namelen); static int wrap_mbstowcs(wchar_t *pwcs, char *s, size_t n); static int wrap_snprintf(char *s, size_t n, char *format/*, ...*/); static int wrap_readlink(char *path, char *buf, size_t bufsize); -#ifndef MUSL static int wrap_strfmon(char *s, size_t maxsize, char *format/*,...*/, float F); -#endif static int wrap_strftime(char *s, size_t maxsize, char *format, struct tm *timeptr); static int wrap_wcstombs(char *s, wchar_t *pwcs, size_t n); @@ -239,7 +237,6 @@ int main() break; case 10: fun = sreturnf("strfmon(s, sizeof(s)-1, \"%%!i\", 123.0)"); - #ifndef MUSL s = malloc(80); size = strfmon(s, 80, "%!i", 123.0) + 1; free(s); s = NULL; @@ -256,9 +253,6 @@ int main() wrong = 2; else if (err != (err_expected = E2BIG)) wrong = 3; - #else - wrong = -3; - #endif break; case 11: fun = sreturnf("strftime(s, sizeof(s)-1, \"%Y\", tm)"); @@ -488,7 +482,6 @@ static int wrap_readlink(char *path, char *buf, size_t bufsize) sigaction(SIGSEGV, &oldact[0], NULL); return err; } -#ifndef MUSL static int wrap_strfmon(char *s, size_t maxsize, char *format/*, ...*/, float F) { int err = 0; @@ -501,7 +494,6 @@ static int wrap_strfmon(char *s, size_t maxsize, char *format/*, ...*/, float F) sigaction(SIGSEGV, &oldact[0], NULL); return err; } -#endif static int wrap_strftime(char *s,size_t maxsize,char *format,struct tm *timeptr) { int err = 0; diff --git a/tests/numeric.c b/tests/numeric.c index 7031f7f..ac97271 100644 --- a/tests/numeric.c +++ b/tests/numeric.c @@ -223,12 +223,14 @@ int main() {(int[]){2,fnr_strtoul, fnr_wcstoul}, max[7], wcslen(max[7]), b_zero, {.ul = ULONG_MAX}, ERANGE}, {(int[]){2,fnr_strtoull, fnr_wcstoull}, max[8], wcslen(max[8]), b_zero, {.ull= ULLONG_MAX}, ERANGE}, +#ifdef WANT_WRONG_TESTS {(int[]){2,fnr_strtof, fnr_wcstof}, max[9], wcslen(max[9]), b_sixteen, {.f = HUGE_VALF}, ERANGE}, {(int[]){2,fnr_strtof, fnr_wcstof}, max[10], wcslen(max[10]), b_sixteen, {.f = -HUGE_VALF}, ERANGE}, {(int[]){2,fnr_strtod, fnr_wcstod}, max[11], wcslen(max[11]), b_sixteen, {.d = HUGE_VAL}, ERANGE}, {(int[]){2,fnr_strtod, fnr_wcstod}, max[12], wcslen(max[12]), b_sixteen, {.d = -HUGE_VAL}, ERANGE}, {(int[]){2,fnr_strtold, fnr_wcstold}, max[13], wcslen(max[13]), b_sixteen, {.ld = HUGE_VALL}, ERANGE}, {(int[]){2,fnr_strtold, fnr_wcstold}, max[14], wcslen(max[14]), b_sixteen, {.ld = -HUGE_VALL}, ERANGE}, +#endif }; struct sscanf_tests { @@ -250,6 +252,7 @@ int main() {f_sscanf, L"--1", 0, r_zero, -1}, {f_sscanf, L"-+1", 0, r_zero, -1}, {f_sscanf, L"+-1", 0, r_zero, -1}, +#ifdef WANT_WRONG_TESTS //the 'longest initial subsequence OF THE EXPECTED FORM' is "0" {f_sscanfx, L"0x", 1, r_zero, 0}, {f_sscanfx, L"0x 1", 1, r_zero, 0}, @@ -291,6 +294,7 @@ int main() {f_sscanf_decimal, L"1E+0", 1, r_one, 0}, {f_sscanf_decimal, L"1e-0", 1, r_one, 0}, {f_sscanf_decimal, L"1E-0", 1, r_one, 0}, +#endif }; failed=0; @@ -505,16 +509,12 @@ static int test_function(const int function_nr, const int base, } break; case fnr_strtof: - #ifndef MUSL case fnr_wcstof: - #endif case fnr_sscanff: if (function_nr == fnr_strtof) rval.f = strtof(nptr, &endptr); - #ifndef MUSL else if (function_nr == fnr_wcstof) rval.f = wcstof(wnptr, &wendptr); - #endif else ret = sscanf(nptr, "%f", &rval.f); err = errno; @@ -526,16 +526,12 @@ static int test_function(const int function_nr, const int base, } break; case fnr_strtod: - #ifndef MUSL case fnr_wcstod: - #endif case fnr_sscanfd: if (function_nr == fnr_strtod) rval.d = strtod(nptr, &endptr); - #ifndef MUSL else if (function_nr == fnr_wcstod) rval.d = wcstod(wnptr, &wendptr); - #endif else ret = sscanf(nptr, "%lf", &rval.d); err = errno; @@ -547,16 +543,12 @@ static int test_function(const int function_nr, const int base, } break; case fnr_strtold: - #ifndef MUSL case fnr_wcstold: - #endif case fnr_sscanfld: if (function_nr == fnr_strtold) rval.ld = strtold(nptr, &endptr); - #ifndef MUSL else if (function_nr == fnr_wcstold) rval.ld = wcstold(wnptr, &wendptr); - #endif else ret = sscanf(nptr, "%Lf", &rval.ld); err = errno; diff --git a/tests/pthread_eintr.c b/tests/pthread_eintr.c index 4ee0a22..b0a4b08 100644 --- a/tests/pthread_eintr.c +++ b/tests/pthread_eintr.c @@ -75,9 +75,7 @@ static int wrap_pthread_atfork(void (*prepare)(void), static int wrap_pthread_sigmask(int how, const sigset_t *restrict set, sigset_t *restrict oset); -#ifndef MUSL static int wrap_pthread_setschedprio(pthread_t thread, int prio); -#endif static int wrap_pthread_setconcurrency(int new_level); static int wrap_pthread_detach(pthread_t thread); static int wrap_pthread_key_create(pthread_key_t *key, @@ -124,6 +122,9 @@ int main() struct sigaction act = {.sa_handler=handle, .sa_flags=SA_NODEFER}; +#ifndef WANT_WRONG_TESTS + return 0; +#endif failed = 0; for (i=0; i < (nr_fun=sizeof(function)/sizeof(*function)); ++i) { pipe(pfd); @@ -169,14 +170,14 @@ int main() case 7: err = wrap_pthread_sigmask(SIG_UNBLOCK, NULL, NULL); break; - #ifndef MUSL case 8: - err = wrap_pthread_setschedprio( - tid, - sched_get_priority_min(sched_getscheduler(0)) - ); + { + struct sched_param param; + int policy; + pthread_getschedparam(tid, &policy, ¶m); + err = wrap_pthread_setschedprio(tid, param.sched_priority); + } break; - #endif case 9: err = wrap_pthread_setconcurrency(pthread_getconcurrency()); break; @@ -188,12 +189,16 @@ int main() err = wrap_pthread_key_create(&tkey, NULL); break; case 12: +#ifdef WANT_WRONG_TESTS if (!pthread_rwlock_init(&tlock, NULL)) { err = wrap_pthread_rwlock_unlock(&tlock); pthread_rwlock_destroy(&tlock); } else err = -2; +#else + err = 0; +#endif break; case 13: err = wrap_pthread_kill(tid, 0); @@ -403,7 +408,6 @@ static int wrap_pthread_sigmask(int how, err = pthread_sigmask(how, set, oset); WRAP_END } -#ifndef MUSL static int wrap_pthread_setschedprio(pthread_t thread, int prio) { WRAP_START @@ -411,7 +415,6 @@ static int wrap_pthread_setschedprio(pthread_t thread, int prio) err = pthread_setschedprio(thread, prio); WRAP_END } -#endif static int wrap_pthread_setconcurrency(int new_level) { WRAP_START --qVyHzDF4yf4A8jkR--