From 3a282370c6a0187af31cd1322a7583a7e539de36 Mon Sep 17 00:00:00 2001 From: Ibrahim AshShohail Date: Fri, 2 Jun 2017 19:19:59 +0300 Subject: [PATCH] wip Signed-off-by: Ibrahim AshShohail --- cmd/dep/ensure.go | 12 ++++++------ internal/gps/hash_test.go | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/cmd/dep/ensure.go b/cmd/dep/ensure.go index a11b449a0a..554c464eff 100644 --- a/cmd/dep/ensure.go +++ b/cmd/dep/ensure.go @@ -144,12 +144,6 @@ func (cmd *ensureCommand) Run(ctx *dep.Ctx, args []string) error { solver, err := gps.Prepare(params, sm) if err != nil { - return errors.Wrap(err, "ensure Prepare") - } - - solution, err := solver.Solve() - if err != nil { - handleAllTheFailuresOfTheWorld(err) if deduceErrs, ok := err.(gps.DeductionFailureErrs); ok { ctx.Loggers.Err.Println("The following errors occurred while deducing packages:") for ip, dErr := range deduceErrs { @@ -157,6 +151,12 @@ func (cmd *ensureCommand) Run(ctx *dep.Ctx, args []string) error { } ctx.Loggers.Err.Println() } + return errors.Wrap(err, "ensure Prepare") + } + + solution, err := solver.Solve() + if err != nil { + handleAllTheFailuresOfTheWorld(err) return errors.Wrap(err, "ensure Solve()") } diff --git a/internal/gps/hash_test.go b/internal/gps/hash_test.go index 220eebae5d..5a7dc28269 100644 --- a/internal/gps/hash_test.go +++ b/internal/gps/hash_test.go @@ -27,6 +27,13 @@ func TestHashInputs(t *testing.T) { s, err := Prepare(params, newdepspecSM(fix.ds, nil)) if err != nil { + if deduceErrs, ok := err.(DeductionFailureErrs); ok { + t.Error("The following errors occurred while deducing packages:") + for ip, dErr := range deduceErrs { + t.Errorf(" * \"%s\": %s", ip, dErr) + } + t.Error() + } t.Fatalf("Unexpected error while prepping solver: %s", err) } @@ -80,6 +87,13 @@ func TestHashInputsReqsIgs(t *testing.T) { s, err := Prepare(params, newdepspecSM(fix.ds, nil)) if err != nil { + if deduceErrs, ok := err.(DeductionFailureErrs); ok { + t.Error("The following errors occurred while deducing packages:") + for ip, dErr := range deduceErrs { + t.Errorf(" * \"%s\": %s", ip, dErr) + } + t.Error() + } t.Fatalf("Unexpected error while prepping solver: %s", err) } @@ -122,6 +136,13 @@ func TestHashInputsReqsIgs(t *testing.T) { s, err = Prepare(params, newdepspecSM(fix.ds, nil)) if err != nil { + if deduceErrs, ok := err.(DeductionFailureErrs); ok { + t.Error("The following errors occurred while deducing packages:") + for ip, dErr := range deduceErrs { + t.Errorf(" * \"%s\": %s", ip, dErr) + } + t.Error() + } t.Fatalf("Unexpected error while prepping solver: %s", err) } @@ -162,6 +183,13 @@ func TestHashInputsReqsIgs(t *testing.T) { s, err = Prepare(params, newdepspecSM(fix.ds, nil)) if err != nil { + if deduceErrs, ok := err.(DeductionFailureErrs); ok { + t.Error("The following errors occurred while deducing packages:") + for ip, dErr := range deduceErrs { + t.Errorf(" * \"%s\": %s", ip, dErr) + } + t.Error() + } t.Fatalf("Unexpected error while prepping solver: %s", err) } @@ -528,7 +556,15 @@ func TestHashInputsOverrides(t *testing.T) { s, err := Prepare(params, newdepspecSM(basefix.ds, nil)) if err != nil { - t.Fatalf("(fix: %q) Unexpected error while prepping solver: %s", fix.name, err) + if deduceErrs, ok := err.(DeductionFailureErrs); ok { + t.Error("The following errors occurred while deducing packages:") + for ip, dErr := range deduceErrs { + t.Errorf(" * \"%s\": %s", ip, dErr) + } + t.Error() + } + t.Errorf("(fix: %q) Unexpected error while prepping solver: %s", fix.name, err) + continue } h := sha256.New()