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

Buildspec tutorial documentation fix #1538

Merged
merged 10 commits into from
Jul 14, 2023
36 changes: 18 additions & 18 deletions buildtest/tools/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,17 @@ def build_spack_examples(autogen_dir):
f"{build_dir}/spack_test_specs.txt": f"buildtest build -b {SPACK_EXAMPLE_DIR}/spack_test_specs.yml",
f"{build_dir}/spack_sbatch.txt": f"buildtest build -b {SPACK_EXAMPLE_DIR}/spack_sbatch.yml",
f"{build_dir}/e4s_testsuite_mpich.txt": f"buildtest build -b {SPACK_EXAMPLE_DIR}/e4s_testsuite_mpich.yml",
f"{inspect_dir}/install_specs.txt": "buildtest inspect query -o -t install_specs_example clone_spack_and_install_zlib",
f"{inspect_dir}/env_install.txt": "buildtest inspect query -t install_in_spack_env",
f"{inspect_dir}/env_create_directory.txt": "buildtest inspect query -o -t spack_env_directory",
f"{inspect_dir}/env_create_manifest.txt": "buildtest inspect query -o -t spack_env_create_from_manifest",
f"{inspect_dir}/remove_environment_example.txt": "buildtest inspect query -t remove_environment_automatically remove_environment_explicit",
f"{inspect_dir}/pre_post_cmds.txt": "buildtest inspect query -o -t run_pre_post_commands",
f"{inspect_dir}/mirror_example.txt": "buildtest inspect query -o -t add_mirror add_mirror_in_spack_env",
f"{inspect_dir}/spack_test.txt": "buildtest inspect query -o -t spack_test_m4",
f"{inspect_dir}/spack_test_specs.txt": "buildtest inspect query -o -t spack_test_results_specs_format",
f"{inspect_dir}/spack_sbatch.txt": "buildtest inspect query -t spack_sbatch_example",
f"{inspect_dir}/e4s_testsuite_mpich.txt": "buildtest inspect query -o -e -t mpich_e4s_testsuite",
f"{inspect_dir}/install_specs.txt": "buildtest inspect query -o --testpath install_specs_example clone_spack_and_install_zlib",
f"{inspect_dir}/env_install.txt": "buildtest inspect query --testpath install_in_spack_env",
f"{inspect_dir}/env_create_directory.txt": "buildtest inspect query -o --testpath spack_env_directory",
f"{inspect_dir}/env_create_manifest.txt": "buildtest inspect query -o --testpath spack_env_create_from_manifest",
f"{inspect_dir}/remove_environment_example.txt": "buildtest inspect query --testpath remove_environment_automatically remove_environment_explicit",
f"{inspect_dir}/pre_post_cmds.txt": "buildtest inspect query -o --testpath run_pre_post_commands",
f"{inspect_dir}/mirror_example.txt": "buildtest inspect query -o --testpath add_mirror add_mirror_in_spack_env",
f"{inspect_dir}/spack_test.txt": "buildtest inspect query -o --testpath spack_test_m4",
f"{inspect_dir}/spack_test_specs.txt": "buildtest inspect query -o --testpath spack_test_results_specs_format",
f"{inspect_dir}/spack_sbatch.txt": "buildtest inspect query --testpath spack_sbatch_example",
f"{inspect_dir}/e4s_testsuite_mpich.txt": "buildtest inspect query -o -e --testpath mpich_e4s_testsuite",
}

for fname, command in commands_to_run.items():
Expand All @@ -112,24 +112,24 @@ def build_compiler_examples(autogen_dir):
COMPILER_EXAMPLE_DIR = os.path.join(BUILDTEST_ROOT, "examples", "compilers")
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"{inspect_dir}/gnu_hello_fortran.txt": "buildtest inspect query --testpath hello_f",
f"{compiler_dir}/compilers_list.txt": "buildtest config compilers -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/",
f"{inspect_dir}/gnu_hello_c.txt": "buildtest inspect query --testpath hello_c/",
f"{build_dir}/compiler_exclude.txt": f"buildtest build -b {COMPILER_EXAMPLE_DIR}/compiler_exclude.yml",
f"{build_dir}/openmp_hello.txt": f"buildtest build -b {COMPILER_EXAMPLE_DIR}/openmp_hello.yml",
f"{inspect_dir}/openmp_hello.txt": "buildtest inspect query -t openmp_hello_c_example",
f"{inspect_dir}/openmp_hello.txt": "buildtest inspect query --testpath openmp_hello_c_example",
f"{build_dir}/envvar_override.txt": f"buildtest build -b {COMPILER_EXAMPLE_DIR}/envvar_override.yml",
f"{inspect_dir}/envvar_override.txt": "buildtest inspect query -t override_environmentvars/",
f"{inspect_dir}/envvar_override.txt": "buildtest inspect query --testpath override_environmentvars/",
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 -b --testpath 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"{inspect_dir}/pre_post_build_run.txt": "buildtest inspect query --testpath pre_post_build_run",
f"{build_dir}/stream_example.txt": f"buildtest build -b {COMPILER_EXAMPLE_DIR}/stream_example.yml",
f"{inspect_dir}/stream_example.txt": "buildtest inspect query -t stream_openmp_c/",
f"{inspect_dir}/stream_example.txt": "buildtest inspect query --testpath stream_openmp_c/",
f"{build_dir}/stream_example_metrics.txt": f"buildtest build -b {COMPILER_EXAMPLE_DIR}/stream_example_metrics.yml",
f"{inspect_dir}/stream_openmp_metrics.txt": "buildtest inspect query -o stream_openmp_metrics/",
}
Expand Down
16 changes: 8 additions & 8 deletions docs/buildspecs/compiler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Shown below is an example build for this test.

The generated test for test name **hello_f** is the following:

.. dropdown:: ``buildtest inspect query -t hello_f``
.. dropdown:: ``buildtest inspect query --testpath hello_f``

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

Expand Down Expand Up @@ -126,7 +126,7 @@ Let's build this test, we will see there is one builder instance for each compil
If we inspect the following test, we see each test has its own compiler flags. The default cflag
is ``-O1`` while **gcc_6.5.0** will use ``-O2`` and **gcc_8.3.0** will use ``-O3``.

.. dropdown:: ``buildtest inspect query -t hello_c/``
.. dropdown:: ``buildtest inspect query --testpath hello_c/``

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

Expand Down Expand Up @@ -172,7 +172,7 @@ Now let's build this test.
We can see the generated test using ``buildtest inspect query`` given the name of test. Take a close
look at the ``export OMP_NUM_THREADS`` in the generated test.

.. dropdown:: ``buildtest inspect query -t openmp_hello_c_example``
.. dropdown:: ``buildtest inspect query --testpath openmp_hello_c_example``

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

Expand All @@ -188,11 +188,11 @@ We can build this test by running::

buildtest build -b $BUILDTEST_ROOT/examples/compilers/envvar_override.yml

Next, let's see the generated test by running ``buildtest inspect query -d all -t override_environmentvars``. The
Next, let's see the generated test by running ``buildtest inspect query -d all --testpath override_environmentvars``. The
shahzebsiddiqui marked this conversation as resolved.
Show resolved Hide resolved
``-d all`` will display all test records for ``override_environmentvars``. Take a note that we have
``export OMP_NUM_THREADS=4`` for `gcc_8.3.0` test and ``export OMP_NUM_THREADS=2`` for system gcc.

.. dropdown:: ``buildtest inspect query -t override_environmentvars/``
.. dropdown:: ``buildtest inspect query --testpath override_environmentvars/``

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

Expand Down Expand Up @@ -254,7 +254,7 @@ You can build this test by running the following::
Once test is complete let's inspect the generated test. We see that buildtest will insert the line specified
by ``run`` property after compilation and run the executable.

.. dropdown:: ``buildtest inspect query -b -t custom_run_by_compilers/``
.. dropdown:: ``buildtest inspect query -b --testpath custom_run_by_compilers/``

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

Expand Down Expand Up @@ -298,7 +298,7 @@ You can run this example by running the following command::
If we inspect the content of test we see that buildtest will insert the shell commands
for ``pre_build``, ``post_build``, ``pre_run`` and ``post_run`` in its corresponding section.

.. dropdown:: ``buildtest inspect query -t pre_post_build_run``
.. dropdown:: ``buildtest inspect query --testpath pre_post_build_run``

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

Expand Down Expand Up @@ -336,7 +336,7 @@ If we build this test we see one test is created per compiler instance defined i
Next, let's see the generated test using ``buildtest inspect query``, we notice buildtest will set variables ``BUILDTEST_*`` for
each test to map to each compiler.

.. dropdown:: ``buildtest inspect query -t stream_openmp_c/``
.. dropdown:: ``buildtest inspect query --testpath stream_openmp_c/``

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

Expand Down
8 changes: 7 additions & 1 deletion docs/buildspecs/spack.rst
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ If we look at the generated script for both tests, we see that mirror is added f
one can have mirrors defined in their ``spack.yaml`` or one of the `configuration scopes <https://spack.readthedocs.io/en/latest/configuration.html#configuration-scopes>`_
defined by spack.

.. dropdown:: ``buildtest inspect query -o --testpath add_mirror add_mirror_in_spack_env``
.. dropdown:: ``buildtest inspect query -o --testpath add_mirror add_mirror_in_spack_env``

.. program-output:: cat buildtest_tutorial_examples/spack/inspect/mirror_example.txt

Expand Down Expand Up @@ -325,11 +325,16 @@ since we are not using the a slurm executor.

.. literalinclude:: ../../examples/spack/spack_sbatch.yml
:language: yaml
:emphasize-lines: 7

buildtest will generate the shell script with the job directives and set the name, output and error
files based on name of test. If we build this test, and inspect the generated test we see that
**#SBATCH** directives are written based on the **sbatch** field.

.. dropdown:: ``buildtest build -b /home/spack/buildtest/examples/spack/spack_sbatch.yml``

.. program-output:: cat buildtest_tutorial_examples/spack/build/spack_sbatch.txt

.. dropdown:: ``buildtest inspect query --testpath spack_sbatch_example``

.. program-output:: cat buildtest_tutorial_examples/spack/inspect/spack_sbatch.txt
Expand All @@ -344,4 +349,5 @@ Shown below is an example buildspec that will specify ``sbatch`` directives for

.. literalinclude:: ../../examples/spack/spack_multiple_executor_sbatch.yml
:language: yaml
:emphasize-lines: 7-11

Loading
Loading