diff --git a/Makefile.in b/Makefile.in index 2ea0567ab..b2b779739 100644 --- a/Makefile.in +++ b/Makefile.in @@ -481,13 +481,25 @@ UNITTEST_OBJS = unittest/run_tests.o \ unittest/get_framerate_test.o \ unittest/video_desc_test.o -unittest/run_tests: $(UNITTEST_OBJS) $(OBJS) +UNITTEST_DEPS = src/compat/platform_time.o \ + src/debug.o \ + src/utils/misc.o \ + src/video.o \ + src/video_frame.o \ + src/video_codec.o + +unittest/run_tests: $(UNITTEST_OBJS) $(UNITTESTS_DEPS) $(MKDIR_P) $(dir $@) - $(LINKER) $(LDFLAGS) $(UNITTEST_OBJS) $(OBJS) $(LIBS) -lcppunit -o $@ + $(LINKER) $(LDFLAGS) $(UNITTEST_OBJS) $(UNITTEST_DEPS) $(LIBS) -lcppunit -o $@ unittests: unittest/run_tests @unittest/run_tests +check: @UNITTESTS_TARGET@ # tests + +distcheck: all + $(TARGET) >/dev/null 2>&1 + # ------------------------------------------------------------------------------------------------- ag-plugins: ag_plugin/uvReceiverService.zip ag_plugin/uvSenderService.zip diff --git a/configure.ac b/configure.ac index 60a1eee5a..75fd66e03 100644 --- a/configure.ac +++ b/configure.ac @@ -3004,6 +3004,17 @@ if test $cineform_req = yes -a $cineform = no; then AC_MSG_ERROR([CINEFORM not found]); fi +# --------------------------------------------------------------------- +# Tests +# --------------------------------------------------------------------- +PKG_CHECK_MODULES([CPPUNIT], [cppunit], [cppunit=yes], [cppunit=no]) +if test "$cppunit" = yes; then + UNITTESTS_TARGET=unittests +else + UNITTESTS_TARGET= +fi +AC_SUBST(UNITTESTS_TARGET) + # ------------------------------------------------------------------------------------------------- # We need to add libraries then # ------------------------------------------------------------------------------------------------- diff --git a/src/control_socket.cpp b/src/control_socket.cpp index 26df90712..0a9c6956d 100644 --- a/src/control_socket.cpp +++ b/src/control_socket.cpp @@ -53,6 +53,7 @@ #include #include "debug.h" +#include "host.h" #include "messaging.h" #include "module.h" #include "rtp/net_udp.h" // socket_error diff --git a/src/debug.cpp b/src/debug.cpp index 5d7def04e..67899a681 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -52,6 +52,8 @@ #include "host.h" #include "rang.hpp" +volatile int log_level = LOG_LEVEL_INFO; + static void _dprintf(const char *format, ...) { if (log_level < LOG_LEVEL_DEBUG) { diff --git a/src/debug.h b/src/debug.h index b77c5afb5..356e1fc99 100644 --- a/src/debug.h +++ b/src/debug.h @@ -42,7 +42,21 @@ #define UNUSED(x) (x=x) -#include "host.h" +#define LOG_LEVEL_QUIET 0 ///< suppress all logging +#define LOG_LEVEL_FATAL 1 ///< errors that prevent UG run +#define LOG_LEVEL_ERROR 2 ///< general errors +#define LOG_LEVEL_WARNING 3 ///< less severe errors +#define LOG_LEVEL_NOTICE 4 ///< information that may be interesting +#define LOG_LEVEL_INFO 5 ///< normal reporting +#define LOG_LEVEL_VERBOSE 6 ///< display more messages but no more than + ///< one of a kind every ~1 sec +#define LOG_LEVEL_DEBUG 7 ///< like LOG_LEVEL_VERBOSE, freq. approx. + ///< 1 message every video frame +#define LOG_LEVEL_DEBUG2 8 ///< even more verbose - eg. every packet can + ///< be logged +#define LOG_LEVEL_MAX LOG_LEVEL_DEBUG2 +extern volatile int log_level; + #ifdef __cplusplus extern "C" { diff --git a/src/host.cpp b/src/host.cpp index e1e5bfd34..4e6fc9f91 100644 --- a/src/host.cpp +++ b/src/host.cpp @@ -101,8 +101,6 @@ char **uv_argv; char *export_dir = NULL; volatile bool should_exit = false; -volatile int log_level = LOG_LEVEL_INFO; - volatile int audio_offset; volatile int video_offset; diff --git a/src/host.h b/src/host.h index 7a91d8afe..bd965c86e 100644 --- a/src/host.h +++ b/src/host.h @@ -94,21 +94,6 @@ extern unsigned int audio_capture_sample_rate; // user-specified sample rate, if extern unsigned int cuda_devices[]; extern unsigned int cuda_devices_count; -#define LOG_LEVEL_QUIET 0 ///< suppress all logging -#define LOG_LEVEL_FATAL 1 ///< errors that prevent UG run -#define LOG_LEVEL_ERROR 2 ///< general errors -#define LOG_LEVEL_WARNING 3 ///< less severe errors -#define LOG_LEVEL_NOTICE 4 ///< information that may be interesting -#define LOG_LEVEL_INFO 5 ///< normal reporting -#define LOG_LEVEL_VERBOSE 6 ///< display more messages but no more than - ///< one of a kind every ~1 sec -#define LOG_LEVEL_DEBUG 7 ///< like LOG_LEVEL_VERBOSE, freq. approx. - ///< 1 message every video frame -#define LOG_LEVEL_DEBUG2 8 ///< even more verbose - eg. every packet can - ///< be logged -#define LOG_LEVEL_MAX LOG_LEVEL_DEBUG2 -extern volatile int log_level; - #define MODE_SENDER (1<<0) #define MODE_RECEIVER (1<<1) diff --git a/src/keyboard_control.h b/src/keyboard_control.h index 30fa3e041..557197c55 100644 --- a/src/keyboard_control.h +++ b/src/keyboard_control.h @@ -38,6 +38,9 @@ #ifndef keyboard_control_h_ #define keyboard_control_h_ +#include "host.h" +#include "module.h" + #ifdef __cplusplus #include @@ -55,8 +58,6 @@ #include #endif -#include "module.h" - class keyboard_control { public: keyboard_control(struct module *parent); diff --git a/src/rtp/net_udp.cpp b/src/rtp/net_udp.cpp index 0b53c6a55..05a3d9f1e 100644 --- a/src/rtp/net_udp.cpp +++ b/src/rtp/net_udp.cpp @@ -48,6 +48,7 @@ #include "config_unix.h" #include "config_win32.h" #include "debug.h" +#include "host.h" #include "memory.h" #include "compat/platform_pipe.h" #include "compat/platform_semaphore.h" diff --git a/src/video_codec.c b/src/video_codec.c index 920b4f9ab..1b9a8f8c4 100644 --- a/src/video_codec.c +++ b/src/video_codec.c @@ -61,6 +61,7 @@ #include #include "debug.h" +#include "host.h" #include "hwaccel_vdpau.h" #include "utils/misc.h" // to_fourcc #include "video_codec.h" diff --git a/unittest/run_tests.cpp b/unittest/run_tests.cpp index 579fdbfd1..6559e5f30 100644 --- a/unittest/run_tests.cpp +++ b/unittest/run_tests.cpp @@ -1,3 +1,9 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#include "config_unix.h" +#include "config_win32.h" +#endif + #include #include #include diff --git a/unittest/video_desc_test.cpp b/unittest/video_desc_test.cpp index a5313b79d..844f4e63c 100644 --- a/unittest/video_desc_test.cpp +++ b/unittest/video_desc_test.cpp @@ -4,6 +4,12 @@ #include "config_win32.h" #endif +#ifdef HAVE_CONFIG_H +#include "config.h" +#include "config_unix.h" +#include "config_win32.h" +#endif + #include #include "video_desc_test.h"