forked from lhcb-org/lbpkr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
66 lines (55 loc) · 1.35 KB
/
main_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
65
66
package main
import (
"io/ioutil"
"os"
"os/exec"
"testing"
)
func TestLbpkrSelfBdist(t *testing.T) {
tmpdir, err := ioutil.TempDir("", "test-lbpkr-")
if err != nil {
t.Fatalf("error creating temporary directory: %v", err)
}
defer os.RemoveAll(tmpdir)
cmd := exec.Command("lbpkr", "self", "bdist")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Dir = tmpdir
err = cmd.Run()
if err != nil {
t.Fatalf("error running bdist: %v", err)
}
}
func TestLbpkrSelfBdistRpm(t *testing.T) {
if _, err := exec.LookPath("rpmbuild"); err != nil {
t.Skip("no rpmbuild installed")
}
tmpdir, err := ioutil.TempDir("", "test-lbpkr-")
if err != nil {
t.Fatalf("error creating temporary directory: %v", err)
}
defer os.RemoveAll(tmpdir)
cmd := exec.Command("lbpkr", "self", "bdist-rpm")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Dir = tmpdir
err = cmd.Run()
if err != nil {
t.Fatalf("error running bdist-rpm: %v", err)
}
}
func TestLbpkrInstallLbpkr(t *testing.T) {
tmpdir, err := ioutil.TempDir("", "test-lbpkr-")
if err != nil {
t.Fatalf("error creating temporary directory: %v", err)
}
defer os.RemoveAll(tmpdir)
cmd := exec.Command("lbpkr", "install", "-siteroot="+tmpdir, "lbpkr")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Dir = tmpdir
err = cmd.Run()
if err != nil {
t.Fatalf("error running install: %v", err)
}
}