aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-10-21 22:38:12 -0400
committerMike Frysinger <vapier@gentoo.org>2021-10-21 22:47:38 -0400
commit2f6a725d660c61230de21748effa685ee9b3cdaa (patch)
tree32c001208e752a109eef2a917f163f89a851df07 /tests
parentbump to sandbox-2.27 (diff)
downloadsandbox-2f6a725d660c61230de21748effa685ee9b3cdaa.tar.gz
sandbox-2f6a725d660c61230de21748effa685ee9b3cdaa.tar.bz2
sandbox-2f6a725d660c61230de21748effa685ee9b3cdaa.zip
libsandbox: add renameat2 wrapper
It's basically renameat at this point as we don't care about the flags. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/renameat2-0.c22
-rwxr-xr-xtests/renameat2-1.sh8
-rw-r--r--tests/renameat2.at3
4 files changed, 34 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c899603..e47c996 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -57,6 +57,7 @@ check_PROGRAMS = \
remove-0 \
rename-0 \
renameat-0 \
+ renameat2-0 \
rmdir-0 \
signal_static-0 \
symlink-0 \
diff --git a/tests/renameat2-0.c b/tests/renameat2-0.c
new file mode 100644
index 0000000..6041d69
--- /dev/null
+++ b/tests/renameat2-0.c
@@ -0,0 +1,22 @@
+#define CONFIG HAVE_RENAMEAT2
+#define FUNC renameat2
+#define SFUNC "renameat2"
+#define FUNC_STR "%i, \"%s\", %i, \"%s\", %i"
+#define FUNC_IMP olddirfd, oldpath, newdirfd, newpath, 0
+#define ARG_CNT 4
+#define ARG_USE "<dirfd>(old) <path>(old) <dirfd>(new) <path>(new)"
+
+#define process_args() \
+ s = argv[i++]; \
+ int olddirfd = at_get_fd(s); \
+ \
+ s = argv[i++]; \
+ char *oldpath = s; \
+ \
+ s = argv[i++]; \
+ int newdirfd = at_get_fd(s); \
+ \
+ s = argv[i++]; \
+ char *newpath = s;
+
+#include "test-skel-0.c"
diff --git a/tests/renameat2-1.sh b/tests/renameat2-1.sh
new file mode 100755
index 0000000..9f91c05
--- /dev/null
+++ b/tests/renameat2-1.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+# basic functionality check
+
+addwrite $PWD
+
+touch old || exit 1
+renameat2-0 0 AT_FDCWD old AT_FDCWD new || exit 1
+[ ! -e old -a -e new ]
diff --git a/tests/renameat2.at b/tests/renameat2.at
new file mode 100644
index 0000000..eec4638
--- /dev/null
+++ b/tests/renameat2.at
@@ -0,0 +1,3 @@
+SB_CHECK(1)
+SB_CHECK(2)
+SB_CHECK(3)