[PATCH 1/3] Allow running tests in a build directory different from source directory.

Tomash Brechko tomash.brechko at gmail.com
Wed Nov 7 13:12:17 UTC 2007


diff --git a/trunk/server/Makefile.am b/trunk/server/Makefile.am
index e92e9e7..bec67d3 100644
--- a/trunk/server/Makefile.am
+++ b/trunk/server/Makefile.am
@@ -11,7 +11,7 @@ DIST_DIRS = scripts
 EXTRA_DIST = doc scripts TODO t memcached.spec
 
 test:	memcached-debug
-	prove t
+	prove $(srcdir)/t
 
 dist-hook:
 	rm -rf $(distdir)/doc/.svn/
diff --git a/trunk/server/t/lib/MemcachedTest.pm b/trunk/server/t/lib/MemcachedTest.pm
index 7d28a52..2954644 100644
--- a/trunk/server/t/lib/MemcachedTest.pm
+++ b/trunk/server/t/lib/MemcachedTest.pm
@@ -3,10 +3,15 @@ use strict;
 use IO::Socket::INET;
 use IO::Socket::UNIX;
 use Exporter 'import';
-use FindBin qw($Bin);
 use Carp qw(croak);
 use vars qw(@EXPORT);
 
+# Instead of doing the substitution with Autoconf, we assume that
+# cwd == builddir.
+use Cwd;
+my $builddir = getcwd;
+
+
 @EXPORT = qw(new_memcached sleep mem_get_is mem_gets mem_gets_is mem_stats free_port);
 
 sub sleep {
@@ -131,7 +136,7 @@ sub free_port {
 }
 
 sub supports_udp {
-    my $output = `$Bin/../memcached-debug -h`;
+    my $output = `$builddir/memcached-debug -h`;
     return 0 if $output =~ /^memcached 1\.1\./;
     return 1;
 }
@@ -149,7 +154,7 @@ sub new_memcached {
     }
     my $childpid = fork();
 
-    my $exe = "$Bin/../memcached-debug";
+    my $exe = "$builddir/memcached-debug";
     croak("memcached binary doesn't exist.  Haven't run 'make' ?\n") unless -e $exe;
     croak("memcached binary not executable\n") unless -x _;
 
-- 
1.5.3.5.529.ge3d6d


More information about the memcached mailing list