Prohibit copying to `fixtures` and dot-direcotry just under `test`

Do not add directories which would let chkbuild fires accidentally, to
just under `test`.  The "fixtures" directory is often used to place
test stuffs.
This commit is contained in:
Nobuyoshi Nakada 2023-08-13 15:30:58 +09:00
Родитель 83718b6bb2
Коммит eb221a3734
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 3582D74E1FEE4465
2 изменённых файлов: 18 добавлений и 2 удалений

Просмотреть файл

@ -600,7 +600,7 @@ module SyncDefaultGems
puts "Remove files added to toplevel: #{toplevels.join(', ')}"
system(*%w"git rm -r --", *toplevels)
end
tools = changed.select {|f|f.start_with?("test/lib/", "tool/")}
tools = changed.select {|f|f.start_with?("test/fixtures/", "test/lib/", "tool/")}
unless tools.empty?
system(*%W"git rm -r --", *tools)
system(*%W"git checkout HEAD~ --", *tools)

Просмотреть файл

@ -96,7 +96,9 @@ module Test_SyncDefaultGems
if dir == "src"
Dir.mkdir("#{dir}/lib")
File.write("#{dir}/lib/fine.rb", "return\n")
system(*%W"git add lib/fine.rb", exception: true, chdir: dir)
Dir.mkdir("#{dir}/test")
File.write("#{dir}/test/test_fine.rb", "return\n")
system(*%W"git add lib/fine.rb test/test_fine.rb", exception: true, chdir: dir)
system(*%W"git commit -q -m", "Looks fine", exception: true, chdir: dir)
end
Dir.mkdir("#{dir}/tool")
@ -154,6 +156,20 @@ module Test_SyncDefaultGems
assert_equal(@sha["src"], IO.popen(%W[git log --format=%H -1], chdir: "src", &:read).chomp, out)
end
def test_skip_test_fixtures
Dir.mkdir("#@target/test")
Dir.mkdir("#@target/test/fixtures")
File.write("#@target/test/fixtures/fixme.rb", "")
system(*%W"git add test/fixtures/fixme.rb", exception: true, chdir: @target)
system(*%W"git commit -q -m", "Add fitures", exception: true, chdir: @target)
out = capture_process_output_to([STDOUT, STDERR]) do
Dir.chdir("src") do
SyncDefaultGems.sync_default_gems_with_commits(@target, ["#{@sha[@target]}..#{@target}/default"])
end
end
assert_equal(@sha["src"], IO.popen(%W[git log --format=%H -1], chdir: "src", &:read).chomp, out)
end
def test_skip_toplevel
Dir.mkdir("#@target/docs")
File.write("#@target/docs/NEWS.md", "= NEWS!!!\n")