mirror of
				https://github.com/optim-enterprises-bv/nDPId.git
				synced 2025-10-31 02:07:47 +00:00 
			
		
		
		
	travis-ci build CMake project
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
		| @@ -13,4 +13,11 @@ script: | |||||||
| - env python3 --version | - env python3 --version | ||||||
| - test/run_tests.sh nDPI | - test/run_tests.sh nDPI | ||||||
| - make -f Makefile.old clean | - make -f Makefile.old clean | ||||||
|  | # pkg-config build | ||||||
| - PKG_CONFIG_PATH="$(realpath ./nDPI/_install/lib/pkgconfig)" make -f Makefile.old PKG_CONFIG_BIN=pkg-config ENABLE_DEBUG=yes ENABLE_SANITIZER=yes all examples | - PKG_CONFIG_PATH="$(realpath ./nDPI/_install/lib/pkgconfig)" make -f Makefile.old PKG_CONFIG_BIN=pkg-config ENABLE_DEBUG=yes ENABLE_SANITIZER=yes all examples | ||||||
|  | - ./nDPId-test || test $? -eq 1 | ||||||
|  | - ./nDPId -h || test $? -eq 1 | ||||||
|  | # cmake/pkg-config build | ||||||
|  | - mkdir -p build && cd build && PKG_CONFIG_PATH="$(realpath ../nDPI/_install/lib/pkgconfig)" cmake .. -DCMAKE_INSTALL_PREFIX=$(realpath ../_install) -DBUILD_EXAMPLES=ON -DENABLE_MEMORY_PROFILING=ON -DENABLE_SANITIZER=ON && make install | ||||||
|  | - cd build && ./nDPId-test || test $? -eq 1 | ||||||
|  | - cd build && ./nDPId -h || test $? -eq 1 | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| cmake_minimum_required(VERSION 3.13) | cmake_minimum_required(VERSION 3.12.4) | ||||||
| project(nDPId C) | project(nDPId C) | ||||||
| set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) | set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) | ||||||
| find_package(PkgConfig REQUIRED) | find_package(PkgConfig REQUIRED) | ||||||
|   | |||||||
							
								
								
									
										27
									
								
								nDPId-test.c
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								nDPId-test.c
									
									
									
									
									
								
							| @@ -308,26 +308,31 @@ int main(int argc, char ** argv) | |||||||
|     if (argc != 2) |     if (argc != 2) | ||||||
|     { |     { | ||||||
|         usage(argv[0]); |         usage(argv[0]); | ||||||
|         return -1; |         return 1; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) |     if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) | ||||||
|     { |     { | ||||||
|         return -1; |         return 1; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     nDPId_options.reader_thread_count = 1; /* Please do not change this! Generating meaningful pcap diff's relies on a |     nDPId_options.reader_thread_count = 1; /* Please do not change this! Generating meaningful pcap diff's relies on a | ||||||
|                                               single reader thread! */ |                                               single reader thread! */ | ||||||
|     nDPId_options.instance_alias = strdup("nDPId-test"); |     nDPId_options.instance_alias = strdup("nDPId-test"); | ||||||
|  |     if (access(argv[1], R_OK) != 0) | ||||||
|  |     { | ||||||
|  |         fprintf(stderr, "%s: pcap file `%s' does not exist or is not readable\n", argv[0], argv[1]); | ||||||
|  |         return 1; | ||||||
|  |     } | ||||||
|     nDPId_options.pcap_file_or_interface = strdup(argv[1]); |     nDPId_options.pcap_file_or_interface = strdup(argv[1]); | ||||||
|     if (validate_options(argv[0]) != 0) |     if (validate_options(argv[0]) != 0) | ||||||
|     { |     { | ||||||
|         return -1; |         return 1; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (setup_pipe(mock_pipefds) != 0 || setup_pipe(mock_servfds) != 0) |     if (setup_pipe(mock_pipefds) != 0 || setup_pipe(mock_servfds) != 0) | ||||||
|     { |     { | ||||||
|         return -1; |         return 1; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /* We do not have any sockets, any socket operation must fail! */ |     /* We do not have any sockets, any socket operation must fail! */ | ||||||
| @@ -336,28 +341,28 @@ int main(int argc, char ** argv) | |||||||
|  |  | ||||||
|     if (setup_remote_descriptors(MAX_REMOTE_DESCRIPTORS) != 0) |     if (setup_remote_descriptors(MAX_REMOTE_DESCRIPTORS) != 0) | ||||||
|     { |     { | ||||||
|         return -1; |         return 1; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     pthread_t nDPId_thread; |     pthread_t nDPId_thread; | ||||||
|     struct thread_return_value nDPId_return = {}; |     struct thread_return_value nDPId_return = {}; | ||||||
|     if (pthread_create(&nDPId_thread, NULL, nDPId_mainloop_thread, &nDPId_return) != 0) |     if (pthread_create(&nDPId_thread, NULL, nDPId_mainloop_thread, &nDPId_return) != 0) | ||||||
|     { |     { | ||||||
|         return -1; |         return 1; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     pthread_t nDPIsrvd_thread; |     pthread_t nDPIsrvd_thread; | ||||||
|     struct thread_return_value nDPIsrvd_return = {}; |     struct thread_return_value nDPIsrvd_return = {}; | ||||||
|     if (pthread_create(&nDPIsrvd_thread, NULL, nDPIsrvd_mainloop_thread, &nDPIsrvd_return) != 0) |     if (pthread_create(&nDPIsrvd_thread, NULL, nDPIsrvd_mainloop_thread, &nDPIsrvd_return) != 0) | ||||||
|     { |     { | ||||||
|         return -1; |         return 1; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     pthread_t distributor_thread; |     pthread_t distributor_thread; | ||||||
|     struct thread_return_value distributor_return = {}; |     struct thread_return_value distributor_return = {}; | ||||||
|     if (pthread_create(&distributor_thread, NULL, distributor_client_mainloop_thread, &distributor_return) != 0) |     if (pthread_create(&distributor_thread, NULL, distributor_client_mainloop_thread, &distributor_return) != 0) | ||||||
|     { |     { | ||||||
|         return -1; |         return 1; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /* Try to gracefully shutdown all threads. */ |     /* Try to gracefully shutdown all threads. */ | ||||||
| @@ -366,7 +371,7 @@ int main(int argc, char ** argv) | |||||||
|     { |     { | ||||||
|         if (THREADS_RETURNED_ERROR() != 0) |         if (THREADS_RETURNED_ERROR() != 0) | ||||||
|         { |         { | ||||||
|             return -1; |             return 1; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -374,7 +379,7 @@ int main(int argc, char ** argv) | |||||||
|     { |     { | ||||||
|         if (THREADS_RETURNED_ERROR() != 0) |         if (THREADS_RETURNED_ERROR() != 0) | ||||||
|         { |         { | ||||||
|             return -1; |             return 1; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -382,7 +387,7 @@ int main(int argc, char ** argv) | |||||||
|     { |     { | ||||||
|         if (THREADS_RETURNED_ERROR() != 0) |         if (THREADS_RETURNED_ERROR() != 0) | ||||||
|         { |         { | ||||||
|             return -1; |             return 1; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -879,19 +879,18 @@ int main(int argc, char ** argv) | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     syslog(LOG_DAEMON, "collector listen on %s", nDPIsrvd_options.json_sockpath); |     syslog(LOG_DAEMON, "collector listen on %s", nDPIsrvd_options.json_sockpath); | ||||||
|  |     syslog(LOG_DAEMON, "distributor listen on %s", nDPIsrvd_options.serv_optarg); | ||||||
|     switch (serv_address.raw.sa_family) |     switch (serv_address.raw.sa_family) | ||||||
|     { |     { | ||||||
|         default: |         default: | ||||||
|             goto error; |             goto error; | ||||||
|         case AF_INET: |         case AF_INET: | ||||||
|         case AF_INET6: |         case AF_INET6: | ||||||
|             syslog(LOG_DAEMON, "distributor listen on %s", nDPIsrvd_options.serv_optarg); |  | ||||||
|             syslog(LOG_DAEMON | LOG_ERR, |             syslog(LOG_DAEMON | LOG_ERR, | ||||||
|                    "Please keep in mind that using a TCP Socket may leak sensitive information to " |                    "Please keep in mind that using a TCP Socket may leak sensitive information to " | ||||||
|                    "everyone with access to the device/network. You've been warned!"); |                    "everyone with access to the device/network. You've been warned!"); | ||||||
|             break; |             break; | ||||||
|         case AF_UNIX: |         case AF_UNIX: | ||||||
|             syslog(LOG_DAEMON, "distributor listen on %s", nDPIsrvd_options.json_sockpath); |  | ||||||
|             break; |             break; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -68,6 +68,12 @@ mkdir -p /tmp/nDPId-test-stderr | |||||||
| set +e | set +e | ||||||
| TESTS_FAILED=0 | TESTS_FAILED=0 | ||||||
|  |  | ||||||
|  | ${nDPId_test_EXEC} -h 2>/dev/null | ||||||
|  | if [ $? -ne 1 ]; then | ||||||
|  |     printf '%s\n' "nDPId-test: ${nDPId_test_EXEC} seems to be an invalid executable" | ||||||
|  |     exit 7 | ||||||
|  | fi | ||||||
|  |  | ||||||
| for pcap_file in $(ls *.pcap *.pcapng *.cap); do | for pcap_file in $(ls *.pcap *.pcapng *.cap); do | ||||||
|     if file "${pcap_file}" | grep -qoE ':\s(pcap|pcap-ng) capture file'; then |     if file "${pcap_file}" | grep -qoE ':\s(pcap|pcap-ng) capture file'; then | ||||||
|         true # pass |         true # pass | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Toni Uhlig
					Toni Uhlig