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

llvm: update lldb python test #192626

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lukeshingles
Copy link
Contributor

  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

The lldb python test assumes that python3 points to the same python as lldb uses. When python3.12 gets demoted to altinstall in #182840, breaks the test.

@github-actions github-actions bot added the python Python use is a significant feature of the PR or issue label Oct 2, 2024
@lukeshingles
Copy link
Contributor Author

I can do the same for llvm@16 in either this PR, or make a separate one.

@Bo98
Copy link
Member

Bo98 commented Oct 2, 2024

python3 is calling this which should return the correct binary?

def python3
"python3.12"
end

@lukeshingles
Copy link
Contributor Author

python3 is calling this which should return the correct binary?

def python3
"python3.12"
end

Depends on which one you consider correct. lldb will pick up python3.13 when that becomes the default (did a quick Google and couldn’t figure out how to override), which doesn’t match python3.12 required by the formula

@Bo98
Copy link
Member

Bo98 commented Oct 2, 2024

The lldb module is only built for a single Python version - it shouldn't be changing dynamically and needs to match the depends_on:

$ ls -d $(brew --prefix llvm)/libexec/python*
/opt/homebrew/opt/llvm/libexec/python3.12

It seems to work correctly on macOS at least:

$ $(brew --prefix llvm)/bin/lldb --print-script-interpreter-info
{"executable":"/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/bin/python3.12","language":"python","lldb-pythonpath":"/opt/homebrew/Cellar/llvm/18.1.8/libexec/python3.12/site-packages","prefix":"/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12"}

@lukeshingles
Copy link
Contributor Author

lukeshingles commented Oct 2, 2024

Yes, ok on macOS. Any other way to solve this on linux?

2024-10-01T12:26:39.8287536Z �[34m==>�[0m �[1mpython3.12 -c 'import pathlib, sys; print(pathlib.Path(sys.prefix).resolve())'�[0m
2024-10-01T12:26:39.8288263Z �[34m==>�[0m �[1m/home/linuxbrew/.linuxbrew/Cellar/llvm/19.1.0/bin/lldb�[0m
2024-10-01T12:26:39.8288929Z Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
2024-10-01T12:26:39.8289311Z 
2024-10-01T12:26:39.8289501Z now exiting InteractiveConsole...
2024-10-01T12:26:39.8289848Z �[31mError:�[0m llvm: failed
2024-10-01T12:26:39.8299421Z ##[error]llvm: failed
2024-10-01T12:26:39.8305796Z An exception occurred within a child process:
2024-10-01T12:26:39.8364087Z   Minitest::Assertion: Expected /\/home\/linuxbrew\/\.linuxbrew\/Cellar\/python@3\.12\/3\.12\.6_1\n/ to match "(lldb) script\n>>> /home/linuxbrew/.linuxbrew\n>>> ".
2024-10-01T12:26:39.8366380Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/minitest-5.25.1/lib/minitest/assertions.rb:176:in `assert'
2024-10-01T12:26:39.8368251Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/minitest-5.25.1/lib/minitest/assertions.rb:291:in `assert_match'
2024-10-01T12:26:39.8369934Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/l/llvm.rb:715:in `block in <class:Llvm>'
2024-10-01T12:26:39.8371192Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:2813:in `block (3 levels) in run_test'
2024-10-01T12:26:39.8372731Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/kernel.rb:536:in `with_env'
2024-10-01T12:26:39.8374012Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:2812:in `block (2 levels) in run_test'
2024-10-01T12:26:39.8375053Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:1199:in `with_logging'
2024-10-01T12:26:39.8375961Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:2811:in `block in run_test'
2024-10-01T12:26:39.8376803Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/mktemp.rb:75:in `block in run'
2024-10-01T12:26:39.8377563Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/mktemp.rb:75:in `chdir'
2024-10-01T12:26:39.8378254Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/mktemp.rb:75:in `run'
2024-10-01T12:26:39.8378983Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:3129:in `mktemp'
2024-10-01T12:26:39.8379768Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:2805:in `run_test'
2024-10-01T12:26:39.8380556Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/test.rb:48:in `block in <main>'
2024-10-01T12:26:39.8381738Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.5/lib/ruby/3.3.0/timeout.rb:186:in `block in timeout'
2024-10-01T12:26:39.8383297Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.5/lib/ruby/3.3.0/timeout.rb:41:in `handle_timeout'
2024-10-01T12:26:39.8384782Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.5/lib/ruby/3.3.0/timeout.rb:195:in `timeout'
2024-10-01T12:26:39.8385730Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/test.rb:52:in `<main>'

@Bo98
Copy link
Member

Bo98 commented Oct 2, 2024

Seems to more be a bug in our sitecustomize (though will require rebuilding LLVM when that's fixed):

# macOS
$ python3.12 -c 'import sys; print(sys.prefix)'    
/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12
# Linux
$ python3.12 -c 'import sys; print(sys.prefix)'  
/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.6

On Linux this is causing it to use Cellar rather than opt_prefix:

$ lldb --print-script-interpreter-info
{"executable":"/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.6/bin/python3.12","language":"python","lldb-pythonpath":"/home/linuxbrew/.linuxbrew/Cellar/llvm/19.1.0/libexec/python3.12/site-packages","prefix":"/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.6"}

@lukeshingles
Copy link
Contributor Author

lukeshingles commented Oct 2, 2024

Ok, close and fix in another PR? (I don't know how to fix the sitecustomize problem)

@carlocab carlocab added the CI-no-bottles Merge without publishing bottles label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI-no-bottles Merge without publishing bottles python Python use is a significant feature of the PR or issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants