mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-20 03:08:39 +00:00
Merged new and old unit tests
+ skip UDP tests if running inside GitHub VM (doesn't support multicast) + create symbols (ctags/cscope) for tests
This commit is contained in:
33
Makefile.in
33
Makefile.in
@@ -449,7 +449,9 @@ gui/QT/uv-qt: $(wildcard $(srcdir)/gui/QT/*.cpp $(srcdir)/gui/QT/*.hpp) $(srcdir
|
||||
cd gui/QT && $(QMAKE) $(srcdir)/../../gui/QT && make -j 4 $(MAKE_GUI_TARGET)
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
TEST_OBJS = test/test_bitstream.o \
|
||||
TEST_OBJS = test/get_framerate_test.o \
|
||||
test/video_desc_test.o \
|
||||
test/test_bitstream.o \
|
||||
test/test_aes.o \
|
||||
test/test_des.o \
|
||||
test/test_md5.o \
|
||||
@@ -463,7 +465,7 @@ TEST_OBJS = test/test_bitstream.o \
|
||||
|
||||
test/run_tests: $(TEST_OBJS) $(OBJS)
|
||||
$(MKDIR_P) $(dir $@)
|
||||
$(LINKER) $(CFLAGS) $(TEST_OBJS) $(OBJS) $(LIBS) -o test/run_tests
|
||||
$(LINKER) $(CFLAGS) $(TEST_OBJS) $(OBJS) $(LIBS) @CPPUNIT_LIBS@ -o test/run_tests
|
||||
|
||||
suggest-tests:
|
||||
@echo ""
|
||||
@@ -477,25 +479,8 @@ configure-messages:
|
||||
tests: test/run_tests
|
||||
@test/run_tests
|
||||
|
||||
UNITTEST_OBJS = unittest/run_tests.o \
|
||||
unittest/get_framerate_test.o \
|
||||
unittest/video_desc_test.o
|
||||
|
||||
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) $(UNITTEST_DEPS) $(LIBS) -lcppunit -o $@
|
||||
|
||||
unittests: unittest/run_tests
|
||||
@unittest/run_tests
|
||||
|
||||
check: @UNITTESTS_TARGET@ tests
|
||||
check: tests
|
||||
|
||||
distcheck: all
|
||||
$(TARGET) >/dev/null 2>&1
|
||||
@@ -539,16 +524,16 @@ distclean: clean
|
||||
-rm -f Makefile config.status config.cache config.log src/config.h cscope.out tags
|
||||
|
||||
etags:
|
||||
etags $$(find $(srcdir)/src \( -name '*.c' -o -name '*.cpp' -o -name '*.cu' -o -name '*.h' -o -name '*.hpp' -o -name '*.m' -o -name '*.mm' \))
|
||||
etags $$(find $(srcdir)/src $(srcdir)/test \( -name '*.c' -o -name '*.cpp' -o -name '*.cu' -o -name '*.h' -o -name '*.hpp' -o -name '*.m' -o -name '*.mm' \))
|
||||
|
||||
ctags:
|
||||
ctags $$(find $(srcdir)/src \( -name '*.c' -o -name '*.cpp' -o -name '*.cu' -o -name '*.h' -o -name '*.hpp' -o -name '*.m' -o -name '*.mm' \))
|
||||
ctags $$(find $(srcdir)/src $(srcdir)/test \( -name '*.c' -o -name '*.cpp' -o -name '*.cu' -o -name '*.h' -o -name '*.hpp' -o -name '*.m' -o -name '*.mm' \))
|
||||
|
||||
ctags-universal:
|
||||
ctags-universal -bv $$(find $(srcdir)/src \( -name '*.c' -o -name '*.cpp' -o -name '*.cu' -o -name '*.h' -o -name '*.hpp' -o -name '*.m' -o -name '*.mm' \))
|
||||
ctags-universal -bv $$(find $(srcdir)/src $(srcdir)/test \( -name '*.c' -o -name '*.cpp' -o -name '*.cu' -o -name '*.h' -o -name '*.hpp' -o -name '*.m' -o -name '*.mm' \))
|
||||
|
||||
cscope:
|
||||
cscope -bv $$(find $(srcdir)/src \( -name '*.c' -o -name '*.cpp' -o -name '*.cu' -o -name '*.h' -o -name '*.hpp' -o -name '*.m' -o -name '*.mm' \))
|
||||
cscope -bv $$(find $(srcdir)/src $(srcdir)/test \( -name '*.c' -o -name '*.cpp' -o -name '*.cu' -o -name '*.h' -o -name '*.hpp' -o -name '*.m' -o -name '*.mm' \))
|
||||
|
||||
doc:
|
||||
cd $(srcdir) && doxygen Doxyfile
|
||||
|
||||
@@ -3009,11 +3009,11 @@ fi
|
||||
# ---------------------------------------------------------------------
|
||||
PKG_CHECK_MODULES([CPPUNIT], [cppunit], [cppunit=yes], [cppunit=no])
|
||||
if test "$cppunit" = yes; then
|
||||
UNITTESTS_TARGET=unittests
|
||||
AC_DEFINE([HAVE_CPPUNIT], [1], [Build with CppUnit tests])
|
||||
else
|
||||
UNITTESTS_TARGET=
|
||||
CPPUNIT_LIBS=
|
||||
fi
|
||||
AC_SUBST(UNITTESTS_TARGET)
|
||||
AC_SUBST(CPPUNIT_LIBS)
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# We need to add libraries then
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "config_win32.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CPPUNIT
|
||||
|
||||
#include <cppunit/config/SourcePrefix.h>
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
@@ -100,3 +102,4 @@ get_framerate_test::test_free()
|
||||
}
|
||||
}
|
||||
|
||||
#endif // defined HAVE_CPPUNIT
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* FILE: run_tests.c
|
||||
* FILE: run_tests.cpp
|
||||
* AUTHORS: Colin Perkins
|
||||
*
|
||||
* Copyright (c) 2004 University of Glasgow
|
||||
@@ -36,10 +36,20 @@
|
||||
* $Date: 2008/01/10 11:07:42 $
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#include "config_unix.h"
|
||||
#include "config_win32.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CPPUNIT
|
||||
#include <cppunit/CompilerOutputter.h>
|
||||
#include <cppunit/extensions/TestFactoryRegistry.h>
|
||||
#include <cppunit/ui/text/TestRunner.h>
|
||||
#endif
|
||||
|
||||
#include "debug.h"
|
||||
extern "C" {
|
||||
#include "test_host.h"
|
||||
#include "test_aes.h"
|
||||
#include "test_bitstream.h"
|
||||
@@ -51,11 +61,10 @@
|
||||
#include "test_rtp.h"
|
||||
#include "test_video_capture.h"
|
||||
#include "test_video_display.h"
|
||||
}
|
||||
|
||||
#define TEST_AV_HW 1
|
||||
|
||||
uint32_t RTT; /* FIXME: will be removed once the global in main.c is removed */
|
||||
|
||||
/* These globals should be fixed in the future as well */
|
||||
uint32_t hd_size_x = 1920;
|
||||
uint32_t hd_size_y = 1080;
|
||||
@@ -66,10 +75,11 @@ uint32_t hd_video_mode;
|
||||
|
||||
long packet_rate = 13600;
|
||||
|
||||
void exit_uv(int ret);
|
||||
void exit_uv(int ret)
|
||||
extern "C" void exit_uv(int status);
|
||||
|
||||
void exit_uv(int status)
|
||||
{
|
||||
exit(ret);
|
||||
exit(status);
|
||||
}
|
||||
|
||||
int main()
|
||||
@@ -88,7 +98,7 @@ int main()
|
||||
return 1;
|
||||
if (test_tv() != 0)
|
||||
return 1;
|
||||
if (test_net_udp() != 0)
|
||||
if (!getenv("UG_SKIP_NET_TESTS") && test_net_udp() != 0)
|
||||
return 1;
|
||||
if (test_rtp() != 0)
|
||||
return 1;
|
||||
@@ -100,5 +110,25 @@ int main()
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CPPUNIT
|
||||
printf("Running CppUnit tests:\n");
|
||||
// Get the top level suite from the registry
|
||||
CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
|
||||
|
||||
// Adds the test to the list of test to run
|
||||
CPPUNIT_NS::TextUi::TestRunner runner;
|
||||
runner.addTest( suite );
|
||||
|
||||
// Change the default outputter to a compiler error format outputter
|
||||
runner.setOutputter( new CPPUNIT_NS::CompilerOutputter( &runner.result(),
|
||||
CPPUNIT_NS::stdCOut() ) );
|
||||
// Run the test.
|
||||
bool wasSucessful = runner.run();
|
||||
|
||||
// Return error code 1 if the one of test failed.
|
||||
return wasSucessful ? 0 : 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "config_win32.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CPPUNIT
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#include "config_unix.h"
|
||||
@@ -62,3 +64,4 @@ video_desc_test::testIOOperatorSymetry()
|
||||
}
|
||||
}
|
||||
|
||||
#endif // defined HAVE_CPPUNIT
|
||||
@@ -1,36 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#include "config_unix.h"
|
||||
#include "config_win32.h"
|
||||
#endif
|
||||
|
||||
#include <cppunit/CompilerOutputter.h>
|
||||
#include <cppunit/extensions/TestFactoryRegistry.h>
|
||||
#include <cppunit/ui/text/TestRunner.h>
|
||||
|
||||
extern "C" void exit_uv(int status);
|
||||
|
||||
void exit_uv(int status)
|
||||
{
|
||||
exit(status);
|
||||
}
|
||||
|
||||
int main(int, char *[])
|
||||
{
|
||||
// Get the top level suite from the registry
|
||||
CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
|
||||
|
||||
// Adds the test to the list of test to run
|
||||
CPPUNIT_NS::TextUi::TestRunner runner;
|
||||
runner.addTest( suite );
|
||||
|
||||
// Change the default outputter to a compiler error format outputter
|
||||
runner.setOutputter( new CPPUNIT_NS::CompilerOutputter( &runner.result(),
|
||||
CPPUNIT_NS::stdCOut() ) );
|
||||
// Run the test.
|
||||
bool wasSucessful = runner.run();
|
||||
|
||||
// Return error code 1 if the one of test failed.
|
||||
return wasSucessful ? 0 : 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user