Swap in the Riverdi RVT70 panel, flip the rotation, and stop ^C orphaning harness runs

This commit is contained in:
flamingcow
2026-08-28 21:04:55 -07:00
parent e3de27a251
commit 2166a456a3
12 changed files with 1719 additions and 10 deletions
+1 -1
View File
@@ -155,7 +155,7 @@ func decode(buf []byte, pitch, pw, ph int) *image.NRGBA {
img := image.NewNRGBA(image.Rect(0, 0, ph, pw))
for x := 0; x < ph; x++ {
for y := 0; y < pw; y++ {
o := drm.Offset(x, y, pitch, pw)
o := drm.Offset(x, y, pitch, ph)
v := uint32(buf[o]) | uint32(buf[o+1])<<8 |
uint32(buf[o+2])<<16 | uint32(buf[o+3])<<24
r, g, b := drm.Unpack(v)
+25
View File
@@ -6,12 +6,14 @@ package main
import (
"bytes"
"errors"
"flag"
"fmt"
"image/png"
"io"
"os"
"os/exec"
"os/signal"
"path/filepath"
"slices"
"strings"
@@ -19,6 +21,8 @@ import (
"time"
)
var errInterrupted = errors.New("interrupted")
const (
shotsDir = "shots"
grace = 3 * time.Second
@@ -55,6 +59,10 @@ func fuzz(n int, runFor time.Duration, args []string) error {
start := time.Now()
err := run(runFor, "", &buf, args)
dur := time.Since(start).Round(100 * time.Millisecond)
if errors.Is(err, errInterrupted) {
os.Stdout.Write(buf.Bytes())
return err
}
if err != nil {
failed++
name := fmt.Sprintf("fuzz-run%02d.log", i)
@@ -107,6 +115,12 @@ func run(runFor time.Duration, at string, out io.Writer, args []string) error {
}
}
// The child gets its own process group below, which is exactly what stops
// the terminal's ^C reaching it, so the harness has to relay the stop.
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
defer signal.Stop(sigs)
cmd := exec.Command("go", append([]string{"run", "."}, args...)...)
cmd.Stdout, cmd.Stderr = out, out
// Its own process group: go run's compiled child is reparented rather than
@@ -126,6 +140,8 @@ func run(runFor time.Duration, at string, out io.Writer, args []string) error {
select {
case err := <-done:
return exited(start, err)
case <-sigs:
return interrupted(start, pgid, done)
case <-time.After(time.Until(start.Add(d))):
}
name := filepath.Join(shotsDir, d.String()+".png")
@@ -139,11 +155,20 @@ func run(runFor time.Duration, at string, out io.Writer, args []string) error {
select {
case err := <-done:
return exited(start, err)
case <-sigs:
return interrupted(start, pgid, done)
case <-time.After(time.Until(start.Add(runFor))):
}
return stop(pgid, done)
}
func interrupted(start time.Time, pgid int, done chan error) error {
if err := stop(pgid, done); err != nil {
return err
}
return fmt.Errorf("%w after %s", errInterrupted, time.Since(start).Round(time.Millisecond))
}
func exited(start time.Time, err error) error {
ran := time.Since(start).Round(time.Millisecond)
if err != nil {