summaryrefslogtreecommitdiff
path: root/Documentation/technotes
diff options
context:
space:
mode:
authorJan Dabros <jsd@semihalf.com>2020-05-26 15:05:00 +0200
committerPatrick Georgi <pgeorgi@google.com>2020-05-30 08:46:59 +0000
commit5694342a8136e85fe474c09e425d0476d9fc4d2b (patch)
tree7ed1dcc43ca2f42f2c28288c34eb1a1d7f4e8b60 /Documentation/technotes
parent23e8b5b4949063319c339120f13e392a90493b58 (diff)
Documentation/tutorial: Add tutorial for writing unit tests
Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: I1ebd2786a49ec8bc25e209d67ecc4c94b475442d Reviewed-on: https://review.coreboot.org/c/coreboot/+/41727 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'Documentation/technotes')
-rw-r--r--Documentation/technotes/2020-03-unit-testing-coreboot.md39
1 files changed, 2 insertions, 37 deletions
diff --git a/Documentation/technotes/2020-03-unit-testing-coreboot.md b/Documentation/technotes/2020-03-unit-testing-coreboot.md
index 0d1d8ece49..02c2e30ee0 100644
--- a/Documentation/technotes/2020-03-unit-testing-coreboot.md
+++ b/Documentation/technotes/2020-03-unit-testing-coreboot.md
@@ -279,41 +279,6 @@ tests/lib/string-test and tests/device/i2c-test:
├── i2c.o
```
-### Adding new tests
-For purpose of this description, let's assume that we want to add a new unit test
-for src/device/i2c.c module. Since this module is rather simple, it will be enough
-to have only one test module.
-
-Firstly (assuming there is no tests/device/Makefile.inc file) we need to create
-Makefile.inc in main unit test module directory. Inside this Makefile.inc, one
-need to register new test and can specify multiple different attributes for it.
-
-```bash
-# Register new test, by adding its name to tests variable
-tests-y += i2c-test
-
-# All attributes are defined by <test_name>-<attribute> variables
-# <test_name>-srcs is used to register all input files (test harness, unit under
-# test and others) for this particular test. Remember to add relative paths.
-i2c-test-srcs += tests/device/i2c-test.c
-i2c-test-srcs += src/device/i2c.c
-
-# We can define extra cflags for this particular test
-i2c-test-cflags += -DSOME_DEFINE=1
-
-# For mocking out external dependencies (functions which cannot be resolved by
-# linker), it is possible to register a mock function. To register new mock, it
-# is enough to add function-to-be-mocked name to <test_name>-mocks variable.
-i2c-test-mocks += platform_i2c_transfer
-
-# Similar to coreboot concept, unit tests also runs in the context of stages.
-# By default all unit tests are compiled to be ramstage executables. If one want
-# to overwrite this setting, there is <test_name>-stage variable available.
-i2c-test-stage:= bootblock
-```
-
### Writing new tests
-Full description of how to write unit tests and Cmocka API description is out of
-the scope of this document. There are other documents related to this
-[Cmocka API](https://api.cmocka.org/) and
-[Mocks](https://lwn.net/Articles/558106/).
+Our tutorial series has [detailed guidelines](../tutorial/part3.md) for writing
+unit tests.