* [musl] libc-test contribution
@ 2024-08-16 1:06 Ward, Ryan C
2024-08-16 7:35 ` Szabolcs Nagy
0 siblings, 1 reply; 4+ messages in thread
From: Ward, Ryan C @ 2024-08-16 1:06 UTC (permalink / raw)
To: musl
Hello,
I would like to start contributing some test cases to libc-test. I have
started with testing some simple recent regressions (e.g. a test for
the recent fix commit 947b4574), and am aiming to start filling in
missing functional test coverage. Am I able to submit the test
directly to this mailing list, and are there any other immediate
areas of libc-test that need implementation?
Kind regards,
Ryan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [musl] libc-test contribution
2024-08-16 1:06 [musl] libc-test contribution Ward, Ryan C
@ 2024-08-16 7:35 ` Szabolcs Nagy
2024-08-16 15:57 ` Rich Felker
0 siblings, 1 reply; 4+ messages in thread
From: Szabolcs Nagy @ 2024-08-16 7:35 UTC (permalink / raw)
To: Ward, Ryan C; +Cc: musl
* Ward, Ryan C <ryan.c.ward3@boeing.com> [2024-08-16 01:06:55 +0000]:
> Hello,
>
> I would like to start contributing some test cases to libc-test. I have
> started with testing some simple recent regressions (e.g. a test for
> the recent fix commit 947b4574), and am aiming to start filling in
> missing functional test coverage. Am I able to submit the test
> directly to this mailing list, and are there any other immediate
> areas of libc-test that need implementation?
this list is fine
there are many areas missing
but they need test infrastucture
eg networking tests depending on
/etc/resolv.conf need to run in
a separate mount namespace.
adding selfcontained regression
tests should be fine
>
> Kind regards,
> Ryan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [musl] libc-test contribution
2024-08-16 7:35 ` Szabolcs Nagy
@ 2024-08-16 15:57 ` Rich Felker
2024-08-16 17:00 ` Rich Felker
0 siblings, 1 reply; 4+ messages in thread
From: Rich Felker @ 2024-08-16 15:57 UTC (permalink / raw)
To: Ward, Ryan C, musl
On Fri, Aug 16, 2024 at 09:35:38AM +0200, Szabolcs Nagy wrote:
> * Ward, Ryan C <ryan.c.ward3@boeing.com> [2024-08-16 01:06:55 +0000]:
> > Hello,
> >
> > I would like to start contributing some test cases to libc-test. I have
> > started with testing some simple recent regressions (e.g. a test for
> > the recent fix commit 947b4574), and am aiming to start filling in
> > missing functional test coverage. Am I able to submit the test
> > directly to this mailing list, and are there any other immediate
> > areas of libc-test that need implementation?
>
> this list is fine
>
> there are many areas missing
> but they need test infrastucture
> eg networking tests depending on
> /etc/resolv.conf need to run in
> a separate mount namespace.
I could try writing a helper module to do this. Basically it would
just unshare into a new user+mount+network namespace and, if
/etc/resolv.conf exists, bind-mount an empty file over it. Then you
can bind port 53 and it will intercept all queries, and you don't have
to worry about anything going out to the real network or having
network-dependent behaviors.
Rich
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [musl] libc-test contribution
2024-08-16 15:57 ` Rich Felker
@ 2024-08-16 17:00 ` Rich Felker
0 siblings, 0 replies; 4+ messages in thread
From: Rich Felker @ 2024-08-16 17:00 UTC (permalink / raw)
To: musl
On Fri, Aug 16, 2024 at 11:57:29AM -0400, Rich Felker wrote:
> On Fri, Aug 16, 2024 at 09:35:38AM +0200, Szabolcs Nagy wrote:
> > * Ward, Ryan C <ryan.c.ward3@boeing.com> [2024-08-16 01:06:55 +0000]:
> > > Hello,
> > >
> > > I would like to start contributing some test cases to libc-test. I have
> > > started with testing some simple recent regressions (e.g. a test for
> > > the recent fix commit 947b4574), and am aiming to start filling in
> > > missing functional test coverage. Am I able to submit the test
> > > directly to this mailing list, and are there any other immediate
> > > areas of libc-test that need implementation?
> >
> > this list is fine
> >
> > there are many areas missing
> > but they need test infrastucture
> > eg networking tests depending on
> > /etc/resolv.conf need to run in
> > a separate mount namespace.
>
> I could try writing a helper module to do this. Basically it would
> just unshare into a new user+mount+network namespace and, if
> /etc/resolv.conf exists, bind-mount an empty file over it. Then you
> can bind port 53 and it will intercept all queries, and you don't have
> to worry about anything going out to the real network or having
> network-dependent behaviors.
Something like this:
#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <sched.h>
#include <sys/mount.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <netinet/in.h>
int enter_dns_test_ns()
{
if (unshare(CLONE_NEWUSER|CLONE_NEWNS|CLONE_NEWNET) < 0)
return -1;
int s = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
if (s < 0) return -1;
struct ifreq ifr = {
.ifr_name = "lo",
.ifr_addr = (union { struct sockaddr_in sin; struct sockaddr sa; }){{
.sin_family = AF_INET,
.sin_port = 0,
.sin_addr = htonl(0x7f000001),
}}.sa,
};
if (ioctl(s, SIOCSIFADDR, &ifr) < 0)
return -1;
if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0)
return -1;
ifr.ifr_flags |= IFF_UP;
if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0)
return -1;
char tmp[] = "/tmp/emptyXXXXXX";
int fd = mkostemp(tmp, O_CLOEXEC);
if (fd < 0) return -1;
int r = mount(tmp, "/etc/resolv.conf", 0, MS_BIND, 0);
unlink(tmp);
return r;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-16 17:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-16 1:06 [musl] libc-test contribution Ward, Ryan C
2024-08-16 7:35 ` Szabolcs Nagy
2024-08-16 15:57 ` Rich Felker
2024-08-16 17:00 ` 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).