Skip to content

Commit

Permalink
Fix test error on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
satoren committed Jun 4, 2017
1 parent c34016c commit 9d963d7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
build*
_build/
single_include
.vscode
lua-*
*.exe
*.dll
Expand Down
13 changes: 8 additions & 5 deletions test/shared_library_test/test_shared_class_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ KAGUYA_TEST_GROUP_START(test_shared_library)

KAGUYA_TEST_FUNCTION_DEF(multi_shared_lib)(kaguya::State &L) {
bool ret =
L.dostring("test_shared_class_reg = require('test_shared_class_reg') "
L.dostring("package.cpath = package.cpath .. ';?.dylib' "
"test_shared_class_reg = require('test_shared_class_reg') "
"test_shared_class_use = require('test_shared_class_use') "
"local a = test_shared_class_reg.A(32) "
"local b = test_shared_class_reg.B() "
"assert(a.data == 32) "
"assert(a.data == 32) "
"assert(test_shared_class_use.A_fn(a) == 32) "
"assert(test_shared_class_use.B_fn(b) == 22) "
"assert(test_shared_class_use.create_A().data == 1) ");
"assert(test_shared_class_use.create_A().data == 1) ");

TEST_CHECK(ret);
}
Expand All @@ -24,7 +25,8 @@ KAGUYA_TEST_FUNCTION_DEF(typemismatch_test)(kaguya::State &L) {

L.setErrorHandler(ignore_error_fun);
bool ret =
L.dostring("test_shared_class_reg = require('test_shared_class_reg') "
L.dostring("package.cpath = package.cpath .. ';?.dylib' "
"test_shared_class_reg = require('test_shared_class_reg') "
"test_shared_class_use = require('test_shared_class_use') ");
TEST_CHECK(ret);
TEST_EQUAL(false,
Expand All @@ -35,7 +37,8 @@ KAGUYA_TEST_FUNCTION_DEF(typemismatch_test)(kaguya::State &L) {
KAGUYA_TEST_FUNCTION_DEF(create_self)(kaguya::State &L) {

bool ret =
L.dostring("test_shared_class_reg = require('test_shared_class_reg') "
L.dostring("package.cpath = package.cpath .. ';?.dylib' "
"test_shared_class_reg = require('test_shared_class_reg') "
"test_shared_class_use = require('test_shared_class_use') ");
TEST_CHECK(ret);

Expand Down
5 changes: 2 additions & 3 deletions test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ def build_and_exec_test(compiler,lua_version,build_type,dir_opt):
cxxcompiler = compiler[1]
addopt = compiler[2]
if os.system(cxxcompiler+' -v 2> /dev/null')!=0: return

buildpath = "_build/"+compiler[0]+"_"+lua_version+"_"+build_type+"_"+dir_opt
buildpath = os.path.join('_build',compiler[0]+"_"+lua_version+"_"+build_type+"_"+dir_opt)
if not os.path.exists(buildpath):
os.makedirs(buildpath)
os.chdir(buildpath)
Expand All @@ -103,7 +102,7 @@ def build_with_target_compiler(lua_version):
build_and_exec_test(compiler,lua_version,"Release",str(i))

def build_msvc_and_exec_test(msvcver,lua_version,build_type):
buildpath = '_build/'+msvcver[0]+'_'+lua_version
buildpath = os.path.join('_build',msvcver[0]+'_'+lua_version)
if not os.path.exists(buildpath):
os.makedirs(buildpath)
os.chdir(buildpath)
Expand Down

0 comments on commit 9d963d7

Please sign in to comment.