From owner-svn-src-all@FreeBSD.ORG Mon Aug 4 05:45:10 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 59921B4E for ; Mon, 4 Aug 2014 05:45:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A8D0222D for ; Mon, 4 Aug 2014 05:45:10 +0000 (UTC) Received: from ngie (uid 1347) (envelope-from ngie@FreeBSD.org) id 580b by svn.freebsd.org (DragonFly Mail Agent v0.9+); Mon, 04 Aug 2014 05:45:09 +0000 From: Garrett Cooper Date: Mon, 4 Aug 2014 05:45:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269503 - head/libexec/rtld-elf/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53df1de6.580b.1280cbff@svn.freebsd.org> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Aug 2014 05:45:10 -0000 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 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);