Project

General

Profile

Actions

Bug #602

open

Flashrom tests fail to build on UCRT64 on latest MSYS2 packages

Added by Antonio Vázquez Blanco 29 days ago. Updated about 13 hours ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
07/18/2025
Due date:
% Done:

0%

Estimated time:
Affected versions:
Needs backport to:
Affected hardware:
Affected OS:

Description

Compiler error:

../tests/spidriver.c: In function 'spidriver_probe_lifecycle_test_success':
../tests/spidriver.c:206:37: error: 'O_NOCTTY' undeclared (first use in this function); did you mean 'ENOTTY'?
  206 |                 .flags = { O_RDWR | O_NOCTTY | O_NDELAY },
      |                                     ^~~~~~~~
      |                                     ENOTTY
../tests/spidriver.c:206:37: note: each undeclared identifier is reported only once for each function it appears in
../tests/spidriver.c:206:48: error: 'O_NDELAY' undeclared (first use in this function)
  206 |                 .flags = { O_RDWR | O_NOCTTY | O_NDELAY },
      |          

Adding fnctl.h does not seem to solve the issue. Maybe those defs are not available under Windows?

Also, would it be desirable to add this platform to testing?

Thanks in advance!

Actions #1

Updated by Anastasia Klimchuk about 13 hours ago

  • Related links updated (diff)
Actions #2

Updated by Anastasia Klimchuk about 13 hours ago

  • Related links updated (diff)

Antonio, thank you so much for reporting this, I really appreciate your effort!

In general, windows is a niche use-case, it's not used/tested often - so the issues can slip in. It is very valuable that you looked into this.

I looked into this issue. The programmer belongs to group_serial and systems_serial and those defined as being supported on windows.

This issue is with the test though. The test defines the flags to mock the open command, very specifically test needs to mock this call (line 297 in current source of serial.c https://github.com/flashrom/flashrom/blob/main/serial.c#L297)
However this line is never expected to run on windows. Above currently in the line 269 is the conditional #if IS_WINDOWS and the line 297 is on the #else branch.

flashrom code is low level and lots of that is platform-specific, and so are the tests. So for the spidriver programmer the current test is a very good one, but it's written for non-windows. If in theory someone writes a spidriver test for windows, that would be a different test, as it needs to mock different sys/library calls.

The immediate fix I think is to add the condition if not windows to the test and have a SKIP_TEST otherwise. Currently test has only condition of #if CONFIG_SPIDRIVER == 1
This should hopefully make the tests build on windows, and then you can see how many tests are running? It would be great to have at least some tests running on windows, there are few platform-independent tests like layout logic test or erase/write logic tests, or chip operations tests, these ones should be fine?

Would you be fine to try to add the condition to this test and see if it works? Thank you!

Actions

Also available in: Atom PDF