-
-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Cleaner: ELF files are executable on Linux #3469
Conversation
Breaking some Linux tests: https://travis-ci.org/Homebrew/brew/jobs/305958848 |
The binary files in |
|
fd52a7b
to
6ca2a0d
Compare
I've fixed the test failures. |
url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" | ||
sha256 "#{TESTBALL_SHA256}" | ||
url "file://#{TEST_FIXTURE_DIR}/tarballs/#{OS.linux? ? "testball-0.1-linux.tbz" : "testball-0.1.tbz"}" | ||
sha256 "#{OS.linux? ? TESTBALL_SHA256_LINUX : TESTBALL_SHA256}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this use the same approach as above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. This code defines the location of the tarball and its checksum, which is platform dependent.
Formulary.factory("testball1").stable.checksum.hexdigest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could calculate the checksum from the contents of the file, rather than store it in Ruby code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could calculate the checksum from the contents of the file, rather than store it in Ruby code.
Yes, let's do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
@@ -20,7 +20,8 @@ | |||
|
|||
subject.clean | |||
|
|||
expect((f.bin/"a.out").stat.mode).to eq(0100555) | |||
mach_executable_perm = OS.linux? ? 0100444 : 0100555 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we set these to the same in the tarball instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file permissions in the tarball are the same. This test is related to a file outside of the tarball,test/support/fixtures/mach/a.out
is a Mach-O file. On Linux, Cleaner::executable_path?
changes ELF files and shell scripts to executable, but not Mach-O files. I can create a separate test/support/fixtures/elf
directory for Linux. Alternatively, I can disable this particular test on Linux using :needs_macos
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can create a separate test/support/fixtures/elf directory for Linux.
Sounds good 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
10d6cc9
to
744631c
Compare
@@ -123,11 +123,12 @@ def brew(*args) | |||
def setup_test_formula(name, content = nil) | |||
case name | |||
when /^testball/ | |||
tarball = TEST_FIXTURE_DIR/"tarballs/#{OS.linux? ? "testball-0.1-linux.tbz" : "testball-0.1.tbz"}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use an if
/else
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing.
Add test/support/fixtures/elf/ and test/support/fixtures/tarballs/testball-0.1-linux.tbz
Thanks again @sjackman! |
Thanks again for merging, Mike! |
brew tests
with your changes locally?