UPSTREAM: tests: Use MOCK_FD instead of NON_ZERO for file operations

NON_ZERO can be a negative number, so MOCK_FD is safer option to
use as a mock file descriptor. Also it is more readable.

BUG=b:237606255
TEST=ninja test (on linux)

(cherry picked from commit 73c0a1d8785f846bb2586a96a3f0a4808456791d)

Original-Change-Id: I097dd59f69c3fb532ac136796fcf5cae8839af7b
Original-TICKET: https://ticket.coreboot.org/issues/411
Original-Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/67310
Original-Reviewed-by: Felix Singer <felixsinger@posteo.net>
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Original-Reviewed-by: Alexander Goncharov <chat@joursoir.net>
Original-Reviewed-by: Thomas Heijligen <src@posteo.de>
Original-Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
GitOrigin-RevId: 73c0a1d8785f846bb2586a96a3f0a4808456791d
Change-Id: I3dc0e6159f0d05a53f29f2a009cac569cbe16cbb
Signed-off-by: CopyBot <copybot.service@gmail.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/flashrom/+/3891142
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Sean Paul <sean@poorly.run>
1 file changed
tree: 63a9c2d6b58de0c551ce15d60c9375592bc0cbc5
  1. .github/
  2. bindings/
  3. Documentation/
  4. include/
  5. Makefile.d/
  6. platform/
  7. subprojects/
  8. tests/
  9. util/
  10. .gitattributes
  11. .gitignore
  12. 82802ab.c
  13. action_descriptor.c
  14. action_descriptor.h
  15. amd_imc.c
  16. at45db.c
  17. atahpt.c
  18. atapromise.c
  19. atavia.c
  20. big_lock.c
  21. big_lock.h
  22. bitbang_spi.c
  23. board_enable.c
  24. buspirate_spi.c
  25. cbtable.c
  26. ch341a_spi.c
  27. chipset_enable.c
  28. cli_classic.c
  29. cli_common.c
  30. cli_output.c
  31. COPYING
  32. cros_alias.c
  33. cros_ec.c
  34. cros_ec.h
  35. cros_ec_commands.h
  36. cros_ec_dev.c
  37. cros_ec_wp.c
  38. custom_baud.c
  39. custom_baud_linux.c
  40. dediprog.c
  41. developerbox_spi.c
  42. digilent_spi.c
  43. DIR_METADATA
  44. dmi.c
  45. Doxyfile
  46. drkaiser.c
  47. dummyflasher.c
  48. edi.c
  49. en29lv640b.c
  50. file_lock.c
  51. flashchips.c
  52. flashchips_crosbl.c
  53. flashrom.8.tmpl
  54. flashrom.c
  55. fmap.c
  56. ft2232_spi.c
  57. gfxnvidia.c
  58. helpers.c
  59. helpers_fileio.c
  60. hwaccess_physmap.c
  61. hwaccess_x86_io.c
  62. hwaccess_x86_msr.c
  63. i2c_helper_linux.c
  64. ich_descriptors.c
  65. ichspi.c
  66. internal.c
  67. ipc_lock.h
  68. it8212.c
  69. it87spi.c
  70. jedec.c
  71. jlink_spi.c
  72. layout.c
  73. libflashrom.c
  74. libflashrom.map
  75. linux_mtd.c
  76. linux_spi.c
  77. MAINTAINERS
  78. Makefile
  79. Makefile.include
  80. mcp6x_spi.c
  81. mediatek_i2c_spi.c
  82. meson.build
  83. meson_options.txt
  84. mstarddc_spi.c
  85. ni845x_spi.c
  86. nic3com.c
  87. nicintel.c
  88. nicintel_eeprom.c
  89. nicintel_spi.c
  90. nicnatsemi.c
  91. nicrealtek.c
  92. ogp_spi.c
  93. opaque.c
  94. opaque_statusreg.c
  95. OWNERS
  96. parade_lspcon.c
  97. parallel.c
  98. pcidev.c
  99. pickit2_spi.c
  100. pony_spi.c
  101. power.c
  102. power.h
  103. PRESUBMIT.cfg
  104. print.c
  105. print_wiki.c
  106. processor_enable.c
  107. programmer.c
  108. programmer_table.c
  109. raiden_debug_spi.c
  110. rayer_spi.c
  111. README
  112. README.chromiumos
  113. realtek_mst_i2c_spi.c
  114. s25f.c
  115. satamv.c
  116. satasii.c
  117. sb600spi.c
  118. serial.c
  119. serprog.c
  120. sfdp.c
  121. spi.c
  122. spi25.c
  123. spi25_statusreg.c
  124. spi95.c
  125. sst28sf040.c
  126. sst49lfxxxc.c
  127. sst_fwhub.c
  128. stlinkv3_spi.c
  129. stm50.c
  130. udelay.c
  131. unblocked_terms.txt
  132. usb_device.c
  133. usbblaster_spi.c
  134. usbdev.c
  135. w29ee011.c
  136. w39.c
  137. wbsio_spi.c
  138. writeprotect.c
  139. writeprotect_ranges.c