v0.4.0 b6be3a8

flip_trace_test.go RawHistoryFolder

1package drm
2
3import (
4	"bytes"
5	"strings"
6	"testing"
7	"time"
8
9	"github.com/bnema/neferwl/internal/ports"
10	"github.com/bnema/zerowrap"
11	"github.com/stretchr/testify/mock"
12)
13
14// Only the event of our pending commit is traced: a stale event and the
15// event that ends an EBUSY wait are not.
16func TestTraceFlipsOnlyOurCommit(t *testing.T) {
17	o, _, commits := testOutput(t)
18	o.cursor = nil
19	o.traceFlips = true
20	var log bytes.Buffer
21	o.log = zerowrap.New(zerowrap.Config{Level: "debug", Format: "json", Output: &log})
22	seen := map[ports.WindowID]uint64{}
23	flips := func() int { return strings.Count(log.String(), `"message":"flip"`) }
24
25	if err := o.commitFrame(70, nil, false, false, pendingFrame{}); err != nil {
26		t.Fatal(err)
27	}
28	c := (*commits)[0]
29	stale := flipEvent{crtc: tCrtc, user: c.user + 1<<userKindBits}
30	if o.completed(stale, seen) || flips() != 0 {
31		t.Fatalf("stale event traced: %s", log.String())
32	}
33	if !o.completed(flipEvent{crtc: tCrtc, user: c.user, when: time.Second}, seen) || flips() != 1 {
34		t.Fatalf("own commit not traced: %s", log.String())
35	}
36	if o.lastFlipAt != time.Second {
37		t.Fatalf("last flip %s", o.lastFlipAt)
38	}
39
40	o.frame.busy(time.Now())
41	if !o.completed(flipEvent{crtc: tCrtc, user: 12345}, seen) || flips() != 1 {
42		t.Fatalf("EBUSY wait end traced: %s", log.String())
43	}
44}
45
46// A modeset starts a new flip interval: the time the output was inactive
47// is not reported as a frame interval.
48func TestModesetResetsFlipTrace(t *testing.T) {
49	o, k, _ := testOutput(t)
50	o.lastFlipAt = time.Second
51	k.EXPECT().createBlob(mock.Anything).Return(99, nil).Once()
52	if err := o.modeset(); err != nil {
53		t.Fatal(err)
54	}
55	if o.lastFlipAt != 0 {
56		t.Fatalf("after modeset: last flip %s", o.lastFlipAt)
57	}
58}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 25

Tags 10

↑↓ moveenter openesc close