summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* treewide: Move list.h to commonlibMaximilian Brune2024-02-243-5/+5
| | | | | | | | | | | It is needed in order to move device_tree.c into commonlib in a subsequent commit. Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com> Change-Id: I16eb7b743fb1d36301f0eda563a62364e7a9cfec Reviewed-on: https://review.coreboot.org/c/coreboot/+/77968 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests/lib/ux_locales-test: Simplify macrosYu-Ping Wu2024-02-221-41/+15
| | | | | | | | | | | | | | | The cmocka problem of sanitizing XML strings has been fixed in CB:80382. Therefore the helper macros UX_LOCALES_GET_TEXT_FOUND_TEST() and UX_LOCALES_GET_TEXT_NOT_FOUND_TEST() can be merged into one. TEST=make unit-tests JUNIT_OUTPUT=y -j Change-Id: Ic3199e2a061550282fb08122943994c835845543 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/80621 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Eric Lai <ericllai@google.com> Reviewed-by: Hsuan-ting Chen <roccochen@google.com>
* commonlib: Change GCD function to always use 64 bitsJulius Werner2024-02-081-12/+17
| | | | | | | | | | | | | | | | | | | | It seems that we have some applications where we need to calculate a GCD in 64 bits. Now, we could instantiate the algorithm multiple times for different bit width combinations to be able to use the most efficient one for each problem... but considering that the function usually only gets called once per callsite per stage, and that software emulation of 64-bit division on 32-bit systems doesn't take *that* long either, we would probably usually be paying more time loading the second instance of the function than we save with faster divisions. So let's just make things easy and always do it in 64-bit and then nobody has to spend time thinking on which version to call. Change-Id: I028361444c4048a0d76ba4f80c7334a9d9983c87 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/80319 Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yidi Lin <yidilin@google.com>
* tests: Add some more ipchksum() test casesJulius Werner2024-02-021-0/+30
| | | | | | | | | | | | | This patch adds a few more test cases for the IP checksum algorithm to catch more possible corner cases (large data with more than 64K carries, unaligned data, checksum addition with offset, etc.). Change-Id: I39b4d3f1bb833894985649872329eec88a02a22c Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/80252 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Jakub Czapiga <czapiga@google.com>
* lib: Move IP checksum to commonlibJulius Werner2024-02-023-30/+30
| | | | | | | | | | | | | | | | | | | | | | This patch moves the IP checksum algorithm into commonlib to prepare for it being shared with libpayload. The current implementation is ancient and pretty hard to read (and does some unnecessary questionable things like the type-punning stuff which leads to suboptimal code generation), so this reimplements it from scratch (that also helps with the licensing). This algorithm is prepared to take in a pre-calculated "wide" checksum in a machine-register-sized data type which is then narrowed down to 16 bits (see RFC 1071 for why that's valid). This isn't used yet (and the code will get optimized out), but will be used later in this patch series for architecture-specific optimization. Change-Id: Ic04c714c00439a17fc04a8a6e730cc2aa19b8e68 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/80251 Reviewed-by: Yidi Lin <yidilin@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jakub Czapiga <czapiga@google.com>
* malloc/memalign: Return NULL if the request is too largePatrick Georgi2024-01-291-10/+4
| | | | | | | | | | | | | | | | | | | | | It's what this function family is defined to do, we currently don't usually run into the case (see: not too many die() instances going around), it's more useful to try to recover, and the JPEG parser can run into it if the work buffer size exceeds the remaining heap, whereas its sole user (the bootsplash code) knows what to do when seeing a NULL. Use xmalloc() if you want an allocation that either works or dies. tl;dr: That code path isn't usually taken. Right now it crashes. With this patch it _might_ survive. There is a use-case for doing it like that now. Change-Id: I262fbad7daae0ca3aab583fda00665a2592deaa8 Signed-off-by: Patrick Georgi <patrick@coreboot.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/80226 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@gmail.com> Reviewed-by: Eric Lai <ericllai@google.com>
* tests: Rename Makefiles from .inc to .mkMartin Roth2024-01-269-3/+3
| | | | | | | | | | | | | | | | The .inc suffix is confusing to various tools as it's not specific to Makefiles. This means that editors don't recognize the files, and don't open them with highlighting and any other specific editor functionality. This issue is also seen in the release notes generation script where Makefiles get renamed before running cloc. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: Id09eafd293a54198aab87281f529749325df8b07 Reviewed-on: https://review.coreboot.org/c/coreboot/+/80122 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
* Makefiles: Rename top-level Makefiles from .inc to .mkMartin Roth2024-01-241-0/+0
| | | | | | | | | | | | | | | | | | | The .inc suffix is confusing to various tools as it's not specific to Makefiles. This means that editors don't recognize the files, and don't open them with highlighting and any other specific editor functionality. This issue is also seen in the release notes generation script where Makefiles get renamed before running cloc. The rest of the Makefiles will be renamed in following commits. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: Idaf69c6871d0bc1ee5e2e53157b8631c55eb3db9 Reviewed-on: https://review.coreboot.org/c/coreboot/+/80063 Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de> Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* tests: Fix ending newlines in MakefilesMartin Roth2024-01-192-2/+1
| | | | | | | | Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I9440d7a81e2a8b2bed87838fd5b11e71ac744f12 Reviewed-on: https://review.coreboot.org/c/coreboot/+/80064 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
* Revert "tests: Allow specifying vboot source directory"Felix Singer2023-11-161-1/+1
| | | | | | | | | | | | | | This reverts commit 7713a2f295d9ed9a7023a78e085ce190ee1203fe. Reason for revert: breaks main branch Change-Id: I2749bea9369c222e510b838e278c7797d5dce56e Signed-off-by: Felix Singer <felixsinger@posteo.net> Reviewed-on: https://review.coreboot.org/c/coreboot/+/78852 Reviewed-by: Martin L Roth <gaumless@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-by: Patrick Georgi <patrick@coreboot.org>
* tests: Allow specifying vboot source directoryroccochen@chromium.com2023-11-161-1/+1
| | | | | | | | | | | | | | | | Respect VBOOT_SOURCE while including generic headers. BUG=none TEST=make clean-unit-tests && VBOOT_SOURCE=/path/to/vboot_reference/ make unit-tests -j TEST=make clean-unit-tests && make unit-tests -j BRANCH=none Change-Id: Id3bb3726c91167d2dd648d748763a3948787f28d Signed-off-by: roccochen@chromium.com <roccochen@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/78849 Reviewed-by: Yu-Ping Wu <yupingso@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests/lib: Enforce ux_locales-test with CONFIG_VBOOTSubrata Banik2023-11-161-0/+1
| | | | | | | | | | | | | | The ux_locales-test relies on the ability to determine supported locales for the platform. However, this information is unavailable without VBOOT config being enabled. Therefore, enforce this test for platforms with VBOOT config alone to avoid unnecessary failures. Change-Id: I2828eb062e2b601e073e7dab9aef7316fc6ba2cd Signed-off-by: Subrata Banik <subratabanik@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/79056 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Hsuan-ting Chen <roccochen@google.com> Reviewed-by: Julius Werner <jwerner@chromium.org>
* tests/acpigen: Patch to allow moving buffersNico Huber2023-11-131-10/+14
| | | | | | | | | | | | | | | | | | | When a package length needs to be written, we used to always write three bytes for it, even when the length would fit into one or two bytes. To allow such compact package lengths, we have to move the written buffer data in case the length is smaller. This makes tracking the start of nested buffers harder, as they may be moved entirely later when a package length is written. So instead of tracking start addresses in test_acpigen_nested_ifs(), let's work with the generated AML alone. In this lucky case, we can simply search for the `if` operations. Change-Id: Id8557dd5d1be3878713ee0b6106c3e0975665e97 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/79008 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
* Allow to build romstage sources inside the bootblockArthur Heymans2023-11-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Having a separate romstage is only desirable: - with advanced setups like vboot or normal/fallback - boot medium is slow at startup (some ARM SOCs) - bootblock is limited in size (Intel APL 32K) When this is not the case there is no need for the extra complexity that romstage brings. Including the romstage sources inside the bootblock substantially reduces the total code footprint. Often the resulting code is 10-20k smaller. This is controlled via a Kconfig option. TESTED: works on qemu x86, arm and aarch64 with and without VBOOT. Change-Id: Id68390edc1ba228b121cca89b80c64a92553e284 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55068 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
* commonlib: Add GCD functionYidi Lin2023-11-042-0/+31
| | | | | | | | | | | | | | | | Implement a simple GCD function. BUG=b:307790895 TEST=emerge-geralt coreboot TEST=make tests/commonlib/bsd/gcd-test Change-Id: I21819cda4299b3809b8ca7a95cbdc6a87e4b3481 Signed-off-by: Yidi Lin <yidilin@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/78798 Reviewed-by: Martin L Roth <gaumless@gmail.com> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests/lib: Add unit tests for ux_locales_get_text()Hsuan Ting Chen2023-08-302-0/+270
| | | | | | | | | | | | | | | | Add unit tests for ux_locales_get_text() in lib/ux_locales.c. BUG=b:264666392, b:289995591 BRANCH=brya TEST=make tests/lib/ux_locales-test TEST=Make sure ux_locales.c has 100% test coverage Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I4d73419c02478870942828d324c258ef0eaa983c Reviewed-on: https://review.coreboot.org/c/coreboot/+/76253 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com> Reviewed-by: Jakub Czapiga <jacz@semihalf.com>
* drivers/efi: Add EFI variable store option supportPatrick Rudolph2023-04-033-3/+218
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a driver to read and write EFI variables stored in a region device. This is particularly useful for EDK2 as payload and allows to reuse existing EFI tools to set/get options used by the firmware. The write implementation is fault tolerant and doesn't corrupt the variable store. A faulting write might result in using the old value even though a 'newer' had been completely written. Implemented basic unit tests for header corruption, writing existing data and append new data into the store. Initial firmware region state: Initially the variable store region isn't formatted. Usually this is done in the EDK2 payload when no valid firmware volume could be found. It might be useful to do this offline or in coreboot to have a working option store on the first boot or when it was corrupted. Performance improvements: Right now the code always checks if the firmware volume header is valid. This could be optimised by caching the test result in heap. For write operations it would be good to cache the end of the variable store in the heap as well, instead of walking the whole store. For read operations caching the entire store could be considered. Reclaiming memory: The EFI variable store is append write only. To update an existing variable, first a new is written to the end of the store and then the previous is marked invalid. This only works on PNOR flash that allow to clear set bits, but keep cleared bits state. This mechanisms allows a fault tolerant write, but it also requires to "clean" the variable store for time to time. This cleaning would remove variables that have been marked "deleted". Such cleaning mechanism in turn must be fault tolerant and thus must use a second partition in the SPI flash as backup/working region. For now to cleaning is done in coreboot. Fault checking: The driver should check if a previous write was successful and if not mark variables as deleted on the next operation. Tested and working: - Enumerate all existing variables - Read variables - Write variables Change-Id: I8079f71d29da5dc2db956fc68bef1486fe3906bb Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/52564 Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tree: Drop repeated wordsAlexander Goncharov2023-02-071-1/+1
| | | | | | | | | | | | | Found-by: linter Change-Id: I7c6d0887a45fdb4b6de294770a7fdd5545a9479b Signed-off-by: Alexander Goncharov <chat@joursoir.net> Reviewed-on: https://review.coreboot.org/c/coreboot/+/72795 Reviewed-by: Nicholas Chin <nic.c3.14@gmail.com> Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com> Reviewed-by: Erik van den Bogaert <ebogaert@eltan.com> Reviewed-by: Frans Hendriks <fhendriks@eltan.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* spd.h: Move enum ddr3_module_type to ddr3.hElyes Haouas2023-01-041-4/+7
| | | | | | | | | | Move specific enum ddr3_module_type to <device/dram/ddr3.h>. Change-Id: I8fd7892dda26158a5bdd6cd4972c7859a252153e Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/71547 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* spd.h: Move enum ddr2_module_type to ddr2.hElyes Haouas2023-01-041-4/+7
| | | | | | | | | | | Move specific enum ddr2_module_type to <device/dram/ddr2.h>. Change-Id: I748658f9b349bff9b1ebe2c0a6acf71bf2a221ce Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/71546 Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* coreboot_tables: Make existing alignment conventions more explicitJulius Werner2022-12-221-6/+7
| | | | | | | | | | | | | | | | | | There seem to be some recurring vague concerns about the alignment of coreboot table entries. While the existing implementation has been producing tables with a well-defined alignment (4 bytes) for a long time, the code doesn't always make it very clear. This patch adds an explicit constant to codify that alignment, assertions to check it after each entry, and adds explicit padding to the few entry structures that were relying on compiler padding to return a correct sizeof() value. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Iaeef29ef255047a855066469e03b5481812e5975 Reviewed-on: https://review.coreboot.org/c/coreboot/+/70158 Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Jakub Czapiga <jacz@semihalf.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Peter Stuge <peter@stuge.se>
* tests/Makefile.inc: Build utilities in separate directoryJakub Czapiga2022-12-171-0/+2
| | | | | | | | | | | | Utilities like kconfig/conf now will be built inside tests build tree. It will eliminate possible colisions of target names when using test framework in more than one place (see CB:70110) Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: I4c1eb901c921f4ec6ee8985b154362153c5fd0e7 Reviewed-on: https://review.coreboot.org/c/coreboot/+/70359 Reviewed-by: Jan Dabros <jsd@semihalf.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests/Makefile.common: Remove unnecessary dependency to kconfig/confJakub Czapiga2022-12-171-1/+1
| | | | | | | | | | | Utility will be built while executing kconfig targets so it is not necessary to keep hard dependency on kconfig here. Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: I578f3e1d9de63e91ded44746539265bcd55bf579 Reviewed-on: https://review.coreboot.org/c/coreboot/+/70298 Reviewed-by: Jan Dabros <jsd@semihalf.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests/Makefile.common: Allow to override tests defconfigJakub Czapiga2022-12-171-1/+1
| | | | | | | | | | | Some tools based on test framework might require defconfig other than one set in tests framework. Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: If53b9a54ef7389dd979dfe772e6946439f7d6a62 Reviewed-on: https://review.coreboot.org/c/coreboot/+/70109 Reviewed-by: Jan Dabros <jsd@semihalf.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests/Makefile.common: Describe available test attributesJakub Czapiga2022-12-171-0/+7
| | | | | | | | Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: I8ce702b4be254e206e2018deabde985b56cc6cd3 Reviewed-on: https://review.coreboot.org/c/coreboot/+/70475 Reviewed-by: Jan Dabros <jsd@semihalf.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests: Support linking with system libcJakub Czapiga2022-12-172-9/+21
| | | | | | | | | | | | | This patch allows for linking selected files with system libc. This allows for creating libraries interacting with filesystem, standard I/O and other parts of system. Until now it was only possible using CMocka proxy functions or functions not masked by code under test. Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: I652362ba61a25e974d706357fc36479ccee763e4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/70108 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jan Dabros <jsd@semihalf.com>
* tests/Makefile.common: Allow to disable test framework with parameterJakub Czapiga2022-12-141-6/+10
| | | | | | | | | | | | | | Test framework can be used as a base for other test-like utilities - for example look at screenshoot utility in depthcharge. Sometimes CMocka is not required and even makes things problematic. Thanks to this patch one can set -no_test_framework parameter to instruct framework not to include and link selected test against CMocka library. Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: I01dc7c6c50e6ae2f7f71bd6752c2d5f2cc7c3cdc Reviewed-on: https://review.coreboot.org/c/coreboot/+/70107 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jan Dabros <jsd@semihalf.com>
* cbmem_top_chipset: Change the return value to uintptr_tElyes Haouas2022-11-182-4/+4
| | | | | | | | | | Get rid of a lot of casts. Change-Id: I93645ef5dd270905ce421e68e342aff4c331eae6 Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/69078 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jakub Czapiga <jacz@semihalf.com>
* lib/coreboot_table: Simplify API to set up lb_serialArthur Heymans2022-11-041-30/+8
| | | | | | | | | | | | | | | | | Instead of having callbacks into serial console code to set up the coreboot table have the coreboot table code call IP specific code to get serial information. This makes it easier to reuse the information as the return value can be used in a different context (e.g. when filling in a FDT). This also removes boilerplate code to set up lb_console entries by setting entry based on the type in struct lb_uart. Change-Id: I6c08a88fb5fc035eb28d0becf19471c709c8043d Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/68768 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* test/lib: Add non-existent DIMMs test case in spd_cache-testEric Lai2022-11-031-0/+21
| | | | | | | | | | | | | | | Add non-existent DIMMs test case in spd_cache-test. BUG=b:213964936 TEST=make unit-tests PASSED Signed-off-by: Eric Lai <eric_lai@quanta.corp-partner.google.com> Change-Id: I3c8aa92ee0cfd5908399f4bbd305f8f306571d40 Reviewed-on: https://review.coreboot.org/c/coreboot/+/63643 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Tim Wawrzynczak <inforichland@gmail.com> Reviewed-by: Jakub Czapiga <jacz@semihalf.com>
* tests: Add option for debug symbols & no optimizationMartin Roth2022-11-031-1/+8
| | | | | | | | | | | | To make it easier to build the tests with debug symbols, add a check for the "GDB_DEBUG" environment variable. If set, build with -g and -Og to enable the symbols and disable optimization. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I3a644dcccb7e15473413b775da8f70617afaefce Reviewed-on: https://review.coreboot.org/c/coreboot/+/67918 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jakub Czapiga <jacz@semihalf.com>
* coreboot_tables: Drop uart PCI addrArthur Heymans2022-10-261-3/+0
| | | | | | | | | | | | | | | Only edk2 used this to fill in a different struct but even there the entries go unused, so removing this struct element from coreboot has no side effects. Change-Id: Iadd2678c4e01d30471eac43017392d256adda341 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/68767 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Bill XIE <persmule@hardenedlinux.org> Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
* tests: Add support for tests build failures detectionJakub Czapiga2022-09-212-4/+48
| | | | | | | | | | | | This patch introduces new target: junit.xml-unit-tests, which builds and runs unit-tests. It also creates build log containing build logs. This feature allows for one to see build failures in Jenkins dashboard. Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: I94184379dcc2ac10f1a47f4a9d205cacbeb640fe Reviewed-on: https://review.coreboot.org/c/coreboot/+/67372 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests/lib/coreboot_table-test.c: Use ALIGN_UP macroElyes Haouas2022-09-121-2/+1
| | | | | | | | Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: Ie0d4788c0a4ffee2f16bcf05e3454dbaeaa1606b Reviewed-on: https://review.coreboot.org/c/coreboot/+/67518 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jakub Czapiga <jacz@semihalf.com>
* tests: Disable unnecessary warningsJakub Czapiga2022-09-091-0/+2
| | | | | | | | | | | | Unit-tests had more strict warning setings than main build. Sometimes it can cause unit-tests builds to fail even if code compiles correctly when building normal coreboot image. Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: Ia219ccc8631b069436497eb45a1552a0910f7aa1 Reviewed-on: https://review.coreboot.org/c/coreboot/+/67453 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <patrick@coreboot.org>
* tests/commonlib/rational-test: Use test group runner wrapperJakub Czapiga2022-09-071-1/+1
| | | | | | | | | | | | | coreboot unit-tests framework requires tests to use cb_run_group_tests() instead of cmocka_run_group_tests() for Jenkins to work correctly. Wrapper ensures that each test has its own report file and does not overwrite results of other tests. Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: Iead63cab0465f37b2da0c7b3ef256057e3a191a2 Reviewed-on: https://review.coreboot.org/c/coreboot/+/67371 Reviewed-by: Yu-Ping Wu <yupingso@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* allocator_v4: Introduce RESOURCE_ALLOCATION_TOP_DOWNNico Huber2022-09-041-15/+33
| | | | | | | | | | | | | | | | | | Add option to resource allocator v4 that restores the top-down allocation approach at the domain level. This makes it easier to handle 64-bit resources natively. With the top-down approach, resources that can be placed either above or below 4G would be placed above, to save precious space below the 4G boundary. Change-Id: Iaf463d3e6b37d52e46761d8e210034fded58a8a4 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/41957 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com> Reviewed-by: Subrata Banik <subratabanik@google.com>
* cbfs/vboot: Adapt to new vb2_digest APIJulius Werner2022-09-021-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | CL:3825558 changes all vb2_digest and vb2_hash functions to take a new hwcrypto_allowed argument, to potentially let them try to call the vb2ex_hwcrypto API for hash calculation. This change will open hardware crypto acceleration up to all hash calculations in coreboot (most notably CBFS verification). As part of this change, the vb2_digest_buffer() function has been removed, so replace existing instances in coreboot with the newer vb2_hash_calculate() API. Due to the circular dependency of these changes with vboot, this patch also needs to update the vboot submodule: Updating from commit id 18cb85b5: 2load_kernel.c: Expose load kernel as vb2_api to commit id b827ddb9: tests: Ensure auxfw sync runs after EC sync This brings in 15 new commits. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I287d8dac3c49ad7ea3e18a015874ce8d610ec67e Reviewed-on: https://review.coreboot.org/c/coreboot/+/66561 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jakub Czapiga <jacz@semihalf.com>
* tests/memrange-test: Correct final end test in test_memrange_steal()Nico Huber2022-08-261-1/+1
| | | | | | | | | | | | If an inserted region's base wasn't aligned, the resulting range should still cover the original end (original region's base + size) and not the aligned-down base + size. Change-Id: I8f1c9456d6dbab4fa868de5c93fa3656397e54c1 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/66607 Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests/memrange-test: Correct commentary on test_memrange_steal()Nico Huber2022-08-261-4/+4
| | | | | | | | | | | | | | Currently, memranges_steal() steals at the lowest possible address. This is actually reflected by the test code that checks if the *base* of the READONLY_TAG range changes. Furthermore, the test ends with the memranges restored, so revise the comment on the final state. Change-Id: Idef71ce464280c6805145f229de9e8913ba850bc Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/66606 Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Jan Dabros <jsd@semihalf.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests/lib: Do not pick up unassigned resourcesShuo Liu2022-08-131-4/+21
| | | | | | | | | | | | Unassigned tag is defined to emulate an unmapped PCI BAR resource. This resource is not mapped into host physical address and hence should not be picked up by memranges_add_resources(). Change-Id: If7a5c437d486b80d798496b985efd80526f13c63 Signed-off-by: Shuo Liu <shuo.liu@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/66451 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jan Dabros <jsd@semihalf.com>
* tests/lib: Set IORESOURCE_ASSIGNED for bootmem-test and memrange-testShuo Liu2022-08-132-12/+21
| | | | | | | | | | | | | | | | | | | IORESOURCE_ASSIGNED is used to indicate the resource is actually mapped host physical address space. E.g. PCI BAR resources not mapped are not regarded as assigned. In src/include/device/device.h, standard macros, e.g. ram_resource, mmio_resource, io_resource, et al, are all following the usage above. This patch updates the bootmem-test and memrange-test to follow the usage as well. Change-Id: Ifc19302482038267cef01321a46a72d90ca76d35 Signed-off-by: Shuo Liu <shuo.liu@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/66450 Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Jonathan Zhang <jonzhang@fb.com> Reviewed-by: Jan Dabros <jsd@semihalf.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* commonlib: Add support for rational number approximationVinod Polimera2022-08-032-0/+61
| | | | | | | | | | | This patch adds a function to calculate best rational approximation for a given fraction and unit tests for it. Change-Id: I2272d9bb31cde54e65721f95662b80754eee50c2 Signed-off-by: Vinod Polimera <quic_vpolimer@quicinc.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/66010 Reviewed-by: Yu-Ping Wu <yupingso@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests: Adjust the order of header files to includeBill XIE2022-07-141-2/+3
| | | | | | | | | | | Consistent with real build process, it retains more potential to detect the build environment. Signed-off-by: Bill XIE <persmule@hardenedlinux.org> Change-Id: I46f2fe04bf1b8c1ca6476f05555114fa1ef2a96e Reviewed-on: https://review.coreboot.org/c/coreboot/+/65728 Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* lib: Check for non-existent DIMMs in check_if_dimm_changedEric Lai2022-04-201-5/+10
| | | | | | | | | | | | | | | | | | | | Treat dimm addr_map 0 non-existent. addr_map default is 0, we don't set it if Hw is not present. Also change the test case default to avoid 0. SODIMM SMbus address 0x50 to 0x53 is commonly used. BUG=b:213964936 BRANCH=firmware-brya-14505.B TEST=emerge-brya coreboot chromeos-bootimage The MRC training does not be performed again after rebooting. Signed-off-by: Eric Lai <eric_lai@quanta.corp-partner.google.com> Change-Id: I2ada0109eb0805174cb85d4ce373e2a3ab7dbcac Reviewed-on: https://review.coreboot.org/c/coreboot/+/63628 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Frank Wu <frank_wu@compal.corp-partner.google.com> Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com> Reviewed-by: Subrata Banik <subratabanik@google.com> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* tests: Split Makefile to allow for making host-side test toolsJakub Czapiga2022-04-192-161/+170
| | | | | | | | | | | | | | | | | | This patch is based on similar changes [1] done in Depthcharge projects, which aimed to provide unified way to build host-side programs for testing internal code. New test tools might benefit from it by having same base code as unit-tests. [1] https://crrev.com/c/3412108 TEST=make unit-tests TEST=COV=1 make unit-tests coverage-report Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: Iac4517ab6146fa3f2d2b7a20df54601ab2d04c3d Reviewed-on: https://review.coreboot.org/c/coreboot/+/63637 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
* tests: update CMocka to stable-1.1Jakub Czapiga2022-04-191-1/+1
| | | | | | | | | | | | CMocka stable-1.1 has some convenience bugfixes like vprint buffer increase or leftover values log fix (funtion names display correctly now. Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: I20ebd15324a21c17cccd2976ae9c3f86b040426d Reviewed-on: https://review.coreboot.org/c/coreboot/+/63636 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
* coreboot_tables: Replace 'struct lb_uint64' with lb_uint64_tJianjun Wang2022-04-142-12/+12
| | | | | | | | | | | | | | | Replace 'struct lb_uint64' with 'typedef __aligned(4) uint64_t lb_uint64_t', and remove unpack_lb64/pack_lb64 functions since it's no longer needed. Also replace 'struct cbuint64' with 'cb_uint64_t' and remove 'cb_unpack64' in libpayload for compatible with lb_uint64_t. Signed-off-by: Jianjun Wang <jianjun.wang@mediatek.com> Change-Id: If6b037e4403a8000625f4a5fb8d20311fe76200a Reviewed-on: https://review.coreboot.org/c/coreboot/+/63494 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* tests/lib: Add space before single line comment terminationPaul Menzel2022-03-272-2/+2
| | | | | | | | Change-Id: I9321391cc06afddff94fbba79f93851b553c74b1 Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/62935 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jakub Czapiga <jacz@semihalf.com>
* coreboot_tables.c: Expose the ACPI RSDPArthur Heymans2022-03-091-0/+12
| | | | | | | | | | | | | | | | | | | | | The ACPI RSDP can only be found in: - legacy BIOS region - via UEFI service On some systems like ARM that legacy BIOS region is not an option, so to avoid needing UEFI it makes sense to expose the RSDP via a coreboot table entry. This also adds the respective unit test. Change-Id: I591312a2c48f0cbbb03b2787e4b365e9c932afff Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/62573 Reviewed-by: Lance Zhao Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>