forked from NeowayLabs/drm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drm_main_test.go
61 lines (54 loc) · 1.15 KB
/
drm_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
package drm_test
import (
"fmt"
"os"
"testing"
"github.com/NeowayLabs/drm"
)
type (
cardDetail struct {
version drm.Version
capabilities map[uint64]uint64
}
)
var (
card, errCard = drm.Available()
cards = map[string]cardDetail{
"i915": cardDetail{
version: drm.Version{
Major: 1,
Minor: 6,
Patch: 1,
Name: "i915",
Desc: "i915",
Date: "20160425",
},
capabilities: map[uint64]uint64{
drm.CapDumbBuffer: 1,
drm.CapVBlankHighCRTC: 1,
drm.CapDumbPreferredDepth: 24,
drm.CapDumbPreferShadow: 1,
drm.CapPrime: 3,
drm.CapTimestampMonotonic: 1,
drm.CapAsyncPageFlip: 0,
drm.CapCursorWidth: 256,
drm.CapCursorHeight: 256,
drm.CapAddFB2Modifiers: 1,
},
},
}
cardInfo cardDetail
)
func TestMain(m *testing.M) {
cards[""] = cards["i915"] // i915 bug in 4.8 kernel?
if errCard != nil {
fmt.Fprintf(os.Stderr, "No graphics card available to test")
os.Exit(1)
}
if _, ok := cards[card.Name]; !ok {
fmt.Fprintf(os.Stderr, "No tests for card %s", card.Name)
os.Exit(1)
}
cardInfo = cards[card.Name]
os.Exit(m.Run())
}