[26/26] buildtools-docs-tarball: Add test for building documentation using sphinx

Message ID 20220317115700.993924-27-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 26b224a1bbe27b5d9886be4552147e1d66e34519
Headers show
Series Add support for sphinx documentation generation | expand

Commit Message

Richard Purdie March 17, 2022, 11:57 a.m. UTC
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/lib/oeqa/sdk/buildtools-docs-cases/README  |  2 ++
 .../lib/oeqa/sdk/buildtools-docs-cases/build.py | 17 +++++++++++++++++
 .../meta/buildtools-docs-tarball.bb             |  4 +++-
 meta/recipes-core/meta/buildtools-tarball.bb    |  5 ++++-
 4 files changed, 26 insertions(+), 2 deletions(-)
 create mode 100644 meta/lib/oeqa/sdk/buildtools-docs-cases/README
 create mode 100644 meta/lib/oeqa/sdk/buildtools-docs-cases/build.py

Comments

Quentin Schulz March 17, 2022, 1:58 p.m. UTC | #1
Hi Richard,

On 3/17/22 12:57, Richard Purdie wrote:
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>   meta/lib/oeqa/sdk/buildtools-docs-cases/README  |  2 ++
>   .../lib/oeqa/sdk/buildtools-docs-cases/build.py | 17 +++++++++++++++++
>   .../meta/buildtools-docs-tarball.bb             |  4 +++-
>   meta/recipes-core/meta/buildtools-tarball.bb    |  5 ++++-
>   4 files changed, 26 insertions(+), 2 deletions(-)
>   create mode 100644 meta/lib/oeqa/sdk/buildtools-docs-cases/README
>   create mode 100644 meta/lib/oeqa/sdk/buildtools-docs-cases/build.py
> 
> diff --git a/meta/lib/oeqa/sdk/buildtools-docs-cases/README b/meta/lib/oeqa/sdk/buildtools-docs-cases/README
> new file mode 100644
> index 00000000000..f8edbc7dad7
> --- /dev/null
> +++ b/meta/lib/oeqa/sdk/buildtools-docs-cases/README
> @@ -0,0 +1,2 @@
> +These test cases are used by build-docs-tarball, and are not used by the testsdk
> +class.
> diff --git a/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py b/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py
> new file mode 100644
> index 00000000000..5b0eca046fa
> --- /dev/null
> +++ b/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py
> @@ -0,0 +1,17 @@
> +#
> +# SPDX-License-Identifier: MIT
> +#
> +
> +import tempfile
> +from oeqa.sdk.case import OESDKTestCase
> +from oeqa.utils.subprocesstweak import errors_have_output
> +errors_have_output()
> +
> +class BuildTests(OESDKTestCase):
> +    """
> +    Verify that our docs can build using our docs tools tarball.
> +    """
> +    def test_docs_build(self):
> +        with tempfile.TemporaryDirectory(prefix='docs-tarball-build-', dir=self.tc.sdk_dir) as testdir:
> +            self._run('git clone git://git.yoctoproject.org/yocto-docs %s' % testdir)

I would suggest to pin a revision that is known to be buildable 
otherwise the test could fail just because a broken commit made it to 
the main branch.

> +            self._run('cd %s/documentation && make html' % testdir)

Also might want to turn off the -W flag which turns warnings into 
errors? (i.e. SPHINXOPTS="-j auto" only) I'd assume we let the 
autobuilder fail the doc builds if there are warnings and that we're not 
interested in that here?

Once this series is merged we should update the docs to explicit this is 
how we build the docs (which provides a known working environment).

Cheers,
Quentin

> diff --git a/meta/recipes-core/meta/buildtools-docs-tarball.bb b/meta/recipes-core/meta/buildtools-docs-tarball.bb
> index 72a256cf04a..72648e3b1cd 100644
> --- a/meta/recipes-core/meta/buildtools-docs-tarball.bb
> +++ b/meta/recipes-core/meta/buildtools-docs-tarball.bb
> @@ -13,4 +13,6 @@ TOOLCHAIN_HOST_TASK += "\
>   
>   TOOLCHAIN_OUTPUTNAME = "${SDK_ARCH}-buildtools-docs-nativesdk-standalone-${DISTRO_VERSION}"
>   
> -SDK_TITLE = "Docs Build tools tarball"
> \ No newline at end of file
> +SDK_TITLE = "Docs Build tools tarball"
> +
> +TESTSDK_CASES = "buildtools-docs-cases"
> diff --git a/meta/recipes-core/meta/buildtools-tarball.bb b/meta/recipes-core/meta/buildtools-tarball.bb
> index 60f6aac837a..fac91cfc3cf 100644
> --- a/meta/recipes-core/meta/buildtools-tarball.bb
> +++ b/meta/recipes-core/meta/buildtools-tarball.bb
> @@ -99,11 +99,14 @@ TOOLCHAIN_NEED_CONFIGSITE_CACHE = ""
>   # The recipe doesn't need any default deps
>   INHIBIT_DEFAULT_DEPS = "1"
>   
> +# Directory in testsdk that contains testcases
> +TESTSDK_CASES = "buildtools-cases"
> +
>   python do_testsdk() {
>       import oeqa.sdk.testsdk
>       testsdk = oeqa.sdk.testsdk.TestSDK()
>   
> -    cases_path = os.path.join(os.path.abspath(os.path.dirname(oeqa.sdk.testsdk.__file__)), "buildtools-cases")
> +    cases_path = os.path.join(os.path.abspath(os.path.dirname(oeqa.sdk.testsdk.__file__)), d.getVar("TESTSDK_CASES"))
>       testsdk.context_executor_class.default_cases = cases_path
>   
>       testsdk.run(d)
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#163412): https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Dcore_message_163412&d=DwIFaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=OMOooZJ-LyEYbPnLygc_ZMQ_QcJlTMswj7GtEBTG5ESUaF1pk3aC91BBjKNJF2dK&s=xcImmtC4uU-7XELDbmvTu9iCL8MwcINqvC4iQMNgl9w&e=
> Mute This Topic: https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_mt_89843344_6293953&d=DwIFaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=OMOooZJ-LyEYbPnLygc_ZMQ_QcJlTMswj7GtEBTG5ESUaF1pk3aC91BBjKNJF2dK&s=5BVim6IZaXUSyo0dnYsv9IAwLhrsvuNj5Jki89oQAJc&e=
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Dcore_unsub&d=DwIFaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=OMOooZJ-LyEYbPnLygc_ZMQ_QcJlTMswj7GtEBTG5ESUaF1pk3aC91BBjKNJF2dK&s=53ufSsaZGBsMBu7rTAP8Vipvhs4ZVcNFg6bnf84ktf0&e=  [quentin.schulz@theobroma-systems.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>

Patch

diff --git a/meta/lib/oeqa/sdk/buildtools-docs-cases/README b/meta/lib/oeqa/sdk/buildtools-docs-cases/README
new file mode 100644
index 00000000000..f8edbc7dad7
--- /dev/null
+++ b/meta/lib/oeqa/sdk/buildtools-docs-cases/README
@@ -0,0 +1,2 @@ 
+These test cases are used by build-docs-tarball, and are not used by the testsdk
+class.
diff --git a/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py b/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py
new file mode 100644
index 00000000000..5b0eca046fa
--- /dev/null
+++ b/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py
@@ -0,0 +1,17 @@ 
+#
+# SPDX-License-Identifier: MIT
+#
+
+import tempfile
+from oeqa.sdk.case import OESDKTestCase
+from oeqa.utils.subprocesstweak import errors_have_output
+errors_have_output()
+
+class BuildTests(OESDKTestCase):
+    """
+    Verify that our docs can build using our docs tools tarball.
+    """
+    def test_docs_build(self):
+        with tempfile.TemporaryDirectory(prefix='docs-tarball-build-', dir=self.tc.sdk_dir) as testdir:
+            self._run('git clone git://git.yoctoproject.org/yocto-docs %s' % testdir)
+            self._run('cd %s/documentation && make html' % testdir)
diff --git a/meta/recipes-core/meta/buildtools-docs-tarball.bb b/meta/recipes-core/meta/buildtools-docs-tarball.bb
index 72a256cf04a..72648e3b1cd 100644
--- a/meta/recipes-core/meta/buildtools-docs-tarball.bb
+++ b/meta/recipes-core/meta/buildtools-docs-tarball.bb
@@ -13,4 +13,6 @@  TOOLCHAIN_HOST_TASK += "\
 
 TOOLCHAIN_OUTPUTNAME = "${SDK_ARCH}-buildtools-docs-nativesdk-standalone-${DISTRO_VERSION}"
 
-SDK_TITLE = "Docs Build tools tarball"
\ No newline at end of file
+SDK_TITLE = "Docs Build tools tarball"
+
+TESTSDK_CASES = "buildtools-docs-cases"
diff --git a/meta/recipes-core/meta/buildtools-tarball.bb b/meta/recipes-core/meta/buildtools-tarball.bb
index 60f6aac837a..fac91cfc3cf 100644
--- a/meta/recipes-core/meta/buildtools-tarball.bb
+++ b/meta/recipes-core/meta/buildtools-tarball.bb
@@ -99,11 +99,14 @@  TOOLCHAIN_NEED_CONFIGSITE_CACHE = ""
 # The recipe doesn't need any default deps
 INHIBIT_DEFAULT_DEPS = "1"
 
+# Directory in testsdk that contains testcases
+TESTSDK_CASES = "buildtools-cases"
+
 python do_testsdk() {
     import oeqa.sdk.testsdk
     testsdk = oeqa.sdk.testsdk.TestSDK()
 
-    cases_path = os.path.join(os.path.abspath(os.path.dirname(oeqa.sdk.testsdk.__file__)), "buildtools-cases")
+    cases_path = os.path.join(os.path.abspath(os.path.dirname(oeqa.sdk.testsdk.__file__)), d.getVar("TESTSDK_CASES"))
     testsdk.context_executor_class.default_cases = cases_path
 
     testsdk.run(d)