restructure project

This commit is contained in:
Benjamin Sergeant
2019-09-10 12:19:22 -07:00
parent c09015e870
commit 0fde169aa4
26 changed files with 119 additions and 44 deletions

View File

@ -15,8 +15,6 @@ if (MAC)
option(USE_TLS "Add TLS support" ON)
endif()
add_subdirectory(${PROJECT_SOURCE_DIR}/.. ixwebsocket)
set (WS ../ws)
include_directories(
@ -36,17 +34,6 @@ set (SOURCES
../third_party/msgpack11/msgpack11.cpp
../third_party/jsoncpp/jsoncpp.cpp
${WS}/ixcore/utils/IXCoreLogger.cpp
${WS}/ixcrypto/IXBase64.cpp
${WS}/ixcrypto/IXHash.cpp
${WS}/ixcrypto/IXUuid.cpp
${WS}/ixcrypto/IXHMac.cpp
${WS}/ixcobra/IXCobraConnection.cpp
${WS}/ixcobra/IXCobraMetricsPublisher.cpp
${WS}/ixcobra/IXCobraMetricsThreadedPublisher.cpp
${WS}/snake/IXSnakeServer.cpp
${WS}/snake/IXSnakeProtocol.cpp
${WS}/snake/IXAppConfig.cpp
@ -99,5 +86,9 @@ if (APPLE AND USE_TLS)
target_link_libraries(ixwebsocket_unittest "-framework foundation" "-framework security")
endif()
target_link_libraries(ixwebsocket_unittest ixcore)
target_link_libraries(ixwebsocket_unittest ixcrypto)
target_link_libraries(ixwebsocket_unittest ixcobra)
target_link_libraries(ixwebsocket_unittest ixwebsocket)
install(TARGETS ixwebsocket_unittest DESTINATION bin)

View File

@ -309,6 +309,7 @@ TEST_CASE("Cobra_chat", "[cobra_chat]")
timeout -= 10;
if (timeout <= 0)
{
snakeServer.stop();
REQUIRE(false); // timeout
}
}
@ -332,6 +333,7 @@ TEST_CASE("Cobra_chat", "[cobra_chat]")
timeout -= 10;
if (timeout <= 0)
{
snakeServer.stop();
REQUIRE(false); // timeout
}
}

View File

@ -350,21 +350,22 @@ def generateXmlOutput(results, xmlOutput, testRunName, runTime):
def run(testName, buildDir, sanitizer, xmlOutput,
testRunName, buildOnly, useLLDB, cpuCount):
testRunName, buildOnly, useLLDB, cpuCount, runOnly):
'''Main driver. Run cmake, compiles, execute and validate the testsuite.'''
# gen build files with CMake
runCMake(sanitizer, buildDir)
if not runOnly:
runCMake(sanitizer, buildDir)
if platform.system() == 'Linux':
# build with make -j
runCommand('make -C {} -j 2'.format(buildDir))
elif platform.system() == 'Darwin':
# build with make
runCommand('make -C {} -j 8'.format(buildDir))
else:
# build with cmake on recent
runCommand('cmake --build --parallel {}'.format(buildDir))
if platform.system() == 'Linux':
# build with make -j
runCommand('make -C {} -j 2'.format(buildDir))
elif platform.system() == 'Darwin':
# build with make
runCommand('make -C {} -j 8'.format(buildDir))
else:
# build with cmake on recent
runCommand('cmake --build --parallel {}'.format(buildDir))
if buildOnly:
return
@ -454,6 +455,8 @@ def main():
help='Validate XML output.')
parser.add_argument('--build_only', '-b', action='store_true',
help='Stop after building. Do not run the unittest.')
parser.add_argument('--run_only', '-r', action='store_true',
help='Only run the test, do not build anything.')
parser.add_argument('--output', '-o', help='Output XML file.')
parser.add_argument('--lldb', action='store_true',
help='Run the test through lldb.')
@ -492,7 +495,7 @@ def main():
if platform.system() == 'Windows':
TEST_EXE_PATH = os.path.join(buildDir, BUILD_TYPE, 'ixwebsocket_unittest.exe')
else:
TEST_EXE_PATH = os.path.join(buildDir, 'ixwebsocket_unittest')
TEST_EXE_PATH = '../build/test/ixwebsocket_unittest'
if args.list:
# catch2 exit with a different error code when requesting the list of files
@ -511,7 +514,7 @@ def main():
args.lldb = False
return run(args.test, buildDir, sanitizer, xmlOutput,
testRunName, args.build_only, args.lldb, args.cpu_count)
testRunName, args.build_only, args.lldb, args.cpu_count, args.run_only)
if __name__ == '__main__':