Skip to content

fix: small follow-ups to the option handling fixes - #163

Merged
maddie merged 4 commits into
librespeed:masterfrom
BKPepe:fix/review-follow-ups
Nov 24, 2026
Merged

maddie merged 4 commits into
librespeed:masterfrom
BKPepe:fix/review-follow-ups

Conversation

@BKPepe

@BKPepe BKPepe commented Nov 23, 2026

Copy link
Copy Markdown
Member

Follow-ups from the reviews of #159, #161 and #162, one per commit:

  • Tests for what was not asserted: the largest upload size, -4 -6, the source address and the mark of a bound connection, and a family localhost has no address in. The mark is checked only as root.
  • --list no longer fails over an --upload-size out of range, which it does not use.
  • A --ca-cert file that cannot be read is reported like other errors, and a file without a certificate gets no usable PEM certificate found.
  • The upload size is scaled to bytes only where the payload is allocated.

Not changed: the ping collection test still depends on scheduling. The old loop passes it with GOMAXPROCS=1, and I found no way to make that certain without a hook in the code.

The largest upload size, the short forms of contradicting options, the
source address and mark of a bound connection, and a family localhost
has no address in were not asserted. The comment on newPinger now says
what an unknown network does.
The size was checked before the servers were listed, so --list with
--upload-size out of range ended in a usage error although nothing is
uploaded.
Such a file ended the run through a fatal log line, without the prefix
the other errors get. The message for a file without a certificate now
says that PEM is expected.
With --no-pre-allocate the size is not checked and not used, and
scaling it to bytes could overflow on a 32-bit system.

@maddie maddie left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed a4c6890 against master (7a9af2a). The four commits are scoped to the follow-ups from the previous review, and the two CI checks are green.

Validation on this head: go build ./..., go vet ./..., gofmt -l ., go test -count=1 ./..., go test -count=1 -race ./... and GOARCH=386 go build ./... all pass. The changed tests also pass five times in a row. No security or apparent-bug finding.

The behavior changes match the commit messages:

  • --list no longer rejects an out-of-range --upload-size because no payload is allocated (speedtest/speedtest.go:190-202).
  • An unreadable --ca-cert now returns the read error instead of calling output.Fatal, and the empty-PEM message is accurate (speedtest/speedtest.go:228-238).
  • The upload payload size is set only in the pre-allocating branch, before GenerateBlob (defs/server.go:511-520).

💡 nit — defs/pinger_test.go:50-53

When localhost has no address in the requested family, the test only requires newPinger to return some error. It would also pass if the constructor failed for an unrelated reason. Asserting that the error is about the requested family (or at least asserting it is non-nil with a clear message) would make the regression test sharper.

💡 nit — speedtest/dialer_linux_test.go:135

socketMark does an unchecked conn.(*net.TCPConn) assertion. The current callers pass a TCP connection, so this is test-only, but an explicit ok check with t.Fatalf would fail with a useful message instead of a panic if a future caller passes another net.Conn.

Approved. No ❌ errors found.

@maddie
maddie merged commit 0bf0ae3 into librespeed:master Nov 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants