[前][次][番号順一覧][スレッド一覧]

ruby-changes:62675

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Sat, 22 Aug 2020 00:33:56 +0900 (JST)
Subject: [ruby-changes:62675] cc2caa6edf (master): do not test --version

https://git.ruby-lang.org/ruby.git/commit/?id=cc2caa6edf

From cc2caa6edf8d61ee85e9f173a047644a1d4a3de7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?=
 <shyouhei@r...>
Date: Fri, 21 Aug 2020 22:25:44 +0900
Subject: 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.

diff --git a/spec/ruby/library/rbconfig/rbconfig_spec.rb b/spec/ruby/library/rbconfig/rbconfig_spec.rb
index c204d53..015c297 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 https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/rbconfig/rbconfig_spec.rb#L59
       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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]