a clean operation should preserve install target cache info - close #101
This commit is contained in:
1 parent
49e1bca1f7
commit
785e8e18fd
3 files changed
+25
-41
No files matched your search
+22
-10
@@ -350,6 +350,28 @@ EOF
|
||||
expect(File.exists?("build/e.1/src/one/one.o")).to be_falsey
|
||||
end
|
||||
end
|
||||
|
||||
it "does not remove install cache entries" do
|
||||
test_dir "typical"
|
||||
|
||||
Dir.mktmpdir do |prefix|
|
||||
result = run_rscons(rsconscript: "install.rb", op: %W[configure --prefix=#{prefix}])
|
||||
expect(result.stderr).to eq ""
|
||||
|
||||
result = run_rscons(rsconscript: "install.rb", op: %W[install])
|
||||
expect(result.stderr).to eq ""
|
||||
|
||||
result = run_rscons(rsconscript: "install.rb", op: %W[clean])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(File.exists?("#{prefix}/bin/program.exe")).to be_truthy
|
||||
expect(File.exists?("build/e.1/src/one/one.o")).to be_falsey
|
||||
|
||||
result = run_rscons(rsconscript: "install.rb", op: %W[uninstall -v])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.stdout).to match %r{Removing #{prefix}/bin/program.exe}
|
||||
expect(Dir.entries(prefix)).to match_array %w[. ..]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it 'allows Ruby classes as custom builders to be used to construct files' do
|
||||
@@ -1175,16 +1197,6 @@ EOF
|
||||
expect(result.stderr).to match /Warning.*was corrupt. Contents:/
|
||||
end
|
||||
|
||||
it "removes the cache file on a clean operation" do
|
||||
test_dir("simple")
|
||||
result = run_rscons
|
||||
expect(result.stderr).to eq ""
|
||||
expect(File.exists?(Rscons::Cache::CACHE_FILE)).to be_truthy
|
||||
result = run_rscons(op: %w[clean])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(File.exists?(Rscons::Cache::CACHE_FILE)).to be_falsey
|
||||
end
|
||||
|
||||
it "forces a build when the target file does not exist and is not in the cache" do
|
||||
test_dir("simple")
|
||||
expect(File.exists?("simple.exe")).to be_falsey
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
module Rscons
|
||||
describe Application do
|
||||
|
||||
describe ".clean" do
|
||||
it "removes all build targets and created directories" do
|
||||
cache = "cache"
|
||||
expect(Rscons::Cache).to receive(:instance).and_return(cache)
|
||||
expect(cache).to receive(:targets).and_return(["build/a.out", "build/main.o"])
|
||||
expect(FileUtils).to receive(:rm_f).with("build/a.out")
|
||||
expect(FileUtils).to receive(:rm_f).with("build/main.o")
|
||||
expect(cache).to receive(:directories).and_return(["build/one", "build/one/two", "build", "other"])
|
||||
expect(File).to receive(:directory?).with("build/one/two").and_return(true)
|
||||
expect(Dir).to receive(:entries).with("build/one/two").and_return([".", ".."])
|
||||
expect(Dir).to receive(:rmdir).with("build/one/two")
|
||||
expect(File).to receive(:directory?).with("build/one").and_return(true)
|
||||
expect(Dir).to receive(:entries).with("build/one").and_return([".", ".."])
|
||||
expect(Dir).to receive(:rmdir).with("build/one")
|
||||
expect(File).to receive(:directory?).with("build").and_return(true)
|
||||
expect(Dir).to receive(:entries).with("build").and_return([".", ".."])
|
||||
expect(Dir).to receive(:rmdir).with("build")
|
||||
expect(File).to receive(:directory?).with("other").and_return(true)
|
||||
expect(Dir).to receive(:entries).with("other").and_return([".", "..", "other.file"])
|
||||
expect(cache).to receive(:clear)
|
||||
|
||||
Rscons.application.__send__(:clean)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user