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

question: how to test a cask binary? #18830

Closed
psibre opened this issue Feb 13, 2016 · 7 comments
Closed

question: how to test a cask binary? #18830

psibre opened this issue Feb 13, 2016 · 7 comments

Comments

@psibre
Copy link
Contributor

psibre commented Feb 13, 2016

Various casks provide binary stanzas to symlink some binary or script within a cask-installed app.
Would it be possible or desirable to provide some lightweight functionality to automatically test that the binary actually results in a working command?

For example, the praat cask creates a symlink

/usr/local/bin/praat -> /opt/homebrew-cask/Caskroom/praat/#{installed_version}/Praat.app/Contents/MacOS/Praat

It would be nice to automatically check when the cask is tested or installed that running praat actually does run that .../Praat.app/Contents/MacOS/Praat binary.

Because sometimes paths inside apps are changed upstream, and the symlinks would break on installing an updated cask. Or some other stuff happens upstream, and the binary itself no longer works.

Catching this sort of issue during the test builds, and guarding against it during postflight might be a good idea.

@vitorgalvao
Copy link
Member

I don’t really see this as necessary, because it really isn’t a problem. Also, with #15603 this will only become less of an issue. That said, I also wouldn’t mind.

Lets see other opinions.

@vitorgalvao vitorgalvao added the awaiting maintainer feedback Issue needs response from a maintainer. label Feb 13, 2016
@psibre
Copy link
Contributor Author

psibre commented Feb 14, 2016

I've floated a simple test balloon in #18879

@vitorgalvao
Copy link
Member

That’s not really the same thing as a test. You’re using postflight for it, mudding it’s usage. Either we make a proper test block for this, or we don’t do it at all.

@psibre
Copy link
Contributor Author

psibre commented Feb 14, 2016

@vitorgalvao I agree that's not what the postflight is for; it was intended as a proof of concept.

  binary 'Praat.app/Contents/MacOS/Praat', target: 'praat'

  # verify binary
  postflight do
    cmd = "praat --version"
    raise "Cannot run command `#{cmd}`" unless system cmd
  end

does provide the functionality I proposed above, though: it fails the installation if the praat command provided by the binary cannot be run.

Would it be possible to port the test block logic over from the main brew formula code?

@vitorgalvao
Copy link
Member

Would it be possible to port the test block logic over from the main brew formula code?

Might be (especially with #14384), but we’re still not agreed on if this is desirable (waiting for more maintainers to chime in).

@psibre
Copy link
Contributor Author

psibre commented Feb 14, 2016

Fair enough. Thanks for linking to the integration issue -- I'll subscribe to that!

@vitorgalvao
Copy link
Member

Seems like there isn’t much interest in this. Closing.

@jawshooah jawshooah removed the awaiting maintainer feedback Issue needs response from a maintainer. label Jul 20, 2016
@Homebrew Homebrew locked and limited conversation to collaborators May 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants