UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
run_tests.c File Reference
#include <stdbool.h>
#include "debug.h"
#include "host.h"
#include "test_host.h"
#include "test_aes.h"
#include "test_bitstream.h"
#include "test_des.h"
#include "test_md5.h"
#include "test_random.h"
#include "test_tv.h"
#include "test_net_udp.h"
#include "test_rtp.h"
#include "test_video_capture.h"
#include "test_video_display.h"
Include dependency graph for run_tests.c:

Go to the source code of this file.

Macros

#define DECLARE_TEST(func)
 
#define DEFINE_QUIET_TEST(func)
 
#define DEFINE_TEST(func)
 
#define TEST_AV_HW   1
 

Functions

 DECLARE_TEST (codec_conversion_test_testcard_uyvy_to_i420)
 
 DECLARE_TEST (ff_codec_conversions_test_pX10_from_to_v210)
 
 DECLARE_TEST (ff_codec_conversions_test_yuv444p16le_from_to_rg48)
 
 DECLARE_TEST (ff_codec_conversions_test_yuv444p16le_from_to_rg48_out_of_range)
 
 DECLARE_TEST (ff_codec_conversions_test_yuv444pXXle_from_to_r10k)
 
 DECLARE_TEST (ff_codec_conversions_test_yuv444pXXle_from_to_r12l)
 
 DECLARE_TEST (get_framerate_test_2997)
 
 DECLARE_TEST (get_framerate_test_3000)
 
 DECLARE_TEST (get_framerate_test_free)
 
 DECLARE_TEST (gpujpeg_test_simple)
 
 DECLARE_TEST (libavcodec_test_get_decoder_from_uv_to_uv)
 
 DECLARE_TEST (misc_test_color_coeff_range)
 
 DECLARE_TEST (misc_test_replace_all)
 
 DECLARE_TEST (misc_test_video_desc_io_op_symmetry)
 
int main (int argc, char **argv)
 
static bool run_tests (const char *test)
 
static bool test_helper (const char *name, int(*func)(), bool quiet)
 

Variables

uint32_t bitdepth = 10
 
uint32_t hd_color_bpp = 3
 
uint32_t hd_size_x = 1920
 
uint32_t hd_size_y = 1080
 
uint32_t hd_video_mode
 
long packet_rate = 13600
 
uint32_t progressive = 0
 
struct { ... }  tests []
 

Detailed Description

Author
Colin Perkins
Martin Pulec

Definition in file run_tests.c.

Macro Definition Documentation

◆ DECLARE_TEST

#define DECLARE_TEST ( func)
Value:
int func(void)
HRESULT __stdcall(* func)()
Definition screen_win.c:325

Definition at line 74 of file run_tests.c.

◆ DEFINE_QUIET_TEST

#define DEFINE_QUIET_TEST ( func)
Value:
{ #func, func, true }

Definition at line 75 of file run_tests.c.

◆ DEFINE_TEST

#define DEFINE_TEST ( func)
Value:
{ #func, func, false }

Definition at line 76 of file run_tests.c.

◆ TEST_AV_HW

#define TEST_AV_HW   1

Definition at line 62 of file run_tests.c.

Function Documentation

◆ DECLARE_TEST() [1/14]

◆ DECLARE_TEST() [2/14]

DECLARE_TEST ( ff_codec_conversions_test_pX10_from_to_v210 )

◆ DECLARE_TEST() [3/14]

DECLARE_TEST ( ff_codec_conversions_test_yuv444p16le_from_to_rg48 )

◆ DECLARE_TEST() [4/14]

DECLARE_TEST ( ff_codec_conversions_test_yuv444p16le_from_to_rg48_out_of_range )

◆ DECLARE_TEST() [5/14]

DECLARE_TEST ( ff_codec_conversions_test_yuv444pXXle_from_to_r10k )

◆ DECLARE_TEST() [6/14]

DECLARE_TEST ( ff_codec_conversions_test_yuv444pXXle_from_to_r12l )

◆ DECLARE_TEST() [7/14]

DECLARE_TEST ( get_framerate_test_2997 )

◆ DECLARE_TEST() [8/14]

DECLARE_TEST ( get_framerate_test_3000 )

◆ DECLARE_TEST() [9/14]

DECLARE_TEST ( get_framerate_test_free )

◆ DECLARE_TEST() [10/14]

DECLARE_TEST ( gpujpeg_test_simple )

◆ DECLARE_TEST() [11/14]

DECLARE_TEST ( libavcodec_test_get_decoder_from_uv_to_uv )

◆ DECLARE_TEST() [12/14]

DECLARE_TEST ( misc_test_color_coeff_range )

◆ DECLARE_TEST() [13/14]

DECLARE_TEST ( misc_test_replace_all )

◆ DECLARE_TEST() [14/14]

◆ main()

int main ( int argc,
char ** argv )

Definition at line 160 of file run_tests.c.

161{
162 if (argc > 1 && (strcmp("-h", argv[1]) == 0 || strcmp("--help", argv[1]) == 0)) {
163 printf("Usage:\n\t%s [-V] [ all | <test_name> | -h | --help ]\n", argv[0]);
164 printf("\nwhere\n"
165 "\t-V[V[V]] | --verbose - verbose (use UG log level verbose/debug/debug2, default fatal)\n"
166 "\t <test_name> - run only test of given name\n");
167 printf("\nAvailable tests:\n");
168 for (unsigned i = 0; i < sizeof tests / sizeof tests[0]; ++i) {
169 printf(" - %s\n", tests[i].name);
170 }
171 return 0;
172 }
173
175 struct init_data *init = NULL;
176 if ((init = common_preinit(argc, argv)) == NULL) {
177 return 2;
178 }
179
180 argc -= 1;
181 argv += 1;
182 if (argc >= 1 && (strstr(argv[0], "-V") == argv[0] || strstr(argv[0], "--verbose") == argv[0])) { // handled in common_preinit
183 argc -= 1;
184 argv += 1;
185 }
186
187 const char *test_name = NULL;;
188 if (argc == 1) {
189 if (strcmp("all", argv[0]) == 0) {
190 } else {
191 test_name = argv[0];
192 }
193 }
194
195 bool success = run_tests(test_name);
196
198
199 // Return error code 1 if the one of test failed.
200 return success ? 0 : 1;
201}
static af_result_code init(struct module *parent, const char *cfg, void **state)
#define LOG_LEVEL_FATAL
errors that prevent UG run
Definition debug.h:58
struct init_data * common_preinit(int argc, char *argv[])
Definition host.cpp:435
void common_cleanup(struct init_data *init)
Definition host.cpp:203
volatile int log_level
Definition debug.cpp:65
struct @95 tests[]
static bool run_tests(const char *test)
Definition run_tests.c:142
const char * name
Definition settings.cpp:193

References common_cleanup(), common_preinit(), init(), log_level, LOG_LEVEL_FATAL, name, run_tests(), and tests.

Here is the call graph for this function:

◆ run_tests()

static bool run_tests ( const char * test)
static

Definition at line 142 of file run_tests.c.

143{
144 if (test) {
145 for (unsigned i = 0; i < sizeof tests / sizeof tests[0]; ++i) {
146 if (strcmp(test, tests[i].name) == 0) {
147 return test_helper(tests[i].name, tests[i].test, tests[i].quiet);
148 }
149 }
150 fprintf(stderr, "No such a test named \"%s!\"\n", test);
151 return false;
152 }
153 bool ret = true;
154 for (unsigned i = 0; i < sizeof tests / sizeof tests[0]; ++i) {
155 ret = test_helper(tests[i].name, tests[i].test, tests[i].quiet) && ret;
156 }
157 return ret;
158}
static bool test_helper(const char *name, int(*func)(), bool quiet)
Definition run_tests.c:128

References name, test_helper(), and tests.

Referenced by main().

Here is the call graph for this function:

◆ test_helper()

static bool test_helper ( const char * name,
int(* func )(),
bool quiet )
static

Definition at line 128 of file run_tests.c.

128 {
129 int ret = func();
130 if (!quiet) {
131 char msg_start[] = "Testing ";
132 size_t len = sizeof msg_start + strlen(name);
133 fprintf(stderr, "%s%s ", msg_start, name);
134 for (int i = len; i < 74; ++i) {
135 fprintf(stderr, ".");
136 }
137 fprintf(stderr, " %s\n", ret == 0 ? "Ok" : ret < 0 ? "FAIL" : "--");
138 }
139 return ret >= 0;
140}
int void size_t * len

References len, and name.

Referenced by run_tests().

Variable Documentation

◆ bitdepth

uint32_t bitdepth = 10

Definition at line 68 of file run_tests.c.

◆ hd_color_bpp

uint32_t hd_color_bpp = 3

Definition at line 67 of file run_tests.c.

◆ hd_size_x

uint32_t hd_size_x = 1920

Definition at line 65 of file run_tests.c.

◆ hd_size_y

uint32_t hd_size_y = 1080

Definition at line 66 of file run_tests.c.

◆ hd_video_mode

uint32_t hd_video_mode

Definition at line 70 of file run_tests.c.

Referenced by display_dvs_reconfigure().

◆ packet_rate

long packet_rate = 13600

Definition at line 72 of file run_tests.c.

Referenced by get_packet_rate(), and tx_send_base().

◆ progressive

uint32_t progressive = 0

Definition at line 69 of file run_tests.c.

◆ []

struct { ... } tests[]
Initial value:
= {
DEFINE_TEST(libavcodec_test_get_decoder_from_uv_to_uv),
}
int codec_conversion_test_testcard_uyvy_to_i420(void)
int get_framerate_test_3000()
int get_framerate_test_2997()
int get_framerate_test_free()
int gpujpeg_test_simple()
int misc_test_video_desc_io_op_symmetry()
Definition misc_test.cpp:88
int misc_test_replace_all()
Definition misc_test.cpp:75
int misc_test_color_coeff_range()
Definition misc_test.cpp:27
#define DEFINE_QUIET_TEST(func)
Definition run_tests.c:75
#define DEFINE_TEST(func)
Definition run_tests.c:76
int test_des(void)
Definition test_des.c:180
int test_md5(void)
Definition test_md5.c:46
int test_net_udp(void)
int test_random(void)
Definition test_random.c:46
int test_rtp(void)
Definition test_rtp.c:39
int test_tv(void)
Definition test_tv.c:42
int test_video_capture(void)
int test_video_display(void)

Referenced by main(), and run_tests().