diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-06-16 00:41:21 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-06-16 00:42:44 +0300 |
commit | e8d937beb5e0bf118c381846f2392cab973a2528 (patch) | |
tree | a7bec6dece0675986811e967d7e9756cc19e415a /src/microhttpd/test_upgrade.c | |
parent | 36bf651023e2f810bd2ae4aa1ab2354338b9f00c (diff) | |
download | libmicrohttpd-e8d937beb5e0bf118c381846f2392cab973a2528.tar.gz libmicrohttpd-e8d937beb5e0bf118c381846f2392cab973a2528.zip |
Make testsuite parallel build compatible (part 1)
Diffstat (limited to 'src/microhttpd/test_upgrade.c')
-rw-r--r-- | src/microhttpd/test_upgrade.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c index 64b47e5d..b1a234cb 100644 --- a/src/microhttpd/test_upgrade.c +++ b/src/microhttpd/test_upgrade.c | |||
@@ -982,6 +982,7 @@ test_upgrade (int flags, | |||
982 | wr_socket sock; | 982 | wr_socket sock; |
983 | struct sockaddr_in sa; | 983 | struct sockaddr_in sa; |
984 | const union MHD_DaemonInfo *real_flags; | 984 | const union MHD_DaemonInfo *real_flags; |
985 | const union MHD_DaemonInfo *dinfo; | ||
985 | #if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) | 986 | #if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) |
986 | pid_t pid = -1; | 987 | pid_t pid = -1; |
987 | #endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ | 988 | #endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ |
@@ -990,7 +991,8 @@ test_upgrade (int flags, | |||
990 | 991 | ||
991 | if (!test_tls) | 992 | if (!test_tls) |
992 | d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE, | 993 | d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE, |
993 | 1080, | 994 | MHD_is_feature_supported(MHD_FEATURE_AUTODETECT_BIND_PORT) ? |
995 | 0 : 1090, | ||
994 | NULL, NULL, | 996 | NULL, NULL, |
995 | &ahc_upgrade, NULL, | 997 | &ahc_upgrade, NULL, |
996 | MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL, | 998 | MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL, |
@@ -1001,7 +1003,8 @@ test_upgrade (int flags, | |||
1001 | #ifdef HTTPS_SUPPORT | 1003 | #ifdef HTTPS_SUPPORT |
1002 | else | 1004 | else |
1003 | d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE | MHD_USE_TLS, | 1005 | d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE | MHD_USE_TLS, |
1004 | 1080, | 1006 | MHD_is_feature_supported(MHD_FEATURE_AUTODETECT_BIND_PORT) ? |
1007 | 0 : 1090, | ||
1005 | NULL, NULL, | 1008 | NULL, NULL, |
1006 | &ahc_upgrade, NULL, | 1009 | &ahc_upgrade, NULL, |
1007 | MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL, | 1010 | MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL, |
@@ -1017,13 +1020,16 @@ test_upgrade (int flags, | |||
1017 | real_flags = MHD_get_daemon_info(d, MHD_DAEMON_INFO_FLAGS); | 1020 | real_flags = MHD_get_daemon_info(d, MHD_DAEMON_INFO_FLAGS); |
1018 | if (NULL == real_flags) | 1021 | if (NULL == real_flags) |
1019 | abort (); | 1022 | abort (); |
1023 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
1024 | if (NULL == dinfo || 0 == dinfo->port) | ||
1025 | abort (); | ||
1020 | if (!test_tls || TLS_LIB_GNUTLS == use_tls_tool) | 1026 | if (!test_tls || TLS_LIB_GNUTLS == use_tls_tool) |
1021 | { | 1027 | { |
1022 | sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt (); | 1028 | sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt (); |
1023 | if (WR_BAD == sock) | 1029 | if (WR_BAD == sock) |
1024 | abort (); | 1030 | abort (); |
1025 | sa.sin_family = AF_INET; | 1031 | sa.sin_family = AF_INET; |
1026 | sa.sin_port = htons (1080); | 1032 | sa.sin_port = htons (dinfo->port); |
1027 | sa.sin_addr.s_addr = htonl (INADDR_LOOPBACK); | 1033 | sa.sin_addr.s_addr = htonl (INADDR_LOOPBACK); |
1028 | if (0 != wr_connect (sock, | 1034 | if (0 != wr_connect (sock, |
1029 | (struct sockaddr *) &sa, | 1035 | (struct sockaddr *) &sa, |
@@ -1034,7 +1040,7 @@ test_upgrade (int flags, | |||
1034 | { | 1040 | { |
1035 | #if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) | 1041 | #if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) |
1036 | MHD_socket tls_fork_sock; | 1042 | MHD_socket tls_fork_sock; |
1037 | if (-1 == (pid = gnutlscli_connect (&tls_fork_sock, 1080))) | 1043 | if (-1 == (pid = gnutlscli_connect (&tls_fork_sock, dinfo->port))) |
1038 | { | 1044 | { |
1039 | MHD_stop_daemon (d); | 1045 | MHD_stop_daemon (d); |
1040 | return 4; | 1046 | return 4; |