Skip to content

Commit 715ee2f

Browse files
liulanzhengbeef9999
authored andcommitted
handle incorrect references to curl in test
Signed-off-by: liulanzheng <[email protected]>
1 parent 7bd09b0 commit 715ee2f

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

io/test/test-fork.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ limitations under the License.
2323
#include <photon/thread/thread.h>
2424
#include <photon/io/fd-events.h>
2525
#include <photon/io/signal.h>
26+
#ifdef ENABLE_CURL
2627
#include <photon/net/curl.h>
28+
#endif
2729
#include <photon/fs/localfs.h>
2830
#include "../../test/gtest.h"
2931

@@ -34,6 +36,12 @@ limitations under the License.
3436
bool exit_flag = false;
3537
bool exit_normal = false;
3638

39+
#ifdef ENABLE_CURL
40+
static int k_init_io_engine = photon::INIT_IO_LIBCURL;
41+
#else
42+
static int k_init_io_engine = photon::INIT_IO_NONE;
43+
#endif
44+
3745
void sigint_handler(int signal = SIGINT) {
3846
LOG_INFO("signal ` received, pid `", signal, getpid());
3947
exit_flag = true;
@@ -136,7 +144,7 @@ int fork_parent_process(uint64_t event_engine) {
136144
return m_pid;
137145
}
138146
photon::fini();
139-
photon::init(event_engine, photon::INIT_IO_LIBCURL);
147+
photon::init(event_engine, k_init_io_engine);
140148

141149
photon::block_all_signal();
142150
photon::sync_signal(SIGINT, &sigint_handler);
@@ -202,7 +210,7 @@ TEST(ForkTest, Fork) {
202210
}
203211

204212
TEST(ForkTest, ForkInThread) {
205-
photon::init(photon::INIT_EVENT_DEFAULT, photon::INIT_IO_LIBCURL);
213+
photon::init(photon::INIT_EVENT_DEFAULT, k_init_io_engine);
206214
DEFER(photon::fini());
207215

208216
int ret = -1;
@@ -225,7 +233,7 @@ TEST(ForkTest, ForkInThread) {
225233
}
226234

227235
TEST(ForkTest, PopenInThread) {
228-
photon::init(photon::INIT_EVENT_DEFAULT, photon::INIT_IO_LIBCURL);
236+
photon::init(photon::INIT_EVENT_DEFAULT, k_init_io_engine);
229237
DEFER(photon::fini());
230238

231239
photon::semaphore sem(0);

net/http/test/headers_test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ limitations under the License.
3030
#include <string>
3131
#include <gflags/gflags.h>
3232

33-
#include "../../curl.h"
3433
#include "../../socket.h"
3534
#include "../../base_socket.h"
3635
#include <photon/common/alog-stdstring.h>

net/test/test.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ limitations under the License.
2121
#include <photon/io/fd-events.h>
2222
#include <photon/thread/thread11.h>
2323
#include <photon/net/socket.h>
24+
#ifdef ENABLE_CURL
2425
#include <photon/net/curl.h>
26+
#endif
2527
#include <photon/net/utils.h>
2628
#include <photon/net/iostream.h>
2729
#include <photon/net/security-context/tls-stream.h>
@@ -687,6 +689,7 @@ void test_writer(Writer& writer) {
687689
EXPECT_EQ(0, strncmp("123456", writer.alog_string().s, 6));
688690
}
689691

692+
#ifdef ENABLE_CURL
690693
TEST(writers, multiple_segment) {
691694
StringWriter sw;
692695
test_writer(sw);
@@ -696,6 +699,7 @@ TEST(writers, multiple_segment) {
696699
BufferWriter<256> bfw;
697700
test_writer(bfw);
698701
}
702+
#endif
699703

700704
void* start_server(void*) {
701705
test_socket_server();

0 commit comments

Comments
 (0)