Commit e7d7ad0e authored by Brendan Higgins's avatar Brendan Higgins Committed by Shuah Khan

Documentation: kunit: fix typos and gramatical errors

Fix typos and gramatical errors in the Getting Started and Usage guide
for KUnit.
Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Link: https://patchwork.kernel.org/patch/11156481/Reported-by: default avatarRinat Ibragimov <ibragimovrinat@mail.ru>
Link: https://github.com/google/kunit-docs/issues/1Signed-off-by: default avatarBrendan Higgins <brendanhiggins@google.com>
Reviewed-by: default avatarDavid Gow <davidgow@google.com>
Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 70efb58b
...@@ -23,7 +23,7 @@ The wrapper can be run with: ...@@ -23,7 +23,7 @@ The wrapper can be run with:
Creating a kunitconfig Creating a kunitconfig
====================== ======================
The Python script is a thin wrapper around Kbuild as such, it needs to be The Python script is a thin wrapper around Kbuild. As such, it needs to be
configured with a ``kunitconfig`` file. This file essentially contains the configured with a ``kunitconfig`` file. This file essentially contains the
regular Kernel config, with the specific test targets as well. regular Kernel config, with the specific test targets as well.
...@@ -59,8 +59,8 @@ If everything worked correctly, you should see the following: ...@@ -59,8 +59,8 @@ If everything worked correctly, you should see the following:
followed by a list of tests that are run. All of them should be passing. followed by a list of tests that are run. All of them should be passing.
.. note:: .. note::
Because it is building a lot of sources for the first time, the ``Building Because it is building a lot of sources for the first time, the
kunit kernel`` step may take a while. ``Building KUnit kernel`` step may take a while.
Writing your first test Writing your first test
======================= =======================
...@@ -159,7 +159,7 @@ Now you can run the test: ...@@ -159,7 +159,7 @@ Now you can run the test:
.. code-block:: bash .. code-block:: bash
./tools/testing/kunit/kunit.py ./tools/testing/kunit/kunit.py run
You should see the following failure: You should see the following failure:
......
...@@ -16,7 +16,7 @@ Organization of this document ...@@ -16,7 +16,7 @@ Organization of this document
============================= =============================
This document is organized into two main sections: Testing and Isolating This document is organized into two main sections: Testing and Isolating
Behavior. The first covers what a unit test is and how to use KUnit to write Behavior. The first covers what unit tests are and how to use KUnit to write
them. The second covers how to use KUnit to isolate code and make it possible them. The second covers how to use KUnit to isolate code and make it possible
to unit test code that was otherwise un-unit-testable. to unit test code that was otherwise un-unit-testable.
...@@ -174,13 +174,13 @@ Test Suites ...@@ -174,13 +174,13 @@ Test Suites
~~~~~~~~~~~ ~~~~~~~~~~~
Now obviously one unit test isn't very helpful; the power comes from having Now obviously one unit test isn't very helpful; the power comes from having
many test cases covering all of your behaviors. Consequently it is common to many test cases covering all of a unit's behaviors. Consequently it is common
have many *similar* tests; in order to reduce duplication in these closely to have many *similar* tests; in order to reduce duplication in these closely
related tests most unit testing frameworks provide the concept of a *test related tests most unit testing frameworks - including KUnit - provide the
suite*, in KUnit we call it a *test suite*; all it is is just a collection of concept of a *test suite*. A *test suite* is just a collection of test cases
test cases for a unit of code with a set up function that gets invoked before for a unit of code with a set up function that gets invoked before every test
every test cases and then a tear down function that gets invoked after every case and then a tear down function that gets invoked after every test case
test case completes. completes.
Example: Example:
...@@ -211,7 +211,7 @@ KUnit test framework. ...@@ -211,7 +211,7 @@ KUnit test framework.
.. note:: .. note::
A test case will only be run if it is associated with a test suite. A test case will only be run if it is associated with a test suite.
For a more information on these types of things see the :doc:`api/test`. For more information on these types of things see the :doc:`api/test`.
Isolating Behavior Isolating Behavior
================== ==================
...@@ -338,7 +338,7 @@ We can easily test this code by *faking out* the underlying EEPROM: ...@@ -338,7 +338,7 @@ We can easily test this code by *faking out* the underlying EEPROM:
return count; return count;
} }
ssize_t fake_eeprom_write(struct eeprom *this, size_t offset, const char *buffer, size_t count) ssize_t fake_eeprom_write(struct eeprom *parent, size_t offset, const char *buffer, size_t count)
{ {
struct fake_eeprom *this = container_of(parent, struct fake_eeprom, parent); struct fake_eeprom *this = container_of(parent, struct fake_eeprom, parent);
...@@ -454,7 +454,7 @@ KUnit on non-UML architectures ...@@ -454,7 +454,7 @@ KUnit on non-UML architectures
By default KUnit uses UML as a way to provide dependencies for code under test. By default KUnit uses UML as a way to provide dependencies for code under test.
Under most circumstances KUnit's usage of UML should be treated as an Under most circumstances KUnit's usage of UML should be treated as an
implementation detail of how KUnit works under the hood. Nevertheless, there implementation detail of how KUnit works under the hood. Nevertheless, there
are instances where being able to run architecture specific code, or test are instances where being able to run architecture specific code or test
against real hardware is desirable. For these reasons KUnit supports running on against real hardware is desirable. For these reasons KUnit supports running on
other architectures. other architectures.
...@@ -557,7 +557,7 @@ run your tests on your hardware setup just by compiling for your architecture. ...@@ -557,7 +557,7 @@ run your tests on your hardware setup just by compiling for your architecture.
.. important:: .. important::
Always prefer tests that run on UML to tests that only run under a particular Always prefer tests that run on UML to tests that only run under a particular
architecture, and always prefer tests that run under QEMU or another easy architecture, and always prefer tests that run under QEMU or another easy
(and monitarily free) to obtain software environment to a specific piece of (and monetarily free) to obtain software environment to a specific piece of
hardware. hardware.
Nevertheless, there are still valid reasons to write an architecture or hardware Nevertheless, there are still valid reasons to write an architecture or hardware
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment