Skip to content

Commit

Permalink
Add googletest as submodule
Browse files Browse the repository at this point in the history
Update test.py script
  • Loading branch information
andrey-golubev committed Oct 24, 2018
1 parent a4c3e80 commit f8b6912
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "external/googletest"]
path = external/googletest
url = https://github.com/google/googletest.git
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@ if (${WITH_ASAN})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libasan")
endif (${WITH_ASAN})

# gtest
set(BUILD_GMOCK OFF CACHE BOOL "Exclude gmock from build")
set(INSTALL_GTEST OFF CACHE BOOL "Do not install gtest")
add_subdirectory(external/googletest)

# clsc
add_subdirectory(tests)
add_subdirectory(utilities)
1 change: 1 addition & 0 deletions external/googletest
Submodule googletest added at 2fe3bd
12 changes: 8 additions & 4 deletions script/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def parse_args():
parser = argparse.ArgumentParser('Command-line options for build script')
parser.add_argument('--debug', action='store_true', default=False,
help='Specify whether debug build should be use')
parser.add_argument('--raw-cmake', default='',
parser.add_argument('--cmake', default='', nargs='*',
help='Pass raw arguments to cmake')
return parser.parse_args()

Expand All @@ -28,14 +28,14 @@ def run_steps(steps, work_dir='.'):
sys.stdout.flush()


def test(debug, raw_args, work_dir='.'):
def test(debug, cmake_args, work_dir='.'):
t = 'DEBUG' if debug else 'RELEASE'
build_type = '-DCMAKE_BUILD_TYPE={t}'.format(t=t)
steps = """
cmake {build_type} {args} ..
make VERBOSE=1
./tests/clsc_tests
""".format(build_type=build_type, args=raw_args)
""".format(build_type=build_type, args=cmake_args)
run_steps(steps, work_dir=work_dir)


Expand All @@ -46,7 +46,11 @@ def main():
if os.path.exists(workdir):
shutil.rmtree(workdir)
os.makedirs(workdir)
test(args.debug, args.raw_cmake, workdir)
cmake_args = args.cmake
for i, arg in enumerate(cmake_args):
if not arg.startswith('-D'):
cmake_args[i] = '-D' + arg
test(args.debug, cmake_args, workdir)
return 0


Expand Down

0 comments on commit f8b6912

Please sign in to comment.