Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restinio: fix build #375955

Merged
merged 2 commits into from
Feb 2, 2025
Merged

restinio: fix build #375955

merged 2 commits into from
Feb 2, 2025

Conversation

xokdvium
Copy link
Contributor

@xokdvium xokdvium commented Jan 22, 2025

Test builds fail with cmake configuration error:

string sub-command JSON failed parsing json string: * Line 1, Column 1

This is a silly regression from catch2_3 3.7.1 -> 3.8.0 bump 1.
Looks like the upstream doesn't hold catch2 correctly and overrides main
for this test so catch2 test discovery machinery can't work.

Upstream issue 2.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@tobim
Copy link
Contributor

tobim commented Jan 23, 2025

Could you open an issue for the catch2 regression and point to that?

@xokdvium
Copy link
Contributor Author

xokdvium commented Feb 2, 2025

On second thought, this isn't a catch2 problem at all, but rather a restinio tests bug. Since test.metaprogramming defines a custom main there's no way it can output the necessary info for the automatic test discovery. Previously it just happened to work because empty output was treated as an empty list of tests.

Comment on lines 37 to 38
substituteInPlace dev/test/CMakeLists.txt --replace-fail \
"add_subdirectory(metaprogramming)" ""
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
substituteInPlace dev/test/CMakeLists.txt --replace-fail \
"add_subdirectory(metaprogramming)" ""
substituteInPlace dev/test/CMakeLists.txt \
--replace-fail "add_subdirectory(metaprogramming)" ""

nit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Applied the suggestion. For future reference: is this a formatting convention I'm unaware of?

I guess it's useful to make diffs cleaner and reduce merge conflicts in case more substitutions are added.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it's useful to make diffs cleaner and reduce merge conflicts in case more substitutions are added.

Yes, that's the motive for this one.

@tobim
Copy link
Contributor

tobim commented Feb 2, 2025

On second thought, this isn't a catch2 problem at all, but rather a restinio tests bug. Since test.metaprogramming defines a custom main there's no way it can output the necessary info for the automatic test discovery. Previously it just happened to work because empty output was treated as an empty list of tests.

I feel like catch2 not allowing this any more is still a regression. That said, restinio should probably reorganize their test directory structure to make it clear that not all tests are implemented with the catch2 framework.

@GaetanLepage
Copy link
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 375955


x86_64-linux

✅ 2 packages built:
  • jami
  • restinio

aarch64-linux

✅ 2 packages built:
  • jami
  • restinio

x86_64-darwin

❌ 1 package failed to build:
  • restinio

aarch64-darwin

❌ 1 package failed to build:
  • restinio

@GaetanLepage
Copy link
Contributor

Maybe try adding __darwinAllowLocalNetworking = true;.

Test builds fail with cmake configuration error:
> string sub-command JSON failed parsing json string: * Line 1, Column 1

This is a silly regression from catch2_3 3.7.1 -> 3.8.0 bump [1].
Looks like the upstream doesn't hold catch2 correctly and overrides `main`
for this test so catch2 test discovery machinery can't work.

Upstream issue [2].

[1]: https://www.github.com/NixOS/nixpkgs/pull/371311
[2]: https://www.github.com/Stiffstream/restinio/issues/230
@xokdvium
Copy link
Contributor Author

xokdvium commented Feb 2, 2025

Yup, seems like I forgot my own suggestion #368300 (review). __darwinAllowLocalNetworking = true; helps, but some tests still fail with not enough permissions, but the amount seems manageable.

@GaetanLepage
Copy link
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 375955


x86_64-linux

✅ 2 packages built:
  • jami
  • restinio

aarch64-linux

✅ 2 packages built:
  • jami
  • restinio

x86_64-darwin

✅ 1 package built:
  • restinio

aarch64-darwin

✅ 1 package built:
  • restinio

Copy link
Contributor

@GaetanLepage GaetanLepage left a comment

Choose a reason for hiding this comment

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

All goof, thanks !

@GaetanLepage GaetanLepage merged commit 14e6ebd into NixOS:master Feb 2, 2025
24 of 27 checks passed
@xokdvium xokdvium deleted the fix/restinio branch February 2, 2025 18:59
xokdvium added a commit to xokdvium/nixpkgs that referenced this pull request Feb 4, 2025
Motivation for this hook is simple: there's no single documented
way to do trivial things with ctest:

1. Pass additional flags to ctest invocation.
2. Selectively disable tests in a mechanism similar to python's
   `disabledTests` or rust's composable skips in `checkFlags`.
3. Disable parallel checking.

Current state of things has lead to several different solutions:

1. Completely overriding `checkPhase` [1] and invoking ctest manually
   with the necessary flags. This is most often coupled with `-E` for
   disabling test or setting parallel level.
2. Wrangling with weird double string/regex escaping and trying to stuff
   additional parameters and/or exclusion regex via `CMAKE_CTEST_ARGUMENTS`.
   This approach is especially painful when test names have spaces. This is
   the reason I originally decided to implement this hook after wrangling with
   failing darwin tests here [2].
3. Stuffing additional arguments into `checkFlagsArray` with the
   `ARGS` makefile parameter [3].

I don't see any reason to keep the status-quo. Doing something along these
lines has been suggested [4] for both `ctest` and `meson`. Meson setup-hook
has switched from `ninja` to `meson` in [5] with little friction. Doing
the same for cmake in a single sweep would prove problematic due to the
aforementioned zoo of workarounds and hacks for `ctest`. Doing it via
a separate hook would allow us to refactor things piecemeal and without
going through staging. The benefit of the hook is immediately clear and it
would allow to drive the refactor tractor at a comfortable pace.

[1]: pd/pdal/package.nix:117, cc/ccache/package.nix:108, gl/glog/package.nix:79
[2]: NixOS#375955
[3]: op/open62541/package.nix:114
[4]: NixOS#113829
[5]: NixOS#213845
xokdvium added a commit to xokdvium/nixpkgs that referenced this pull request Feb 6, 2025
Motivation for this hook is simple: there's no single documented
way to do trivial things with ctest:

1. Pass additional flags to ctest invocation.
2. Selectively disable tests in a mechanism similar to python's
   `disabledTests` or rust's composable skips in `checkFlags`.
3. Disable parallel checking.

Current state of things has lead to several different solutions:

1. Completely overriding `checkPhase` [1] and invoking ctest manually
   with the necessary flags. This is most often coupled with `-E` for
   disabling test or setting parallel level.
2. Wrangling with weird double string/regex escaping and trying to stuff
   additional parameters and/or exclusion regex via `CMAKE_CTEST_ARGUMENTS`.
   This approach is especially painful when test names have spaces. This is
   the reason I originally decided to implement this hook after wrangling with
   failing darwin tests here [2].
3. Stuffing additional arguments into `checkFlagsArray` with the
   `ARGS` makefile parameter [3].

I don't see any reason to keep the status-quo. Doing something along these
lines has been suggested [4] for both `ctest` and `meson`. Meson setup-hook
has switched from `ninja` to `meson` in [5] with little friction. Doing
the same for cmake in a single sweep would prove problematic due to the
aforementioned zoo of workarounds and hacks for `ctest`. Doing it via
a separate hook would allow us to refactor things piecemeal and without
going through staging. The benefit of the hook is immediately clear and it
would allow to drive the refactor tractor at a comfortable pace.

[1]: pd/pdal/package.nix:117, cc/ccache/package.nix:108, gl/glog/package.nix:79
[2]: NixOS#375955
[3]: op/open62541/package.nix:114
[4]: NixOS#113829
[5]: NixOS#213845
xokdvium added a commit to xokdvium/nixpkgs that referenced this pull request Feb 14, 2025
Motivation for this hook is simple: there's no single documented
way to do trivial things with ctest:

1. Pass additional flags to ctest invocation.
2. Selectively disable tests in a mechanism similar to python's
   `disabledTests` or rust's composable skips in `checkFlags`.
3. Disable parallel checking.

Current state of things has lead to several different solutions:

1. Completely overriding `checkPhase` [1] and invoking ctest manually
   with the necessary flags. This is most often coupled with `-E` for
   disabling test or setting parallel level.
2. Wrangling with weird double string/regex escaping and trying to stuff
   additional parameters and/or exclusion regex via `CMAKE_CTEST_ARGUMENTS`.
   This approach is especially painful when test names have spaces. This is
   the reason I originally decided to implement this hook after wrangling with
   failing darwin tests here [2].
3. Stuffing additional arguments into `checkFlagsArray` with the
   `ARGS` makefile parameter [3].

I don't see any reason to keep the status-quo. Doing something along these
lines has been suggested [4] for both `ctest` and `meson`. Meson setup-hook
has switched from `ninja` to `meson` in [5] with little friction. Doing
the same for cmake in a single sweep would prove problematic due to the
aforementioned zoo of workarounds and hacks for `ctest`. Doing it via
a separate hook would allow us to refactor things piecemeal and without
going through staging. The benefit of the hook is immediately clear and it
would allow to drive the refactor tractor at a comfortable pace.

[1]: pd/pdal/package.nix:117, cc/ccache/package.nix:108, gl/glog/package.nix:79
[2]: NixOS#375955
[3]: op/open62541/package.nix:114
[4]: NixOS#113829
[5]: NixOS#213845
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants