From 114062f958a0a3d58913138bbca298aeff6cecf6 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 22 Jul 2022 23:24:35 -0700 Subject: [PATCH] ... --- test/integration/Makefile.am | 6 ++++- test/integration/qbittorrent.tests.c | 34 ++++++++++++++++++++++++++++ test/integration/test_utils.h | 2 ++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 test/integration/qbittorrent.tests.c diff --git a/test/integration/Makefile.am b/test/integration/Makefile.am index 5cccaf1..a9e83d4 100644 --- a/test/integration/Makefile.am +++ b/test/integration/Makefile.am @@ -16,7 +16,7 @@ AM_CPPFLAGS += \ -DNDEBUG endif -check_PROGRAMS = basic.tests +check_PROGRAMS = basic.tests qbittorrent.tests TESTS = $(check_PROGRAMS) #if ENABLE_MEMCHECK @@ -31,5 +31,9 @@ basic_tests_SOURCES = \ $(common_SOURCES) \ basic.tests.c +qbittorrent_tests_SOURCES = \ + $(common_SOURCES) \ + qbittorrent.tests.c + clean-local: -rm -rf $(TEST_DIRECTORY) diff --git a/test/integration/qbittorrent.tests.c b/test/integration/qbittorrent.tests.c new file mode 100644 index 0000000..4924fdb --- /dev/null +++ b/test/integration/qbittorrent.tests.c @@ -0,0 +1,34 @@ +#include + +int main(); +void qbittorrent_integration_test(); + +int main() { + setup_env(); + + qbittorrent_integration_test(); + + reset_env(); + + return EXIT_SUCCESS; +} + +#define QBITTORRENT_PORT "9634" + +void qbittorrent_integration_test() { + struct addrinfo hints, *res; + int sock_fd; + + memset(&hints,0,sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + + getaddrinfo("127.0.0.1",QBITTORRENT_PORT,&hints,&res); + + sock_fd = socket(res->ai_family,res->ai_socktype,res->ai_protocol); + assert(sock_fd>0); + + assert(0==connect(sock_fd,res->ai_addr,res->ai_addrlen)); + + close(sock_fd); +} diff --git a/test/integration/test_utils.h b/test/integration/test_utils.h index 5df4ace..1d9ee1b 100644 --- a/test/integration/test_utils.h +++ b/test/integration/test_utils.h @@ -4,9 +4,11 @@ #include #include +#include #include #include #include +#include #include #include #include -- 2.30.2