brarcher [Sat, 4 Jan 2014 18:33:49 +0000 (18:33 +0000)]
Add new test case for Check error printouts
When check hits an eprintf() call, this is a "Check error printout".
This test case, only available when fork() is available, will
test the instances when check should hit an eprintf() and exit.
brarcher [Sat, 4 Jan 2014 18:33:35 +0000 (18:33 +0000)]
check.h: export suite_tcase() function
Because it did not have CK_EXPORT in front of it, the symbol
was not being exported. It looks like this function should
be callable, but it could not before.
brarcher [Thu, 2 Jan 2014 02:43:22 +0000 (02:43 +0000)]
cmake: remove HAVE_* for snprintf in config.h.in
Having these caused MSVC to not compile, not having them
makes Linux fail prior to adding these definitions
in CMakeLists.txt. As they now cause problems for MSVC, but
the CMakeLists.txt definitions allow Linux to compile, there
should not be any issue.
brarcher [Thu, 2 Jan 2014 02:43:07 +0000 (02:43 +0000)]
Check for __GNUC__ consistently
Some tests will only be executed if compiled on gcc. However,
some of the tables did not have the related entries
compiled out when compiled on MSVC. This lead to crashes during
tests. Removing the entries correctly prevents this.
brarcher [Thu, 2 Jan 2014 02:42:43 +0000 (02:42 +0000)]
check_check_sub: sleep during test_eternal
For some reason on Linux (maybe other systems) if
check_check is canceled (e.g. Ctrl+C) when the test_eternal
is running, check_check will still run in the background
on this test. Because the test is in a tight loop,
it eats lots of CPU. Replacing the busy loop with the sleep
does not fix the problem, but at least when it happens
it will not take lots of CPU.
brarcher [Thu, 2 Jan 2014 02:42:40 +0000 (02:42 +0000)]
libcompat: remove replacement for sleep()
Before working on MSVC support, the replacement sleep() call
only called assert(). Instead, it was assumed that the related
code would not be called, as the only platform that did not
provide a sleep() call also did not provide fork() (e.g. Windows),
so the related code never got executed.
As we still do not provide a fork(), the sleep() replacement is
unnecessary as it is never called. If, in the future, Check
provides a fork() replacement, then a sleep() replacement will
make sense.
brarcher [Thu, 2 Jan 2014 02:42:37 +0000 (02:42 +0000)]
libcompat: remove unsetenv replacement
no system to date has been found that provides setenv
but not unsetenv. If setenv is unavailable, all related
tests are disabled at compile time. This stub replacement
does not serve any purpose. If in the future a system
with unsetenv is found that does provide setenv, then
the unit tests will need to disable all tests that
require unsetenv.
brarcher [Thu, 2 Jan 2014 02:42:33 +0000 (02:42 +0000)]
libcompat: remove putenv replacement
the putenv replacement did nothing except call abort().
There is no platform (yet) which did not have putenv()
but did have fork(). For this reason, the assert()
has yet to be hit, meaning that the stub itself is
pointless.
If in the future a platform is found to have fork() but
not putenv(), then the related tests need to be disabled
at compile time using something like
#if defined(HAVE_DECL_PUTENV)
along with a related AC_CHECK_DECLS check.
brarcher [Thu, 2 Jan 2014 02:42:29 +0000 (02:42 +0000)]
libcompat: do not offer to replace setenv
if setenv is missing on the system, the only thing that is
affected are unit tests. Check itself does not need setenv.
In this case, the affected unit tests are not compiled in.
This change removed the stub setenv replacement which was
never called, even when a system did not provide it.
brarcher [Thu, 2 Jan 2014 02:42:26 +0000 (02:42 +0000)]
replace how setenv availability is detected
The generated config.h file defines HAVE_DECL_SETENV, which
was checked at compile time in libcompat to create
HAVE_WORKING_SETENV. There is no reason to have the latter, when
the former can be used directly.
brarcher [Tue, 31 Dec 2013 20:39:33 +0000 (20:39 +0000)]
test_xml_output: do not use -n with echo
On some systems (e.g. OSX) a script will use the built-in version
of echo, which does not support arguments. Instead of getting no
newline, instead there is an extra "-n" in the output.
brarcher [Tue, 31 Dec 2013 20:39:31 +0000 (20:39 +0000)]
autotools: include pthread.h when checking for clockid_t/timer_t
Must include pthread.h to check for clockid_t and timer_t. This is
because MinGW and MinGW-w64 both put the time related definitions
in pthread headers and not in sys/types.h. Without optionally
including pthread.h, the check for these types may mistakenly fail.
brarcher [Fri, 27 Dec 2013 18:18:17 +0000 (18:18 +0000)]
consolidate all output tests into ex_output.c
This way, it will be simpler to add more outputs. Simply extend
this file. Further, if any bugs are found and needed to be
regression tested, they are added to only one place.
brarcher [Wed, 25 Dec 2013 04:39:11 +0000 (04:39 +0000)]
cmake: create a check_stdint.h file
Sinple hack replacement for the autotools AX_CREATE_STDINT_H
command. There may be a better way to do this that actually
checks if stdint.h is available, and what to do if it is not.
However, There are checks for the various int types already.
brarcher [Wed, 25 Dec 2013 03:04:59 +0000 (03:04 +0000)]
use only FILE* API for file reading/writing
MSVC does not like switching between read()/write() API and
FILE* API using fileno(). The fileno() call seems to return something
that does not work with write(). Keeping the API used
consistent removes this problem.
brarcher [Wed, 25 Dec 2013 03:04:44 +0000 (03:04 +0000)]
modify how HAVE_FORK is determined in code
autotools will define HAVE_FORK only if fork is available.
cmake can do the same thing on Linux, however on Windows
the only way to get HAVE_FORK to appear is to make it always
appear and contain a value. To support both autotools and
cmake, change the compile time check slightly to check that
HAVE_FORK is 1.
brarcher [Wed, 25 Dec 2013 03:04:39 +0000 (03:04 +0000)]
Fix fileno(get_pipe()) for MSVC
MSVC is unable to parse the code:
fileno(get_pipe())
when directly as an argument for ppack() or punpack(). This may
be because fileno() is replaced with _fileno() in a #define.
brarcher [Wed, 25 Dec 2013 03:04:19 +0000 (03:04 +0000)]
cmake: always compile in memory leaking tests
The check_mem_leaks is not configured to compile with cmake.
As the target for cmake is Windows, and Windows does not have
a valgrind that will work, there is no point in supporting
it.
brarcher [Mon, 23 Dec 2013 16:29:42 +0000 (16:29 +0000)]
test_xml_output: add tests for valid duration for tests
This is to check for the case where the duration is not -1
or in [0, CK_DEFAULT_TIMEOUT]. There was an issue with NO_FORK
mode where the duration was not valid.
brarcher [Mon, 23 Dec 2013 15:48:37 +0000 (15:48 +0000)]
move clock_gettime calls outside of setjmp context for NO_FORK mode
The test duration was getting smashed if tests failed in NO_FORK
mode. If the setjmp() function was used to abort a test, the end
time would not get captured. This resulted in arbitrary numbers
being written for the test's duration.
This change moves the settime() calls outside of the setjmp() context,
so the times get captured if the test passes or fails.
brarcher [Sat, 21 Dec 2013 00:04:59 +0000 (00:04 +0000)]
librt_timers.m4: use prev behavior when cross compiling
In the case where we are cross compiling, the POSIX detection of
the timer_create() function is skipped, and instead the usual check
for the existence of all the timer_* functions is done using
AC_REPLACE_FUNCS.