-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease_test.go
64 lines (58 loc) · 1.98 KB
/
release_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package main
//This file holds test performed on binaries and should only be ran after the main_test.go file
import (
"bytes"
"fmt"
"os/exec"
"testing"
)
// fmt.Println("Test Init when not yet inited")
// cmd := exec.Command("/usr/bin/bash", "-c", "export PATH=$PATH:/usr/local/go/bin; go run main.go logger.go lexer.go init")
// cmd.Stdout = &stdout
// cmd.Stderr = &stderr
// err = cmd.Run()
// if err != nil {
// t.Fatal("Error initing flowcat", err.Error())
// }
// if stdout.String() != "" {
// fmt.Println(stdout.String())
// }
func TestBuildBinaries(t *testing.T) {
var stdout bytes.Buffer
var stderr bytes.Buffer
// Create the binaries
fmt.Println("Building binary for darwin-arm64")
// env GOOS=darwin GOARCH=arm64 GO111MODULE=auto go build *.go -o bin/flowcat-darwin-arm64/flowcat
cmd := exec.Command("/usr/bin/bash", "-c", "export PATH=$PATH:/usr/local/go/bin; env GOOS=darwin GOARCH=arm64 GO111MODULE=auto go build -o bin/flowcat-darwin-arm64/flowcat")
cmd.Stdout = &stdout
cmd.Stderr = &stderr
err := cmd.Run()
if err != nil {
t.Fatal("Error compiling binary darwin-arm64", err.Error())
}
if stdout.String() != "" {
fmt.Println(stdout.String())
}
fmt.Println("Building binary for linux-386")
cmd = exec.Command("/usr/bin/bash", "-c", "export PATH=$PATH:/usr/local/go/bin; env GOOS=linux GOARCH=386 GO111MODULE=auto go build -o bin/flowcat-linux-386/flowcat")
cmd.Stdout = &stdout
cmd.Stderr = &stderr
err = cmd.Run()
if err != nil {
t.Fatal("Error compiling binary linux-386", err.Error())
}
if stdout.String() != "" {
fmt.Println(stdout.String())
}
fmt.Println("Building binary for linux-amd64")
cmd = exec.Command("/usr/bin/bash", "-c", "export PATH=$PATH:/usr/local/go/bin; env GOOS=linux GOARCH=amd64 GO111MODULE=auto go build -o bin/flowcat-linux-amd64/flowcat")
cmd.Stdout = &stdout
cmd.Stderr = &stderr
err = cmd.Run()
if err != nil {
t.Fatal("Error compiling binary linux-amd64", err.Error())
}
if stdout.String() != "" {
fmt.Println(stdout.String())
}
}