Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rerun tutorial examples #1654

Merged
merged 6 commits into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion buildtest/builders/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ def check_test_state(self):
self.metadata["result"]["state"] = self.status["state"]
return

if self.status.get("returncode"):
if "returncode" in self.status:
self.metadata["check"]["returncode"] = returncode_check(self)

# check regex against output or error stream based on regular expression defined in status property. Return value is a boolean
Expand Down
1 change: 0 additions & 1 deletion buildtest/buildsystem/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def returncode_check(builder):
console.print(
f"[blue]{builder}[/]: Checking returncode - {builder.metadata['result']['returncode']} is matched in list {buildspec_returncode}"
)

return returncode_match


Expand Down
4 changes: 4 additions & 0 deletions buildtest/settings/spack_container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ system:
bash:
description: submit jobs on local machine using bash shell
shell: bash
before_script: |
source /etc/profile
sh:
description: submit jobs on local machine using sh shell
shell: sh
before_script: |
source /etc/profile
compilers:
find:
gcc: ^(gcc)
Expand Down
4 changes: 2 additions & 2 deletions buildtest/tools/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def build_compiler_examples(autogen_dir):
commands_to_run = {
f"{build_dir}/gnu_hello_fortran.txt": f"buildtest build -b {COMPILER_EXAMPLE_DIR}/gnu_hello_fortran.yml",
f"{inspect_dir}/gnu_hello_fortran.txt": "buildtest inspect query -t hello_f",
f"{compiler_dir}/compilers_list.txt": "buildtest config compilers -y",
f"{compiler_dir}/compilers_list.txt": "buildtest config compilers list -y",
f"{build_dir}/vecadd.txt": f"buildtest build -b {COMPILER_EXAMPLE_DIR}/vecadd.yml",
f"{build_dir}/gnu_hello_c.txt": f"buildtest build -b {COMPILER_EXAMPLE_DIR}/gnu_hello_c.yml",
f"{inspect_dir}/gnu_hello_c.txt": "buildtest inspect query -t hello_c/",
Expand All @@ -131,7 +131,7 @@ def build_compiler_examples(autogen_dir):
f"{build_dir}/compiler_status_regex.txt": f"buildtest build -b {COMPILER_EXAMPLE_DIR}/compiler_status_regex.yml",
f"{inspect_dir}/compiler_status_regex.txt": "buildtest inspect query -o override_status_regex/",
f"{build_dir}/custom_run.txt": f"buildtest build -b {COMPILER_EXAMPLE_DIR}/custom_run.yml",
f"{inspect_dir}/custom_run.txt": "buildtest inspect query -b -t custom_run_by_compilers/",
f"{inspect_dir}/custom_run.txt": "buildtest inspect query -t custom_run_by_compilers/",
f"{build_dir}/pre_post_build_run.txt": f"buildtest build -b {COMPILER_EXAMPLE_DIR}/pre_post_build_run.yml",
f"{inspect_dir}/pre_post_build_run.txt": "buildtest inspect query -t pre_post_build_run",
f"{build_dir}/stream_example.txt": f"buildtest build -b {COMPILER_EXAMPLE_DIR}/stream_example.yml",
Expand Down
15 changes: 8 additions & 7 deletions docs/buildspecs/compiler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ relative path to buildspec file or an absolute path.
In this example the source file ``src/hello.f90`` is relative path to where buildspec file is located.
The ``compilers`` section declares compiler configuration, the ``name``
property is required that is used to search compiler names from our buildtest configuration via regular
expression. In this example we use the **builtin_gcc** compiler as regular expression which is the system
gcc compiler provided by buildtest. The ``default`` section specifies default compiler
configuration applicable to a specific compiler group like `gcc`. Within each compiler group we can specify
options like ``cflags``, ``fflags``, ``cxxflags``, ``ldflags`` to customize compilation line.
expression. In this example we use the **gcc_7.5.0** compiler specified in the regular expression. The
``default`` section specifies default compiler configuration applicable to a specific compiler group like `gcc`.
Within each compiler group we can specify options like ``cflags``, ``fflags``, ``cxxflags``, ``ldflags`` to customize compilation line.

.. literalinclude:: ../../examples/compilers/gnu_hello_fortran.yml
:language: yaml
Expand Down Expand Up @@ -84,7 +83,7 @@ and path to ``cc``, ``fc``, ``cxx`` wrapper. In addition one can specify ``modul
to modulefile. If `module` property is defined you can specify list of modules to load via ``load`` property and buildtest will
automatically load these modules when using the compiler.

.. dropdown:: ``buildtest config compilers -y``
.. dropdown:: ``buildtest config compilers list -y``

.. program-output:: cat buildtest_tutorial_examples/compilers/compilers_list.txt

Expand All @@ -97,6 +96,7 @@ this code requires we specify ``-lm`` flag to link with math library.

.. literalinclude:: ../../examples/compilers/vecadd.yml
:language: yaml
:emphasize-lines: 9-13

We expect buildtest to generate one test per gcc compiler as you can see below.

Expand All @@ -115,7 +115,7 @@ options for each compiler name.

.. literalinclude:: ../../examples/compilers/gnu_hello_c.yml
:language: yaml
:emphasize-lines: 14-17
:emphasize-lines: 10-17

Let's build this test, we will see there is one builder instance for each compiler.

Expand Down Expand Up @@ -339,12 +339,13 @@ each test to map to each compiler.

.. program-output:: cat buildtest_tutorial_examples/compilers/inspect/stream_example.txt

In the next example, we will run STREAM benchmark and extract metrics from test results and assign them to metrics name
In the next example, we will run STREAM benchmark and :ref:`define metrics <metrics>` from test results and assign them to metrics name
``copy``, ``add``, ``scale``, ``triad``. Each metrics will be searched using regular expression against stdout stream


.. literalinclude:: ../../examples/compilers/stream_example_metrics.yml
:language: yaml
:emphasize-lines: 18-42

buildtest will record the metrics in the test report and ``buildtest inspect query`` will display metrics
if found in test. Shown below we see the output of the metrics and its corresponding values.
Expand Down
Loading
Loading