forked from layeh/radius
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd_test.go
50 lines (42 loc) · 1002 Bytes
/
cmd_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
package radius_test
import (
"io/ioutil"
"os"
"os/exec"
"testing"
)
func Test_cmd_radiusdictgen(t *testing.T) {
t.Parallel()
name := tempFile(t)
defer os.Remove(name)
output, err := exec.Command("go", "build", "-o", name, "layeh.com/radius/cmd/radius-dict-gen").CombinedOutput()
if err != nil {
t.Fatalf("%s\n", output)
}
}
func Test_cmd_radserver(t *testing.T) {
t.Parallel()
name := tempFile(t)
defer os.Remove(name)
output, err := exec.Command("go", "build", "-o", name, "layeh.com/radius/cmd/radserver").CombinedOutput()
if err != nil {
t.Fatalf("%s\n", output)
}
}
func Test_cmd_radtest(t *testing.T) {
t.Parallel()
name := tempFile(t)
defer os.Remove(name)
output, err := exec.Command("go", "build", "-o", name, "layeh.com/radius/cmd/radtest").CombinedOutput()
if err != nil {
t.Fatalf("%s\n", output)
}
}
func tempFile(t *testing.T) string {
f, err := ioutil.TempFile(os.TempDir(), "gobuild")
if err != nil {
t.Fatal(err)
}
f.Close()
return f.Name()
}