Skip to content

Fix broken user_settings.h flip in windows-check workflow#1030

Draft
yosuke-wolfssl wants to merge 3 commits into
wolfSSL:masterfrom
yosuke-wolfssl:fix/winLog
Draft

Fix broken user_settings.h flip in windows-check workflow#1030
yosuke-wolfssl wants to merge 3 commits into
wolfSSL:masterfrom
yosuke-wolfssl:fix/winLog

Conversation

@yosuke-wolfssl

@yosuke-wolfssl yosuke-wolfssl commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Repairs Windows CI coverage that was silently broken, plus the two latent
test issues that surfaced once it started working. Three commits:

  1. .github/workflows/windows-check.yml — fix the broken user_settings.h
    feature flip in both the build and asan-tests jobs.
  2. tests/api.c — initialize Winsock in api-test.
  3. tests/api.c — exclude the threaded echoserver tests from api-test on
    Windows.

Commits 2 and 3 are fallout the flip fix exposed: with the features finally
compiled in, api-test ran code on Windows CI that had never run there before.

1. Fix the broken user_settings.h flip

The old step

get-content $f | %{$_ -replace "if 0","if 1"}

pipes the modified text to the console and never writes the file back (no
Set-Content/Out-File). Both #if 0 blocks in ide/winvs/user_settings.h
(X509 and SSHD) therefore stayed off, so the Windows build silently compiled the
library and app without WOLFSSH_SSHD, WOLFSSH_CERTS, WOLFSSH_SFTP, or
X509 — while staying green. The job stopped covering every feature it was named
for.

Replaced with the write-in-place pattern already proven in windows-sftp.yml:

    - name: Update user_settings.h for sshd and x509
      working-directory: ${{env.GITHUB_WORKSPACE}}
      shell: bash
      run: |
        sed -i 's/#if 0/#if 1/g' ${{env.USER_SETTINGS_H_NEW}}
        cp ${{env.USER_SETTINGS_H_NEW}} ${{env.USER_SETTINGS_H}}

ide/winvs/user_settings.h has exactly two #if 0 blocks and nothing else uses
#if 0, so the anchored substitution flips precisely the two intended blocks.
The asan-tests job (added to master after this branch first forked) carried
an identical broken get-content flip, so the same fix is applied there.

2. Initialize Winsock in api-test

With the flip repaired, api-test compiled in the SCP/SFTP rekey tests for the
first time. The first one aborted at setup:

wolfSSH error: no entry for host
api-test failed under ASAN (exit 1)

These tests resolve the loopback address via gethostbyname() in
build_addr(). On Windows gethostbyname() returns NULL until WSAStartup()
has run, and api-test's entry point called wolfSSH_Init() without first
calling WSTARTTCP() (unlike testsuite.c and kex.c). Added WSTARTTCP()
before wolfSSH_Init(). The macro is empty off Windows.

3. Exclude threaded echoserver tests on Windows

Past the Winsock fix, the SCP rekey test then failed with ctx => NULL at the
post-connect assertion. The threaded echoserver tests synchronize with the
server via SignalTcpReady/WaitTcpReady, which are POSIX-only and compile to
no-ops on MSVC (no _POSIX_THREADS). Without the readiness handshake the server
never reports its port and the client connects before the listener is up, so the
client context comes back NULL.

The block guards already excluded SINGLE_THREADED and WOLFSSH_ZEPHYR — the
other cases where these primitives are no-ops — but omitted USE_WINDOWS_API,
an inconsistency that was harmless only because api-test never ran on Windows
CI. Added !defined(USE_WINDOWS_API) to both block guards so the tests compile
to their existing stubs on Windows, matching the guard the same functions
already use on their networked subsections.

Testing

  • grep -rn "get-content" .github/workflows/ returns nothing — no broken flips
    remain.
  • Windows build and asan-tests jobs green.

@yosuke-wolfssl yosuke-wolfssl self-assigned this Jun 15, 2026
Copilot AI review requested due to automatic review settings June 15, 2026 07:48
@yosuke-wolfssl yosuke-wolfssl marked this pull request as draft June 15, 2026 07:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the Windows CI (windows-check) build configuration so that ide/winvs/user_settings.h is actually modified in-place (enabling the #if 0 blocks for X509 + SSHD) before being copied into the wolfSSL build tree, restoring expected wolfsshd logging behavior in Release builds.

Changes:

  • Replace the ineffective PowerShell “replace” pipeline (stdout-only) with an in-place sed -i edit.
  • Reorder the operation so the flipped user_settings.h is then copied into wolfssl/IDE/WIN/user_settings.h.
  • Standardize the step to the same bash/sed approach already used successfully in windows-sftp.yml.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yosuke-wolfssl yosuke-wolfssl marked this pull request as ready for review June 23, 2026 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants