From 9fcdbd08d28b74c28df2aeb7b5577106b9ab3224 Mon Sep 17 00:00:00 2001 From: Gabriel Ferreira Date: Fri, 11 Feb 2022 22:47:03 -0300 Subject: [PATCH] build: fix ns3 sphinx targets and test-ns3.py tests --- buildsupport/macros_and_definitions.cmake | 6 ++++-- ns3 | 2 +- utils/tests/test-ns3.py | 10 ++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/buildsupport/macros_and_definitions.cmake b/buildsupport/macros_and_definitions.cmake index 307fa86a4..35d756332 100644 --- a/buildsupport/macros_and_definitions.cmake +++ b/buildsupport/macros_and_definitions.cmake @@ -942,11 +942,13 @@ macro(process_options) add_custom_target(sphinx COMMENT "Building sphinx documents") function(sphinx_target targetname) + # cmake-format: off add_custom_target( - sphinx_${targetname} COMMAND make SPHINXOPTS=-N -k html singlehtml - latexpdf + sphinx_${targetname} + COMMAND make SPHINXOPTS=-N -k html singlehtml latexpdf WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/doc/${targetname} ) + # cmake-format: on add_dependencies(sphinx sphinx_${targetname}) endfunction() sphinx_target(manual) diff --git a/ns3 b/ns3 index 89b7d276a..382503f6f 100755 --- a/ns3 +++ b/ns3 @@ -827,7 +827,7 @@ def build_step(args, target = get_target_to_build(target, ns3_version, build_profile) else: # Sphinx target should have the sphinx prefix - if target in ["manual", "models", "tutorial"]: + if target in ["contributing", "manual", "models", "tutorial"]: target = "sphinx_%s" % target # Docs should build both doxygen and sphinx based docs diff --git a/utils/tests/test-ns3.py b/utils/tests/test-ns3.py index 182a1fd65..027b5e5c2 100644 --- a/utils/tests/test-ns3.py +++ b/utils/tests/test-ns3.py @@ -1588,14 +1588,16 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): doc_folder = os.path.abspath(os.sep.join([".", "doc"])) - # First we need to clean old docs, or it will not make any sense. - for target in ["manual", "models", "tutorial"]: + # For each sphinx doc target. + for target in ["contributing", "manual", "models", "tutorial"]: + # First we need to clean old docs, or it will not make any sense. doc_build_folder = os.sep.join([doc_folder, target, "build"]) + doc_temp_folder = os.sep.join([doc_folder, target, "source-temp"]) if os.path.exists(doc_build_folder): shutil.rmtree(doc_build_folder) + if os.path.exists(doc_temp_folder): + shutil.rmtree(doc_temp_folder) - # For each sphinx doc target. - for target in ["manual", "models", "tutorial"]: # Build return_code, stdout, stderr = run_ns3("docs %s" % target) self.assertEqual(return_code, 0)