improve debuggability of cache.up_to_date? - close #46
This commit is contained in:
1 parent
53ba7dad41
commit
57de94a3fb
3 files changed
+146
-8
No files matched your search
@@ -91,6 +91,7 @@ end
|
||||
$LOAD_PATH.unshift(#{@owd.inspect} + "/lib")
|
||||
# force color off
|
||||
ENV["TERM"] = nil
|
||||
#{options[:ruby_setup_code]}
|
||||
EOF
|
||||
end
|
||||
stdout, stderr, status = nil, nil, nil
|
||||
@@ -1273,6 +1274,69 @@ EOF
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.stdout).to eq ""
|
||||
end
|
||||
|
||||
context "debugging" do
|
||||
it "prints a message when the target does not exist" do
|
||||
test_dir("simple")
|
||||
result = run_test(rsconsfile: "cache_debugging.rb")
|
||||
expect(result.stdout).to match /Target foo\.o needs rebuilding because it does not exist on disk/
|
||||
end
|
||||
|
||||
it "prints a message when there is no cached build information for the target" do
|
||||
test_dir("simple")
|
||||
FileUtils.touch("foo.o")
|
||||
result = run_test(rsconsfile: "cache_debugging.rb")
|
||||
expect(result.stdout).to match /Target foo\.o needs rebuilding because there is no cached build information for it/
|
||||
end
|
||||
|
||||
it "prints a message when the target file has changed on disk" do
|
||||
test_dir("simple")
|
||||
result = run_test(rsconsfile: "cache_debugging.rb")
|
||||
File.open("foo.o", "wb") {|fh| fh.puts "hi"}
|
||||
result = run_test(rsconsfile: "cache_debugging.rb")
|
||||
expect(result.stdout).to match /Target foo\.o needs rebuilding because it has been changed on disk since being built last/
|
||||
end
|
||||
|
||||
it "prints a message when the command has changed" do
|
||||
test_dir("simple")
|
||||
result = run_test(rsconsfile: "cache_debugging.rb")
|
||||
result = run_test(rsconsfile: "cache_debugging.rb", ruby_setup_code: %[ENV["command_change"] = "yes"])
|
||||
expect(result.stdout).to match /Target foo\.o needs rebuilding because the command used to build it has changed/
|
||||
end
|
||||
|
||||
it "prints a message when strict_deps is in use and the set of dependencies does not match" do
|
||||
test_dir("simple")
|
||||
result = run_test(rsconsfile: "cache_debugging.rb", ruby_setup_code: %[ENV["strict_deps1"] = "yes"])
|
||||
result = run_test(rsconsfile: "cache_debugging.rb", ruby_setup_code: %[ENV["strict_deps2"] = "yes"])
|
||||
expect(result.stdout).to match /Target foo\.o needs rebuilding because the :strict_deps option is given and the set of dependencies does not match the previous set of dependencies/
|
||||
end
|
||||
|
||||
it "prints a message when there is a new dependency" do
|
||||
test_dir("simple")
|
||||
result = run_test(rsconsfile: "cache_debugging.rb")
|
||||
result = run_test(rsconsfile: "cache_debugging.rb", ruby_setup_code: %[ENV["new_dep"] = "yes"])
|
||||
expect(result.stdout).to match /Target foo\.o needs rebuilding because there are new dependencies/
|
||||
end
|
||||
|
||||
it "prints a message when there is a new user-specified dependency" do
|
||||
test_dir("simple")
|
||||
result = run_test(rsconsfile: "cache_debugging.rb")
|
||||
result = run_test(rsconsfile: "cache_debugging.rb", ruby_setup_code: %[ENV["new_user_dep"] = "yes"])
|
||||
expect(result.stdout).to match /Target foo\.o needs rebuilding because the set of user-specified dependency files has changed/
|
||||
end
|
||||
|
||||
it "prints a message when a dependency file has changed" do
|
||||
test_dir("simple")
|
||||
result = run_test(rsconsfile: "cache_debugging.rb")
|
||||
f = File.read("simple.c", mode: "rb")
|
||||
f += "\n"
|
||||
File.open("simple.c", "wb") do |fh|
|
||||
fh.write(f)
|
||||
end
|
||||
result = run_test(rsconsfile: "cache_debugging.rb")
|
||||
expect(result.stdout).to match /Target foo\.o needs rebuilding because dependency file simple\.c has changed/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "Object builder" do
|
||||
|
||||
Reference in new issue
Block a user