unittest on appveyor
This commit is contained in:
@ -8,7 +8,9 @@ project (ixwebsocket_unittest)
|
||||
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
|
||||
option(USE_TLS "Add TLS support" ON)
|
||||
if (NOT WIN32)
|
||||
option(USE_TLS "Add TLS support" ON)
|
||||
endif()
|
||||
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/.. ixwebsocket)
|
||||
|
||||
|
62
test/run.py
Normal file
62
test/run.py
Normal file
@ -0,0 +1,62 @@
|
||||
import os
|
||||
import platform
|
||||
import shutil
|
||||
|
||||
osName = platform.system()
|
||||
print('os name = {}'.format(osName))
|
||||
|
||||
root = os.path.dirname(os.path.realpath(__file__))
|
||||
buildDir = os.path.join(root, 'build')
|
||||
|
||||
if not os.path.exists(buildDir):
|
||||
os.mkdir(buildDir)
|
||||
|
||||
os.chdir(buildDir)
|
||||
|
||||
if osName == 'Windows':
|
||||
generator = '-G"NMake Makefiles"'
|
||||
make = 'nmake'
|
||||
testBinary ='ixwebsocket_unittest.exe'
|
||||
else:
|
||||
generator = ''
|
||||
make = 'make'
|
||||
testBinary ='./ixwebsocket_unittest'
|
||||
|
||||
os.system('cmake -DCMAKE_BUILD_TYPE=Debug {} ..'.format(generator))
|
||||
ret = os.system(make)
|
||||
assert ret == 0, 'Make failed, exiting'
|
||||
|
||||
def findFiles(prefix):
|
||||
'''Find all files under a given directory'''
|
||||
|
||||
paths = []
|
||||
|
||||
for root, _, files in os.walk(prefix):
|
||||
for path in files:
|
||||
fullPath = os.path.join(root, path)
|
||||
|
||||
if os.path.islink(fullPath):
|
||||
continue
|
||||
|
||||
paths.append(fullPath)
|
||||
|
||||
return paths
|
||||
|
||||
for path in findFiles('.'):
|
||||
print(path)
|
||||
|
||||
shutil.copy(os.path.join(
|
||||
'..',
|
||||
'..',
|
||||
'third_party',
|
||||
'ZLIB-Windows',
|
||||
'zlib-1.2.11_deploy_v140',
|
||||
'release_dynamic',
|
||||
'x64',
|
||||
'bin',
|
||||
'zlib.dll'), '.')
|
||||
|
||||
|
||||
# unittest broken on Windows
|
||||
if osName != 'Windows':
|
||||
os.system(testBinary)
|
@ -7,8 +7,14 @@
|
||||
#define CATCH_CONFIG_RUNNER
|
||||
#include "catch.hpp"
|
||||
|
||||
#include <ixwebsocket/IXSocket.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
ix::Socket::init(); // for Windows
|
||||
|
||||
int result = Catch::Session().run(argc, argv);
|
||||
|
||||
ix::Socket::cleanup(); // for Windows
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user