[ Agent ] [ Executor ] - add systemc shutdown service
This commit is contained in:
@@ -3,6 +3,7 @@ package executor
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -117,3 +118,51 @@ func TestPipelineCommandExecutor(t *testing.T) {
|
||||
t.Logf("command result are 下 \n")
|
||||
BasicPrettyPrint(ok, resultLog)
|
||||
}
|
||||
|
||||
func TestSimple(t *testing.T) {
|
||||
|
||||
for i := 0; i < 10; i++ {
|
||||
var output bytes.Buffer
|
||||
|
||||
fmt.Printf("output address is => %p \n", &output)
|
||||
|
||||
}
|
||||
fmt.Println()
|
||||
var output bytes.Buffer
|
||||
fmt.Printf("out is => %#v\n", output)
|
||||
|
||||
command := exec.Command("ls")
|
||||
command.StdoutPipe()
|
||||
|
||||
}
|
||||
|
||||
func TestFileBasedPipe(t *testing.T) {
|
||||
reader, writer, err := os.Pipe()
|
||||
if err != nil {
|
||||
fmt.Printf("Error: Couldn't create the named pipe: %s\n", err)
|
||||
}
|
||||
go func() {
|
||||
|
||||
output := make([]byte, 100)
|
||||
n, err := reader.Read(output)
|
||||
if err != nil {
|
||||
fmt.Printf("Error: Couldn't read data from the named pipe: %s\n", err)
|
||||
}
|
||||
fmt.Printf("Read %d byte(s). [file-based pipe]\n", n)
|
||||
|
||||
fmt.Printf("Read content are => %s\n", string(output))
|
||||
|
||||
}()
|
||||
|
||||
input := make([]byte, 26)
|
||||
for i := 65; i <= 90; i++ {
|
||||
input[i-65] = byte(i)
|
||||
}
|
||||
n, err := writer.Write(input)
|
||||
if err != nil {
|
||||
fmt.Printf("Error: Couldn't write data to the named pipe: %s\n", err)
|
||||
}
|
||||
fmt.Printf("Written %d byte(s). [file-based pipe]\n", n)
|
||||
//time.Sleep(200 * time.Millisecond)
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user