Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ewianda committed Apr 24, 2024
1 parent 974af11 commit f3f3d1e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build --test_output=errors
2 changes: 1 addition & 1 deletion pkg/private/pkg_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def add_from_default_info(
_check_dest(mapping_context.content_map, d_path, rf, src.label, mapping_context.allow_duplicates_with_different_content)
mapping_context.content_map[d_path] = _DestFile(
src = rf,
entry_type = ENTRY_IS_DIR if rf.is_directory else ENTRY_IS_FILE,
entry_type = ENTRY_IS_TREE if rf.is_directory else ENTRY_IS_FILE,
origin = src.label,
mode = fmode,
user = mapping_context.default_user,
Expand Down
45 changes: 42 additions & 3 deletions tests/tar/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ pkg_tar(

fake_artifact(
name = "a_program",
executable = True,
files = ["//tests:testdata/executable.sh"],
runfiles = ["BUILD"],
executable = True,
)

pkg_tar(
Expand All @@ -339,7 +339,6 @@ pkg_tar(

verify_archive_test(
name = "runfiles_test",
target = ":test-tar-with-runfiles",
must_contain = [
"a_program",
"a_program.runfiles/_main/tests/tar/BUILD",
Expand All @@ -356,8 +355,9 @@ verify_archive_test(
"an_executable.runfiles/_main/tests/foo.cc",
"an_executable.runfiles/_main/tests/an_executable",
"an_executable.runfiles/_main/tests/testdata/hello.txt",
]
],
}),
target = ":test-tar-with-runfiles",
)

pkg_tar(
Expand Down Expand Up @@ -710,3 +710,42 @@ verify_archive_test(
"new/base/something/this": "that",
},
)

fake_artifact(
name = "program_with_dir_runfiles",
files = ["//tests:testdata/executable.sh"],
runfiles = [
":generate_tree",
],
)

pkg_tar(
name = "program_with_dir_runfiles_tar",
srcs = [
":program_with_dir_runfiles",
],
include_runfiles = True,
)

verify_archive_test(
name = "program_with_dir_runfiles_test",
must_contain = [
"program_with_dir_runfiles.runfiles",
"program_with_dir_runfiles.runfiles/_main",
"program_with_dir_runfiles.runfiles/_main/tests",
"program_with_dir_runfiles.runfiles/_main/tests/tar",
"program_with_dir_runfiles.runfiles/_main/tests/tar/generate_tree",
"program_with_dir_runfiles.runfiles/_main/tests/tar/generate_tree/a",
"program_with_dir_runfiles.runfiles/_main/tests/tar/generate_tree/a/a",
"program_with_dir_runfiles.runfiles/_main/tests/tar/generate_tree/a/b",
"program_with_dir_runfiles.runfiles/_main/tests/tar/generate_tree/a/b/c",
"program_with_dir_runfiles.runfiles/_main/tests/tar/generate_tree/b",
"program_with_dir_runfiles.runfiles/_main/tests/tar/generate_tree/b/c",
"program_with_dir_runfiles.runfiles/_main/tests/tar/generate_tree/b/c/d",
"program_with_dir_runfiles.runfiles/_main/tests/tar/generate_tree/b/d",
"program_with_dir_runfiles.runfiles/_main/tests/tar/generate_tree/b/e",
"executable.sh",
"program_with_dir_runfiles",
],
target = ":program_with_dir_runfiles_tar",
)

0 comments on commit f3f3d1e

Please sign in to comment.