UPSTREAM: tests: Add unit test to run init/shutdown for linux_spi.c

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
BRANCH=none

Original-Change-Id: I4911fbb6f04371283f0e62d2196bdd691a227584
Original-Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/52498
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
(cherry picked from commit 98534e717bc457ea41a3bdf6e1d677fb0c1f63ca)

Cq-Depend: chromium:2879373
Change-Id: I9d1f0634561212f3bb9a95e9f054742046016f62
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/flashrom/+/2879384
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
Tested-by: Edward O'Callaghan <quasisec@chromium.org>
Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
4 files changed
tree: cce5a44c96699d7d6726c072552a4963ff46bfa9
  1. Documentation/
  2. subprojects/
  3. tests/
  4. util/
  5. .gitattributes
  6. .gitignore
  7. 82802ab.c
  8. action_descriptor.c
  9. action_descriptor.h
  10. amd_imc.c
  11. archtest.c
  12. at45db.c
  13. atahpt.c
  14. atapromise.c
  15. atavia.c
  16. big_lock.c
  17. big_lock.h
  18. bitbang_spi.c
  19. board_enable.c
  20. buspirate_spi.c
  21. cbtable.c
  22. ch341a_spi.c
  23. chipdrivers.h
  24. chipset_enable.c
  25. cli_classic.c
  26. cli_common.c
  27. cli_output.c
  28. COPYING
  29. coreboot_tables.h
  30. cros_alias.c
  31. cros_ec.c
  32. cros_ec.h
  33. cros_ec_commands.h
  34. cros_ec_dev.c
  35. custom_baud.c
  36. custom_baud.h
  37. dediprog.c
  38. developerbox_spi.c
  39. digilent_spi.c
  40. dmi.c
  41. drkaiser.c
  42. dummyflasher.c
  43. edi.c
  44. edi.h
  45. en29lv640b.c
  46. endiantest.c
  47. ene.h
  48. ene_lpc.c
  49. file.c
  50. file.h
  51. file_lock.c
  52. flash.h
  53. flashchips.c
  54. flashchips.h
  55. flashrom.8.tmpl
  56. flashrom.c
  57. fmap.c
  58. fmap.h
  59. ft2232_spi.c
  60. gfxnvidia.c
  61. helpers.c
  62. hwaccess.c
  63. hwaccess.h
  64. hwaccess_x86_io.h
  65. i2c_helper.h
  66. i2c_helper_linux.c
  67. ich_descriptors.c
  68. ich_descriptors.h
  69. ichspi.c
  70. internal.c
  71. ipc_lock.h
  72. it8212.c
  73. it85spi.c
  74. it87spi.c
  75. jedec.c
  76. jlink_spi.c
  77. layout.c
  78. layout.h
  79. libflashrom.c
  80. libflashrom.h
  81. libflashrom.map
  82. linux_mtd.c
  83. linux_spi.c
  84. lspcon_i2c_spi.c
  85. Makefile
  86. mcp6x_spi.c
  87. mec1308.c
  88. meson.build
  89. meson_options.txt
  90. mstarddc_spi.c
  91. ni845x_spi.c
  92. nic3com.c
  93. nicintel.c
  94. nicintel_eeprom.c
  95. nicintel_spi.c
  96. nicnatsemi.c
  97. nicrealtek.c
  98. ogp_spi.c
  99. opaque.c
  100. os.h
  101. OWNERS
  102. pcidev.c
  103. physmap.c
  104. pickit2_spi.c
  105. platform.h
  106. pony_spi.c
  107. power.c
  108. power.h
  109. PRESUBMIT.cfg
  110. print.c
  111. print_wiki.c
  112. processor_enable.c
  113. programmer.c
  114. programmer.h
  115. raiden_debug_spi.c
  116. rayer_spi.c
  117. README
  118. README.chromiumos
  119. realtek_mst_i2c_spi.c
  120. s25f.c
  121. satamv.c
  122. satasii.c
  123. sb600spi.c
  124. serial.c
  125. serprog.c
  126. serprog.h
  127. sfdp.c
  128. spi.c
  129. spi.h
  130. spi25.c
  131. spi25_statusreg.c
  132. spi95.c
  133. sst28sf040.c
  134. sst49lfxxxc.c
  135. sst_fwhub.c
  136. stlinkv3_spi.c
  137. stm50.c
  138. udelay.c
  139. unittest_env.h
  140. usb_device.c
  141. usb_device.h
  142. usbblaster_spi.c
  143. usbdev.c
  144. w29ee011.c
  145. w39.c
  146. wbsio_spi.c
  147. writeprotect.c
  148. writeprotect.h