Nikolai Artemiev | 702c58a | 2020-09-16 14:12:22 +1000 | [diff] [blame] | 1 | # 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'Callaghan | 46f2d4e | 2020-05-20 20:10:20 +1000 | [diff] [blame] | 14 | root_includes = include_directories('../subprojects') |
| 15 | |
| 16 | srcs = [ |
| 17 | 'tests.c', |
Edward O'Callaghan | 3cc70c2 | 2020-05-22 18:42:11 +1000 | [diff] [blame] | 18 | 'helpers.c', |
Edward O'Callaghan | 629b8f0 | 2020-05-22 16:46:52 +1000 | [diff] [blame] | 19 | 'flashrom.c', |
Edward O'Callaghan | 41f48c7 | 2020-05-22 16:46:26 +1000 | [diff] [blame] | 20 | 'spi25.c', |
Anastasia Klimchuk | cffaac1 | 2021-04-21 07:58:30 +1000 | [diff] [blame] | 21 | 'init_shutdown.c', |
Edward O'Callaghan | 46f2d4e | 2020-05-20 20:10:20 +1000 | [diff] [blame] | 22 | ] |
| 23 | |
| 24 | mocks = [ |
| 25 | '-Wl,--wrap=physunmap', |
| 26 | '-Wl,--wrap=physmap', |
Edward O'Callaghan | 41f48c7 | 2020-05-22 16:46:26 +1000 | [diff] [blame] | 27 | '-Wl,--wrap=spi_send_command', |
Anastasia Klimchuk | 98534e7 | 2021-04-23 15:47:03 +1000 | [diff] [blame] | 28 | '-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'Callaghan | 46f2d4e | 2020-05-20 20:10:20 +1000 | [diff] [blame] | 35 | '-Wl,--gc-sections', |
| 36 | ] |
| 37 | |
| 38 | flashrom_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 | ) |
| 53 | test('cmocka test flashrom', flashrom_tests) |