|
From: <tho...@us...> - 2014-05-01 20:48:50
|
Revision: 551
http://sourceforge.net/p/cgreen/code/551
Author: thomasnilsson
Date: 2014-05-01 20:48:41 +0000 (Thu, 01 May 2014)
Log Message:
-----------
Changed handling of blocked pipe so that the test case for it works
However it reveals a C++ problem with uninitialized CppConstaints
which fails the test suite for C++
Modified Paths:
--------------
trunk/cgreen/cmake/Modules/DefineCompilerFlags.cmake
trunk/cgreen/include/cgreen/cpp_constraint.h
trunk/cgreen/src/posix_cgreen_pipe.c
Modified: trunk/cgreen/cmake/Modules/DefineCompilerFlags.cmake
===================================================================
--- trunk/cgreen/cmake/Modules/DefineCompilerFlags.cmake 2014-05-01 13:28:45 UTC (rev 550)
+++ trunk/cgreen/cmake/Modules/DefineCompilerFlags.cmake 2014-05-01 20:48:41 UTC (rev 551)
@@ -11,7 +11,7 @@
if (UNIX)
if (CMAKE_COMPILER_IS_GNUCC OR COMPILER_IS_CLANG)
if (WITH_CXX)
- add_definitions( -g -Weffc++ -Wall -Wextra -Wunused)
+ add_definitions(-g -Weffc++ -Wall -Wextra -Wunused)
else()
add_definitions(-g -std=c99 -Wall -Wextra -Wunused)
endif (WITH_CXX)
Modified: trunk/cgreen/include/cgreen/cpp_constraint.h
===================================================================
--- trunk/cgreen/include/cgreen/cpp_constraint.h 2014-05-01 13:28:45 UTC (rev 550)
+++ trunk/cgreen/include/cgreen/cpp_constraint.h 2014-05-01 20:48:41 UTC (rev 551)
@@ -37,10 +37,12 @@
void test_want_value(CppConstraint<T> *constraint, const char *function, T actual, const char *test_file, int test_line, TestReporter *reporter) {
}
+#include <stdlib.h>
// TODO: add create_equal_to_constraint_<T> where operator<< output is used for expected_value name
template<typename T>
CppConstraint<T> *create_equal_to_value_constraint(T expected_value, const char *expected_value_name) {
CppConstraint<T> *constraint;// = create_cpp_constraint<T>();
+ constraint = new CppConstraint<T>();
constraint->type = VALUE_COMPARER;
constraint->compare = &compare_want_value;
Modified: trunk/cgreen/src/posix_cgreen_pipe.c
===================================================================
--- trunk/cgreen/src/posix_cgreen_pipe.c 2014-05-01 13:28:45 UTC (rev 550)
+++ trunk/cgreen/src/posix_cgreen_pipe.c 2014-05-01 20:48:41 UTC (rev 551)
@@ -4,6 +4,7 @@
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
+#include <sys/wait.h>
#ifndef O_ASYNC
# define O_ASYNC FASYNC
@@ -55,19 +56,18 @@
ssize_t cgreen_pipe_write(int p, const void *buf, size_t count)
{
int pipe_write_result = write(p, buf, count);
+ int status;
if (pipe_write_result < 0) {
if (errno == EWOULDBLOCK) {
fprintf(stderr, "\tCGREEN EXCEPTION: Too many assertions within a single test.\n");
} else if (errno != EPIPE) {
fprintf(stderr, "\tCGREEN EXCEPTION: Error when reporting from test case process to reporter\n");
}
- kill(getpid(), SIGPIPE);
raise(SIGPIPE);
+ wait(&status); /* Safe-guarding against a signalhandler for SIGPIPE, which
+ incidentaly the test case for pipe block need to have... */
}
-
- return write(p, buf, count);
-
- // return pipe_write_result;
+ return pipe_write_result;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|