blob: b087f2ce24b2f31b40eabd4e7dc20dd4b5c5d121 [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',
Edward O'Callaghan46f2d4e2020-05-20 20:10:20 +100035 '-Wl,--gc-sections',
36]
37
38flashrom_tests = executable('flashrom_unit_tests',
39 srcs,
40 include_directories : root_includes,
41 c_args : [
42 cargs,
43 '-ffunction-sections',
44 '-fdata-sections',
45 # '-DSTANDALONE',
46 '-DCONFIG_DEFAULT_PROGRAMMER=PROGRAMMER_DUMMY',
47 '-DCONFIG_DEFAULT_PROGRAMMER_ARGS=""',
48 ],
49 export_dynamic : true,
50 link_args : mocks,
51 dependencies : [cmocka_dep, flashrom_test_dep],
52)
53test('cmocka test flashrom', flashrom_tests)