Russ Cox | c99616f | 2014-11-09 21:10:49 -0500 | [diff] [blame] | 1 | // +build !nacl |
Josh Bleecher Snyder | 9b54444 | 2014-11-06 15:14:08 -0500 | [diff] [blame] | 2 | // run |
| 3 | |
| 4 | // Copyright 2014 The Go Authors. All rights reserved. |
| 5 | // Use of this source code is governed by a BSD-style |
| 6 | // license that can be found in the LICENSE file. |
| 7 | |
| 8 | // Run the sinit test. |
| 9 | |
| 10 | package main |
| 11 | |
| 12 | import ( |
| 13 | "bytes" |
| 14 | "fmt" |
Josh Bleecher Snyder | 9b54444 | 2014-11-06 15:14:08 -0500 | [diff] [blame] | 15 | "os" |
| 16 | "os/exec" |
| 17 | ) |
| 18 | |
| 19 | func main() { |
Russ Cox | 0f4132c | 2015-05-21 13:28:13 -0400 | [diff] [blame] | 20 | cmd := exec.Command("go", "tool", "compile", "-S", "sinit.go") |
Josh Bleecher Snyder | 9b54444 | 2014-11-06 15:14:08 -0500 | [diff] [blame] | 21 | out, err := cmd.CombinedOutput() |
| 22 | if err != nil { |
| 23 | fmt.Println(string(out)) |
| 24 | fmt.Println(err) |
| 25 | os.Exit(1) |
| 26 | } |
Russ Cox | cf932cd | 2015-05-21 13:28:17 -0400 | [diff] [blame] | 27 | os.Remove("sinit.o") |
Josh Bleecher Snyder | 9b54444 | 2014-11-06 15:14:08 -0500 | [diff] [blame] | 28 | |
| 29 | if bytes.Contains(out, []byte("initdone")) { |
| 30 | fmt.Println("sinit generated an init function") |
| 31 | os.Exit(1) |
| 32 | } |
| 33 | } |