display run commands in helper script

This commit is contained in:
Robin Müller 2022-02-22 14:02:03 +01:00
parent a274d6598e
commit fdc8a3d4f7
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -97,11 +97,11 @@ def handle_docs_type(args, build_dir_list: list):
build_directory = determine_build_dir(build_dir_list) build_directory = determine_build_dir(build_dir_list)
os.chdir(build_directory) os.chdir(build_directory)
if args.build: if args.build:
os.system("cmake --build . -j") cmd_runner("cmake --build . -j")
if args.open: if args.open:
if not os.path.isfile("docs/sphinx/index.html"): if not os.path.isfile("docs/sphinx/index.html"):
# try again.. # try again..
os.system("cmake --build . -j") cmd_runner("cmake --build . -j")
if not os.path.isfile("docs/sphinx/index.html"): if not os.path.isfile("docs/sphinx/index.html"):
print( print(
"No Sphinx documentation file detected. " "No Sphinx documentation file detected. "
@ -147,21 +147,21 @@ def handle_tests_type(args, build_dir_list: list):
# If we are in a different directory we try to switch into it but # If we are in a different directory we try to switch into it but
# this might fail # this might fail
os.chdir(UNITTEST_FOLDER_NAME) os.chdir(UNITTEST_FOLDER_NAME)
os.system("valgrind --leak-check=full ./fsfw-tests") cmd_runner("valgrind --leak-check=full ./fsfw-tests")
os.chdir("..") os.chdir("..")
def create_tests_build_cfg(): def create_tests_build_cfg():
os.mkdir(UNITTEST_FOLDER_NAME) os.mkdir(UNITTEST_FOLDER_NAME)
os.chdir(UNITTEST_FOLDER_NAME) os.chdir(UNITTEST_FOLDER_NAME)
os.system("cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..") cmd_runner("cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..")
os.chdir("..") os.chdir("..")
def create_docs_build_cfg(): def create_docs_build_cfg():
os.mkdir(DOCS_FOLDER_NAME) os.mkdir(DOCS_FOLDER_NAME)
os.chdir(DOCS_FOLDER_NAME) os.chdir(DOCS_FOLDER_NAME)
os.system("cmake -DFSFW_OSAL=host -DFSFW_BUILD_DOCS=ON ..") cmd_runner("cmake -DFSFW_OSAL=host -DFSFW_BUILD_DOCS=ON ..")
os.chdir("..") os.chdir("..")
@ -184,7 +184,7 @@ def check_for_cmake_build_dir(build_dir_list: list) -> list:
def perform_lcov_operation(directory: str, chdir: bool): def perform_lcov_operation(directory: str, chdir: bool):
if chdir: if chdir:
os.chdir(directory) os.chdir(directory)
os.system("cmake --build . -- fsfw-tests_coverage -j") cmd_runner("cmake --build . -- fsfw-tests_coverage -j")
def determine_build_dir(build_dir_list: List[str]): def determine_build_dir(build_dir_list: List[str]):
@ -206,5 +206,10 @@ def determine_build_dir(build_dir_list: List[str]):
return build_directory return build_directory
def cmd_runner(cmd: str):
print(f"Executing command: {cmd}")
os.system(cmd)
if __name__ == "__main__": if __name__ == "__main__":
main() main()