Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/atf/dist Pull up part of revision f621bc0489ac3...
details: https://anonhg.NetBSD.org/src/rev/df91b0e46d34
branches: trunk
changeset: 766091:df91b0e46d34
user: jmmv <jmmv%NetBSD.org@localhost>
date: Wed Jun 15 08:48:35 2011 +0000
description:
Pull up part of revision f621bc0489ac3e4ef364f840a852a6a5290e8e12:
-----
Only silence stdin for test programs
atf-check is expected to accept data in its stdin, and a previous change
broke this behavior.
-----
This should fix a few tests that broke during the 0.14 import. In
particularly, the tests in libc/stdlib and libc/ssp that redirect stuff
to atf_check.
diffstat:
external/bsd/atf/dist/atf-c/detail/process.c | 22 ----------------------
external/bsd/atf/dist/atf-run/test-program.cpp | 14 ++++++++++++++
external/bsd/atf/dist/atf-sh/atf-check_test.sh | 13 +++++++++++++
3 files changed, 27 insertions(+), 22 deletions(-)
diffs (107 lines):
diff -r 423d61b3ca67 -r df91b0e46d34 external/bsd/atf/dist/atf-c/detail/process.c
--- a/external/bsd/atf/dist/atf-c/detail/process.c Wed Jun 15 08:19:43 2011 +0000
+++ b/external/bsd/atf/dist/atf-c/detail/process.c Wed Jun 15 08:48:35 2011 +0000
@@ -412,24 +412,6 @@
}
static
-atf_error_t
-silence_stdin(void)
-{
- atf_error_t err;
-
- close(STDIN_FILENO);
- int fd = open("/dev/zero", O_RDONLY);
- if (fd == -1)
- err = atf_libc_error(errno, "Could not open /dev/zero");
- else {
- INV(fd == STDIN_FILENO);
- err = atf_no_error();
- }
-
- return err;
-}
-
-static
void
do_child(void (*)(void *),
void *,
@@ -445,10 +427,6 @@
{
atf_error_t err;
- err = silence_stdin();
- if (atf_is_error(err))
- goto out;
-
err = child_connect(outsp, STDOUT_FILENO);
if (atf_is_error(err))
goto out;
diff -r 423d61b3ca67 -r df91b0e46d34 external/bsd/atf/dist/atf-run/test-program.cpp
--- a/external/bsd/atf/dist/atf-run/test-program.cpp Wed Jun 15 08:19:43 2011 +0000
+++ b/external/bsd/atf/dist/atf-run/test-program.cpp Wed Jun 15 08:48:35 2011 +0000
@@ -31,6 +31,7 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <fcntl.h>
#include <signal.h>
#include <unistd.h>
}
@@ -220,6 +221,17 @@
static
void
+silence_stdin(void)
+{
+ ::close(STDIN_FILENO);
+ int fd = ::open("/dev/null", O_RDONLY);
+ if (fd == -1)
+ throw std::runtime_error("Could not open /dev/null");
+ INV(fd == STDIN_FILENO);
+}
+
+static
+void
prepare_child(const atf::fs::path& workdir)
{
const int ret = ::setpgid(::getpid(), 0);
@@ -244,6 +256,8 @@
atf::env::set("__RUNNING_INSIDE_ATF_RUN", "internal-yes-value");
impl::change_directory(workdir);
+
+ silence_stdin();
}
static
diff -r 423d61b3ca67 -r df91b0e46d34 external/bsd/atf/dist/atf-sh/atf-check_test.sh
--- a/external/bsd/atf/dist/atf-sh/atf-check_test.sh Wed Jun 15 08:19:43 2011 +0000
+++ b/external/bsd/atf/dist/atf-sh/atf-check_test.sh Wed Jun 15 08:48:35 2011 +0000
@@ -400,6 +400,17 @@
h_fail "echo foo bar 1>&2" -e not-match:foo
}
+atf_test_case stdin
+stdin_head()
+{
+ atf_set "descr" "Tests that stdin is preserved"
+}
+stdin_body()
+{
+ echo "hello" | ${Atf_Check} -o match:"hello" cat || \
+ atf_fail "atf-check does not seem to respect stdin"
+}
+
atf_test_case invalid_umask
invalid_umask_head()
{
@@ -444,6 +455,8 @@
atf_add_test_case eflag_multiple
atf_add_test_case eflag_negated
+ atf_add_test_case stdin
+
atf_add_test_case invalid_umask
}
Home |
Main Index |
Thread Index |
Old Index