blob: 852fd4c1848e6769cb73b453b4a98af93b701b7f [file] [log] [blame]
Nikolai Artemiev702c58a2020-09-16 14:12:22 +10001# This file is part of the flashrom project.
2#
3# Copyright 2020 Google LLC
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; version 2 of the License.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13
Edward O'Callaghan46f2d4e2020-05-20 20:10:20 +100014root_includes = include_directories('../subprojects')
15
16srcs = [
17 'tests.c',
Edward O'Callaghan3cc70c22020-05-22 18:42:11 +100018 'helpers.c',
Edward O'Callaghan629b8f02020-05-22 16:46:52 +100019 'flashrom.c',
Edward O'Callaghan41f48c72020-05-22 16:46:26 +100020 'spi25.c',
Anastasia Klimchukcffaac12021-04-21 07:58:30 +100021 'init_shutdown.c',
Edward O'Callaghan46f2d4e2020-05-20 20:10:20 +100022]
23
24mocks = [
25 '-Wl,--wrap=physunmap',
26 '-Wl,--wrap=physmap',
Edward O'Callaghan41f48c72020-05-22 16:46:26 +100027 '-Wl,--wrap=spi_send_command',
Anastasia Klimchuk98534e72021-04-23 15:47:03 +100028 '-Wl,--wrap=sio_write',
29 '-Wl,--wrap=sio_read',
30 '-Wl,--wrap=open',
31 '-Wl,--wrap=open64',
32 '-Wl,--wrap=ioctl',
33 '-Wl,--wrap=fopen',
34 '-Wl,--wrap=fopen64',
Anastasia Klimchuk21e22ba2021-05-10 10:19:25 +100035 '-Wl,--wrap=rget_io_perms',
36 '-Wl,--wrap=test_outb',
37 '-Wl,--wrap=test_inb',
38 '-Wl,--wrap=test_outw',
39 '-Wl,--wrap=test_inw',
40 '-Wl,--wrap=test_outl',
41 '-Wl,--wrap=test_inl',
Edward O'Callaghan46f2d4e2020-05-20 20:10:20 +100042 '-Wl,--gc-sections',
43]
44
45flashrom_tests = executable('flashrom_unit_tests',
46 srcs,
47 include_directories : root_includes,
48 c_args : [
49 cargs,
50 '-ffunction-sections',
51 '-fdata-sections',
52 # '-DSTANDALONE',
Edward O'Callaghan46f2d4e2020-05-20 20:10:20 +100053 ],
54 export_dynamic : true,
55 link_args : mocks,
56 dependencies : [cmocka_dep, flashrom_test_dep],
57)
58test('cmocka test flashrom', flashrom_tests)