public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2016-03-29 12:24 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2016-03-29 12:24 UTC (permalink / raw
  To: gentoo-commits

commit:     e10203aa97bae3060606a9115cd42aaf0c5e0bd9
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 29 09:22:56 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Mar 29 09:22:56 2016 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=e10203aa

tests: make all shell scripts executable

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 tests/mkdtemp-1.sh     | 0
 tests/mkostemp-1.sh    | 0
 tests/mkostemp64-1.sh  | 0
 tests/mkostemps-1.sh   | 0
 tests/mkostemps64-1.sh | 0
 tests/mkstemp-1.sh     | 0
 tests/mkstemp64-1.sh   | 0
 tests/mkstemps-1.sh    | 0
 tests/mkstemps64-1.sh  | 0
 9 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/tests/mkdtemp-1.sh b/tests/mkdtemp-1.sh
old mode 100644
new mode 100755

diff --git a/tests/mkostemp-1.sh b/tests/mkostemp-1.sh
old mode 100644
new mode 100755

diff --git a/tests/mkostemp64-1.sh b/tests/mkostemp64-1.sh
old mode 100644
new mode 100755

diff --git a/tests/mkostemps-1.sh b/tests/mkostemps-1.sh
old mode 100644
new mode 100755

diff --git a/tests/mkostemps64-1.sh b/tests/mkostemps64-1.sh
old mode 100644
new mode 100755

diff --git a/tests/mkstemp-1.sh b/tests/mkstemp-1.sh
old mode 100644
new mode 100755

diff --git a/tests/mkstemp64-1.sh b/tests/mkstemp64-1.sh
old mode 100644
new mode 100755

diff --git a/tests/mkstemps-1.sh b/tests/mkstemps-1.sh
old mode 100644
new mode 100755

diff --git a/tests/mkstemps64-1.sh b/tests/mkstemps64-1.sh
old mode 100644
new mode 100755


^ permalink raw reply	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2023-07-01 23:52 Mike Gilbert
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Gilbert @ 2023-07-01 23:52 UTC (permalink / raw
  To: gentoo-commits

commit:     e5032c6b89621db0475e36fb06c2905b6a9c024c
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Jul  1 20:52:34 2023 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Sat Jul  1 23:51:18 2023 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=e5032c6b

tests: use explicit adddeny() calls in fchmod and fchown tests.

When running the test suite under portage, the entire build directory
will be writable because portage adds PORTAGE_TMPDIR to SANDBOX_WRITE
(thanks floppym). This breaks the tests for these two wrappers, since
they expect to fail when trying to write above $PWD.

To avoid that, we create a new file to call fchown/fchmod on, and then
explicitly deny access to it.

Closes: https://bugs.gentoo.org/909445
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 tests/fchmod-1.sh | 6 +++++-
 tests/fchown-1.sh | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tests/fchmod-1.sh b/tests/fchmod-1.sh
index db404ba..140d84f 100755
--- a/tests/fchmod-1.sh
+++ b/tests/fchmod-1.sh
@@ -4,11 +4,15 @@
 #
 
 addwrite $PWD
+rm -f deny || exit 1
+touch deny || exit 1
+adddeny $PWD/deny
 
 # The sandbox doesn't log anything when it returns a junk file
 # descriptor? It doesn't look like we can test the contents of
 # sandbox.log here... instead, we just have to count on fchmod
 # failing, which it does if you use O_RDWR, and it *should* if you use
 # O_RDONLY (because that won't stop the change of permissions).
-fchmod-0 $(stat --format='%#04a' ../..) ../.. && exit 1
+fchmod-0 $(stat --format='%#04a' $PWD/deny) $PWD/deny && exit 1
+
 exit 0

diff --git a/tests/fchown-1.sh b/tests/fchown-1.sh
index 1b4a173..6c1178e 100755
--- a/tests/fchown-1.sh
+++ b/tests/fchown-1.sh
@@ -4,11 +4,15 @@
 #
 
 addwrite $PWD
+rm -f deny || exit 1
+touch deny || exit 1
+adddeny $PWD/deny
 
 # The sandbox doesn't log anything when it returns a junk file
 # descriptor? It doesn't look like we can test the contents of
 # sandbox.log here... instead, we just have to count on fchown
 # failing, which it does if you use O_RDWR, and it *should* if you use
 # O_RDONLY (because that won't stop the change of ownership).
-fchown-0 ${SB_UID} ${SB_GID} ../.. && exit 1
+fchown-0 ${SB_UID} ${SB_GID} $PWD/deny && exit 1
+
 exit 0


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2023-06-22 13:54 Mike Gilbert
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Gilbert @ 2023-06-22 13:54 UTC (permalink / raw
  To: gentoo-commits

commit:     05e32f542c145253eb01ae4005ca13c63a1c79d8
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 28 01:05:02 2018 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Thu Jun 22 13:54:38 2023 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=05e32f54

tests: add test case for fchown/fchmod with O_RDONLY.

Bug: https://bugs.gentoo.org/599706
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 tests/fchmod-0.c  | 35 +++++++++++++++++++++++++++++++++++
 tests/fchmod-1.sh | 14 ++++++++++++++
 tests/fchmod.at   |  1 +
 tests/fchown-0.c  | 34 ++++++++++++++++++++++++++++++++++
 tests/fchown-1.sh | 14 ++++++++++++++
 tests/fchown.at   |  1 +
 tests/local.mk    |  2 ++
 7 files changed, 101 insertions(+)

diff --git a/tests/fchmod-0.c b/tests/fchmod-0.c
new file mode 100644
index 0000000..de0c237
--- /dev/null
+++ b/tests/fchmod-0.c
@@ -0,0 +1,35 @@
+/*
+ * https://bugs.gentoo.org/599706
+ *
+ */
+
+#include "headers.h"
+
+int main(int argc, char *argv[])
+{
+	if (argc < 2)
+		return -2;
+
+	int mode = 0;
+	sscanf(argv[1], "%i", &mode);
+	/* The sandbox catches this:
+	 *
+	 *   int fd = open(argv[2], O_RDWR);
+	 *
+	 * And it /should/ catch this:
+	 *
+	 *    int fd = open(argv[2], O_RDONLY);
+	 *
+	 * ...but the latter only works when /proc/self/fd/%i
+	 * is available.
+	 *
+	 */
+#ifdef SANDBOX_PROC_SELF_FD
+	int fd = open(argv[2], O_RDONLY);
+#else
+	int fd = open(argv[2], O_RDWR);
+#endif
+	int fchmod_result = fchmod(fd, (mode_t)mode);
+	close(fd);
+	return fchmod_result;
+}

diff --git a/tests/fchmod-1.sh b/tests/fchmod-1.sh
new file mode 100755
index 0000000..db404ba
--- /dev/null
+++ b/tests/fchmod-1.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# https://bugs.gentoo.org/599706
+#
+
+addwrite $PWD
+
+# The sandbox doesn't log anything when it returns a junk file
+# descriptor? It doesn't look like we can test the contents of
+# sandbox.log here... instead, we just have to count on fchmod
+# failing, which it does if you use O_RDWR, and it *should* if you use
+# O_RDONLY (because that won't stop the change of permissions).
+fchmod-0 $(stat --format='%#04a' ../..) ../.. && exit 1
+exit 0

diff --git a/tests/fchmod.at b/tests/fchmod.at
new file mode 100644
index 0000000..081d7d2
--- /dev/null
+++ b/tests/fchmod.at
@@ -0,0 +1 @@
+SB_CHECK(1)

diff --git a/tests/fchown-0.c b/tests/fchown-0.c
new file mode 100644
index 0000000..7fdca73
--- /dev/null
+++ b/tests/fchown-0.c
@@ -0,0 +1,34 @@
+/*
+ * https://bugs.gentoo.org/599706
+ *
+ */
+
+#include "headers.h"
+
+int main(int argc, char *argv[])
+{
+	if (argc < 3)
+		return -2;
+
+	uid_t uid = atoi(argv[1]);
+	gid_t gid = atoi(argv[2]);
+	/* The sandbox catches this:
+	 *
+	 *   int fd = open(argv[3], O_RDWR);
+	 *
+	 * And it /should/ catch this:
+	 *
+	 *    int fd = open(argv[3], O_RDONLY);
+	 *
+	 * ...but the latter only works when /proc/self/fd/%i
+	 * is available.
+	 */
+#ifdef SANDBOX_PROC_SELF_FD
+	int fd = open(argv[3], O_RDONLY);
+#else
+	int fd = open(argv[3], O_RDWR);
+#endif
+	int fchown_result = fchown(fd, uid, gid);
+	close(fd);
+	return fchown_result;
+}

diff --git a/tests/fchown-1.sh b/tests/fchown-1.sh
new file mode 100755
index 0000000..1b4a173
--- /dev/null
+++ b/tests/fchown-1.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# https://bugs.gentoo.org/599706
+#
+
+addwrite $PWD
+
+# The sandbox doesn't log anything when it returns a junk file
+# descriptor? It doesn't look like we can test the contents of
+# sandbox.log here... instead, we just have to count on fchown
+# failing, which it does if you use O_RDWR, and it *should* if you use
+# O_RDONLY (because that won't stop the change of ownership).
+fchown-0 ${SB_UID} ${SB_GID} ../.. && exit 1
+exit 0

diff --git a/tests/fchown.at b/tests/fchown.at
new file mode 100644
index 0000000..081d7d2
--- /dev/null
+++ b/tests/fchown.at
@@ -0,0 +1 @@
+SB_CHECK(1)

diff --git a/tests/local.mk b/tests/local.mk
index 046cf6f..f1f4ac0 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -29,7 +29,9 @@ check_PROGRAMS += \
 	%D%/execv-0 \
 	%D%/execvp-0 \
 	%D%/faccessat-0 \
+	%D%/fchmod-0 \
 	%D%/fchmodat-0 \
+	%D%/fchown-0 \
 	%D%/fchownat-0 \
 	%D%/fopen-0 \
 	%D%/fopen64-0 \


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2023-06-22 13:54 Mike Gilbert
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Gilbert @ 2023-06-22 13:54 UTC (permalink / raw
  To: gentoo-commits

commit:     652097eb4228ac9ba9973811b2832fc77f2048a2
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 28 03:38:26 2018 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Thu Jun 22 13:54:38 2023 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=652097eb

tests: add more tests to make sure fchown/fchmod are handled correctly.

Closes: https://bugs.gentoo.org/599706
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 tests/fchmod-2.sh | 11 +++++++++++
 tests/fchmod.at   |  1 +
 tests/fchown-2.sh | 11 +++++++++++
 tests/fchown.at   |  1 +
 4 files changed, 24 insertions(+)

diff --git a/tests/fchmod-2.sh b/tests/fchmod-2.sh
new file mode 100755
index 0000000..96d7cc9
--- /dev/null
+++ b/tests/fchmod-2.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# Ensure that fchmod() doesn't trigger spurious violations in the most
+# basic of cases.
+#
+addwrite $PWD
+
+# This should not trigger a violation.
+rm -f file
+touch file
+fchmod-0 0644 file || exit 1

diff --git a/tests/fchmod.at b/tests/fchmod.at
index 081d7d2..d364b4b 100644
--- a/tests/fchmod.at
+++ b/tests/fchmod.at
@@ -1 +1,2 @@
 SB_CHECK(1)
+SB_CHECK(2)

diff --git a/tests/fchown-2.sh b/tests/fchown-2.sh
new file mode 100755
index 0000000..dedfbe4
--- /dev/null
+++ b/tests/fchown-2.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# Ensure that fchown() doesn't trigger spurious violations in the most
+# basic of cases.
+#
+addwrite $PWD
+
+# This should not trigger a violation.
+rm -f file
+touch file
+fchown-0 ${SB_UID} ${SB_GID} file || exit 1

diff --git a/tests/fchown.at b/tests/fchown.at
index 081d7d2..d364b4b 100644
--- a/tests/fchown.at
+++ b/tests/fchown.at
@@ -1 +1,2 @@
 SB_CHECK(1)
+SB_CHECK(2)


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2021-11-03 19:13 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2021-11-03 19:13 UTC (permalink / raw
  To: gentoo-commits

commit:     369fc5965ce5065f2653225627f61442641c5bef
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Nov  3 19:11:33 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Nov  3 19:11:33 2021 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=369fc596

tests: skip static children tests when YAMA ptrace_scope is enabled

Since we can't trace static children under certain YAMA ptrace_scope
settings, skip tests that rely on that functionality.

Closes: https://bugs.gentoo.org/821418
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 tests/atlocal.in   | 9 +++++++++
 tests/script-17.sh | 8 +++++++-
 tests/script-8.sh  | 3 +++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/tests/atlocal.in b/tests/atlocal.in
index e8213c0..adf3bad 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -42,5 +42,14 @@ case "${MAKEFLAGS}" in
 	;;
 esac
 
+# Figure out currently YAMA ptrace_scope restriction level.
+at_yama_ptrace_scope=$(cat /proc/sys/kernel/yama/ptrace_scope 2>/dev/null || echo 0)
+if [ ${at_yama_ptrace_scope} -gt 0 ] ; then
+	if [ "$(id -u)" -eq 0 ] ; then
+		at_yama_ptrace_scope=0
+	fi
+fi
+export at_yama_ptrace_scope
+
 # This script must finish with ($? == 0) else the autotest runner gets upset.
 :

diff --git a/tests/script-17.sh b/tests/script-17.sh
index a8a8f51..83c51f9 100755
--- a/tests/script-17.sh
+++ b/tests/script-17.sh
@@ -10,7 +10,13 @@ adddeny "${PWD}/subdir"
 for child in 0 1 2 3 4 5 ; do
 	fork-follow_tst ${child} subdir/dyn${child} || exit $?
 done
-for child in 0 1 2 3 4 5 ; do
+
+depth="0"
+# We can't trace static children currently with YAMA ptrace_scope 1+.
+if [ ${at_yama_ptrace_scope} -eq 0 ] ; then
+	depth="${depth} 1 2 3 4 5"
+fi
+for child in ${depth} ; do
 	fork-follow_static_tst ${child} subdir/static${child} || exit $?
 done
 

diff --git a/tests/script-8.sh b/tests/script-8.sh
index 6d9de55..9d8ca11 100755
--- a/tests/script-8.sh
+++ b/tests/script-8.sh
@@ -6,6 +6,9 @@ sigsuspend-zsh_tst
 d=$?
 echo "ret = $d"
 
+# We can't trace static children currently with YAMA ptrace_scope 1+.
+[ ${at_yama_ptrace_scope} -gt 0 ] && exit ${d}
+
 sigsuspend-zsh_static_tst
 s=$?
 echo "ret = $s"


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2021-10-24  0:54 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2021-10-24  0:54 UTC (permalink / raw
  To: gentoo-commits

commit:     192ed5f48b728877a46c39523717363df87dec82
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 24 00:53:48 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Oct 24 00:53:48 2021 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=192ed5f4

tests: fix lremovexattr typo

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 tests/lremovexattr-0.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/lremovexattr-0.c b/tests/lremovexattr-0.c
index 4abdfff..ca925f1 100644
--- a/tests/lremovexattr-0.c
+++ b/tests/lremovexattr-0.c
@@ -1,5 +1,5 @@
-#define FUNC removexattr
-#define SFUNC "removexattr"
+#define FUNC lremovexattr
+#define SFUNC "lremovexattr"
 #define FUNC_STR "\"%s\", \"%s\""
 #define FUNC_IMP path, name
 #define ARG_CNT 2


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2021-10-23 22:19 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2021-10-23 22:19 UTC (permalink / raw
  To: gentoo-commits

commit:     38348c15ee54a9d5a6aefeaef9dd41e031271dc0
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 23 22:01:04 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Oct 23 22:17:09 2021 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=38348c15

tests: fix handling of srcdir vs abs_srcdir for dist creation

The paths listed in EXTRA_DIST must be the targets that we define
exactly, or running distcheck can fail with stale targets -- they
should have been generated before creating the dist, but they get
updated afterwards.  This is easy to repro with:
  touch tests/testsuite.at && make distcheck

Let's split the relative & absolute path logic a bit to help with
this.  We should only use relative paths in dependency related
settings, but use absolute paths when running tools after a cd to
a different location.

Also add testsuite.list.at to the dist explicitly.  We were getting
this implicitly via testsuite depending on it, but better to list
all the files exactly.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 tests/local.mk | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/tests/local.mk b/tests/local.mk
index 0aac4f1..aa2acac 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -1,12 +1,16 @@
 AT_FILES = $(wildcard $(top_srcdir)/%D%/*.at)
-TESTSUITE = $(abs_top_srcdir)/%D%/testsuite
 DISTCLEANFILES += %D%/atconfig
 
+# Use top_srcdir for dependencies, and abs_top_srcdir to execute it.
+TESTSUITE = $(top_srcdir)/%D%/testsuite
+ABS_TESTSUITE = $(abs_top_srcdir)/%D%/testsuite
+
 EXTRA_DIST += \
 	$(AT_FILES) \
+	$(TESTSUITE) \
+	$(TESTSUITE_LIST) \
 	%D%/atlocal.in \
 	%D%/package.m4.in \
-	%D%/testsuite \
 	%D%/test-skel-0.c \
 	%D%/tests.h \
 	%D%/xattr-0
@@ -118,23 +122,23 @@ TESTSUITEFLAGS = --jobs=`getconf _NPROCESSORS_ONLN || echo 1`
 tests: $(check_PROGRAMS) $(TESTSUITE)
 
 check-local: %D%/atconfig %D%/atlocal $(TESTSUITE)
-	cd %D% && $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='src:tests' $(TESTSUITEFLAGS)
+	cd %D% && $(SHELL) '$(ABS_TESTSUITE)' AUTOTEST_PATH='src:tests' $(TESTSUITEFLAGS)
 
 installcheck-local: %D%/atconfig %D%/atlocal $(TESTSUITE)
-	cd %D% && $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='src:tests:$(bindir)' $(TESTSUITEFLAGS)
+	cd %D% && $(SHELL) '$(ABS_TESTSUITE)' AUTOTEST_PATH='src:tests:$(bindir)' $(TESTSUITEFLAGS)
 
 clean-local:
-	test ! -f '$(TESTSUITE)' || { cd %D% && $(SHELL) '$(TESTSUITE)' --clean; }
+	test ! -f '$(TESTSUITE)' || { cd %D% && $(SHELL) '$(ABS_TESTSUITE)' --clean; }
 
 TESTSUITE_LIST = $(top_srcdir)/%D%/testsuite.list.at
 AUTOTEST = $(AUTOM4TE) --language=autotest
 $(TESTSUITE): $(AT_FILES) $(TESTSUITE_LIST)
-	@$(MKDIR_P) $(abs_top_srcdir)/%D%
-	$(AM_V_GEN)cd $(abs_top_srcdir)/%D% && $(AUTOTEST) -I. -o $@.tmp $@.at
+	@$(MKDIR_P) $(top_srcdir)/%D%
+	$(AM_V_GEN)cd $(top_srcdir)/%D% && $(AUTOTEST) -I. -o testsuite.tmp testsuite.at
 	$(AM_V_at)mv $@.tmp $@
 
 $(TESTSUITE_LIST): $(AT_FILES)
-	@$(MKDIR_P) $(abs_top_srcdir)/%D%
+	@$(MKDIR_P) $(top_srcdir)/%D%
 	$(AM_V_GEN)( echo "dnl DO NOT EDIT: GENERATED BY MAKEFILE.AM"; \
 	$(GREP) -l -e '^SB_CHECK' -e '^AT_CHECK' $(AT_FILES) | LC_ALL=C sort | \
 		$(SED) -e 's:^[^/]*/%D%/:sb_inc([:' -e 's:[.]at$$:]):' ) > $@


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2021-10-22  7:21 Michał Górny
  0 siblings, 0 replies; 31+ messages in thread
From: Michał Górny @ 2021-10-22  7:21 UTC (permalink / raw
  To: gentoo-commits

commit:     4283dce8529d7423e8dc7584dc3b5e3b110c48e9
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 22 07:14:57 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Oct 22 07:14:57 2021 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=4283dce8

tests: Add missing EXTRA_DIST for xattr-0

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 tests/Makefile.am | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 846a8f6..5bb476d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,7 +3,8 @@ TESTSUITE = $(srcdir)/testsuite
 DISTCLEANFILES = atconfig
 EXTRA_DIST = atlocal.in package.m4.in $(AT_FILES) $(TESTSUITE) \
 	test-skel-0.c \
-	tests.h
+	tests.h \
+	xattr-0
 
 AM_CPPFLAGS = -I$(top_srcdir) $(SANDBOX_DEFINES)
 


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2021-10-22  4:54 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2021-10-22  4:54 UTC (permalink / raw
  To: gentoo-commits

commit:     9cdd208c660ac8c01f43bbcffaf9c786c31be59b
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 22 04:53:43 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Oct 22 04:53:43 2021 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=9cdd208c

tests: add missing xattr-0 program

Needed for new xattr tests.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 tests/xattr-0 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/xattr-0 b/tests/xattr-0
new file mode 100755
index 0000000..5504443
--- /dev/null
+++ b/tests/xattr-0
@@ -0,0 +1,7 @@
+#!/bin/sh
+# Make sure the filesystem supports xattrs.
+file=".test.xattrs"
+touch "${file}"
+setxattr-0 0 "${file}" user.sandbox test 4 0 && ret=0 || ret=77
+rm -f "${file}"
+exit "${ret}"


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2021-10-22  4:15 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2021-10-22  4:15 UTC (permalink / raw
  To: gentoo-commits

commit:     be55fcb37786f6d29ac3db0c9c98bad5b1de5d94
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 22 02:38:12 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Oct 22 04:15:04 2021 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=be55fcb3

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 <AT> gentoo.org>

 tests/renameat2-2.sh | 12 ++++++++++++
 tests/renameat2-3.sh | 11 +++++++++++
 2 files changed, 23 insertions(+)

diff --git a/tests/renameat2-2.sh b/tests/renameat2-2.sh
new file mode 100755
index 0000000..420b36d
--- /dev/null
+++ b/tests/renameat2-2.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# make sure we can clobber symlinks #612202
+
+addwrite $PWD
+
+ln -s /asdf sym || exit 1
+touch file
+renameat2-0 0 AT_FDCWD file AT_FDCWD sym || exit 1
+[ ! -e file ]
+[ ! -L sym ]
+[ -e sym ]
+test ! -s "${SANDBOX_LOG}"

diff --git a/tests/renameat2-3.sh b/tests/renameat2-3.sh
new file mode 100755
index 0000000..ca945a5
--- /dev/null
+++ b/tests/renameat2-3.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+# make sure we reject bad renames #612202
+
+addwrite $PWD
+mkdir deny
+adddeny $PWD/deny
+
+touch file
+renameat2-0 -1,EACCES AT_FDCWD file AT_FDCWD deny/file || exit 1
+[ -e file ]
+test -s "${SANDBOX_LOG}"


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2021-10-21  2:48 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2021-10-21  2:48 UTC (permalink / raw
  To: gentoo-commits

commit:     ac981df3077edde8bfc95dc54d8a82943986042f
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 21 02:40:59 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Oct 21 02:40:59 2021 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=ac981df3

tests: handle fd leakage from GNU make jobservers

Current versions of GNU make (at least v4.3) seem to be leaking its
jobserver fds to children which breaks some tests that expect fd 3
and higher to be free.  Add some startup logic to clean those to fix
`make -j check` failures.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 tests/atlocal.in  | 18 ++++++++++++++++++
 tests/script-1.sh |  5 ++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/tests/atlocal.in b/tests/atlocal.in
index 91b41b2..e8213c0 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -24,5 +24,23 @@ export SANDBOX_VERBOSE=0
 # If the terminal has this flag set, the tests get all messed up.
 stty -tostop 2>/dev/null || :
 
+# Some tests want this internal path.
+for devfd in /proc/self/fd /dev/fd ; do
+	[ -e "${devfd}" ] && break
+done
+
+# GNU make likes to leak fds when using jobservers (i.e. using -j).
+case "${MAKEFLAGS}" in
+*--jobserver-auth=*)
+	flags=${MAKEFLAGS#*--jobserver-auth=}
+	flags=${flags%% *}
+	for fd in $(echo "${flags}" | tr ',' ' ') ; do
+		if [ -e "${devfd}/${fd}" ] ; then
+			eval "exec ${fd}>&-"
+		fi
+	done
+	;;
+esac
+
 # This script must finish with ($? == 0) else the autotest runner gets upset.
 :

diff --git a/tests/script-1.sh b/tests/script-1.sh
index 3ac6252..8b18114 100755
--- a/tests/script-1.sh
+++ b/tests/script-1.sh
@@ -1,5 +1,8 @@
 #!/bin/sh
 # http://bugs.gentoo.org/257418
 [ "${at_xfail}" = "yes" ] && exit 77 # see script-0
-(>/dev/fd/3)
+(
+cd "${devfd}"
+>3
+)
 exit 0


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2021-10-18  5:21 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2021-10-18  5:21 UTC (permalink / raw
  To: gentoo-commits

commit:     422e3666f6118448062defccab99af6c9b40d5d0
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 18 04:36:04 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Oct 18 04:36:04 2021 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=422e3666

tests: add missing +x on scripts

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 tests/script-14.sh | 0
 tests/script-15.sh | 0
 2 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/tests/script-14.sh b/tests/script-14.sh
old mode 100644
new mode 100755

diff --git a/tests/script-15.sh b/tests/script-15.sh
old mode 100644
new mode 100755


^ permalink raw reply	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2020-05-31 10:52 Michał Górny
  0 siblings, 0 replies; 31+ messages in thread
From: Michał Górny @ 2020-05-31 10:52 UTC (permalink / raw
  To: gentoo-commits

commit:     818d14f59a5bcf3cc9e8e88a993abc5605ed0b26
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun May 31 09:55:41 2020 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun May 31 10:31:10 2020 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=818d14f5

tests/script-16.sh: mark as passing only for native ABI

All scripts assume that ran tools matck tested sandbox's ABI.
Most scripts have a guard against ABI check, but script-16 was missing it.

It's afollow-up commit to 24fd102c9976
("check_syscall(): turn internal sandbox violation into denywrite")

Reported-by: Michał Górny
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
Closes: https://bugs.gentoo.org/590084
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 tests/script-16.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/script-16.sh b/tests/script-16.sh
index c668cfa..1622694 100755
--- a/tests/script-16.sh
+++ b/tests/script-16.sh
@@ -1,5 +1,6 @@
 #!/bin/sh
-
+# http://bugs.gentoo.org/139591
+[ "${at_xfail}" = "yes" ] && exit 77 # see script-0
 addwrite $PWD
 
 mkdir -p to-be/deleted


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2019-06-27 21:41 Sergei Trofimovich
  0 siblings, 0 replies; 31+ messages in thread
From: Sergei Trofimovich @ 2019-06-27 21:41 UTC (permalink / raw
  To: gentoo-commits

commit:     604927f331829f971d3a32c2e67e0ad5ce3d8ee4
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 27 09:09:56 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Jun 27 09:09:56 2019 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=604927f3

tests: disable utimensat-3 on *-linux-musl

x86_64-gentoo-linux-musl fails a single test:
    83: utimensat/3     FAILED (utimensat.at:3)

The test checks if sandbox does not crash when
    utimensat(<filefd>, NULL, NULL, 0)
is called. The behaviour is not specified by POSIX
but glibc returns EINVAL for such a case. Thus the
test behaves differently on varius libs.

https://www.openwall.com/lists/musl/2019/06/25/1 has
a conversation with musl upstream.

The change restricts test down to glibc targets.

Bug: https://bugs.gentoo.org/549108
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 tests/atlocal.in     |  1 +
 tests/utimensat-3.sh | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/tests/atlocal.in b/tests/atlocal.in
index b9a631b..91b41b2 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -2,6 +2,7 @@
 
 export abs_top_srcdir abs_top_builddir abs_srcdir abs_builddir
 export AWK="@AWK@"
+export HOST="@host@"
 
 if ! ${at_clean} ; then
 	export SB_UID=$(./get-user)

diff --git a/tests/utimensat-3.sh b/tests/utimensat-3.sh
index 4ecd4b3..a7b9843 100755
--- a/tests/utimensat-3.sh
+++ b/tests/utimensat-3.sh
@@ -1,6 +1,17 @@
 #!/bin/sh
 # make sure NULL filename is handled correctly
 
+# Note: this test is dependent on glibc internals
+# other libcs chose not to validate invalid parameters:
+#    https://bugs.gentoo.org/549108#c28
+#    https://www.openwall.com/lists/musl/2019/06/25/1
+# Run this test only on glibc systems.
+
+case $HOST in
+    *-linux-gnu);;
+    *) exit 77;;
+esac
+
 addwrite $PWD
 
 exec utimensat-0 -1:22 'f:O_WRONLY|O_CREAT:0666' NULL NULL 0


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2018-02-19  5:50 Michał Górny
  0 siblings, 0 replies; 31+ messages in thread
From: Michał Górny @ 2018-02-19  5:50 UTC (permalink / raw
  To: gentoo-commits

commit:     3cc39bfc6387d1f1f61dd2a8533f5dc6a6edc42c
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 19 05:49:45 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Feb 19 05:49:45 2018 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=3cc39bfc

tests: Add a test for LD_PRELOAD non-preserving (SANDBOX_ON=0)

 tests/script-15.sh | 21 +++++++++++++++++++++
 tests/script.at    |  1 +
 2 files changed, 22 insertions(+)

diff --git a/tests/script-15.sh b/tests/script-15.sh
new file mode 100644
index 0000000..b2acddc
--- /dev/null
+++ b/tests/script-15.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+# check that sandbox stops cloberring LD_PRELOAD when it's disabled
+[ "${at_xfail}" = "yes" ] && exit 77 # see script-0
+
+SANDBOX_ON=0
+
+# keep in sync with script-4!
+checkit() {
+	if eval "$@" | grep -q '^LD_PRELOAD=.*libsandbox.so.*' ; then
+		echo "LD_PRELOAD was reset when running (w/ SANDBOX_ON=0):"
+		echo "	$*"
+		exit 1
+	fi
+}
+
+checkit "env -uLD_PRELOAD env"
+checkit "(unset LD_PRELOAD; env)"
+checkit "env LD_PRELOAD= env"
+checkit "env LD_PRELOAD=libc.so env"
+
+exit $?

diff --git a/tests/script.at b/tests/script.at
index 9134ac1..8837bda 100644
--- a/tests/script.at
+++ b/tests/script.at
@@ -12,3 +12,4 @@ SB_CHECK(11)
 SB_CHECK(12)
 SB_CHECK(13)
 SB_CHECK(14)
+SB_CHECK(15)


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2016-03-29 12:24 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2016-03-29 12:24 UTC (permalink / raw
  To: gentoo-commits

commit:     a0285db815b3604899453c215cce93df74066fdc
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 17 00:22:29 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Feb 17 00:22:29 2016 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=a0285db8

tests: add test for overriding mmap

URL: http://bugs.gentoo.org/290249
Reported-by: Diego E. Pettenò <flameeyes <AT> gentoo.org>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 tests/Makefile.am       |  3 +++
 tests/execvp-0.c        | 15 +++++++++++++++
 tests/malloc-0          |  7 +++++++
 tests/malloc-1.sh       |  4 ++++
 tests/malloc.at         |  1 +
 tests/malloc_mmap_tst.c | 26 ++++++++++++++++++++++++++
 6 files changed, 56 insertions(+)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3627344..943ce3b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -18,6 +18,7 @@ check_PROGRAMS = \
 	chown-0 \
 	creat-0 \
 	creat64-0 \
+	execvp-0 \
 	faccessat-0 \
 	fchmodat-0 \
 	fchownat-0 \
@@ -72,6 +73,7 @@ check_PROGRAMS = \
 	\
 	getcwd-gnulib_tst \
 	libsigsegv_tst \
+	malloc_mmap_tst \
 	pipe-fork_tst \
 	pipe-fork_static_tst \
 	sb_printf_tst \
@@ -81,6 +83,7 @@ check_PROGRAMS = \
 
 dist_check_SCRIPTS = \
 	$(wildcard $(srcdir)/*-[0-9]*.sh) \
+	malloc-0 \
 	script-0 \
 	trace-0
 

diff --git a/tests/execvp-0.c b/tests/execvp-0.c
new file mode 100644
index 0000000..6cfce13
--- /dev/null
+++ b/tests/execvp-0.c
@@ -0,0 +1,15 @@
+/*
+ * A simple wrapper for execvp.  Useful when most host programs don't match
+ * the ABI of the active libsandbox.so (e.g. 64bit vs 32bit).
+ */
+
+#include "tests.h"
+
+int main(int argc, char *argv[])
+{
+	if (argc < 2) {
+		printf("usage: execvp <path> [argv0 [argvN] ...]\n");
+		return 0;
+	}
+	return execvp(argv[1], argv + 2);
+}

diff --git a/tests/malloc-0 b/tests/malloc-0
new file mode 100755
index 0000000..9a4190b
--- /dev/null
+++ b/tests/malloc-0
@@ -0,0 +1,7 @@
+#!/bin/sh
+# make sure `timeout` is available.
+if timeout --help >/dev/null ; then
+	exit 0
+else
+	exit 77
+fi

diff --git a/tests/malloc-1.sh b/tests/malloc-1.sh
new file mode 100755
index 0000000..2b5623d
--- /dev/null
+++ b/tests/malloc-1.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Since the malloc binary is in the target ABI, make sure the exec is
+# launched from the same ABI so the same libsandbox.so is used.
+timeout -s KILL 10 execvp-0 malloc_mmap_tst malloc_mmap_tst

diff --git a/tests/malloc.at b/tests/malloc.at
new file mode 100644
index 0000000..081d7d2
--- /dev/null
+++ b/tests/malloc.at
@@ -0,0 +1 @@
+SB_CHECK(1)

diff --git a/tests/malloc_mmap_tst.c b/tests/malloc_mmap_tst.c
new file mode 100644
index 0000000..a1a15e1
--- /dev/null
+++ b/tests/malloc_mmap_tst.c
@@ -0,0 +1,26 @@
+/* Make sure programs that override mmap don't mess us up. #290249 */
+
+#include "headers.h"
+
+/* A few basic stubs that do nothing. */
+void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset)
+{
+	errno = ENOMEM;
+	return MAP_FAILED;
+}
+int munmap(void *addr, size_t length)
+{
+	errno = ENOMEM;
+	return -1;
+}
+
+int main(int argc, char *argv[])
+{
+	/* Don't loop forever. */
+	alarm(10);
+
+	/* Make sure we do an operation to trigger the sandbox. */
+	open("/dev/null", 0);
+
+	return 0;
+}


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2015-12-20 21:33 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2015-12-20 21:33 UTC (permalink / raw
  To: gentoo-commits

commit:     4f000d9c228474b6e34c9ce9e84bcce781271914
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 20 21:32:26 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Dec 20 21:32:26 2015 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=4f000d9c

tests: check errno with more static tests

This verifies the error code setting with ptrace logic -- if the ptrace
code is broken, the errno will often be ENOSYS instead of EPERM.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 tests/open_static-1.sh   | 2 +-
 tests/openat_static-1.sh | 2 +-
 tests/unlink_static-1.sh | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/open_static-1.sh b/tests/open_static-1.sh
index faf91d0..e815b57 100755
--- a/tests/open_static-1.sh
+++ b/tests/open_static-1.sh
@@ -8,5 +8,5 @@ open_static-0 3 ok O_RDONLY 0666 || exit 1
 
 mkdir deny || exit 1
 adddeny $PWD/deny
-open_static-0 -1 deny/not-ok "O_WRONLY|O_CREAT" 0666
+open_static-0 -1,EPERM deny/not-ok "O_WRONLY|O_CREAT" 0666 || exit 1
 test -e sandbox.log

diff --git a/tests/openat_static-1.sh b/tests/openat_static-1.sh
index 929fc51..a4d1b90 100755
--- a/tests/openat_static-1.sh
+++ b/tests/openat_static-1.sh
@@ -8,5 +8,5 @@ openat_static-0 3 AT_FDCWD ok O_RDONLY 0666 || exit 1
 
 mkdir deny || exit 1
 adddeny $PWD/deny
-openat_static-0 -1 AT_FDCWD deny/not-ok "O_WRONLY|O_CREAT" 0666
+openat_static-0 -1,EPERM AT_FDCWD deny/not-ok "O_WRONLY|O_CREAT" 0666 || exit 1
 test -e sandbox.log

diff --git a/tests/unlink_static-1.sh b/tests/unlink_static-1.sh
index 9585862..2281a98 100755
--- a/tests/unlink_static-1.sh
+++ b/tests/unlink_static-1.sh
@@ -5,5 +5,5 @@
 touch f
 test -e f || exit 1
 adddeny "${PWD}"
-unlink_static-0 -1,EPERM f
+unlink_static-0 -1,EPERM f || exit 1
 test -e sandbox.log -a -e f


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2015-09-28 20:17 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2015-09-28 20:17 UTC (permalink / raw
  To: gentoo-commits

commit:     6b0db7d9abfded8bdf8c7d061b261f053eec886d
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 28 20:00:17 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Sep 28 20:00:17 2015 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=6b0db7d9

tests: add basic parsing of timespec fields

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 tests/test-skel-0.c | 23 ++++++++++++++++++++++-
 tests/tests.h       |  3 +++
 tests/utimensat-0.c |  2 +-
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/tests/test-skel-0.c b/tests/test-skel-0.c
index dbe60db..96e42ae 100644
--- a/tests/test-skel-0.c
+++ b/tests/test-skel-0.c
@@ -9,7 +9,6 @@ const char *color_red    = "\033[31;01m";
 # define CONFIG 1
 #endif
 
-#define V_TIMESPEC "NULL"
 #define V_STRMODE "<r|w|a>[+bcemx] (see `man 3 fopen`)"
 
 static bool _strtoul(const char *sul, unsigned long *ul)
@@ -132,6 +131,28 @@ int at_get_fd(const char *str_dirfd)
 	return open(str_path, f_get_flags(str_flags), sscanf_mode_t(str_mode));
 }
 
+#define V_TIMESPEC "NULL | NOW | #[,#]"
+struct timespec *parse_timespec(const char *s)
+{
+	struct timespec *times;
+
+	if (!strcmp(s, "NULL"))
+		return NULL;
+
+	times = xzalloc(sizeof(*times));
+
+	if (!strcmp(s, "NOW")) {
+		times->tv_sec = time(0);
+	} else {
+		long sec = 0, nsec = 0;
+		sscanf(s, "%li,%li", &sec, &nsec);
+		times->tv_sec = sec;
+		times->tv_nsec = nsec;
+	}
+
+	return times;
+}
+
 #define V_ACCESS_MODE "r | w | x | f"
 int access_mode(const char *s)
 {

diff --git a/tests/tests.h b/tests/tests.h
index 51dc68a..22733ca 100644
--- a/tests/tests.h
+++ b/tests/tests.h
@@ -10,6 +10,9 @@
 #define err(fmt, args...) ({ _stderr_msg(fmt, ##args); exit(1); })
 #define errp(fmt, args...) ({ _stderr_pmsg(fmt, ##args); exit(1); })
 
+#define xmalloc(size) ({ void *ret = malloc(size); assert(ret); ret; })
+#define xzalloc(size) ({ void *ret = xmalloc(size); memset(ret, 0, size); ret; })
+
 typedef struct {
 	const char *name;
 	int val;

diff --git a/tests/utimensat-0.c b/tests/utimensat-0.c
index 431d179..99c3fa4 100644
--- a/tests/utimensat-0.c
+++ b/tests/utimensat-0.c
@@ -14,7 +14,7 @@
 	const char *file = f_get_file(s); \
 	\
 	s = argv[i++]; \
-	const struct timespec *times = NULL; \
+	const struct timespec *times = parse_timespec(s); \
 	\
 	s = argv[i++]; \
 	int flags = at_get_flags(s);


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2015-09-27  6:13 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2015-09-27  6:13 UTC (permalink / raw
  To: gentoo-commits

commit:     314587590c5ab7204171606cadac52933a49f89d
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 20 23:23:10 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 23:23:10 2015 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=31458759

tests: avoid overflowing exit codes

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 tests/script-8.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/script-8.sh b/tests/script-8.sh
index 685d5d3..6d9de55 100755
--- a/tests/script-8.sh
+++ b/tests/script-8.sh
@@ -10,4 +10,4 @@ sigsuspend-zsh_static_tst
 s=$?
 echo "ret = $s"
 
-exit $(( d + s ))
+exit $(( d | s ))


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2015-09-11  7:53 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2015-09-11  7:53 UTC (permalink / raw
  To: gentoo-commits

commit:     3559ba4b30934da041801f1a150fd28d2d64002c
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 11 06:47:17 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Sep 11 06:47:17 2015 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=3559ba4b

tests: make sure we ignore stty exit status

If the stty step fails (for any reason really), the main testrunner
will abort with a weird error message:
$ make check
...
/bin/sh './testsuite' AUTOTEST_PATH='src:tests' --jobs=`getconf _NPROCESSORS_ONLN || echo 1`
testsuite: error: invalid content: atlocal
...

Make sure we ignore stty's exit status, and we put a final comment/$?
reset at the end of the script.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 tests/atlocal.in | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/atlocal.in b/tests/atlocal.in
index 8435f61..b9a631b 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -21,4 +21,7 @@ fi
 export SANDBOX_VERBOSE=0
 
 # If the terminal has this flag set, the tests get all messed up.
-stty -tostop 2>/dev/null
+stty -tostop 2>/dev/null || :
+
+# This script must finish with ($? == 0) else the autotest runner gets upset.
+:


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2015-09-11  7:53 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2015-09-11  7:53 UTC (permalink / raw
  To: gentoo-commits

commit:     441c11d5c5f628d2be20972b023d908bf6c39fc8
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 11 07:10:51 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Sep 11 07:10:51 2015 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=441c11d5

tests: add dynamic/static categories

This way we can quickly execute the tests that run dynamic or static
binaries.  We leave scripts out as they're a bit of a special case.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 tests/local.at | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/local.at b/tests/local.at
index f937ff1..95db774 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -17,6 +17,10 @@ m4_defun([AT_SB_CHECK],[AT_CHECK([SB_RUN $1],[$2],[$3],[$4],[$5],[$6])])
 m4_defun([SB_CHECK],[dnl
 AT_SETUP([SB_SECTION/$1])
 AT_KEYWORDS([SB_SECTION])
+m4_bmatch(SB_SECTION,
+	[_static$], [AT_KEYWORDS([static])],
+	[^script$], [],
+	[AT_KEYWORDS([dynamic])])
 AT_XFAIL_IF([(
 	]SB_SECTION[-0 >/dev/null ; test $? -eq 77 && exit 0
 	if expr ]SB_SECTION[ : .*_static >/dev/null ; then


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2012-12-24 23:58 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2012-12-24 23:58 UTC (permalink / raw
  To: gentoo-commits

commit:     5daa8f40978f03ea1ae96f2dff48e7219ad6fff4
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 24 23:33:33 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Dec 24 23:48:35 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/sandbox.git;a=commit;h=5daa8f40

tests: expand usage strings

Makes it easier to quickly figure out how to run a helper test
without having to resort to existing usage or the code itself.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 tests/access-0.c      |    8 ++------
 tests/faccessat-0.c   |    5 ++---
 tests/fchmodat-0.c    |    2 +-
 tests/fchownat-0.c    |    2 +-
 tests/fopen-0.c       |    2 +-
 tests/fopen64-0.c     |    2 +-
 tests/futimesat-0.c   |    2 +-
 tests/link-0.c        |    2 +-
 tests/linkat-0.c      |    2 +-
 tests/lutimes-0.c     |    2 +-
 tests/mkostemp-0.c    |    2 +-
 tests/mkostemp64-0.c  |    2 +-
 tests/mkostemps-0.c   |    2 +-
 tests/mkostemps64-0.c |    2 +-
 tests/open-0.c        |    2 +-
 tests/open64-0.c      |    2 +-
 tests/openat-0.c      |    2 +-
 tests/openat64-0.c    |    2 +-
 tests/rename-0.c      |    2 +-
 tests/renameat-0.c    |    2 +-
 tests/symlink-0.c     |    2 +-
 tests/symlinkat-0.c   |    2 +-
 tests/test-skel-0.c   |   41 ++++++++++++++++++++++++++++++++++++++++-
 tests/truncate-0.c    |    2 +-
 tests/truncate64-0.c  |    2 +-
 tests/unlinkat-0.c    |    2 +-
 tests/utime-0.c       |    2 +-
 tests/utimensat-0.c   |    2 +-
 tests/utimes-0.c      |    2 +-
 29 files changed, 70 insertions(+), 36 deletions(-)

diff --git a/tests/access-0.c b/tests/access-0.c
index 91507e0..fd03177 100644
--- a/tests/access-0.c
+++ b/tests/access-0.c
@@ -3,17 +3,13 @@
 #define FUNC_STR "\"%s\", %x"
 #define FUNC_IMP file, mode
 #define ARG_CNT 2
-#define ARG_USE "<file> <mode>"
+#define ARG_USE "<file> <acc_mode>"
 
 #define process_args() \
 	s = argv[i++]; \
 	const char *file = f_get_file(s); \
 	\
 	s = argv[i++]; \
-	int mode = 0; \
-	if (strchr(s, 'r')) mode |= R_OK; \
-	if (strchr(s, 'w')) mode |= W_OK; \
-	if (strchr(s, 'x')) mode |= X_OK; \
-	if (strchr(s, 'f')) mode  = F_OK;
+	int mode = access_mode(s);
 
 #include "test-skel-0.c"

diff --git a/tests/faccessat-0.c b/tests/faccessat-0.c
index e348984..98ea2ec 100644
--- a/tests/faccessat-0.c
+++ b/tests/faccessat-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "%i, \"%s\", %x, %x"
 #define FUNC_IMP dirfd, file, mode, flags
 #define ARG_CNT 4
-#define ARG_USE "<dirfd> <file> <mode> <flags>"
+#define ARG_USE "<dirfd> <file> <acc_mode> <atflags>"
 
 #define process_args() \
 	s = argv[i++]; \
@@ -14,8 +14,7 @@
 	const char *file = f_get_file(s); \
 	\
 	s = argv[i++]; \
-	int mode = 0; \
-	sscanf(s, "%i", &mode); \
+	int mode = access_mode(s); \
 	\
 	s = argv[i++]; \
 	int flags = at_get_flags(s);

diff --git a/tests/fchmodat-0.c b/tests/fchmodat-0.c
index 98ffe66..fe77a35 100644
--- a/tests/fchmodat-0.c
+++ b/tests/fchmodat-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "%i, \"%s\", %o, %x"
 #define FUNC_IMP dirfd, file, mode, flags
 #define ARG_CNT 4
-#define ARG_USE "<dirfd> <file> <mode> <flags>"
+#define ARG_USE "<dirfd> <file> <mode> <atflags>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/fchownat-0.c b/tests/fchownat-0.c
index a168e75..e47d7f3 100644
--- a/tests/fchownat-0.c
+++ b/tests/fchownat-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "%i, \"%s\", %i, %i, %x"
 #define FUNC_IMP dirfd, file, uid, gid, flags
 #define ARG_CNT 5
-#define ARG_USE "<dirfd> <file> <uid> <gid> <flags>"
+#define ARG_USE "<dirfd> <file> <uid> <gid> <atflags>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/fopen-0.c b/tests/fopen-0.c
index abf4965..e8702bf 100644
--- a/tests/fopen-0.c
+++ b/tests/fopen-0.c
@@ -3,7 +3,7 @@
 #define FUNC_STR "\"%s\", \"%s\""
 #define FUNC_IMP file, mode
 #define ARG_CNT 2
-#define ARG_USE "<file> <mode>"
+#define ARG_USE "<file> <strmode>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/fopen64-0.c b/tests/fopen64-0.c
index e7aa673..78c0fa7 100644
--- a/tests/fopen64-0.c
+++ b/tests/fopen64-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "\"%s\", \"%s\""
 #define FUNC_IMP file, mode
 #define ARG_CNT 2
-#define ARG_USE "<file> <mode>"
+#define ARG_USE "<file> <strmode>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/futimesat-0.c b/tests/futimesat-0.c
index f710e8f..6d2ae43 100644
--- a/tests/futimesat-0.c
+++ b/tests/futimesat-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "%i, \"%s\", %p"
 #define FUNC_IMP dirfd, file, times
 #define ARG_CNT 3
-#define ARG_USE "<dirfd> <file> <times:=NULL>"
+#define ARG_USE "<dirfd> <file> <times>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/link-0.c b/tests/link-0.c
index f5e4f88..2c7b66c 100644
--- a/tests/link-0.c
+++ b/tests/link-0.c
@@ -3,7 +3,7 @@
 #define FUNC_STR "\"%s\", \"%s\""
 #define FUNC_IMP oldpath, newpath
 #define ARG_CNT 2
-#define ARG_USE "<oldpath> <newpath>"
+#define ARG_USE "<path>(old) <path>(new)"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/linkat-0.c b/tests/linkat-0.c
index 8c1af52..0f729bb 100644
--- a/tests/linkat-0.c
+++ b/tests/linkat-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "%i, \"%s\", %i, \"%s\", %x"
 #define FUNC_IMP olddirfd, oldpath, newdirfd, newpath, flags
 #define ARG_CNT 5
-#define ARG_USE "<olddirfd> <oldpath> <newdirfd> <newpath> <flags>"
+#define ARG_USE "<dirfd>(old) <path>(old) <dirfd>(new) <path>(new) <atflags>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/lutimes-0.c b/tests/lutimes-0.c
index 6b7c2e3..1037438 100644
--- a/tests/lutimes-0.c
+++ b/tests/lutimes-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "\"%s\", %p"
 #define FUNC_IMP file, times
 #define ARG_CNT 2
-#define ARG_USE "<file> <times:=NULL>"
+#define ARG_USE "<file> <times>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/mkostemp-0.c b/tests/mkostemp-0.c
index 7445126..65cf8c2 100644
--- a/tests/mkostemp-0.c
+++ b/tests/mkostemp-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "\"%s\", %#x"
 #define FUNC_IMP template, flags
 #define ARG_CNT 2
-#define ARG_USE "<template> <flags>"
+#define ARG_USE "<template> <fflags>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/mkostemp64-0.c b/tests/mkostemp64-0.c
index 6b25c29..54e5a5b 100644
--- a/tests/mkostemp64-0.c
+++ b/tests/mkostemp64-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "\"%s\", %#x"
 #define FUNC_IMP template, flags
 #define ARG_CNT 2
-#define ARG_USE "<template> <flags>"
+#define ARG_USE "<template> <fflags>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/mkostemps-0.c b/tests/mkostemps-0.c
index 62857b8..739a491 100644
--- a/tests/mkostemps-0.c
+++ b/tests/mkostemps-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "\"%s\", %i, %#x"
 #define FUNC_IMP template, suffixlen, flags
 #define ARG_CNT 3
-#define ARG_USE "<template> <suffixlen> <flags>"
+#define ARG_USE "<template> <suffixlen> <fflags>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/mkostemps64-0.c b/tests/mkostemps64-0.c
index 146da61..9f2e5d8 100644
--- a/tests/mkostemps64-0.c
+++ b/tests/mkostemps64-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "\"%s\", %i, %#x"
 #define FUNC_IMP template, suffixlen, flags
 #define ARG_CNT 3
-#define ARG_USE "<template> <suffixlen> <flags>"
+#define ARG_USE "<template> <suffixlen> <fflags>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/open-0.c b/tests/open-0.c
index dfae46d..7c84e51 100644
--- a/tests/open-0.c
+++ b/tests/open-0.c
@@ -3,7 +3,7 @@
 #define FUNC_STR "\"%s\", %#x, %o"
 #define FUNC_IMP file, flags, mode
 #define ARG_CNT 3
-#define ARG_USE "<file> <flags> <mode>"
+#define ARG_USE "<file> <fflags> <mode>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/open64-0.c b/tests/open64-0.c
index 76d2686..5000ddb 100644
--- a/tests/open64-0.c
+++ b/tests/open64-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "\"%s\", %o"
 #define FUNC_IMP file, flags
 #define ARG_CNT 2
-#define ARG_USE "<file> <flags>"
+#define ARG_USE "<file> <fflags>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/openat-0.c b/tests/openat-0.c
index 7978e11..24f230b 100644
--- a/tests/openat-0.c
+++ b/tests/openat-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "%i, \"%s\", %#x, %o"
 #define FUNC_IMP dirfd, file, flags, mode
 #define ARG_CNT 4
-#define ARG_USE "<dirfd> <file> <flags> <mode>"
+#define ARG_USE "<dirfd> <file> <fflags> <mode>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/openat64-0.c b/tests/openat64-0.c
index 9c707f6..9686bc9 100644
--- a/tests/openat64-0.c
+++ b/tests/openat64-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "%i, \"%s\", %#x, %o"
 #define FUNC_IMP dirfd, file, flags, mode
 #define ARG_CNT 4
-#define ARG_USE "<dirfd> <file> <flags> <mode>"
+#define ARG_USE "<dirfd> <file> <fflags> <mode>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/rename-0.c b/tests/rename-0.c
index aa50f37..28fbdc9 100644
--- a/tests/rename-0.c
+++ b/tests/rename-0.c
@@ -3,7 +3,7 @@
 #define FUNC_STR "\"%s\", \"%s\""
 #define FUNC_IMP oldpath, newpath
 #define ARG_CNT 2
-#define ARG_USE "<oldpath> <newpath>"
+#define ARG_USE "<path>(old) <path>(new)"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/renameat-0.c b/tests/renameat-0.c
index fcb5c88..1c1cd59 100644
--- a/tests/renameat-0.c
+++ b/tests/renameat-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "%i, \"%s\", %i, \"%s\""
 #define FUNC_IMP olddirfd, oldpath, newdirfd, newpath
 #define ARG_CNT 4
-#define ARG_USE "<olddirfd> <oldpath> <newdirfd> <newpath>"
+#define ARG_USE "<dirfd>(old) <path>(old) <dirfd>(new) <path>(new)"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/symlink-0.c b/tests/symlink-0.c
index 6ddfd0c..70f52e3 100644
--- a/tests/symlink-0.c
+++ b/tests/symlink-0.c
@@ -3,7 +3,7 @@
 #define FUNC_STR "\"%s\", \"%s\""
 #define FUNC_IMP oldpath, newpath
 #define ARG_CNT 2
-#define ARG_USE "<oldpath> <newpath>"
+#define ARG_USE "<path>(old) <path>(new)"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/symlinkat-0.c b/tests/symlinkat-0.c
index f668829..1e52c60 100644
--- a/tests/symlinkat-0.c
+++ b/tests/symlinkat-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "\"%s\", %i, \"%s\""
 #define FUNC_IMP oldpath, newdirfd, newpath
 #define ARG_CNT 3
-#define ARG_USE "<oldpath> <newdirfd> <newpath>"
+#define ARG_USE "<path>(old) <dirfd>(new) <path>(new)"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/test-skel-0.c b/tests/test-skel-0.c
index 3476552..dbe60db 100644
--- a/tests/test-skel-0.c
+++ b/tests/test-skel-0.c
@@ -9,6 +9,9 @@ const char *color_red    = "\033[31;01m";
 # define CONFIG 1
 #endif
 
+#define V_TIMESPEC "NULL"
+#define V_STRMODE "<r|w|a>[+bcemx] (see `man 3 fopen`)"
+
 static bool _strtoul(const char *sul, unsigned long *ul)
 {
 	char *e;
@@ -34,6 +37,7 @@ static int _get_flags(const char *str_flags, const value_pair flags[])
 	return ret;
 }
 
+#define V_FFLAGS "O_XXX flags (see `man 2 open`)"
 int f_get_flags(const char *str_flags)
 {
 	const value_pair flags[] = {
@@ -54,6 +58,7 @@ int f_get_flags(const char *str_flags)
 	return _get_flags(str_flags, flags);
 }
 
+#define V_FILE "NULL | path"
 const char *f_get_file(const char *str_file)
 {
 	if (!strcmp(str_file, "NULL"))
@@ -62,6 +67,7 @@ const char *f_get_file(const char *str_file)
 		return str_file;
 }
 
+#define V_ATFLAGS "0 | AT_SYMLINK_NOFOLLOW | AT_REMOVEDIR | AT_SYMLINK_FOLLOW | AT_EACCESS"
 int at_get_flags(const char *str_flags)
 {
 	const value_pair flags[] = {
@@ -74,6 +80,7 @@ int at_get_flags(const char *str_flags)
 	return _get_flags(str_flags, flags);
 }
 
+#define V_MODE_T "0x# (for hex) | 0# (for octal) | # (for decimal)"
 mode_t sscanf_mode_t(const char *str_mode)
 {
 	/* some systems (like Linux) have a 32bit mode_t.  Others
@@ -88,6 +95,7 @@ mode_t sscanf_mode_t(const char *str_mode)
 	return (mode_t)mode;
 }
 
+#define V_DEV_T V_MODE_T
 dev_t sscanf_dev_t(const char *str_dev)
 {
 	/* Similar issue with dev_t as mode_t.  Can't assume that
@@ -98,6 +106,7 @@ dev_t sscanf_dev_t(const char *str_dev)
 	return (dev_t)dev;
 }
 
+#define V_DIRFD "AT_FDCWD | fd # | path[:<flags>[:<mode>]]"
 int at_get_fd(const char *str_dirfd)
 {
 	/* work some magic ... expected format:
@@ -123,16 +132,46 @@ int at_get_fd(const char *str_dirfd)
 	return open(str_path, f_get_flags(str_flags), sscanf_mode_t(str_mode));
 }
 
+#define V_ACCESS_MODE "r | w | x | f"
+int access_mode(const char *s)
+{
+	int ret = 0;
+	if (strchr(s, 'r')) ret |= R_OK;
+	if (strchr(s, 'w')) ret |= W_OK;
+	if (strchr(s, 'x')) ret |= X_OK;
+	if (strchr(s, 'f')) ret  = F_OK;
+	return ret;
+}
+
 int main(int argc, char *argv[])
 {
 #if CONFIG
 	int i, test_ret;
 
 	if ((argc - 1) % (ARG_CNT + 1) || argc == 1) {
+#define _ARG_USE "<ret> " ARG_USE
 		printf(
 			"usage: " SFUNC " <tests>\n"
-			"test: < <ret> " ARG_USE " >\n"
+			"test: < " _ARG_USE " >\n"
+			"\n"
 		);
+		const char *vusage[] = {
+			"<ret>", "#[,<errno>]; # is a decimal and errno can be symbolic",
+			"<dirfd>", V_DIRFD,
+			"<file>", V_FILE,
+			"<times>", V_TIMESPEC,
+			"<atflags>", V_ATFLAGS,
+			"<fflags>", V_FFLAGS,
+			"<mode>", V_MODE_T,
+			"<strmode>", V_STRMODE,
+			"<acc_mode>", V_ACCESS_MODE,
+			"<dev>", V_DEV_T,
+			"<uid>", "# (decimal)",
+			"<gid>", "# (decimal)",
+		};
+		for (i = 0; i < ARRAY_SIZE(vusage); i += 2)
+			if (strstr(_ARG_USE, vusage[i]))
+				printf("%-10s := %s\n", vusage[i], vusage[i + 1]);
 		exit(1);
 	}
 

diff --git a/tests/truncate-0.c b/tests/truncate-0.c
index 43810a8..c510e5c 100644
--- a/tests/truncate-0.c
+++ b/tests/truncate-0.c
@@ -3,7 +3,7 @@
 #define FUNC_STR "\"%s\", %llu"
 #define FUNC_IMP path, (unsigned long long)length
 #define ARG_CNT 2
-#define ARG_USE "<oldpath> <newpath>"
+#define ARG_USE "<path> <length>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/truncate64-0.c b/tests/truncate64-0.c
index 2e28332..6e1a15f 100644
--- a/tests/truncate64-0.c
+++ b/tests/truncate64-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "\"%s\", %llu"
 #define FUNC_IMP path, (unsigned long long)length
 #define ARG_CNT 2
-#define ARG_USE "<oldpath> <newpath>"
+#define ARG_USE "<path> <length>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/unlinkat-0.c b/tests/unlinkat-0.c
index 3653965..6bf8bd6 100644
--- a/tests/unlinkat-0.c
+++ b/tests/unlinkat-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "%i, \"%s\", %x"
 #define FUNC_IMP dirfd, path, flags
 #define ARG_CNT 3
-#define ARG_USE "<dirfd> <path> <flags>"
+#define ARG_USE "<dirfd> <path> <atflags>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/utime-0.c b/tests/utime-0.c
index 865163e..a532693 100644
--- a/tests/utime-0.c
+++ b/tests/utime-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "\"%s\", %p"
 #define FUNC_IMP file, times
 #define ARG_CNT 2
-#define ARG_USE "<file> <times:=NULL>"
+#define ARG_USE "<file> <times>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/utimensat-0.c b/tests/utimensat-0.c
index da1847d..431d179 100644
--- a/tests/utimensat-0.c
+++ b/tests/utimensat-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "%i, \"%s\", %p, %x"
 #define FUNC_IMP dirfd, file, times, flags
 #define ARG_CNT 4
-#define ARG_USE "<dirfd> <file> <times:=NULL> <flags>"
+#define ARG_USE "<dirfd> <file> <times> <atflags>"
 
 #define process_args() \
 	s = argv[i++]; \

diff --git a/tests/utimes-0.c b/tests/utimes-0.c
index 62c8e93..366d44a 100644
--- a/tests/utimes-0.c
+++ b/tests/utimes-0.c
@@ -4,7 +4,7 @@
 #define FUNC_STR "\"%s\", %p"
 #define FUNC_IMP file, times
 #define ARG_CNT 2
-#define ARG_USE "<file> <times:=NULL>"
+#define ARG_USE "<file> <times>"
 
 #define process_args() \
 	s = argv[i++]; \


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2012-11-26 10:10 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2012-11-26 10:10 UTC (permalink / raw
  To: gentoo-commits

commit:     963811e4799eee8666f3b8f32e6c06d71315ddee
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 23 06:40:42 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Nov 26 10:10:42 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/sandbox.git;a=commit;h=963811e4

tests: disable tostop on controlling terminal

If this flag is set, then the tests get all hung up.  Clear
it in case someone has it active on their terminal.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 tests/atlocal.in |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/tests/atlocal.in b/tests/atlocal.in
index 1addcf0..8435f61 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -19,3 +19,6 @@ if [ "${AUTOTEST_PATH}" = "tests" ] ; then
 fi
 
 export SANDBOX_VERBOSE=0
+
+# If the terminal has this flag set, the tests get all messed up.
+stty -tostop 2>/dev/null


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2012-06-24  6:14 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2012-06-24  6:14 UTC (permalink / raw
  To: gentoo-commits

commit:     03069c9fb1e3a4147d66b2ea374d2e7fc62c81b0
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 24 05:20:40 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Jun 24 06:14:49 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/sandbox.git;a=commit;h=03069c9f

tests: enable color/parallel by default

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 tests/Makefile.am  |    2 ++
 tests/testsuite.at |    1 +
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 71c2872..6a05fe3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -90,6 +90,8 @@ if HAVE_LIBSIGSEGV
 libsigsegv_tst_LDADD = -lsigsegv
 endif
 
+TESTSUITEFLAGS = --jobs=`getconf _NPROCESSORS_ONLN || echo 1`
+
 check-local: atconfig atlocal $(TESTSUITE)
 	$(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='src:tests' $(TESTSUITEFLAGS)
 

diff --git a/tests/testsuite.at b/tests/testsuite.at
index f8af052..2fbe1dc 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -1,4 +1,5 @@
 AT_INIT
+AT_COLOR_TESTS
 
 m4_defun([sb_inc],[dnl
 m4_defun([SB_SECTION],[$1])



^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2012-06-23 21:27 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2012-06-23 21:27 UTC (permalink / raw
  To: gentoo-commits

commit:     99a9e43c31445464271502e60e99ed6e16a35566
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 18 01:26:31 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Jun 23 21:26:05 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/sandbox.git;a=commit;h=99a9e43c

tests: move disabling of sandbox verbose to common init

Since none of our tests care about the verbose output, move the disable
to a common location so we don't have to do it on a more fine grained
basis.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 tests/atlocal.in    |    2 ++
 tests/chmod-1.sh    |    1 -
 tests/chown-1.sh    |    1 -
 tests/fchmodat-1.sh |    1 -
 tests/fchownat-2.sh |    1 -
 5 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/tests/atlocal.in b/tests/atlocal.in
index 4cabcff..1addcf0 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -17,3 +17,5 @@ export SANDBOX_PREDICT=${SANDBOX_PREDICT%:/}
 if [ "${AUTOTEST_PATH}" = "tests" ] ; then
 	AUTOTEST_PATH="src:tests"
 fi
+
+export SANDBOX_VERBOSE=0

diff --git a/tests/chmod-1.sh b/tests/chmod-1.sh
index 89b57fe..f857eac 100755
--- a/tests/chmod-1.sh
+++ b/tests/chmod-1.sh
@@ -17,6 +17,5 @@ chmod-0 0 link 0666 || exit 1
 # this *should* trigger a sandbox violation
 adddeny $PWD/deny
 export SANDBOX_LOG=$PWD/sb.log
-unset SANDBOX_VERBOSE
 chmod-0 -1 link 0666 || exit 1
 test -s sb.log

diff --git a/tests/chown-1.sh b/tests/chown-1.sh
index ef4de0e..4a4b778 100755
--- a/tests/chown-1.sh
+++ b/tests/chown-1.sh
@@ -17,6 +17,5 @@ chown-0 0 link ${SB_UID} ${SB_GID} || exit 1
 # this *should* trigger a sandbox violation
 adddeny $PWD/deny
 export SANDBOX_LOG=$PWD/sb.log
-unset SANDBOX_VERBOSE
 chown-0 -1 link ${SB_UID} ${SB_GID} || exit 1
 test -s sb.log

diff --git a/tests/fchmodat-1.sh b/tests/fchmodat-1.sh
index 5db4365..570a2bf 100755
--- a/tests/fchmodat-1.sh
+++ b/tests/fchmodat-1.sh
@@ -17,6 +17,5 @@ fchmodat-0 0 AT_FDCWD link 0666 0 || exit 1
 # this *should* trigger a sandbox violation
 adddeny $PWD/deny
 export SANDBOX_LOG=$PWD/sb.log
-unset SANDBOX_VERBOSE
 fchmodat-0 -1 AT_FDCWD link 0666 0 || exit 1
 test -s sb.log

diff --git a/tests/fchownat-2.sh b/tests/fchownat-2.sh
index 9fd68f0..5c67616 100755
--- a/tests/fchownat-2.sh
+++ b/tests/fchownat-2.sh
@@ -17,6 +17,5 @@ fchownat-0 0 AT_FDCWD link ${SB_UID} ${SB_GID} 0 || exit 1
 # this *should* trigger a sandbox violation
 adddeny $PWD/deny
 export SANDBOX_LOG=$PWD/sb.log
-unset SANDBOX_VERBOSE
 fchownat-0 -1 AT_FDCWD link ${SB_UID} ${SB_GID} 0 || exit 1
 test -s sb.log



^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2012-03-06 19:00 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2012-03-06 19:00 UTC (permalink / raw
  To: gentoo-commits

commit:     e2744dbc889d63fad8a2c819db4785b45d3c8c62
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  5 05:22:23 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Mar  6 19:00:33 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/sandbox.git;a=commit;h=e2744dbc

tests: add static unlink tests

Make sure that when we trace static apps, their bad syscalls don't
get a chance to actually complete.

URL: http://bugs.gentoo.org/406543
Reported-by: Marijn Schouten <hkbst <AT> gentoo.org>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 tests/Makefile.am        |    1 +
 tests/unlink_static-0.c  |    1 +
 tests/unlink_static-1.sh |   10 ++++++++++
 tests/unlink_static.at   |    1 +
 4 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2646228..71c2872 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -62,6 +62,7 @@ check_PROGRAMS = \
 	truncate-0 \
 	truncate64-0 \
 	unlink-0 \
+	unlink_static-0 \
 	unlinkat-0 \
 	utime-0 \
 	utimensat-0 \

diff --git a/tests/unlink_static-0.c b/tests/unlink_static-0.c
new file mode 100644
index 0000000..efb4c91
--- /dev/null
+++ b/tests/unlink_static-0.c
@@ -0,0 +1 @@
+#include "unlink-0.c"

diff --git a/tests/unlink_static-1.sh b/tests/unlink_static-1.sh
new file mode 100755
index 0000000..62cb6b7
--- /dev/null
+++ b/tests/unlink_static-1.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# make sure we catch openat with relative path
+[ "${at_xfail}" = "yes" ] && exit 77 # see trace-0
+
+export SANDBOX_LOG=$PWD/sb.log
+touch f
+test -e f || exit 1
+adddeny "${PWD}"
+unlink_static-0 -1,EPERM f
+test -e sb.log -a -e f

diff --git a/tests/unlink_static.at b/tests/unlink_static.at
new file mode 100644
index 0000000..081d7d2
--- /dev/null
+++ b/tests/unlink_static.at
@@ -0,0 +1 @@
+SB_CHECK(1)



^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2012-03-05  7:01 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2012-03-05  7:01 UTC (permalink / raw
  To: gentoo-commits

commit:     b00795beb43741397d73558c5455bcf1ff305c6e
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  5 05:22:49 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Mar  5 07:00:54 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/sandbox.git;a=commit;h=b00795be

tests: note that testsuite.list.at is generated

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 tests/Makefile.am |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index e1ba631..2646228 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -105,5 +105,6 @@ $(TESTSUITE): $(AT_FILES) testsuite.list.at
 	mv $@.tmp $@
 
 testsuite.list.at: $(AT_FILES)
+	( echo "dnl DO NOT EDIT: GENERATED BY MAKEFILE.AM"; \
 	$(GREP) -l '^SB_CHECK' $(AT_FILES) | LC_ALL=C sort | \
-		$(SED) -e 's:^[.]/:sb_inc([:' -e 's:[.]at$$:]):' > $@
+		$(SED) -e 's:^[.]/:sb_inc([:' -e 's:[.]at$$:]):' ) > $@



^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2012-03-05  7:01 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2012-03-05  7:01 UTC (permalink / raw
  To: gentoo-commits

commit:     21b27c36015164a887af248e197c1210c6c7a365
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  5 05:20:34 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Mar  5 07:00:36 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/sandbox.git;a=commit;h=21b27c36

tests: make `./testsuite #` work

Without this, the test will fail because it can't find sandbox.sh
which lives in the src dir.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 tests/atlocal.in |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tests/atlocal.in b/tests/atlocal.in
index 7633401..4cabcff 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -13,3 +13,7 @@ export at_xfail
 # portage likes to do `addpredict /` ... we dont need/want
 # that garbage messing up our env
 export SANDBOX_PREDICT=${SANDBOX_PREDICT%:/}
+
+if [ "${AUTOTEST_PATH}" = "tests" ] ; then
+	AUTOTEST_PATH="src:tests"
+fi



^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2011-07-08 19:53 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2011-07-08 19:53 UTC (permalink / raw
  To: gentoo-commits

commit:     98bb61ee169cbbe12067c418472e56f63dff6853
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Jul  8 19:50:23 2011 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Jul  8 19:51:05 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/sandbox.git;a=commit;h=98bb61ee

tests: disable non-POSIX EBADFD

POSIX doesn't specify EBADFD, and EBADF should cover us, and we
don't really need it, so disable for now.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 tests/tests.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tests/tests.h b/tests/tests.h
index 08b8cd9..72c678c 100644
--- a/tests/tests.h
+++ b/tests/tests.h
@@ -51,7 +51,7 @@ const value_pair tbl_errno[] = {
 	PAIR(EACCES)
 	PAIR(EAGAIN)
 	PAIR(EBADF)
-	PAIR(EBADFD)
+/*	PAIR(EBADFD) POSIX only has EBADF */
 	PAIR(EBUSY)
 	PAIR(ECANCELED)
 	PAIR(ECHILD)



^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2011-07-04 23:06 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2011-07-04 23:06 UTC (permalink / raw
  To: gentoo-commits

commit:     c143ca8009fa46b737dbaa1ba7e749595330f8b1
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Jul  4 21:08:47 2011 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Jul  4 21:08:47 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/sandbox.git;a=commit;h=c143ca80

tests: fix flags parsing in open64

The open test got this fix a while ago, but open64 was missed.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 tests/open64-0.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/tests/open64-0.c b/tests/open64-0.c
index 425a4e2..76d2686 100644
--- a/tests/open64-0.c
+++ b/tests/open64-0.c
@@ -11,7 +11,6 @@
 	const char *file = f_get_file(s); \
 	\
 	s = argv[i++]; \
-	int flags; \
-	sscanf(s, "%i", &flags);
+	int flags = f_get_flags(s);
 
 #include "test-skel-0.c"



^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [gentoo-commits] proj/sandbox:master commit in: tests/
@ 2011-07-04 23:06 Mike Frysinger
  0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2011-07-04 23:06 UTC (permalink / raw
  To: gentoo-commits

commit:     1cc78eb4297c3135f5b7be826183a0a8b16bc2f9
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Jul  4 21:06:21 2011 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Jul  4 21:06:21 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/sandbox.git;a=commit;h=1cc78eb4

tests: use %#x instead of 0x%x

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 tests/open-0.c     |    2 +-
 tests/openat-0.c   |    2 +-
 tests/openat64-0.c |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/open-0.c b/tests/open-0.c
index 94a22ad..dfae46d 100644
--- a/tests/open-0.c
+++ b/tests/open-0.c
@@ -1,6 +1,6 @@
 #define FUNC open
 #define SFUNC "open"
-#define FUNC_STR "\"%s\", 0x%x, %o"
+#define FUNC_STR "\"%s\", %#x, %o"
 #define FUNC_IMP file, flags, mode
 #define ARG_CNT 3
 #define ARG_USE "<file> <flags> <mode>"

diff --git a/tests/openat-0.c b/tests/openat-0.c
index 360b9ed..7978e11 100644
--- a/tests/openat-0.c
+++ b/tests/openat-0.c
@@ -1,7 +1,7 @@
 #define CONFIG HAVE_OPENAT
 #define FUNC openat
 #define SFUNC "openat"
-#define FUNC_STR "%i, \"%s\", 0x%x, %o"
+#define FUNC_STR "%i, \"%s\", %#x, %o"
 #define FUNC_IMP dirfd, file, flags, mode
 #define ARG_CNT 4
 #define ARG_USE "<dirfd> <file> <flags> <mode>"

diff --git a/tests/openat64-0.c b/tests/openat64-0.c
index a471b29..9c707f6 100644
--- a/tests/openat64-0.c
+++ b/tests/openat64-0.c
@@ -1,7 +1,7 @@
 #define CONFIG HAVE_OPENAT64
 #define FUNC openat64
 #define SFUNC "openat64"
-#define FUNC_STR "%i, \"%s\", 0x%x, %o"
+#define FUNC_STR "%i, \"%s\", %#x, %o"
 #define FUNC_IMP dirfd, file, flags, mode
 #define ARG_CNT 4
 #define ARG_USE "<dirfd> <file> <flags> <mode>"



^ permalink raw reply related	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2023-07-01 23:52 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-29 12:24 [gentoo-commits] proj/sandbox:master commit in: tests/ Mike Frysinger
  -- strict thread matches above, loose matches on Subject: below --
2023-07-01 23:52 Mike Gilbert
2023-06-22 13:54 Mike Gilbert
2023-06-22 13:54 Mike Gilbert
2021-11-03 19:13 Mike Frysinger
2021-10-24  0:54 Mike Frysinger
2021-10-23 22:19 Mike Frysinger
2021-10-22  7:21 Michał Górny
2021-10-22  4:54 Mike Frysinger
2021-10-22  4:15 Mike Frysinger
2021-10-21  2:48 Mike Frysinger
2021-10-18  5:21 Mike Frysinger
2020-05-31 10:52 Michał Górny
2019-06-27 21:41 Sergei Trofimovich
2018-02-19  5:50 Michał Górny
2016-03-29 12:24 Mike Frysinger
2015-12-20 21:33 Mike Frysinger
2015-09-28 20:17 Mike Frysinger
2015-09-27  6:13 Mike Frysinger
2015-09-11  7:53 Mike Frysinger
2015-09-11  7:53 Mike Frysinger
2012-12-24 23:58 Mike Frysinger
2012-11-26 10:10 Mike Frysinger
2012-06-24  6:14 Mike Frysinger
2012-06-23 21:27 Mike Frysinger
2012-03-06 19:00 Mike Frysinger
2012-03-05  7:01 Mike Frysinger
2012-03-05  7:01 Mike Frysinger
2011-07-08 19:53 Mike Frysinger
2011-07-04 23:06 Mike Frysinger
2011-07-04 23:06 Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox