BIND 10 trac366, updated. 13668e95ca6bbb07128babb14f1772bfefcb09a8 [trac366] Fix tests
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Mar 28 09:30:54 UTC 2011
The branch, trac366 has been updated
via 13668e95ca6bbb07128babb14f1772bfefcb09a8 (commit)
from eddf905784249ab6949e6186f2676f9d627b089c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 13668e95ca6bbb07128babb14f1772bfefcb09a8
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Mon Mar 28 11:30:13 2011 +0200
[trac366] Fix tests
It needed very large stack, causing a stack overflow sometimes.
-----------------------------------------------------------------------
Summary of changes:
src/lib/util/unittests/fork.cc | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/util/unittests/fork.cc b/src/lib/util/unittests/fork.cc
index bfced89..1eeb2cc 100644
--- a/src/lib/util/unittests/fork.cc
+++ b/src/lib/util/unittests/fork.cc
@@ -47,7 +47,8 @@ process_ok(pid_t process) {
if (sigaction(SIGALRM, &ignored, &original)) {
return false;
}
- alarm(3);
+ // It is long, but if everything is OK, it'll not happen
+ alarm(10);
int status;
int result(waitpid(process, &status, 0) == -1);
// Cancel the alarm and return the original handler
@@ -104,10 +105,13 @@ check_output(int *write_pipe, const void *output, const size_t length)
*write_pipe = pipes[1];
pid_t pid(fork());
if (pid) { // We are in parent
+ close(pipes[0]);
return pid;
} else {
close(pipes[1]);
- unsigned char buffer[length + 1];
+ // We don't return the memory, but we're in tests and end this process
+ // right away.
+ unsigned char *buffer = new unsigned char[length + 1];
// Try to read one byte more to see if the output ends here
size_t got_length(read_data(pipes[0], buffer, length + 1));
bool ok(true);
@@ -120,7 +124,7 @@ check_output(int *write_pipe, const void *output, const size_t length)
if(!ok || memcmp(buffer, output, length)) {
const unsigned char *output_c(static_cast<const unsigned char *>(
output));
- // If the differ, print what we have
+ // If they differ, print what we have
for(size_t i(0); i != got_length; ++ i) {
fprintf(stderr, "%02hhx", buffer[i]);
}
More information about the bind10-changes
mailing list