From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: cluts test suite with musl
Date: Tue, 23 Apr 2013 11:47:05 -0400 [thread overview]
Message-ID: <20130423154705.GB20323@brightrain.aerifal.cx> (raw)
In-Reply-To: <20130423153127.GA20323@brightrain.aerifal.cx>
[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]
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
[-- Attachment #2: fix_wrong_tests.diff --]
[-- Type: text/plain, Size: 8525 bytes --]
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 <unistd.h> //confstr, getcwd, gethostname, readlink
#include <iconv.h> //iconv
#include <time.h> //time, gmtime
-//#include <monetary.h> //strfmon
+#include <monetary.h> //strfmon
/*
* Copyright (c) 2011 Luka Marčetić<paxcoder@gmail.com>
@@ -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
next prev parent reply other threads:[~2013-04-23 15:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-23 12:26 Timerlan Moldobaev
2013-04-23 13:40 ` Rich Felker
2013-04-23 15:17 ` Timerlan Moldobaev
2013-04-23 15:31 ` Rich Felker
2013-04-23 15:47 ` Rich Felker [this message]
2013-04-24 12:26 ` Timerlan Moldobaev
2013-04-24 13:32 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130423154705.GB20323@brightrain.aerifal.cx \
--to=dalias@aerifal.cx \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).