blob: e4de25d5d00e8912126a06d0fd48e8019829668b [file] [log] [blame]
Ian Lance Taylorc5de72b2014-12-08 10:28:18 -08001// +build !nacl
2// run
Russ Coxcd22afa2012-09-23 13:16:14 -04003
Emmanuel Odeke53fd5222016-04-10 14:32:26 -07004// Copyright 2010 The Go Authors. All rights reserved.
Russ Coxa9a62ee2010-08-10 17:39:38 -07005// Use of this source code is governed by a BSD-style
6// license that can be found in the LICENSE file.
7
Ian Lance Taylorc5de72b2014-12-08 10:28:18 -08008package main
9
10import (
11 "fmt"
Ian Lance Taylorc5de72b2014-12-08 10:28:18 -080012 "os"
13 "os/exec"
14 "path/filepath"
Ian Lance Taylorc5de72b2014-12-08 10:28:18 -080015)
16
17func main() {
Russ Cox0f4132c2015-05-21 13:28:13 -040018 run("go", "tool", "compile", filepath.Join("fixedbugs", "bug302.dir", "p.go"))
Russ Coxcf932cd2015-05-21 13:28:17 -040019 run("go", "tool", "pack", "grc", "pp.a", "p.o")
Russ Cox0f4132c2015-05-21 13:28:13 -040020 run("go", "tool", "compile", "-I", ".", filepath.Join("fixedbugs", "bug302.dir", "main.go"))
Russ Coxcf932cd2015-05-21 13:28:17 -040021 os.Remove("p.o")
Ian Lance Taylorc5de72b2014-12-08 10:28:18 -080022 os.Remove("pp.a")
Russ Coxcf932cd2015-05-21 13:28:17 -040023 os.Remove("main.o")
Ian Lance Taylorc5de72b2014-12-08 10:28:18 -080024}
25
26func run(cmd string, args ...string) {
27 out, err := exec.Command(cmd, args...).CombinedOutput()
28 if err != nil {
29 fmt.Println(string(out))
30 fmt.Println(err)
31 os.Exit(1)
32 }
33}