diff options
author | jonathan <jonathan@FreeBSD.org> | 2014-06-20 17:14:59 +0000 |
---|---|---|
committer | jonathan <jonathan@FreeBSD.org> | 2014-06-20 17:14:59 +0000 |
commit | 67c7333f6441bd61161019503af39cc3d61539b9 (patch) | |
tree | 08a9d7a51acb910a6fb5b937ac507889dd179957 /libexec/rtld-elf/tests/target | |
parent | ab3c0264998c57f6cb943e584be2ac021694102f (diff) | |
download | FreeBSD-src-67c7333f6441bd61161019503af39cc3d61539b9.zip FreeBSD-src-67c7333f6441bd61161019503af39cc3d61539b9.tar.gz |
Test RTLD's new LD_LIBRARY_PATH_FDS variable.
Test LD_LIBRARY_PATH_FDS by linking a binary that requires a shared
library that isn't in any of the usual search paths. Ensure this fails
when we don't supply LD_LIBRARY_PATH_FDS or we pass invalid information
in it. Ensure it works when we pass the correct directory in various
places in the variable.
Approved by: rwatson (mentor)
MFC after: 3 weeks
Sponsored by: DARPA/AFRL
Diffstat (limited to 'libexec/rtld-elf/tests/target')
-rw-r--r-- | libexec/rtld-elf/tests/target/Makefile | 13 | ||||
-rw-r--r-- | libexec/rtld-elf/tests/target/target.c | 39 |
2 files changed, 52 insertions, 0 deletions
diff --git a/libexec/rtld-elf/tests/target/Makefile b/libexec/rtld-elf/tests/target/Makefile new file mode 100644 index 0000000..0ae8c1d --- /dev/null +++ b/libexec/rtld-elf/tests/target/Makefile @@ -0,0 +1,13 @@ +# $FreeBSD$ + +.include <bsd.own.mk> + +PROG= target +BINDIR= ${TESTSBASE}${TESTSDIR}/libexec/rtld-elf + +CFLAGS+= -I${.CURDIR}/../libpythagoras +LDADD= -L${.OBJDIR}/../libpythagoras -lpythagoras + +MAN= + +.include <bsd.prog.mk> diff --git a/libexec/rtld-elf/tests/target/target.c b/libexec/rtld-elf/tests/target/target.c new file mode 100644 index 0000000..e88b899 --- /dev/null +++ b/libexec/rtld-elf/tests/target/target.c @@ -0,0 +1,39 @@ +/*- + * Copyright 2014 Jonathan Anderson. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include "pythagoras.h" + +#include <stdio.h> + +int +main(int argc, char *argv[]) +{ + float hypotenuse = pythagorean_theorem(3, 4); + printf("the hypotenuse of 3 and 4 is %d\n", (int) hypotenuse); + + return 0; +} |