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

Glue libprobe and probe_frontend together #36

Merged
merged 18 commits into from
Aug 4, 2024
Merged

Glue libprobe and probe_frontend together #36

merged 18 commits into from
Aug 4, 2024

Conversation

charmoniumQ
Copy link
Owner

@charmoniumQ charmoniumQ commented Jul 25, 2024

Integrate the Rust flake into the top-level flake because the top-level needs to "give" Rust a package (libprobe-interface) and the Rust flake needs to "give" the top-level flake a package (probe-cli and the other probe-*).

The true contribution is that nix build .#probe-bundled && ./result/bin/PROBE record ls works. It builds libprobe, the Rust CLI, and tells the CLI where to find libprobe.

This utterly breaks the devshell, the Python code, and the interactive development cycle, which a future PR will fix.

@charmoniumQ charmoniumQ requested a review from Ex-32 July 25, 2024 20:54
Copy link
Collaborator

@Ex-32 Ex-32 left a comment

Choose a reason for hiding this comment

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

I noticed the nix code wasn't formatted, other than that, and the couple of comments I left, it looks good.

probe_src/probe_frontend/rust-stuff.nix Outdated Show resolved Hide resolved
probe_src/arena/arena.h Outdated Show resolved Hide resolved
flake.nix Show resolved Hide resolved
probe_src/probe_frontend/rust-stuff.nix Outdated Show resolved Hide resolved
flake.nix Show resolved Hide resolved
@charmoniumQ
Copy link
Owner Author

charmoniumQ commented Jul 30, 2024

Not only does nix build .#probe-bundled && ./result/bin/probe record ls work, but also the following:

nix develop
nix-shell$ make -C probe_src/libprobe all
nix-shell$ env -C probe_src/probe_frontend cargo build --release
nix-shell$ probe record ls
nix-shell$ python -m probe_py.manual.cli process-graph

This refactors and unifies the whole build process for the hermetic Nix sandbox and an impure dev-shell for edit-in-place and don't-rebuild-the-world development.

Copy link
Collaborator

@Ex-32 Ex-32 left a comment

Choose a reason for hiding this comment

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

I glossed over the python code changes since I'm not really familiar with that part of the codebase, but the nix and rust changes look good.

Justfile Show resolved Hide resolved
@charmoniumQ
Copy link
Owner Author

charmoniumQ commented Jul 30, 2024

@Shofiya2003 Could you help us debug these tests? It's failing in two places:

  1. I know you didn't write the validate_hb_graph (that one's my fault), but I think the code should be readable (the func just returns a list of strings representing errors its sees in the graph), and it would help a lot if you could help debug it.
  2. We are also failing test_pthreads - assert 140737351620288 in [] (test_probe.py:231) which should be closer to the tests you wrote.

@Shofiya2003
Copy link
Contributor

@Shofiya2003 Could you help us debug these tests? It's failing in two places:

  1. I know you didn't write the validate_hb_graph (that one's my fault), but I think the code should be readable (the func just returns a list of strings representing errors its sees in the graph), and it would help a lot if you could help debug it.
  2. We are also failing test_pthreads - assert 140737351620288 in [] (test_probe.py:231) which should be closer to the tests you wrote.

Yup, on it!

@Ex-32
Copy link
Collaborator

Ex-32 commented Aug 3, 2024

I noticed is that currently, the execute_command() function in test_probe.py still has an option for the --make flag, which the rust frontend doesn't support.

['probe', 'record'] + (["--debug"] if DEBUG_LIBPROBE else []) + (["--make"] if REMAKE_LIBPROBE else []) + command,

Also, it's probably a good idea to pass the -- argument before command; it's unlikely to be a real issue, but for a script, it doesn't hurt to be obsessively scrupulous.

@Ex-32
Copy link
Collaborator

Ex-32 commented Aug 3, 2024

Currently, the CI is failing because it's trying to run the compiled tests without actually compiling them first, I think a good solution is to add a new Justfile rule, and make it a dependency of test-dev and test-ci:

compile-tests:
    env --chdir=probe_src/tests/c make
    # expand as needed for other languages

@charmoniumQ charmoniumQ merged commit 66e9713 into main Aug 4, 2024
1 check passed
@charmoniumQ charmoniumQ deleted the glue-code branch August 4, 2024 00:19
@charmoniumQ
Copy link
Owner Author

Even better, the middle two commands (make and env ... cargo can be replaced with just compile).

nix develop
nix-shell$ make -C probe_src/libprobe all
nix-shell$ env -C probe_src/probe_frontend cargo build --release
nix-shell$ probe record ls
nix-shell$ python -m probe_py.manual.cli process-graph

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