summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Daloze <benoit.daloze@oracle.com>2019-07-15 14:57:02 +0200
committerBenoit Daloze <eregontp@gmail.com>2020-03-25 16:11:34 +0100
commit13e8ab6dea4d9777ef3998f44c62c0207ccc93e0 (patch)
tree1d162e60c3f87a545bacc2d3080906ef1cb3d7f1
parent40383fec7eb78fa66f90d32cb5dcf72a6f45c94d (diff)
downloadffi-13e8ab6dea4d9777ef3998f44c62c0207ccc93e0.tar.gz
Always call make for FFI specs
* The fact that the library exists doesn't mean it's up to date. * The Makefile does the right timestamp checks and compares to sources, and it's fast. * Simplify code, `system` returns false or nil when the command fails.
-rw-r--r--spec/ffi/fixtures/compile.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/spec/ffi/fixtures/compile.rb b/spec/ffi/fixtures/compile.rb
index 16892e0..6444601 100644
--- a/spec/ffi/fixtures/compile.rb
+++ b/spec/ffi/fixtures/compile.rb
@@ -50,15 +50,12 @@ module TestLibrary
def self.compile_library(path, lib)
dir = File.expand_path(path, File.dirname(__FILE__))
lib = "#{dir}/#{lib}"
- unless File.exist?(lib)
- output = nil
- FileUtils.cd(dir) do
- make = ENV['MAKE'] || (system('which gmake >/dev/null') ? 'gmake' : 'make')
- output = system(*%{#{make} CPU=#{CPU} OS=#{OS}}.tap{|x| puts x.inspect})
- end
- unless $?.success?
- puts "ERROR:\n#{output}"
+ FileUtils.cd(dir) do
+ make = ENV['MAKE'] || (system('which gmake >/dev/null') ? 'gmake' : 'make')
+
+ unless system(*%{#{make} CPU=#{CPU} OS=#{OS}}.tap{ |cmd| puts cmd.inspect })
+ puts "ERROR: #{$?}"
raise "Unable to compile #{lib.inspect}"
end
end