Skip to content

Fix tests on windows-latest by compiling and bundling native DLL#8

Closed
s-a wants to merge 5 commits intojonatas:mainfrom
s-a:fix/windows-latest-test-failure
Closed

Fix tests on windows-latest by compiling and bundling native DLL#8
s-a wants to merge 5 commits intojonatas:mainfrom
s-a:fix/windows-latest-test-failure

Conversation

@s-a
Copy link

@s-a s-a commented Jul 8, 2025

This ensures the libpgquery_wrapper.dll is correctly built and included in the test runtime, allowing .NET P/Invoke to succeed during test execution on Windows CI runners.

@s-a s-a force-pushed the fix/windows-latest-test-failure branch from 711b48a to 4f8bdc4 Compare July 8, 2025 15:45
This ensures the libpgquery_wrapper.dll is correctly built and included in the test runtime, allowing .NET P/Invoke to succeed during test execution on Windows CI runners.
@s-a s-a force-pushed the fix/windows-latest-test-failure branch from 4f8bdc4 to b9b46b1 Compare July 8, 2025 16:04
s-a added 3 commits July 8, 2025 18:15
This commit fixes a critical runtime exception that caused the application
to crash immediately upon startup (`Abort trap: 6` in the build logs).

Problem:
The application was throwing a `System.InvalidOperationException` from the
CommandLineParser library with the message: "Type GrepSQL.Options appears
to be immutable, but no constructor found to accept values."

Cause:
The `Options` class had duplicated properties for handling both positional
and named arguments (e.g., `PositionalPattern` and `Pattern`). This
structure confused the parser, leading it to incorrectly infer an
immutable type and fail during object construction.

Solution:
- The duplicated properties in the `Options` class have been consolidated
  into single properties (e.g., just `Pattern` and `Files`).
- Both `[Value]` (for positional) and `[Option]` (for named) attributes
  are now applied to the same, consolidated property.
- The logic in `RunGrepSql` has been updated to use these simplified
  properties.

This change makes the `Options` class unambiguous for the parser,
resolving the crash and making the argument handling more robust and clean.
The build script previously continued after the `nmake` command failed,
leading to a confusing "file not found" error later.

This change adds explicit exit code checks after each `nmake` call to
expose the root C++ compiler/linker error immediately.
The default `nmake` target for `libpg_query` builds the static library
and runs tests, but does not produce the required `pg_query.dll`.

This commit changes the build command to `nmake /F Makefile.msvc dll`
to specifically instruct the build system to create the dynamic link
library needed for the .NET application. This resolves the
"Build artifact pg_query.dll not found" error.
@s-a s-a force-pushed the fix/windows-latest-test-failure branch from cd2f1b0 to e85cd48 Compare July 8, 2025 16:43
This commit resolves a `System.DllNotFoundException` for `libdl.so` that
was causing all tests to fail on the Linux platform.

The .NET runtime on the GitHub `ubuntu-latest` runner was unable to locate
the dynamic linking library `libdl.so` in its standard search paths, even
though it is present on the system via the `libc6-dev` package.

This fix adds a command to the "Install Linux dependencies" step to create
a symbolic link from the actual library location to a path where the .NET
runtime can find it. This unblocks the native library loader and allows
the tests to run successfully.
@s-a s-a force-pushed the fix/windows-latest-test-failure branch from e85cd48 to 6b18172 Compare July 8, 2025 16:59
@s-a s-a closed this Jul 8, 2025
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.

1 participant