diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-03-08 07:35:32 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-03-08 09:11:14 -0400 |
commit | d4dee0ebe39627e9d3b90c312f770d7ba73a46f5 (patch) | |
tree | b5613010981c5561febfd3b6dd07076b375a5364 /tests/test-skel-0.c | |
parent | libsandbox: handle symlinks properly (diff) | |
download | sandbox-d4dee0ebe39627e9d3b90c312f770d7ba73a46f5.tar.gz sandbox-d4dee0ebe39627e9d3b90c312f770d7ba73a46f5.tar.bz2 sandbox-d4dee0ebe39627e9d3b90c312f770d7ba73a46f5.zip |
tests: add symlink tests and unify code
Add test cases for symlink behavior and unify some of the test code to
make adding more test cases even easier.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'tests/test-skel-0.c')
-rw-r--r-- | tests/test-skel-0.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/tests/test-skel-0.c b/tests/test-skel-0.c index c782704..0fcb17b 100644 --- a/tests/test-skel-0.c +++ b/tests/test-skel-0.c @@ -4,6 +4,25 @@ # define CONFIG 1 #endif +int at_get_fd(const char *str_dirfd) +{ + if (!strcmp(str_dirfd, "AT_FDCWD")) + return AT_FDCWD; + else + return atoi(str_dirfd); +} + +int at_get_flags(const char *str_flags) +{ + if (!strcmp(str_flags, "AT_SYMLINK_NOFOLLOW")) + return AT_SYMLINK_NOFOLLOW; + else { + int flags = 0; + sscanf(str_flags, "%i", &flags); + return flags; + } +} + int main(int argc, char *argv[]) { #if CONFIG @@ -23,12 +42,12 @@ int main(int argc, char *argv[]) char *s; s = argv[i++]; - int ret = atoi(s); + long ret = atoi(s); process_args(); - int actual_ret = (int)FUNC(FUNC_IMP); - printf("%s: " SFUNC "(" FUNC_STR ") = %i (wanted %i)\n", + long actual_ret = (long)FUNC(FUNC_IMP); + printf("%s: " SFUNC "(" FUNC_STR ") = %li (wanted %li)\n", (actual_ret == ret) ? "PASS" : "FAIL", FUNC_IMP, actual_ret, ret); if (actual_ret != ret) ++test_ret; @@ -37,6 +56,6 @@ int main(int argc, char *argv[]) return test_ret; #else puts("not implemented"); - return 0; + return 77; #endif } |