aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/shell
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2015-12-09 08:57:08 +0000
committerGravatar Lukacs Berki <lberki@google.com>2015-12-09 14:47:15 +0000
commit6aff7f4f2bf0c6418fb88e967653f2feeb83819e (patch)
tree2e7bf4d0e8acd2ee1359cd314a432e00319c88b3 /src/test/shell
parentcdf0c157750fb663814754f77a6d41b3d36c690d (diff)
Refactor external repository support significantly to solve a number of issues.
In particular: - Separate the implementation of maven_server into a RepositoryFunction and one that creates the MavenServerValue (ideally, maven_server wouldn't exist but we'll have to make to for the time being) - Refactor the logic of determining whether an external repository needs to be re-fetched to RepositoryDelegatorFunction - Make RepositoryFunctions not be SkyFunctions anymore (they are called from RepositoryDelegatorFunction, though, who *is* a SkyFunction) - Add a Skyframe dirtiness checker that makes --nofetch RepositoryValues not be cached - Add a bunch of test cases and javadoc There is only one wart that I know of that remains: changes to BUILD files of new_* repository rules that weren't refetched when their RepositoryValue was initiall created on server restart won't take effect. This is because we don't add those BUILD files to the created RepositoryValue. This will fix itself once the ExternalFilesHelper refactoring is submitted. -- MOS_MIGRATED_REVID=109768345
Diffstat (limited to 'src/test/shell')
-rwxr-xr-xsrc/test/shell/bazel/git_repository_test.sh47
-rwxr-xr-xsrc/test/shell/bazel/maven_test.sh2
2 files changed, 48 insertions, 1 deletions
diff --git a/src/test/shell/bazel/git_repository_test.sh b/src/test/shell/bazel/git_repository_test.sh
index 4beda0c47b..e9061d5b6c 100755
--- a/src/test/shell/bazel/git_repository_test.sh
+++ b/src/test/shell/bazel/git_repository_test.sh
@@ -267,6 +267,53 @@ EOF
}
+function test_git_repository_refetched_when_commit_changes() {
+ local repo_dir=$TEST_TMPDIR/repos/refetch
+
+ cd $WORKSPACE_DIR
+ cat > WORKSPACE <<EOF
+git_repository(name='g', remote='$repo_dir', commit='f0b79ff0')
+EOF
+
+ bazel build @g//:g >& $TEST_log || fail "Build failed"
+ expect_log "Cloning"
+ assert_contains "GIT 1" bazel-genfiles/external/g/go
+
+ cat > WORKSPACE <<EOF
+git_repository(name='g', remote='$repo_dir', commit='62777acc')
+EOF
+
+
+ bazel build @g//:g >& $TEST_log || fail "Build failed"
+ expect_log "Cloning"
+ assert_contains "GIT 2" bazel-genfiles/external/g/go
+}
+
+function test_git_repository_and_nofetch() {
+ local repo_dir=$TEST_TMPDIR/repos/refetch
+
+ cd $WORKSPACE_DIR
+ cat > WORKSPACE <<EOF
+git_repository(name='g', remote='$repo_dir', commit='f0b79ff0')
+EOF
+
+ bazel build --nofetch @g//:g >& $TEST_log && fail "Build succeeded"
+ expect_log "fetching repositories is disabled"
+ bazel build @g//:g >& $TEST_log || fail "Build failed"
+ assert_contains "GIT 1" bazel-genfiles/external/g/go
+
+ cat > WORKSPACE <<EOF
+git_repository(name='g', remote='$repo_dir', commit='62777acc')
+EOF
+
+
+ bazel build --nofetch @g//:g >& $TEST_log || fail "Build failed"
+ expect_log "External repository 'g' is not up-to-date"
+ assert_contains "GIT 1" bazel-genfiles/external/g/go
+ bazel build @g//:g >& $TEST_log || fail "Build failed"
+ assert_contains "GIT 2" bazel-genfiles/external/g/go
+}
+
# Helper function for setting up the workspace as follows
#
# $WORKSPACE_DIR/
diff --git a/src/test/shell/bazel/maven_test.sh b/src/test/shell/bazel/maven_test.sh
index 94683e6738..4f36ef61d5 100755
--- a/src/test/shell/bazel/maven_test.sh
+++ b/src/test/shell/bazel/maven_test.sh
@@ -213,7 +213,7 @@ EOF
chmod +x y.sh
bazel build //:y &> $TEST_log && fail "Building thing failed"
- expect_log "no such package '@x//'"
+ expect_log "does not represent an actual repository"
}
function test_auth() {