0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-27 15:41:05 +08:00

Add "#undef NDEBUG" to all tests.

This change makes sure that even if the tests are built in a
"release" configuration (with optimizations and NDEBUG turned on),
the assertions won't get compiled out of the tests themselves.

The C standard guarantees that the most recent inclusion of
<assert.h> is the one that counts, so it's important that the
"#undef NDEBUG/#include <assert.h>" come as the last thing in
the block of header files.

"testutil.hpp" includes <assert.h>, so I've left <assert.h> out
of any test that #includes "testutil.hpp", just for the sake of
brevity.
This commit is contained in:
Arthur O'Dwyer 2012-08-23 13:40:30 -07:00
parent 84728cd961
commit cf20932df0
20 changed files with 67 additions and 47 deletions

View File

@ -18,15 +18,15 @@ You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <errno.h>
#include <unistd.h>
#include "../include/zmq.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <string>
#undef NDEBUG
#include <assert.h>
static void *server (void *)
{

View File

@ -18,12 +18,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include "../include/zmq.h"
#include <stdio.h>
#include <errno.h>
#include "../include/zmq.h"
#undef NDEBUG
#include <assert.h>
int main (void)
{

View File

@ -19,9 +19,7 @@
*/
#include <assert.h>
#include <stdio.h>
#include "testutil.hpp"
int main (void)

View File

@ -20,9 +20,11 @@
*/
#include "../include/zmq.h"
#include <assert.h>
#include <stdio.h>
#undef NDEBUG
#include <assert.h>
int main (void)
{
fprintf (stderr, "test_invalid_rep running...\n");

View File

@ -19,10 +19,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include "../include/zmq.h"
#include <string.h>
#include "../include/zmq.h"
#undef NDEBUG
#include <assert.h>
static void do_bind_and_verify (void *s, const char *endpoint)
{

View File

@ -19,12 +19,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <string.h>
#include "testutil.hpp"
#include "../include/zmq.h"
#include "../include/zmq_utils.h"
#include <string.h>
#include "testutil.hpp"
static int events;

View File

@ -19,10 +19,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include "../include/zmq.h"
#include <string.h>
#include "../include/zmq.h"
#undef NDEBUG
#include <assert.h>
int main (void)
{

View File

@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <stdio.h>
#include "testutil.hpp"

View File

@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <stdio.h>
#include "testutil.hpp"

View File

@ -19,7 +19,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <stdio.h>
#include "testutil.hpp"

View File

@ -19,11 +19,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include "../include/zmq.h"
#include <stdio.h>
#include <string.h>
#undef NDEBUG
#include <assert.h>
int main (void)
{

View File

@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <stdio.h>
#include "testutil.hpp"

View File

@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <stdio.h>
#include "testutil.hpp"

View File

@ -19,7 +19,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <stdio.h>
#include "testutil.hpp"

View File

@ -19,7 +19,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <stdio.h>
#include "testutil.hpp"

View File

@ -20,11 +20,13 @@
*/
#include "../include/zmq.h"
#include <assert.h>
#include <pthread.h>
#include <stddef.h>
#include <stdio.h>
#undef NDEBUG
#include <assert.h>
#define THREAD_COUNT 100
extern "C"

View File

@ -19,11 +19,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <stdio.h>
#include "../include/zmq.h"
#include "../include/zmq_utils.h"
#include <stdio.h>
#undef NDEBUG
#include <assert.h>
int main (void)
{

View File

@ -1,10 +1,31 @@
#include <assert.h>
#include <string.h>
#include <unistd.h>
/*
Copyright (c) 2010-2011 250bpm s.r.o.
Copyright (c) 2011 iMatix Corporation
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
This file is part of 0MQ.
0MQ is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
0MQ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../include/zmq.h"
#include "../include/zmq_utils.h"
#include <string.h>
#include <unistd.h>
#undef NDEBUG
#include <assert.h>
int main (void)
{

View File

@ -18,13 +18,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <string.h>
#include <pthread.h>
#include <stdio.h>
#include "../include/zmq.h"
#include "../include/zmq_utils.h"
#include <pthread.h>
#include <stdio.h>
#include <string.h>
#undef NDEBUG
#include <assert.h>
extern "C"
{

View File

@ -22,10 +22,11 @@
#ifndef __ZMQ_TEST_TESTUTIL_HPP_INCLUDED__
#define __ZMQ_TEST_TESTUTIL_HPP_INCLUDED__
#include <assert.h>
#include "../include/zmq.h"
#include <string.h>
#include "../include/zmq.h"
#undef NDEBUG
#include <assert.h>
inline void bounce (void *sb, void *sc)
{