Run recovery handoffs for the host target
This commit is contained in:
@@ -142,16 +142,17 @@ func selectedPublicationRecoveryCommand(ctx context.Context, result releasekit.P
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if len(args) > 0 {
|
||||
command := "env GOWORK=off GOTOOLCHAIN=local go"
|
||||
for _, arg := range args {
|
||||
if args != nil {
|
||||
prefix := "go -C " + shellQuote(git.DisplayDiagnostic(args.Directory))
|
||||
command := "(export GOWORK=off GOTOOLCHAIN=local && releasekit_host_os=$(" + prefix + " env GOHOSTOS) && releasekit_host_arch=$(" + prefix + " env GOHOSTARCH) && GOOS=\"$releasekit_host_os\" GOARCH=\"$releasekit_host_arch\" " + prefix
|
||||
for _, arg := range args.Args {
|
||||
command += " " + shellQuote(git.DisplayDiagnostic(arg))
|
||||
}
|
||||
path, err := filepath.Abs(git.DisplayDiagnostic(result.RecordPath))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return command + " reconcile --record " + shellQuote(path), nil
|
||||
return command + " reconcile --record " + shellQuote(path) + ")", nil
|
||||
}
|
||||
}
|
||||
return publicationRecoveryCommand(result.RecordPath)
|
||||
|
||||
@@ -256,7 +256,8 @@ func TestColdGoToolRecoverySurvivesLauncherExit(t *testing.T) {
|
||||
}
|
||||
// Execute from another directory after the original driver and the
|
||||
// API-only launcher's temporary files are gone.
|
||||
evidence, err := publish.LoadEvidence(outputLineValue(text, "publication record saved: "))
|
||||
originalRecord := outputLineValue(text, "publication record saved: ")
|
||||
evidence, err := publish.LoadEvidence(originalRecord)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -277,10 +278,12 @@ func TestColdGoToolRecoverySurvivesLauncherExit(t *testing.T) {
|
||||
}
|
||||
selected := command
|
||||
if scenario.record != "" {
|
||||
selected += " --record " + shellQuote(scenario.record)
|
||||
selected = strings.Replace(selected, shellQuote(originalRecord), shellQuote(scenario.record), 1)
|
||||
}
|
||||
recovery := exec.Command("sh", "-c", selected)
|
||||
recovery.Dir = t.TempDir()
|
||||
foreignOS, foreignArch := foreignTarget()
|
||||
recovery.Env = setEnvironment(setEnvironment(os.Environ(), "GOOS", foreignOS), "GOARCH", foreignArch)
|
||||
recovered, err := recovery.CombinedOutput()
|
||||
if scenario.status == 0 && err != nil || scenario.status != 0 && (!errors.As(err, &exitError) || exitError.ExitCode() != scenario.status) {
|
||||
t.Fatalf("recovery status want %d: %v: %s", scenario.status, err, recovered)
|
||||
|
||||
Reference in New Issue
Block a user