...
authoralex <[email protected]>
Sat, 23 Jul 2022 06:24:35 +0000 (23:24 -0700)
committeralex <[email protected]>
Sat, 23 Jul 2022 06:24:35 +0000 (23:24 -0700)
test/integration/Makefile.am
test/integration/qbittorrent.tests.c [new file with mode: 0644]
test/integration/test_utils.h

index 5cccaf1e2b0b10c913b58a1cf3be357b6cfe5f82..a9e83d4ed0298c581125724e9a22477380f1d6d2 100644 (file)
@@ -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 (file)
index 0000000..4924fdb
--- /dev/null
@@ -0,0 +1,34 @@
+#include<test_utils.h>
+
+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);
+}
index 5df4acea014269d511b5f8413a9c129144baf417..1d9ee1b464819a85ac0273e057c41bb265ac972e 100644 (file)
@@ -4,9 +4,11 @@
 #include<test_macros.h>
 
 #include<assert.h>
+#include<netdb.h>
 #include<signal.h>
 #include<stdlib.h>
 #include<string.h>
+#include<sys/socket.h>
 #include<sys/stat.h>
 #include<sys/types.h>
 #include<sys/wait.h>