diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-09-29 12:03:56 (GMT) |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-09-29 12:03:56 (GMT) |
commit | 0da4ea8b6510e0d00ccf1eb0c52599532d8c4bb3 (patch) | |
tree | df46cf02ddc181cc75db90055bf9d4ed1aa96e79 /tests | |
parent | 0177cc4483979b5b216240e0b1340ce97dd84113 (diff) | |
download | patchelf-0da4ea8b6510e0d00ccf1eb0c52599532d8c4bb3.zip patchelf-0da4ea8b6510e0d00ccf1eb0c52599532d8c4bb3.tar.gz patchelf-0da4ea8b6510e0d00ccf1eb0c52599532d8c4bb3.tar.bz2 |
* Add tests.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 27 | ||||
-rw-r--r-- | tests/bar.c | 7 | ||||
-rw-r--r-- | tests/foo.c | 9 | ||||
-rw-r--r-- | tests/main.c | 13 | ||||
-rwxr-xr-x | tests/plain-fail.sh | 2 | ||||
-rwxr-xr-x | tests/plain-run.sh | 7 |
6 files changed, 65 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..fc92ab3 --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,27 @@ +check_PROGRAMS = main + +TESTS = plain-run.sh $(XFAIL_TESTS) + +XFAIL_TESTS = plain-fail.sh + + +main: main.o libfoo.so + LD_LIBRARY_PATH=. $(CC) -o main main.o -L . -lfoo + +main.o: main.c + $(CC) -fpic -o main.o -c main.c + +libfoo.so: foo.o libbar.so + $(CC) -shared -o libfoo.so foo.o -L . -lbar + +foo.o: foo.c + $(CC) -fpic -o foo.o -c foo.c + +libbar.so: bar.o + $(CC) -shared -o libbar.so bar.o -L . + +bar.o: bar.c + $(CC) -fpic -o bar.o -c bar.c + +clean-local: + $(RM) *.o libfoo.so libbar.so main diff --git a/tests/bar.c b/tests/bar.c new file mode 100644 index 0000000..5012310 --- /dev/null +++ b/tests/bar.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int bar() +{ + printf("This is bar()!\n"); + return 34; +} diff --git a/tests/foo.c b/tests/foo.c new file mode 100644 index 0000000..be71954 --- /dev/null +++ b/tests/foo.c @@ -0,0 +1,9 @@ +#include <stdio.h> + +int bar(); + +int foo() +{ + printf("This is foo()!\n"); + return 12 + bar(); +} diff --git a/tests/main.c b/tests/main.c new file mode 100644 index 0000000..8d71605 --- /dev/null +++ b/tests/main.c @@ -0,0 +1,13 @@ +#include <stdio.h> + +char buf[16 * 1024 * 1024]; + +int foo(); + +int main(int argc, char * * argv) +{ + printf("Hello World\n"); + int x = foo(); + printf("Result is %d\n", x); + return x; +} diff --git a/tests/plain-fail.sh b/tests/plain-fail.sh new file mode 100755 index 0000000..b8021bc --- /dev/null +++ b/tests/plain-fail.sh @@ -0,0 +1,2 @@ +#! /bin/sh +./main diff --git a/tests/plain-run.sh b/tests/plain-run.sh new file mode 100755 index 0000000..e092956 --- /dev/null +++ b/tests/plain-run.sh @@ -0,0 +1,7 @@ +#! /bin/sh +LD_LIBRARY_PATH=. ./main +exitCode=$? +if test "$exitCode" != 46; then + echo "bad exit code!" + exit 1 +fi |