Skip to content

Conversation

ensh63
Copy link
Contributor

@ensh63 ensh63 commented Aug 25, 2025

Proposed changes

Some unit tests may use C functions from nginx. To support this scenario, special static library is built. Necessary linker flags are also added. Since these changes are needed for specific unit tests only, new feature "unittest" is defined in nginx-sys and nginx-src crates.

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have written my commit messages in the Conventional Commits format.
  • I have read the CONTRIBUTING doc
  • I have added tests (when possible) that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

Some unit tests may use C functions from nginx. To support this
scenario, special static library is built. Necessary linker flags are also
added. Since these changes are needed for specific unit tests only,
new feature "unittest" is defined.
@ensh63 ensh63 force-pushed the shirykalov/libnginx branch from ecb0d92 to 05a67cb Compare August 25, 2025 21:18
@ensh63 ensh63 requested a review from Copilot August 25, 2025 22:07
Copy link

@Copilot Copilot AI left a comment

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 adds support for linking unit tests with nginx library by introducing a new "unittest" feature flag and building a static nginx library. The changes enable unit tests to use C functions from nginx by creating a special static library (libnginx) and adding necessary linker flags when the unittest feature is enabled.

  • Introduces a new "unittest" feature flag for nginx-sys and nginx-src crates
  • Creates a libnginx module with helper functions for nginx initialization in tests
  • Adds build configuration to generate static nginx library and parse linker flags

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/core/pool.rs Adds comprehensive unit tests for Pool functionality using nginx C functions
nginx-sys/build/main.rs Extends makefile parsing to extract library flags and adds unittest feature support
nginx-sys/Cargo.toml Defines unittest feature dependency on vendored nginx-src
nginx-src/src/lib.rs Configures nginx build to include libnginx module when unittest feature is enabled
nginx-src/libnginx/ New module providing C wrapper functions for nginx initialization in tests
Cargo.toml Adds nginx-sys with unittest feature as dev dependency

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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