Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Aug 2014 05:45:09 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r269503 - head/libexec/rtld-elf/tests
Message-ID:  <53df1de6.580b.1280cbff@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Mon Aug  4 05:45:09 2014
New Revision: 269503
URL: http://svnweb.freebsd.org/changeset/base/269503

Log:
  Remove hardcoded path to TESTSDIR (Makefile, ld_library_pathfds.c) at
  build time by using atf_tc_get_config_var(tc, "srcdir"))
  
  This will allow end-users to move the binaries to different locations
  after they've been built without having to rebuild the binaries with
  the new paths
  
  Phabric: D525 (part of a larger patch)
  
  Reviewed by: jmmv
  Approved by: jmmv (co-mentor)

Modified:
  head/libexec/rtld-elf/tests/Makefile
  head/libexec/rtld-elf/tests/ld_library_pathfds.c

Modified: head/libexec/rtld-elf/tests/Makefile
==============================================================================
--- head/libexec/rtld-elf/tests/Makefile	Mon Aug  4 05:40:51 2014	(r269502)
+++ head/libexec/rtld-elf/tests/Makefile	Mon Aug  4 05:45:09 2014	(r269503)
@@ -9,6 +9,4 @@ SUBDIR+=	libpythagoras target
 
 ATF_TESTS_C=	ld_library_pathfds
 
-CFLAGS+=	 -DTESTSDIR="\"${TESTSDIR}\""
-
 .include <bsd.test.mk>

Modified: head/libexec/rtld-elf/tests/ld_library_pathfds.c
==============================================================================
--- head/libexec/rtld-elf/tests/ld_library_pathfds.c	Mon Aug  4 05:40:51 2014	(r269502)
+++ head/libexec/rtld-elf/tests/ld_library_pathfds.c	Mon Aug  4 05:45:09 2014	(r269503)
@@ -38,7 +38,7 @@ struct descriptors {
 	int	usr;
 };
 
-static void	setup(struct descriptors *);
+static void	setup(struct descriptors *, const atf_tc_t *);
 static void	expect_success(int binary, char *pathfds);
 static void	expect_missing_library(int binary, char *pathfds);
 
@@ -53,7 +53,7 @@ ATF_TC_BODY(missing_library, tc)
 {
 	struct descriptors files;
 
-	setup(&files);
+	setup(&files, tc);
 	expect_missing_library(files.binary, NULL);
 }
 
@@ -64,7 +64,7 @@ ATF_TC_BODY(wrong_library_directories, t
 	struct descriptors files;
 	char *pathfds;
 
-	setup(&files);
+	setup(&files, tc);
 	ATF_REQUIRE(
 		asprintf(&pathfds, "LD_LIBRARY_PATH_FDS=%d", files.etc) > 0);
 
@@ -78,7 +78,7 @@ ATF_TC_BODY(bad_library_directories, tc)
 	struct descriptors files;
 	char *pathfds;
 
-	setup(&files);
+	setup(&files, tc);
 	ATF_REQUIRE(asprintf(&pathfds, "::", files.etc) > 0);
 
 	expect_missing_library(files.binary, pathfds);
@@ -91,7 +91,7 @@ ATF_TC_BODY(single_library_directory, tc
 	struct descriptors files;
 	char *pathfds;
 
-	setup(&files);
+	setup(&files, tc);
 	ATF_REQUIRE(
 	    asprintf(&pathfds, "LD_LIBRARY_PATH_FDS=%d", files.testdir) > 0);
 
@@ -105,7 +105,7 @@ ATF_TC_BODY(first_library_directory, tc)
 	struct descriptors files;
 	char *pathfds;
 
-	setup(&files);
+	setup(&files, tc);
 	ATF_REQUIRE(
 	    asprintf(&pathfds, "LD_LIBRARY_PATH_FDS=%d:%d",
 		files.testdir, files.etc) > 0);
@@ -120,7 +120,7 @@ ATF_TC_BODY(middle_library_directory, tc
 	struct descriptors files;
 	char *pathfds;
 
-	setup(&files);
+	setup(&files, tc);
 	ATF_REQUIRE(
 	    asprintf(&pathfds, "LD_LIBRARY_PATH_FDS=%d:%d:%d",
 		files.root, files.testdir, files.usr) > 0);
@@ -135,7 +135,7 @@ ATF_TC_BODY(last_library_directory, tc)
 	struct descriptors files;
 	char *pathfds;
 
-	setup(&files);
+	setup(&files, tc);
 	ATF_REQUIRE(
 	    asprintf(&pathfds, "LD_LIBRARY_PATH_FDS=%d:%d",
 		files.root, files.testdir) > 0);
@@ -161,10 +161,11 @@ ATF_TP_ADD_TCS(tp)
 
 
 static void
-setup(struct descriptors *dp)
+setup(struct descriptors *dp, const atf_tc_t *tc)
 {
 
-	ATF_REQUIRE((dp->testdir = opendir(TESTSDIR)) >= 0);
+	dp->testdir = opendir(atf_tc_get_config_var(tc, "srcdir"));
+	ATF_REQUIRE(dp->testdir >= 0);
 	ATF_REQUIRE(
 	    (dp->binary = openat(dp->testdir, "target", O_RDONLY)) >= 0);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53df1de6.580b.1280cbff>