diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-08-13 15:30:58 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-08-13 15:30:58 +0900 |
commit | eb221a37349806bc202dbea2c088754c674605fc (patch) | |
tree | f95e8a7f36b2f272cc1ebc61d6abedd4a2984fb9 | |
parent | 83718b6bb299c483e60a638ccce98bc8ae1665a1 (diff) | |
download | ruby-eb221a37349806bc202dbea2c088754c674605fc.tar.gz |
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.
-rwxr-xr-x | tool/sync_default_gems.rb | 2 | ||||
-rwxr-xr-x | tool/test/test_sync_default_gems.rb | 18 |
2 files changed, 18 insertions, 2 deletions
diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index a7785a989c..d2c17f35af 100755 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -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) diff --git a/tool/test/test_sync_default_gems.rb b/tool/test/test_sync_default_gems.rb index aa72dcfb20..e6c654ed55 100755 --- a/tool/test/test_sync_default_gems.rb +++ b/tool/test/test_sync_default_gems.rb @@ -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") |