Skip to content

Support NixOS resource dirs #546

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jeaye
Copy link
Contributor

@jeaye jeaye commented Apr 1, 2025

Previously, CppInterOp assumed that the resource dir would end in the clang major version. This is common, but it's not always the case. On NixOS, for example, we have something like this:

❯ clang++ -print-resource-dir
/nix/store/xl0vlc2wdchfbq8536zs19pj2r3xdmma-clang-wrapper-19.1.5/resource-root

I have updated the function to check that the path contains the major version, rather than ending in it. This is still a useful version check, though it's not as precise as it was before.

Previously, CppInterOp assumed that the resource dir would end in the
clang major version. This is common, but it's not always the case. On
NixOS, for example, we have something like this:

```
❯ clang++ -print-resource-dir
/nix/store/xl0vlc2wdchfbq8536zs19pj2r3xdmma-clang-wrapper-19.1.5/resource-root
```

I have updated the function to check that the path contains the major
version, rather than ending in it. This is still a useful version check,
though it's not as precise as it was before.
Copy link
Contributor

github-actions bot commented Apr 1, 2025

clang-tidy review says "All clean, LGTM! 👍"

Copy link

codecov bot commented Apr 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.94%. Comparing base (e1ace51) to head (2238e67).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #546   +/-   ##
=======================================
  Coverage   75.94%   75.94%           
=======================================
  Files           9        9           
  Lines        3646     3646           
=======================================
  Hits         2769     2769           
  Misses        877      877           
Files with missing lines Coverage Δ
lib/Interpreter/CppInterOp.cpp 83.88% <100.00%> (ø)
Files with missing lines Coverage Δ
lib/Interpreter/CppInterOp.cpp 83.88% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vgvassilev
Copy link
Contributor

Can we somehow add a test for this?

@jeaye
Copy link
Contributor Author

jeaye commented Apr 8, 2025

Can we somehow add a test for this?

Seems possible, if we were to:

  1. Create a mock executable script which prints a resource dir for normal situations
  2. Create a mock executable script which prints a resource dir for NixOS situations
  3. Create a unit test for that function which passes in the path of the custom scripts

I didn't bother, since that didn't seem worth the effort. If this is required, please let me know where the scripts should live.

@vgvassilev
Copy link
Contributor

Perhaps we can move the compatibility check logic into a new function that takes a string and then implement a test based on the expected strings?

@mcbarton
Copy link
Collaborator

Although it wouldn't cover NixOS, if you can suggest another OS which is not following the typical pattern, but for which a docker image exists on Docker hub (I couldn't find an image for NixOS), I should be able to construct a workflow for this operating system, and therefore provide a way to test this change.

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