Source file test/fixedbugs/issue37513.dir/main.go

     1  // Copyright 2020 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	"bytes"
     9  	"fmt"
    10  	"os"
    11  	"os/exec"
    12  )
    13  
    14  func main() {
    15  	if len(os.Args) > 1 {
    16  		// Generate a SIGILL.
    17  		sigill()
    18  		return
    19  	}
    20  	// Run ourselves with an extra argument. That process should SIGILL.
    21  	out, _ := exec.Command(os.Args[0], "foo").CombinedOutput()
    22  	want := "instruction bytes: 0xf 0xb 0xc3"
    23  	if !bytes.Contains(out, []byte(want)) {
    24  		fmt.Printf("got:\n%s\nwant:\n%s\n", string(out), want)
    25  	}
    26  }
    27  func sigill()
    28  

View as plain text