...
Run Format

Source file test/sinit_run.go

Documentation: test

     1  // +build !nacl,!js
     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"
    15  	"os"
    16  	"os/exec"
    17  )
    18  
    19  func main() {
    20  	cmd := exec.Command("go", "tool", "compile", "-S", "sinit.go")
    21  	out, err := cmd.CombinedOutput()
    22  	if err != nil {
    23  		fmt.Println(string(out))
    24  		fmt.Println(err)
    25  		os.Exit(1)
    26  	}
    27  	os.Remove("sinit.o")
    28  
    29  	if bytes.Contains(out, []byte("initdone")) {
    30  		fmt.Println("sinit generated an init function")
    31  		os.Exit(1)
    32  	}
    33  }
    34  

View as plain text