diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Makefile | 2 | ||||
| -rw-r--r-- | tests/test_realpath.c | 11 | ||||
| -rw-r--r-- | tests/test_realpath_null.c | 11 |
3 files changed, 24 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile index 81f7f6e..9c2dede 100644 --- a/tests/Makefile +++ b/tests/Makefile | |||
| @@ -61,6 +61,8 @@ RUNTIME_TARGETS= \ | |||
| 61 | test_read_static \ | 61 | test_read_static \ |
| 62 | test_readlink_dynamic \ | 62 | test_readlink_dynamic \ |
| 63 | test_readlink_static \ | 63 | test_readlink_static \ |
| 64 | test_realpath_null \ | ||
| 65 | test_realpath \ | ||
| 64 | test_recv_dynamic \ | 66 | test_recv_dynamic \ |
| 65 | test_recv_static \ | 67 | test_recv_static \ |
| 66 | test_recvfrom_dynamic \ | 68 | test_recvfrom_dynamic \ |
diff --git a/tests/test_realpath.c b/tests/test_realpath.c new file mode 100644 index 0000000..2a17708 --- /dev/null +++ b/tests/test_realpath.c | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <stdlib.h> | ||
| 4 | #include <stdio.h> | ||
| 5 | |||
| 6 | int main(int argc, char** argv) { | ||
| 7 | char buf[PATH_MAX]; | ||
| 8 | char* rpath = realpath("/root/../", buf); | ||
| 9 | printf("%s\n", rpath); | ||
| 10 | return 0; | ||
| 11 | } | ||
diff --git a/tests/test_realpath_null.c b/tests/test_realpath_null.c new file mode 100644 index 0000000..b62cee8 --- /dev/null +++ b/tests/test_realpath_null.c | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <stdlib.h> | ||
| 4 | #include <stdio.h> | ||
| 5 | |||
| 6 | int main(int argc, char** argv) { | ||
| 7 | char* rpath = realpath("/root/../", NULL); | ||
| 8 | printf("%s\n", rpath); | ||
| 9 | free(rpath); | ||
| 10 | return 0; | ||
| 11 | } | ||
