diff options
Diffstat (limited to 'tests/test_rpath_rpath_get.c')
-rw-r--r-- | tests/test_rpath_rpath_get.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_rpath_rpath_get.c b/tests/test_rpath_rpath_get.c new file mode 100644 index 0000000..c8e573b --- /dev/null +++ b/tests/test_rpath_rpath_get.c @@ -0,0 +1,21 @@ +#include "spm.h" +#include "framework.h" + +const char *testFmt = "returned '%s', expected '%s'\n"; + +int main(int argc, char *argv[]) { + int retval_lib = 0; + int retval_bin = 0; + char *filename_lib = mock_image(AS_MOCK_LIB, "libwinning", (char *[]) {"-L/usr/lib", "-lz", NULL}, &retval_lib); + char *filename_bin = mock_image(AS_MOCK_BIN, "winning", (char *[]) {"-L.", "-lwinning", NULL}, &retval_bin); + char *rpath_lib = rpath_get(filename_lib); + char *rpath_bin = rpath_get(filename_bin); + + myassert(retval_lib == 0, "mock library build failed with code: %d\n", retval_lib); + myassert(strcmp(dirname(filename_lib), rpath_lib) == 0, testFmt, dirname(filename_lib), rpath_lib); + + myassert(retval_lib == 0, "mock executable build failed with code: %d\n", retval_bin); + myassert(strcmp(dirname(filename_bin), rpath_bin) == 0, testFmt, dirname(filename_bin), rpath_bin); + + return 0; +}
\ No newline at end of file |