avtp: crf: tests: Only run tests if packet socket is available
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9364>
This commit is contained in:
parent
cde27346fb
commit
7d8f9b840f
@ -27,6 +27,11 @@
|
||||
#include <gst/check/gstharness.h>
|
||||
#include "../../../ext/avtp/gstavtpcrfutil.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/ether.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#define STREAM_ID 0xDEADC0DEDEADC0DE
|
||||
|
||||
static GstHarness *
|
||||
@ -239,6 +244,19 @@ GST_START_TEST (test_crf_period_zero)
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static gboolean
|
||||
packet_socket_allowed (void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = socket (AF_PACKET, SOCK_DGRAM, htons (ETH_P_ALL));
|
||||
if (fd < 0)
|
||||
return FALSE;
|
||||
|
||||
close (fd);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Suite *
|
||||
avtpcrfcheck_suite (void)
|
||||
{
|
||||
@ -247,9 +265,11 @@ avtpcrfcheck_suite (void)
|
||||
|
||||
suite_add_tcase (s, tc_chain);
|
||||
tcase_add_test (tc_chain, test_properties);
|
||||
tcase_add_test (tc_chain, test_crf_cvf_data);
|
||||
tcase_add_test (tc_chain, test_crf_aaf_data);
|
||||
tcase_add_test (tc_chain, test_crf_period_zero);
|
||||
if (packet_socket_allowed ()) {
|
||||
tcase_add_test (tc_chain, test_crf_cvf_data);
|
||||
tcase_add_test (tc_chain, test_crf_aaf_data);
|
||||
tcase_add_test (tc_chain, test_crf_period_zero);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -29,6 +29,11 @@
|
||||
#include <gst/check/gstharness.h>
|
||||
#include "../../../ext/avtp/gstavtpcrfutil.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/ether.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#define STREAM_ID 0xDEADC0DEDEADC0DE
|
||||
|
||||
struct buffer_tstamps
|
||||
@ -369,6 +374,19 @@ GST_START_TEST (test_crf_period_zero)
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static gboolean
|
||||
packet_socket_allowed (void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = socket (AF_PACKET, SOCK_DGRAM, htons (ETH_P_ALL));
|
||||
if (fd < 0)
|
||||
return FALSE;
|
||||
|
||||
close (fd);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Suite *
|
||||
avtpcrfsync_suite (void)
|
||||
{
|
||||
@ -382,9 +400,11 @@ avtpcrfsync_suite (void)
|
||||
tcase_add_test (tc_chain, test_properties);
|
||||
tcase_add_test (tc_chain, test_set_avtp_tstamp);
|
||||
tcase_add_test (tc_chain, test_set_avtp_mr_bit);
|
||||
tcase_add_test (tc_chain, test_crf_cvf_data);
|
||||
tcase_add_test (tc_chain, test_crf_aaf_data);
|
||||
tcase_add_test (tc_chain, test_crf_period_zero);
|
||||
if (packet_socket_allowed ()) {
|
||||
tcase_add_test (tc_chain, test_crf_cvf_data);
|
||||
tcase_add_test (tc_chain, test_crf_aaf_data);
|
||||
tcase_add_test (tc_chain, test_crf_period_zero);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user