-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5897 from clebergnu/runnable_recipe_validation_re…
…solver Signed-off-by: Jan Richter <[email protected]>
- Loading branch information
Showing
13 changed files
with
200 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
Defining what to run using recipe files | ||
--------------------------------------- | ||
|
||
If you've followed the previous documentation sections, you should now | ||
be able to write ``exec-test`` tests and also ``avocado-instrumented`` | ||
tests. These tests should be found when you run | ||
``avocado run /reference/to/a/test``. Internally, though, these will | ||
be defined as a :class:`avocado.core.nrunner.runnable.Runnable`. | ||
|
||
This is interesting because you are able to have a shortcut into what | ||
Avocado runs by defining a ``Runnable``. Runnables can be defined using | ||
pure Python code, such as in the following Job example: | ||
|
||
.. literalinclude:: ../../../../../examples/jobs/custom_exec_test.py | ||
|
||
But, they can also be defined in JSON files, which we call "runnable | ||
recipes", such as: | ||
|
||
.. literalinclude:: ../../../../../examples/nrunner/recipes/runnables/exec_test_sleep_3.json | ||
|
||
|
||
Runnable recipe format | ||
~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
While it should be somewhat easy to see the similarities between | ||
between the fields in the | ||
:class:`avocado.core.nrunner.runnable.Runnable` structure and a | ||
runnable recipe JSON data, Avocado actually ships with a schema that | ||
defines the exact format of the runnable recipe: | ||
|
||
.. literalinclude:: ../../../../../avocado/schemas/runnable-recipe.schema.json | ||
|
||
Avocado will attempt to enforce the JSON schema any time a | ||
``Runnable`` is loaded from such recipe files. | ||
|
||
Using runnable recipes as references | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Avocado ships with a ``runnable-recipe`` resolver plugin, which means | ||
that you can use runnable recipe file as a reference, and get | ||
something that Avocado can run (that is, a ``Runnable``). Example:: | ||
|
||
avocado list examples/nrunner/recipes/runnables/python_unittest.json | ||
python-unittest selftests/unit/test.py:TestClassTestUnit.test_long_name | ||
|
||
And just as runnable recipe's resolution can be listed, they can also | ||
be executed:: | ||
|
||
avocado run examples/nrunner/recipes/runnables/python_unittest.json | ||
JOB ID : bca087e0e5f16e62f24430602f87df67ecf093f7 | ||
JOB LOG : ~/avocado/job-results/job-2024-04-17T11.53-bca087e/job.log | ||
(1/1) selftests/unit/test.py:TestClassTestUnit.test_long_name: STARTED | ||
(1/1) selftests/unit/test.py:TestClassTestUnit.test_long_name: PASS (0.02 s) | ||
RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 | ||
JOB TIME : 2.72 s | ||
|
||
.. tip:: As a possible integration strategy with existing tests, you | ||
can have one or more runnable recipe files that are passed | ||
to Avocado to be executed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
Summary: Framework with tools and libraries for Automated Testing | ||
Name: python-avocado | ||
Version: 104.0 | ||
Release: 1%{?gitrel}%{?dist} | ||
Release: 2%{?gitrel}%{?dist} | ||
License: GPLv2+ and GPLv2 and MIT | ||
URL: https://avocado-framework.github.io/ | ||
%if 0%{?rel_build} | ||
|
@@ -84,6 +84,7 @@ Requires: python3-avocado-common == %{version}-%{release} | |
Requires: gdb | ||
Requires: gdb-gdbserver | ||
Requires: procps-ng | ||
Requires: python3-jsonschema | ||
%if ! 0%{?rhel} | ||
Requires: python3-pycdlib | ||
%endif | ||
|
@@ -191,9 +192,12 @@ cp -r examples/tests %{buildroot}%{_docdir}/avocado | |
cp -r examples/yaml_to_mux %{buildroot}%{_docdir}/avocado | ||
cp -r examples/varianter_pict %{buildroot}%{_docdir}/avocado | ||
cp -r examples/varianter_cit %{buildroot}%{_docdir}/avocado | ||
mkdir -p %{buildroot}%{_datarootdir}/avocado | ||
mv %{buildroot}%{python3_sitelib}/avocado/schemas %{buildroot}%{_datarootdir}/avocado | ||
find %{buildroot}%{_docdir}/avocado -type f -name '*.py' -exec chmod -c -x {} ';' | ||
mkdir -p %{buildroot}%{_libexecdir}/avocado | ||
mv %{buildroot}%{python3_sitelib}/avocado/libexec/* %{buildroot}%{_libexecdir}/avocado | ||
rmdir %{buildroot}%{python3_sitelib}/avocado/libexec | ||
|
||
%if %{with tests} | ||
%check | ||
|
@@ -263,6 +267,10 @@ Common files (such as configuration) for the Avocado Testing Framework. | |
%dir %{_sysconfdir}/avocado/scripts/job/pre.d | ||
%dir %{_sysconfdir}/avocado/scripts/job/post.d | ||
%dir %{_sharedstatedir}/avocado | ||
%dir %{_sharedstatedir}/avocado/data | ||
%dir %{_datarootdir}/avocado | ||
%dir %{_datarootdir}/avocado/schemas | ||
%{_datarootdir}/avocado/schemas/* | ||
%config(noreplace)%{_sysconfdir}/avocado/sysinfo/commands | ||
%config(noreplace)%{_sysconfdir}/avocado/sysinfo/files | ||
%config(noreplace)%{_sysconfdir}/avocado/sysinfo/profilers | ||
|
@@ -436,6 +444,12 @@ Again Shell code (and possibly other similar shells). | |
%{_libexecdir}/avocado* | ||
|
||
%changelog | ||
* Tue Apr 2 2024 Cleber Rosa <[email protected]> - 104.0-2 | ||
- Package JSON schema files | ||
- Removed empty libexec dir | ||
- Require python3-jsonschema to perform runtime schema validation | ||
for recipe files | ||
|
||
* Tue Mar 19 2024 Jan Richter <[email protected]> - 104.0-1 | ||
- New release | ||
|
||
|
Oops, something went wrong.