public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* RFC V2 [2/2] test-in-container
@ 2018-02-28 10:20 DJ Delorie
  2018-06-26 13:03 ` Florian Weimer
  0 siblings, 1 reply; 3+ messages in thread
From: DJ Delorie @ 2018-02-28 10:20 UTC (permalink / raw)
  To: libc-alpha


	* nss/tst-nss-test3.c: Convert to test-in-container.
	* nss/tst-nss-test3.root/: New.

diff --git a/nss/Makefile b/nss/Makefile
index a5cd2aacae..60a28a1519 100644
--- a/nss/Makefile
+++ b/nss/Makefile
@@ -55,11 +55,13 @@ tests-internal		= tst-field
 tests			= test-netdb test-digits-dots tst-nss-getpwent bug17079 \
 			  tst-nss-test1 \
 			  tst-nss-test2 \
-			  tst-nss-test3 \
 			  tst-nss-test4 \
 			  tst-nss-test5
 xtests			= bug-erange
 
+tests-container = \
+			  tst-nss-test3
+
 # Tests which need libdl
 ifeq (yes,$(build-shared))
 tests += tst-nss-files-hosts-erange
diff --git a/nss/tst-nss-test3.c b/nss/tst-nss-test3.c
index d9d708ae7b..4112231778 100644
--- a/nss/tst-nss-test3.c
+++ b/nss/tst-nss-test3.c
@@ -107,7 +107,11 @@ do_test (void)
   int i;
   struct group *g = NULL;
 
-  __nss_configure_lookup ("group", "test1");
+/* Previously we used __nss_configure_lookup to isolate the test
+   from the host environment and to get it to lookup from our new
+   test1 NSS service module, but now this test is run in a different
+   root filesystem via the test-container support and we directly
+   configure the use of the test1 NSS service.  */
 
   setgrent ();
 
diff --git a/nss/tst-nss-test3.root/etc/nsswitch.conf b/nss/tst-nss-test3.root/etc/nsswitch.conf
new file mode 100644
index 0000000000..5e08fe5eea
--- /dev/null
+++ b/nss/tst-nss-test3.root/etc/nsswitch.conf
@@ -0,0 +1 @@
+group	test1
diff --git a/nss/tst-nss-test3.root/files.txt b/nss/tst-nss-test3.root/files.txt
new file mode 100644
index 0000000000..a10beb1e6c
--- /dev/null
+++ b/nss/tst-nss-test3.root/files.txt
@@ -0,0 +1,2 @@
+cp $B/nss/libnss_test1.so $L/libnss_test1.so.2
+cp $B/nss/libnss_test2.so $L/libnss_test2.so.2

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

* Re: RFC V2 [2/2] test-in-container
  2018-02-28 10:20 RFC V2 [2/2] test-in-container DJ Delorie
@ 2018-06-26 13:03 ` Florian Weimer
  2018-06-28 21:05   ` DJ Delorie
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2018-06-26 13:03 UTC (permalink / raw)
  To: DJ Delorie, libc-alpha

On 02/27/2018 09:34 PM, DJ Delorie wrote:

> diff --git a/nss/Makefile b/nss/Makefile
> index a5cd2aacae..60a28a1519 100644
> --- a/nss/Makefile
> +++ b/nss/Makefile
> @@ -55,11 +55,13 @@ tests-internal		= tst-field
>   tests			= test-netdb test-digits-dots tst-nss-getpwent bug17079 \
>   			  tst-nss-test1 \
>   			  tst-nss-test2 \
> -			  tst-nss-test3 \
>   			  tst-nss-test4 \
>   			  tst-nss-test5
>   xtests			= bug-erange
>   
> +tests-container = \
> +			  tst-nss-test3
> +

> diff --git a/nss/tst-nss-test3.root/files.txt b/nss/tst-nss-test3.root/files.txt
> new file mode 100644
> index 0000000000..a10beb1e6c
> --- /dev/null
> +++ b/nss/tst-nss-test3.root/files.txt
> @@ -0,0 +1,2 @@
> +cp $B/nss/libnss_test1.so $L/libnss_test1.so.2
> +cp $B/nss/libnss_test2.so $L/libnss_test2.so.2

I like this interface for writing tests, but it doesn't quite work at 
present: the makefile doesn't know about the test dependency on 
libnss_test1.so.2 and libnss_test2.so.2, so you get spurious failures at 
high concurrency levels.

I'm not sure what the proper remedy is here.  Should we auto-generate a 
makefile fragment from the file copy instructions?  Should these 
instructions be included in the makefile instead?

Thanks,
Florian

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

* Re: RFC V2 [2/2] test-in-container
  2018-06-26 13:03 ` Florian Weimer
@ 2018-06-28 21:05   ` DJ Delorie
  0 siblings, 0 replies; 3+ messages in thread
From: DJ Delorie @ 2018-06-28 21:05 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha


> I like this interface for writing tests, but it doesn't quite work at
> present: the makefile doesn't know about the test dependency on
> libnss_test1.so.2 and libnss_test2.so.2, so you get spurious failures
> at high concurrency levels.

This is supposed to handle it, in nss/Makefile already:

$(patsubst %,$(objpfx)%.out,$(tests)) : \
	$(objpfx)/libnss_test1.so$(libnss_test1.so-version) \
	$(objpfx)/libnss_test2.so$(libnss_test2.so-version)

> Should these instructions be included in the makefile instead?

Well, two reasons not to...

1. There are a lot of shortcuts in that "syntax" that would be more
   complex in a plain Makefile.  Reducing the cost of adding lots of
   tests was one of the design considerations.

2. We run that script after we've locked and cleaned the testroot, which
   we can't do in the Makefile.

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

end of thread, other threads:[~2018-06-28 21:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-28 10:20 RFC V2 [2/2] test-in-container DJ Delorie
2018-06-26 13:03 ` Florian Weimer
2018-06-28 21:05   ` DJ Delorie

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 read-only IMAP folder(s) and NNTP newsgroup(s).