blob: c9afd3b77719a20bceb0b364ed470a477c735619 [file] [log] [blame]
Russ Coxc99616f2014-11-09 21:10:49 -05001// +build !nacl
Josh Bleecher Snyder9b544442014-11-06 15:14:08 -05002// 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
10package main
11
12import (
13 "bytes"
14 "fmt"
Josh Bleecher Snyder9b544442014-11-06 15:14:08 -050015 "os"
16 "os/exec"
17)
18
19func main() {
Russ Cox0f4132c2015-05-21 13:28:13 -040020 cmd := exec.Command("go", "tool", "compile", "-S", "sinit.go")
Josh Bleecher Snyder9b544442014-11-06 15:14:08 -050021 out, err := cmd.CombinedOutput()
22 if err != nil {
23 fmt.Println(string(out))
24 fmt.Println(err)
25 os.Exit(1)
26 }
Russ Coxcf932cd2015-05-21 13:28:17 -040027 os.Remove("sinit.o")
Josh Bleecher Snyder9b544442014-11-06 15:14:08 -050028
29 if bytes.Contains(out, []byte("initdone")) {
30 fmt.Println("sinit generated an init function")
31 os.Exit(1)
32 }
33}