diff options
author | 卜部昌平 <[email protected]> | 2020-08-21 22:25:44 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2020-08-22 00:33:37 +0900 |
commit | cc2caa6edf8d61ee85e9f173a047644a1d4a3de7 (patch) | |
tree | cf70dc2bbc8140ae046f4827597dcd20e4f4659d /spec/ruby/library/rbconfig/rbconfig_spec.rb | |
parent | 44d25c65287558e899188eb9e0fbd7d76e6f74ce (diff) |
do not test --version
`llvm-strip-7` is a sane valid strip command that LLVM 7 ships, albeit
it does not understand `--version`. It is a bad idea to check that
option. Instead just see if the command actually strips something. A
copy of `/bin/sh` should suffice. That file must be ubiquitous.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3439
Diffstat (limited to 'spec/ruby/library/rbconfig/rbconfig_spec.rb')
-rw-r--r-- | spec/ruby/library/rbconfig/rbconfig_spec.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/spec/ruby/library/rbconfig/rbconfig_spec.rb b/spec/ruby/library/rbconfig/rbconfig_spec.rb index c204d5326f..015c2972b2 100644 --- a/spec/ruby/library/rbconfig/rbconfig_spec.rb +++ b/spec/ruby/library/rbconfig/rbconfig_spec.rb @@ -59,11 +59,17 @@ describe 'RbConfig::CONFIG' do out.should_not be_empty end + require 'tempfile' it "['STRIP'] exists and can be executed" do strip = RbConfig::CONFIG.fetch('STRIP') - out = `#{strip} --version` - $?.should.success? - out.should_not be_empty + Tempfile.open('sh') do |dst| + File.open('/bin/sh', 'rb') do |src| + IO.copy_stream(src, dst) + dst.flush + out =`#{strip} #{dst.to_path}` + $?.should.success? + end + end end end end |