From a96d19c04e78504ba339041b6766be4b9d35936c Mon Sep 17 00:00:00 2001 From: ichern Date: Tue, 18 Jun 2019 23:52:37 -0700 Subject: [PATCH] Correct pluto repository directory in skylark_git_repository_test.sh, the test for shallow option with a commit before the shallow date does not fail any more, as the callback without shallow options gets invoked under cover. Add comment about that, keep the test for now to demonstrate the new behavior, and remove the test as superficial in the following commit. Closes #8667. PiperOrigin-RevId: 253940289 --- .../bazel/skylark_git_repository_test.sh | 46 ++++++------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/src/test/shell/bazel/skylark_git_repository_test.sh b/src/test/shell/bazel/skylark_git_repository_test.sh index c4e14982ef57b3..e4645b31d02668 100755 --- a/src/test/shell/bazel/skylark_git_repository_test.sh +++ b/src/test/shell/bazel/skylark_git_repository_test.sh @@ -90,6 +90,10 @@ function set_up() { export XDG_CONFIG_HOME= } +function get_pluto_repo() { + echo "$TEST_TMPDIR/repos/pluto" +} + # Test cloning a Git repository using the git_repository rule. # # This test uses the pluto Git repository at tag 1-build, which contains the @@ -119,7 +123,7 @@ function set_up() { # # //planets has a dependency on a target in the pluto Git repository. function do_git_repository_test() { - local pluto_repo_dir=$TEST_TMPDIR/repos/pluto + local pluto_repo_dir=$(get_pluto_repo) # Commit corresponds to tag 1-build. See testdata/pluto.git_log. local commit_hash="$1" local strip_prefix="" @@ -169,8 +173,9 @@ function test_git_repository_strip_prefix() { } function test_git_repository_shallow_since() { - # This date is the day the commit was made. - do_git_repository_test "52f9a3f87a2dd17ae0e5847bbae9734f09354afd" "" "2016-07-16" + # This date is the previous day before the commit was made. + # We need the revious day, because git adds current time to the specified date. + do_git_repository_test "52f9a3f87a2dd17ae0e5847bbae9734f09354afd" "" "2015-07-15" } function test_new_git_repository_with_build_file() { do_new_git_repository_test "0-initial" "build_file" @@ -214,7 +219,7 @@ function test_new_git_repository_with_build_file_content_strip_prefix() { # //planets has a dependency on a target in the $TEST_TMPDIR/pluto Git # repository. function do_new_git_repository_test() { - local pluto_repo_dir=$TEST_TMPDIR/repos/pluto + local pluto_repo_dir=$(get_pluto_repo) local strip_prefix="" [ $# -eq 3 ] && strip_prefix="strip_prefix=\"$3\"," @@ -526,7 +531,7 @@ EOF # info function test_git_repository_both_commit_tag_error() { setup_error_test - local pluto_repo_dir=$TEST_TMPDIR/repos/pluto + local pluto_repo_dir=$(get_pluto_repo) # Commit corresponds to tag 1-build. See testdata/pluto.git_log. local commit_hash="52f9a3f87a2dd17ae0e5847bbae9734f09354afd" @@ -557,7 +562,7 @@ EOF # info function test_git_repository_no_commit_tag_error() { setup_error_test - local pluto_repo_dir=$TEST_TMPDIR/repos/pluto + local pluto_repo_dir=$(get_pluto_repo) cd $WORKSPACE_DIR cat > WORKSPACE < WORKSPACE < WORKSPACE < WORKSPACE <& $TEST_log \ - || echo "Expect run to fail." - expect_log "error cloning" -} - run_suite "skylark git_repository tests"