mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-28 23:43:42 +02:00

The current implementation tests a particular path of the init procedure. There are two ways for it to succeed: reading the buffer size from sysfs and the fallback to getpagesize(). This test does the latter (fallback to getpagesize). Extract from meson-logs/testlog.txt for new test: [ RUN ] linux_spi_init_and_shutdown_test_success Testing programmer_init for programmer=25 ... __wrap_open64 is called __wrap_ioctl is called __wrap_ioctl is called __wrap_ioctl is called __wrap_fopen64 is called ... programmer_init for programmer=25 successful Testing programmer_shutdown for programmer=25 ... ... programmer_shutdown for programmer=25 successful [ OK ] linux_spi_init_and_shutdown_test_success BUG=b:181803212 TEST=builds and ninja test Change-Id: I4911fbb6f04371283f0e62d2196bdd691a227584 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/52498 Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
54 lines
1.4 KiB
Meson
54 lines
1.4 KiB
Meson
# This file is part of the flashrom project.
|
|
#
|
|
# Copyright 2020 Google LLC
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; version 2 of the License.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
|
|
root_includes = include_directories('../subprojects')
|
|
|
|
srcs = [
|
|
'tests.c',
|
|
'helpers.c',
|
|
'flashrom.c',
|
|
'spi25.c',
|
|
'init_shutdown.c',
|
|
]
|
|
|
|
mocks = [
|
|
'-Wl,--wrap=physunmap',
|
|
'-Wl,--wrap=physmap',
|
|
'-Wl,--wrap=spi_send_command',
|
|
'-Wl,--wrap=sio_write',
|
|
'-Wl,--wrap=sio_read',
|
|
'-Wl,--wrap=open',
|
|
'-Wl,--wrap=open64',
|
|
'-Wl,--wrap=ioctl',
|
|
'-Wl,--wrap=fopen',
|
|
'-Wl,--wrap=fopen64',
|
|
'-Wl,--gc-sections',
|
|
]
|
|
|
|
flashrom_tests = executable('flashrom_unit_tests',
|
|
srcs,
|
|
include_directories : root_includes,
|
|
c_args : [
|
|
cargs,
|
|
'-ffunction-sections',
|
|
'-fdata-sections',
|
|
# '-DSTANDALONE',
|
|
'-DCONFIG_DEFAULT_PROGRAMMER=PROGRAMMER_DUMMY',
|
|
'-DCONFIG_DEFAULT_PROGRAMMER_ARGS=""',
|
|
],
|
|
export_dynamic : true,
|
|
link_args : mocks,
|
|
dependencies : [cmocka_dep, flashrom_test_dep],
|
|
)
|
|
test('cmocka test flashrom', flashrom_tests)
|