Created
July 13, 2018 10:19
-
-
Save nikhedonia/af4d304def083dedd8f5d04d21dd8c6b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include_defs('//BUCKAROO_DEPS') | |
def test_tree(name, path): | |
genrule( | |
name = name, | |
out = ".", | |
srcs = [path], | |
cmd = "cp -r $SRCS/* $OUT" | |
) | |
return ":"+name | |
def sh_cxx_test( | |
name, | |
tree = False, | |
**kwargs): | |
target = name | |
binTarget = "bin-" + name | |
shTarget = "sh-" + name | |
runTarget = "run-" + name | |
cxx_binary( | |
binTarget, | |
**kwargs | |
) | |
genrule( | |
name = runTarget, | |
out = "run.sh", | |
srcs = [], | |
cmd = "&&".join([ | |
"echo '%s' > $OUT" % "\n".join([ | |
"#!/bin/bash", | |
"cd $(location %s)" % tree if tree else "cd $BUCK_PROJECT_ROOT/__default__/gen", | |
"exec $(location :%s)" % binTarget | |
]), | |
"chmod +x $OUT" | |
]) | |
) | |
sh_binary( | |
name = shTarget, | |
main = ":run-"+target, | |
resources = [] | |
) | |
sh_test( | |
name = target, | |
test = ":sh-"+target, | |
visibility = ["PUBLIC"], | |
) | |
return ":"+target | |
cxx_library( | |
name = 'test', | |
exported_headers = subdir_glob([ | |
('include', '**/*.hpp'), | |
('include', '**/*.ipp'), | |
]), | |
exported_linker_flags=['-lpthread'], | |
preprocessor_flags=['-DBOOST_TEST_DYN_LINK'], | |
exported_preprocessor_flags=['-DBOOST_TEST_DYN_LINK'], | |
srcs = glob([ | |
'src/**/*.cpp' | |
]), | |
deps = BUCKAROO_DEPS, | |
visibility=['PUBLIC'] | |
) | |
test_tree( | |
name = 'test-tree', | |
path = 'test' | |
) | |
test_suite( | |
name='testall', | |
tests = [sh_cxx_test( | |
name = file | |
.replace('/','-') | |
.replace('.cpp',''), | |
srcs = [file], | |
deps = [':test'], | |
tree = ':test-tree' | |
) for file in glob(['test/*/*.cpp'], | |
exclude = glob([ | |
'test/smoke-ts/basic-smoke-test3.cpp', | |
'test/utils-ts/basic_cstring-test.cpp', | |
'test/execution_monitor-ts/*', | |
'test/prg_exec_monitor-ts/*', | |
'test/usage-variants-ts/*', | |
'test/test-organization-ts/dataset-master-test-suite-accessible-test.cpp', | |
'test/framework-ts/*' # framework::master_test_suite is private | |
]) | |
)], | |
visibility=['PUBLIC'] | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment