Skip to content

Commit

Permalink
fix core tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Apr 25, 2024
1 parent 04c421e commit bd28829
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
PROJECT(libswoole)
cmake_minimum_required(VERSION 2.8.12)

ENABLE_LANGUAGE(ASM)
set(SWOOLE_VERSION 6.0.0-dev)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -g")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
cmake_minimum_required(VERSION 2.8)

file(READ ./config.h SWOOLE_CONFIG_FILE)

Expand Down
8 changes: 4 additions & 4 deletions core-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.1)
cmake_minimum_required(VERSION 2.8.12)

project(core_tests)

Expand All @@ -10,14 +10,14 @@ file(GLOB_RECURSE SOURCE_FILES FOLLOW_SYMLINKS src/*.cpp deps/llhttp/src/*.c)

add_definitions(-DHAVE_CONFIG_H)

set(core_tests_includes ./include/ ../thirdparty ../thirdparty/hiredis ./deps/llhttp/include)
set(core_tests_includes ./include/ ../thirdparty ../thirdparty/hiredis ./deps/llhttp/include /usr/local/include)
set(core_tests_libraries)
set(core_tests_link_directories /usr/local/lib)

list(APPEND core_tests_libraries pthread)
list(APPEND core_tests_libraries pthread gtest gtest_main)

# find GTest
find_package(GTest)
find_package(GTest REQUIRED)
if (!${GTEST_FOUND})
message(FATAL_ERROR "Not found GTest")
endif()
Expand Down
6 changes: 6 additions & 0 deletions core-tests/src/os/async.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ TEST(async, schedule) {
ASSERT_GT(SwooleTG.async_threads->get_queue_size(), 100);
ASSERT_GT(SwooleTG.async_threads->get_task_num(), 100);
break;
} else if (count == N - 1) {
ASSERT_EQ(SwooleTG.async_threads->get_worker_num(), 4);
ASSERT_EQ(SwooleTG.async_threads->get_queue_size(), 1);
ASSERT_EQ(SwooleTG.async_threads->get_task_num(), 1);
} else if (count < N / 2) {
ASSERT_GT(SwooleTG.async_threads->get_worker_num(), 4);
}
}
});
Expand Down

0 comments on commit bd28829

Please sign in to comment.