Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Merge #7451
Browse files Browse the repository at this point in the history
7451: Windows spec fixes r=deivid-rodriguez a=deivid-rodriguez

### What was the end-user problem that led to this PR?

The problem was that we have a bunch of spec failures on Windows (~315).

### What is your fix for the problem, implemented in this PR?

My fix is to improve some stuff to be more OS-independent. This should bring the failures down to ~305.

Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
  • Loading branch information
bundlerbot and deivid-rodriguez committed Nov 23, 2019
2 parents dbcfed3 + dda56eb commit 0a866d0
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 15 deletions.
9 changes: 9 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
trigger:
branches:
include:
- master
- staging
- trying
- /.+-dev$/
- /.+-stable$/

jobs:
- job: Windows
pool:
Expand Down
4 changes: 2 additions & 2 deletions spec/bundler/env_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
end

it "prints gem path" do
with_clear_paths("GEM_PATH", "/a/b/c:/d/e/f") do
with_clear_paths("GEM_PATH", "/a/b/c#{File::PATH_SEPARATOR}d/e/f") do
out = described_class.report
expect(out).to include("Gem Path /a/b/c:/d/e/f")
expect(out).to include("Gem Path /a/b/c#{File::PATH_SEPARATOR}d/e/f")
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/install/gems/resolving_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
build_repo2

path = "#{gem_repo2}/#{Gem::MARSHAL_SPEC_DIR}/actionpack-2.3.2.gemspec.rz"
spec = Marshal.load(Bundler.rubygems.inflate(File.read(path)))
spec = Marshal.load(Bundler.rubygems.inflate(File.binread(path)))
spec.dependencies.each do |d|
d.instance_variable_set(:@type, :fail)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/install/redownload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
bundle! :install, flag => true

expect(out).to include "Installing rack 1.0.0"
expect(rack_lib.open(&:read)).to eq("RACK = '1.0.0'\n")
expect(rack_lib.binread).to eq("RACK = '1.0.0'\n")
expect(the_bundle).to include_gems "rack 1.0.0"
end

Expand Down
8 changes: 7 additions & 1 deletion spec/runtime/setup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,12 @@ def clean_load_path(lp)
end

describe "when a vendored gem specification uses the :path option" do
let(:filesystem_root) do
current = Pathname.new(Dir.pwd)
current = current.parent until current == current.parent
current
end

it "should resolve paths relative to the Gemfile" do
path = bundled_app(File.join("vendor", "foo"))
build_lib "foo", :path => path
Expand All @@ -866,7 +872,7 @@ def clean_load_path(lp)
end

it "should make sure the Bundler.root is really included in the path relative to the Gemfile" do
relative_path = File.join("vendor", Dir.pwd[1..-1], "foo")
relative_path = File.join("vendor", Dir.pwd.gsub(/^#{filesystem_root}/, ""))
absolute_path = bundled_app(relative_path)
FileUtils.mkdir_p(absolute_path)
build_lib "foo", :path => absolute_path
Expand Down
2 changes: 1 addition & 1 deletion spec/support/artifice/compact_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class CompactIndexAPI < Endpoint
def load_spec(name, version, platform, gem_repo)
full_name = "#{name}-#{version}"
full_name += "-#{platform}" if platform != "ruby"
Marshal.load(Bundler.rubygems.inflate(File.open(gem_repo.join("quick/Marshal.4.8/#{full_name}.gemspec.rz")).read))
Marshal.load(Bundler.rubygems.inflate(File.binread(gem_repo.join("quick/Marshal.4.8/#{full_name}.gemspec.rz"))))
end

def etag_response
Expand Down
2 changes: 1 addition & 1 deletion spec/support/artifice/compact_index_api_missing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class CompactIndexApiMissing < CompactIndexAPI
if params[:id] == "rack-1.0.gemspec.rz"
halt 404
else
File.read("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
File.binread("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/support/artifice/compact_index_extra_api_missing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CompactIndexExtraAPIMissing < CompactIndexExtraApi
if params[:id] == "missing-1.0.gemspec.rz"
halt 404
else
File.read("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
File.binread("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/support/artifice/compact_index_extra_missing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CompactIndexExtraMissing < CompactIndexExtra
if params[:id] == "missing-1.0.gemspec.rz"
halt 404
else
File.read("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
File.binread("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/support/artifice/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def dependencies_for(gem_names, gem_repo = GEM_REPO)
def load_spec(name, version, platform, gem_repo)
full_name = "#{name}-#{version}"
full_name += "-#{platform}" if platform != "ruby"
Marshal.load(Bundler.rubygems.inflate(File.open(gem_repo.join("quick/Marshal.4.8/#{full_name}.gemspec.rz")).read))
Marshal.load(Bundler.rubygems.inflate(File.binread(gem_repo.join("quick/Marshal.4.8/#{full_name}.gemspec.rz"))))
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/support/artifice/endpoint_api_missing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class EndpointApiMissing < Endpoint
if params[:id] == "rack-1.0.gemspec.rz"
halt 404
else
File.read("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
File.binread("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/support/artifice/endpoint_extra_missing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class EndpointExtraMissing < EndpointExtra
if params[:id] == "missing-1.0.gemspec.rz"
halt 404
else
File.read("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
File.binread("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/support/artifice/windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def gem_repo

files.each do |file|
get "/#{file}" do
File.read gem_repo.join(file)
File.binread gem_repo.join(file)
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/support/builders.rb
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ def @spec.validate(*); end
@files.each do |file, source|
file = Pathname.new(path).join(file)
FileUtils.mkdir_p(file.dirname)
File.open(file, "w") {|f| f.puts source }
File.open(file, "wb") {|f| f.puts source }
end
@spec.files = @files.keys
path
Expand Down
2 changes: 1 addition & 1 deletion spec/support/rubygems_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def setup
FileUtils.mkdir_p(Path.base_system_gems)
puts "installing gems for the tests to use..."
install_gems(DEPS)
manifest_path.open("w") {|f| f << manifest.join }
manifest_path.open("wb") {|f| f << manifest.join }
end

FileUtils.mkdir_p(Path.home)
Expand Down

0 comments on commit 0a866d0

Please sign in to comment.