mailing list of musl libc
 help / color / mirror / code / Atom feed
* cluts test suite with musl
@ 2013-04-23 12:26 Timerlan Moldobaev
  2013-04-23 13:40 ` Rich Felker
  0 siblings, 1 reply; 7+ messages in thread
From: Timerlan Moldobaev @ 2013-04-23 12:26 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 397 bytes --]

Hi ,

I am trying to run cluts test suite from
https://github.com/lmarcetic/cluts over
the latest musl libraries.
Seems that this test suite is not synchronized with musl as I am
getting numerous errors.
Is this test suite operational ?
Is it a part of  musl correct functionality  checking ?
Can you look at  potential issues in musl discovered as a result of cluts
tests running ?

Thanks,
Tim.

[-- Attachment #2: Type: text/html, Size: 887 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cluts test suite with musl
  2013-04-23 12:26 cluts test suite with musl Timerlan Moldobaev
@ 2013-04-23 13:40 ` Rich Felker
  2013-04-23 15:17   ` Timerlan Moldobaev
  0 siblings, 1 reply; 7+ messages in thread
From: Rich Felker @ 2013-04-23 13:40 UTC (permalink / raw)
  To: musl

On Tue, Apr 23, 2013 at 03:26:51PM +0300, Timerlan Moldobaev wrote:
> Hi ,
> 
> I am trying to run cluts test suite from
> https://github.com/lmarcetic/cluts over
> the latest musl libraries.
> Seems that this test suite is not synchronized with musl as I am
> getting numerous errors.
> Is this test suite operational ?
> Is it a part of  musl correct functionality  checking ?
> Can you look at  potential issues in musl discovered as a result of cluts
> tests running ?

I know we don't use all of cluts because some of the tests are wrong,
and it has some bitrot. Maybe somebody could look into this and making
an updated version that's correct or at least has the incorrect tests
disabled? I'll look at it when I have enough time to spend on it.

Rich


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cluts test suite with musl
  2013-04-23 13:40 ` Rich Felker
@ 2013-04-23 15:17   ` Timerlan Moldobaev
  2013-04-23 15:31     ` Rich Felker
  0 siblings, 1 reply; 7+ messages in thread
From: Timerlan Moldobaev @ 2013-04-23 15:17 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1139 bytes --]

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).

Thanks,
Tim.


On Tue, Apr 23, 2013 at 4:40 PM, Rich Felker <dalias@aerifal.cx> wrote:

> On Tue, Apr 23, 2013 at 03:26:51PM +0300, Timerlan Moldobaev wrote:
> > Hi ,
> >
> > I am trying to run cluts test suite from
> > https://github.com/lmarcetic/cluts over
> > the latest musl libraries.
> > Seems that this test suite is not synchronized with musl as I am
> > getting numerous errors.
> > Is this test suite operational ?
> > Is it a part of  musl correct functionality  checking ?
> > Can you look at  potential issues in musl discovered as a result of cluts
> > tests running ?
>
> I know we don't use all of cluts because some of the tests are wrong,
> and it has some bitrot. Maybe somebody could look into this and making
> an updated version that's correct or at least has the incorrect tests
> disabled? I'll look at it when I have enough time to spend on it.
>
> Rich
>

[-- Attachment #2: Type: text/html, Size: 1814 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cluts test suite with musl
  2013-04-23 15:17   ` Timerlan Moldobaev
@ 2013-04-23 15:31     ` Rich Felker
  2013-04-23 15:47       ` Rich Felker
  0 siblings, 1 reply; 7+ messages in thread
From: Rich Felker @ 2013-04-23 15:31 UTC (permalink / raw)
  To: musl

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.

Rich


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cluts test suite with musl
  2013-04-23 15:31     ` Rich Felker
@ 2013-04-23 15:47       ` Rich Felker
  2013-04-24 12:26         ` Timerlan Moldobaev
  0 siblings, 1 reply; 7+ messages in thread
From: Rich Felker @ 2013-04-23 15:47 UTC (permalink / raw)
  To: musl

[-- 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, &param);
+                     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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cluts test suite with musl
  2013-04-23 15:47       ` Rich Felker
@ 2013-04-24 12:26         ` Timerlan Moldobaev
  2013-04-24 13:32           ` Rich Felker
  0 siblings, 1 reply; 7+ messages in thread
From: Timerlan Moldobaev @ 2013-04-24 12:26 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 2256 bytes --]

Thanks !

I applied the patch. Still have some tests failing.

For instance tests/buf fails with the following error message:

iconv(&<"abcd">, &<4>, &s, &<3>) caused a SIGSEGV!

I am not sure but  it seems that iconv()  that is called from wrap_iconv()
should return  an error return value and set an errno value.
At least to my understanding  that the way the test is written.
For musl implementation of iconv()  returns 0 and sets no errno.

While in the case of standard Linux implementation, errno = E2BIG and -1
returned ( error return value) .

For the case buf linked dynamically against the standard libc.so library:

 ldd tests/buf
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00000030d1000000)
        librt.so.1 => /lib64/librt.so.1 (0x00000030d4400000)
        libm.so.6 => /lib64/libm.so.6 (0x00000030d0800000)
        libc.so.6 => /lib64/libc.so.6 (0x00000030d0400000)
        /lib64/ld-linux-x86-64.so.2 (0x00000030cf400000)

> uname -a
Linux lnxbdc96 2.6.18-164.11.1.el5 #1 SMP Wed Jan 6 13:26:04 EST 2010
x86_64 x86_64 x86_64 GNU/Linux

Can you please look into this ?

Thanks.



On Tue, Apr 23, 2013 at 6:47 PM, Rich Felker <dalias@aerifal.cx> wrote:

> 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: Type: text/html, Size: 3356 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cluts test suite with musl
  2013-04-24 12:26         ` Timerlan Moldobaev
@ 2013-04-24 13:32           ` Rich Felker
  0 siblings, 0 replies; 7+ messages in thread
From: Rich Felker @ 2013-04-24 13:32 UTC (permalink / raw)
  To: musl

On Wed, Apr 24, 2013 at 03:26:57PM +0300, Timerlan Moldobaev wrote:
> Thanks !
> 
> I applied the patch. Still have some tests failing.
> 
> For instance tests/buf fails with the following error message:
> 
> iconv(&<"abcd">, &<4>, &s, &<3>) caused a SIGSEGV!
> 
> I am not sure but  it seems that iconv()  that is called from wrap_iconv()
> should return  an error return value and set an errno value.
> At least to my understanding  that the way the test is written.
> For musl implementation of iconv()  returns 0 and sets no errno.
> 
> While in the case of standard Linux implementation, errno = E2BIG and -1
> returned ( error return value) .
> 
> For the case buf linked dynamically against the standard libc.so library:
> 
>  ldd tests/buf
>         libpthread.so.0 => /lib64/libpthread.so.0 (0x00000030d1000000)
>         librt.so.1 => /lib64/librt.so.1 (0x00000030d4400000)
>         libm.so.6 => /lib64/libm.so.6 (0x00000030d0800000)
>         libc.so.6 => /lib64/libc.so.6 (0x00000030d0400000)
>         /lib64/ld-linux-x86-64.so.2 (0x00000030cf400000)
> 
> > uname -a
> Linux lnxbdc96 2.6.18-164.11.1.el5 #1 SMP Wed Jan 6 13:26:04 EST 2010
> x86_64 x86_64 x86_64 GNU/Linux
> 
> Can you please look into this ?

Yes, the test is invoking undefined behavior by failing to check the
return value of iconv_open and passing an invalid conversion
descriptor ((iconv_t)-1) to iconv. I don't know why it's crashing for
you but not me; probably a difference from being 64-bit vs 32-bit
affecting the way the bits of the conversion descriptor are handled.

Apparently the test was written based on GNU documentation that allows
"" as an alias for the current locale's encoding. This usage is
non-portable, but may be something we should add to musl.
nl_langinfo(CODESET) is the portable way to get this.

Rich


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-04-24 13:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-23 12:26 cluts test suite with musl 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
2013-04-24 12:26         ` Timerlan Moldobaev
2013-04-24 13:32           ` Rich Felker

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).