aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/mvs/mvs_test.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2021-02-18 20:20:12 -0500
committerBryan C. Mills <bcmills@google.com>2021-02-25 16:45:36 +0000
commit2c4c189bba57a4a72c371afa7e544c16abd76ffa (patch)
treedb7fb55f102bc434989b0f13e29f2f1a7d809b96 /src/cmd/go/internal/mvs/mvs_test.go
parent9fe8ebf9b49e632db54aa60809e2019a2a87e28b (diff)
downloadgo-2c4c189bba57a4a72c371afa7e544c16abd76ffa.tar.gz
go-2c4c189bba57a4a72c371afa7e544c16abd76ffa.zip
cmd/go/internal/mvs: add test cases for downgrade interaction with hidden versions
For #36460 Change-Id: I889c4ece0d2caff7528cf437f89f7446dbd83955 Reviewed-on: https://go-review.googlesource.com/c/go/+/294292 Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/go/internal/mvs/mvs_test.go')
-rw-r--r--src/cmd/go/internal/mvs/mvs_test.go53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/cmd/go/internal/mvs/mvs_test.go b/src/cmd/go/internal/mvs/mvs_test.go
index 742e396e0d..661f68be08 100644
--- a/src/cmd/go/internal/mvs/mvs_test.go
+++ b/src/cmd/go/internal/mvs/mvs_test.go
@@ -275,6 +275,59 @@ B1:
build A: A B2
downgrade A B1: A B1
+# Both B3 and C2 require D2.
+# If we downgrade D to D1, then in isolation B3 would downgrade to B1,
+# because B2 is hidden — B1 is the next-highest version that is not hidden.
+# However, if we downgrade D, we will also downgrade C to C1.
+# And C1 requires B2.hidden, and B2.hidden also meets our requirements:
+# it is compatible with D1 and a strict downgrade from B3.
+#
+# BUG(?): B2.hidden does not require E1, so there is no need for E1
+# to appear in the final build list. Nonetheless, there it is.
+#
+name: downhiddenartifact
+A: B3 C2
+A1: B3
+B1: E1
+B2.hidden:
+B3: D2
+C1: B2.hidden
+C2: D2
+D1:
+D2:
+build A1: A1 B3 D2
+downgrade A1 D1: A1 B1 D1 E1
+build A: A B3 C2 D2
+downgrade A D1: A B2.hidden C1 D1 E1
+
+# Both B3 and C3 require D2.
+# If we downgrade D to D1, then in isolation B3 would downgrade to B1,
+# and C3 would downgrade to C1.
+# But C1 requires B2.hidden, and B1 requires C2.hidden, so we can't
+# downgrade to either of those without pulling the other back up a little.
+#
+# B2.hidden and C2.hidden are both compatible with D1, so that still
+# meets our requirements — but then we're in an odd state in which
+# B and C have both been downgraded to hidden versions, without any
+# remaining requirements to explain how those hidden versions got there.
+#
+# TODO(bcmills): Would it be better to force downgrades to land on non-hidden
+# versions?
+# In this case, that would remove the dependencies on B and C entirely.
+#
+name: downhiddencross
+A: B3 C3
+B1: C2.hidden
+B2.hidden:
+B3: D2
+C1: B2.hidden
+C2.hidden:
+C3: D2
+D1:
+D2:
+build A: A B3 C3 D2
+downgrade A D1: A B2.hidden C2.hidden D1
+
# golang.org/issue/25542.
name: noprev1
A: B4 C2