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

solc-select, crytic-compile, slither-analyzer, echidna: improve testing on ARM #127681

Merged
merged 4 commits into from Apr 18, 2023

Conversation

elopez
Copy link
Contributor

@elopez elopez commented Apr 6, 2023

  • 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 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 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

Running solc (through solc-select) requires an Intel system or Rosetta. The tests therefore fail on non-Rosetta ARM Macs, which causes solc-select and dependents to not be bottled on ARM. To remediate this, account for this limitation in the solc-select test, and implement testing with a Truffle or prebuilt project on ARM instead on crytic-compile, echidna, and slither-analyzer, which can use the solcjs compiler if needed.

@github-actions github-actions bot added the python Python use is a significant feature of the PR or issue label Apr 6, 2023
@elopez elopez changed the title solc-select, crytic-compile, slither-analyzer: improve testing on ARM solc-select, crytic-compile, slither-analyzer, echidna: improve testing on ARM Apr 6, 2023
@elopez elopez marked this pull request as ready for review April 6, 2023 03:18
@elopez elopez mentioned this pull request Apr 6, 2023
Comment on lines +44 to +45
# running solc itself requires an Intel system or Rosetta
return if Hardware::CPU.arm?

Copy link
Member

Choose a reason for hiding this comment

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

That seems like it won't be very useful for people to have this bottled on ARM then. I'd say it's better to mark it as x86.

Copy link
Contributor Author

@elopez elopez Apr 6, 2023

Choose a reason for hiding this comment

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

Hi @SMillerDev! The software itself (solc-select) is written in Python and can run fine on ARM. It's also a runtime dependency (imported python lib) for some of the other programs in this PR, which can be meaningfully used on an ARM Mac without Rosetta. My understanding is that marking solc-select as x86 would mean none of the packages here get bottled, which would not be desirable.

Copy link
Member

Choose a reason for hiding this comment

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

@SMillerDev Seems fine on me as-is given what @elopez has said.

@elopez
Copy link
Contributor Author

elopez commented Apr 7, 2023

It looks like the CI timed out, we may need a longer run for this PR 😅

@elopez elopez requested a review from SMillerDev April 13, 2023 19:35
@elopez elopez force-pushed the improve-slither-bottling branch 2 times, most recently from 93c8917 to 698ff17 Compare April 15, 2023 17:51
@elopez elopez marked this pull request as draft April 15, 2023 17:51
@elopez elopez force-pushed the improve-slither-bottling branch 2 times, most recently from d2d304a to 6ed9a30 Compare April 15, 2023 20:00
@elopez elopez marked this pull request as ready for review April 15, 2023 21:53
@SMillerDev SMillerDev requested a review from a team April 17, 2023 07:51
system "solc-select", "install", "0.8.0"
with_env(SOLC_VERSION: "0.8.0") do
system bin/"crytic-compile", testpath/"test.sol", "--export-format=solc", "--export-dir=#{testpath}/export"
resource "testdata" do
Copy link
Member

Choose a reason for hiding this comment

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

@Homebrew/core is this a thing we're doing now? Not opposed, kinda in favour if it saves a non-test-time download, but just wanted to check it 1) works and 2) is desirable.

Copy link
Member

@carlocab carlocab Apr 17, 2023

Choose a reason for hiding this comment

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

By "this", do you mean resource blocks inside test blocks? IIRC there were a handful of examples of this a while back that we had to get rid of to enable formulae being frozen after instantiation.

Agreed that it would be good to do if it worked though.

Copy link
Member

Choose a reason for hiding this comment

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

Seems to work, though, so I must be misremembering. Or maybe formulae freezing has changed since then. Probably the former. @Bo98?

Copy link
Member

Choose a reason for hiding this comment

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

By "this", do you mean resource blocks inside test blocks?

@carlocab Yup!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to add context, I opted to include this resource block inside the test block to avoid having virtualenv_install_with_resources trying to install the test file as a python package.

Formula/crytic-compile.rb Outdated Show resolved Hide resolved
Formula/echidna.rb Outdated Show resolved Hide resolved
Formula/slither-analyzer.rb Outdated Show resolved Hide resolved
Formula/solc-select.rb Outdated Show resolved Hide resolved
Formula/solc-select.rb Show resolved Hide resolved
Comment on lines +44 to +45
# running solc itself requires an Intel system or Rosetta
return if Hardware::CPU.arm?

Copy link
Member

Choose a reason for hiding this comment

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

@SMillerDev Seems fine on me as-is given what @elopez has said.

Running solc itself requires an Intel system or Rosetta. Account for
that fact in the brew test.
Running solc (through solc-select) requires an Intel system or
Rosetta. Implement testing with a precompiled project instead,
which should work on all platforms.
Running solc (through solc-select) requires an Intel system or
Rosetta. Implement testing with a pre-compiled project instead,
which should work across all platforms.
`solc` binaries (through `solc-select`) are only available for Intel
platforms or through Rosetta. Switch `echidna` to test with a Truffle
project instead, which can be built on all platforms.
MikeMcQuaid
MikeMcQuaid previously approved these changes Apr 17, 2023
@elopez
Copy link
Contributor Author

elopez commented Apr 17, 2023

@MikeMcQuaid thanks for the review! Can you please tag this PR with the longer timeout CI tag? it seems it's very close to the default time limit and some of the jobs got cancelled.

@MikeMcQuaid MikeMcQuaid added CI-long-timeout Use longer GitHub Actions CI timeout. long build Needs CI-long-timeout labels Apr 17, 2023
@github-actions
Copy link
Contributor

🤖 A scheduled task has requested bottles to be published to this PR.

@github-actions
Copy link
Contributor

⚠️ Bottle publish failed. CC @carlocab

@BrewTestBot BrewTestBot dismissed MikeMcQuaid’s stale review April 17, 2023 23:04

bottle publish failed

@carlocab carlocab added the CI-no-bottles Merge without publishing bottles label Apr 18, 2023
Copy link
Member

@carlocab carlocab left a comment

Choose a reason for hiding this comment

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

Thanks!

@carlocab carlocab removed the CI-long-timeout Use longer GitHub Actions CI timeout. label Apr 18, 2023
@carlocab carlocab added this pull request to the merge queue Apr 18, 2023
Merged via the queue into Homebrew:master with commit 93904aa Apr 18, 2023
29 of 37 checks passed
@elopez elopez mentioned this pull request Apr 18, 2023
6 tasks
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 long build Needs CI-long-timeout 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.

None yet

4 participants