Hi Ludovic, thanks for your work.
[email protected] (Ludovic Courtès) writes: > Hello, > > Just to let you know that 0.9.2 was successfully packaged for NixOS (see > <http://hydra.nixos.org/job/nixpkgs/trunk/myserver>). > > I applied this simple patch, which allows the tests to run in a chroot > without /etc/hosts and /etc/passwd like the Nix build chroot: > > > https://svn.nixos.org/repos/nix/nixpkgs/trunk/pkgs/servers/http/myserver/tests-in-chroot.patch > > The second part can probably be applied blindly. For ‘test_homedir’, > you would need to find a way to gracefully handle the case where > /etc/passwd isn’t available/readable. > > Once these are fixed, http://hydra.nixos.org/jobset/gnu/myserver-master > will be happy. Speaking of which, I could enable email notification of > build status changes, if you want. I am going to apply the following patches. At this point, I think you can enable the email notification, if other errors will appear then email flooding will be the right punishment :-) Cheers, Giuseppe >From f73d12eff0e4dcababb077e8a72b468944b2d155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <[email protected]> Date: Tue, 16 Feb 2010 12:02:28 +0100 Subject: [PATCH 1/2] Avoid a DNS lookup. Now TestSocket::testRecv works in a chroot. --- myserver/THANKS | 1 + myserver/tests/test_socket.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/myserver/THANKS b/myserver/THANKS index 0f74f08..3d11452 100644 --- a/myserver/THANKS +++ b/myserver/THANKS @@ -5,4 +5,5 @@ or if you'd prefer a different address be used, please send a note to the bug mailing list. Renato Nunes Bastos <[email protected]> +Ludovic Courtès <[email protected]> Debarshi Ray <[email protected]> diff --git a/myserver/tests/test_socket.cpp b/myserver/tests/test_socket.cpp index 34b15c7..326917c 100644 --- a/myserver/tests/test_socket.cpp +++ b/myserver/tests/test_socket.cpp @@ -178,7 +178,7 @@ static DEFINE_THREAD (testRecvClient, pParam) { int ret; Socket *obj2 = new Socket; - char host[] = "localhost"; + char host[] = "127.0.0.1"; ret = obj2->socket (AF_INET, SOCK_STREAM, 0); CPPUNIT_ASSERT (ret != -1); -- 1.6.6.2 >From 55f8bc1720d6423c53a6d2434441372ca0768d0c Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano <[email protected]> Date: Tue, 16 Feb 2010 12:22:02 +0100 Subject: [PATCH 2/2] TestHomeDir::testGetAdmin passes if the user is not found. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported by: Ludovic Courtès <[email protected]> --- myserver/tests/test_homedir.cpp | 22 +++++++++++++++++++++- 1 files changed, 21 insertions(+), 1 deletions(-) diff --git a/myserver/tests/test_homedir.cpp b/myserver/tests/test_homedir.cpp index fa3f36b..612752e 100644 --- a/myserver/tests/test_homedir.cpp +++ b/myserver/tests/test_homedir.cpp @@ -17,11 +17,14 @@ #include "myserver.h" #include <include/base/home_dir/home_dir.h> +#include <include/base/file/files_utility.h> #include <cppunit/CompilerOutputter.h> #include <cppunit/extensions/TestFactoryRegistry.h> #include <cppunit/ui/text/TestRunner.h> #include <cppunit/extensions/HelperMacros.h> +#include <errno.h> + class TestHomeDir : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE ( TestHomeDir ); @@ -60,7 +63,24 @@ public: #endif string dir; - CPPUNIT_ASSERT_EQUAL (homeDir->getHomeDir (username, dir), 0); +#if !WIN32 + errno = 0; +#endif + + int ret = homeDir->getHomeDir (username, dir); + + /* FIXME: handle this case in homeDir::getHomeDir. */ +#if GETPWNAM + /* If the user could not be found, silently return. */ + if (ret && (errno == ENOENT || errno == ESRCH || errno == EBADF + || errno == EPERM)) + return; +#elif !WIN32 + if (! FilesUtility::fileExists ("/etc/passwd")) + return; +#endif + + CPPUNIT_ASSERT_EQUAL (ret, 0); CPPUNIT_ASSERT (dir.length ()); -- 1.6.6.2
