summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-09-29 12:03:56 (GMT)
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-09-29 12:03:56 (GMT)
commit0da4ea8b6510e0d00ccf1eb0c52599532d8c4bb3 (patch)
treedf46cf02ddc181cc75db90055bf9d4ed1aa96e79 /tests
parent0177cc4483979b5b216240e0b1340ce97dd84113 (diff)
downloadpatchelf-0da4ea8b6510e0d00ccf1eb0c52599532d8c4bb3.zip
patchelf-0da4ea8b6510e0d00ccf1eb0c52599532d8c4bb3.tar.gz
patchelf-0da4ea8b6510e0d00ccf1eb0c52599532d8c4bb3.tar.bz2
* Add tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am27
-rw-r--r--tests/bar.c7
-rw-r--r--tests/foo.c9
-rw-r--r--tests/main.c13
-rwxr-xr-xtests/plain-fail.sh2
-rwxr-xr-xtests/plain-run.sh7
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