1
0
mirror of https://github.com/golang/go synced 2024-11-26 06:27:58 -07:00

cmd/go/internal/mvs: clarify and annotate test cases

For #36460

Change-Id: I5a8be8f36fb8825ffa08ed1427cb1e15b106b31a
Reviewed-on: https://go-review.googlesource.com/c/go/+/287732
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
Bryan C. Mills 2021-01-28 17:01:54 -05:00
parent a76efea1fe
commit a5c8a15f64

View File

@ -31,6 +31,8 @@ A2: B1 C4 D4
build A: A B1 C2 D4 E2 F1
upgrade* A: A B1 C4 D5 E2 F1 G1
upgrade A C4: A B1 C4 D4 E2 F1 G1
build A2: A2 B1 C4 D4 E2 F1 G1
# BUG: selected versions E2 and F1 are not preserved.
downgrade A2 D2: A2 C4 D2
name: trim
@ -214,6 +216,7 @@ A: B2
B1: C1
B2: C2
build A: A B2 C2
# BUG: build list from downgrade omits selected version C1.
downgrade A C1: A B1
name: down2
@ -227,12 +230,56 @@ D2: B2
E2: D2
E1:
F1:
build A: A B2 C2 D2 E2 F2
# BUG: selected versions C1 and D1 are not preserved, and
# requested version F1 is not selected.
downgrade A F1: A B1 E1
# https://research.swtch.com/vgo-mvs#algorithm_4:
# [D]owngrades are constrained to only downgrade packages, not also upgrade
# them; if an upgrade before downgrade is needed, the user must ask for it
# explicitly.
#
# Here, downgrading B2 to B1 upgrades C1 to C2, and C2 does not depend on D2.
# However, C2 would be an upgrade not a downgrade so B1 must also be
# rejected.
name: downcross1
A: B2 C1
B1: C2
B2: C1
C1: D2
C2:
D1:
D2:
build A: A B2 C1 D2
# BUG: requested version D1 is not selected.
downgrade A D1: A
# https://research.swtch.com/vgo-mvs#algorithm_4:
# Unlike upgrades, downgrades must work by removing requirements, not adding
# them.
#
# However, downgrading a requirement may introduce a new requirement on a
# previously-unrequired module. If each dependency's requirements are complete
# (tidy), that can't change the behavior of any other package whose version is
# not also being downgraded, so we should allow it.
name: downcross2
A: B2
B1: C1
B2: D2
C1:
D1:
D2:
build A: A B2 D2
# BUG: requested version D1 is not selected,
# and selected version C1 is omitted from the returned build list.
downgrade A D1: A B1
name: downcycle
A: A B2
B2: A
B1:
build A: A B2
downgrade A B1: A B1
# golang.org/issue/25542.
@ -240,6 +287,7 @@ name: noprev1
A: B4 C2
B2.hidden:
C2:
build A: A B4 C2
downgrade A B2.hidden: A B2.hidden C2
name: noprev2
@ -247,6 +295,7 @@ A: B4 C2
B2.hidden:
B1:
C2:
build A: A B4 C2
downgrade A B2.hidden: A B2.hidden C2
name: noprev3
@ -254,6 +303,7 @@ A: B4 C2
B3:
B2.hidden:
C2:
build A: A B4 C2
downgrade A B2.hidden: A B2.hidden C2
# Cycles involving the target.