Skip to content

FreeBSD: quiet dmesg.boot read and extract testable command parsers - #3495

Merged
dbwiddis merged 4 commits into
oshi:masterfrom
dbwiddis:freebsd-dmesg-and-coverage
Jul 20, 2026
Merged

dbwiddis merged 4 commits into
oshi:masterfrom
dbwiddis:freebsd-dmesg-and-coverage

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Jul 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Improves FreeBSD testability/coverage and quiets a log-noise source, in three focused commits.

  1. Read /var/run/dmesg.boot quietly — the file is often unreadable to non-root users; read it with reportError=false so a routine permission miss no longer logs an error.

  2. Extract testable parse methods from FreeBSD command readers — separate acquisition (runNative/readFile) from parsing across the FreeBSD HAL, so the parsing logic is unit-testable with synthetic fixtures rather than only on a live FreeBSD host:

    • FreeBsdCentralProcessor: parseProcessorIdFromDmesg (+ DmesgProcessorId holder), parseProcModelsAndFlags, parseCachesFromLscpu
    • FreeBsdUsbDevice: parseUsbDevices (lshal device tree)
    • FreeBsdSoundCard: parseSoundCards (lshal pcm nodes)
    • FreeBsdComputerSystem: parseDmiDecode (dmidecode -t system)
    • FreeBsdFirmware: parseDmiDecode (dmidecode -t bios)

    New fixtures are grounded in real dmesg.boot / lshal / lscpu / dmidecode output; the tests run on every platform and cover each parse method's lines fully.

  3. Tolerate an unresolvable procstat cwd in the live FreeBSD test — procstat resolves a process cwd on a best-effort basis; on some CI filesystems it returns empty. Accept that, and require an absolute path only when one is actually returned.

Testing

  • oshi-common full gate green: spotless, checkstyle, install + forbiddenapis, javadoc.
  • clean test passes; new parse methods measured at ~100% line coverage locally via JaCoCo.

No CHANGELOG entry — test/coverage work plus a minor log-noise reduction.

Summary by CodeRabbit

  • Bug Fixes
    • Improved FreeBSD CPU identification (including precedence rules), cache parsing, and processor-model/feature extraction.
    • Refined FreeBSD dmidecode parsing for system and BIOS details with centralized fallbacks for missing fields.
    • Improved FreeBSD hardware parsing for sound cards and USB devices by reliably handling lshal output.
  • Tests
    • Added/expanded JUnit coverage for FreeBSD CPU, cache, system, firmware, sound card, and USB parsing, including empty-input and edge cases.
    • Relaxed FreeBSD procstat cwd assertions to accept valid empty results.

dbwiddis added 3 commits July 19, 2026 21:12
A missing dmesg.boot is tolerated (falls back to sysctl); warning on every
CentralProcessor construction spammed callers that recreate SystemInfo.
Split data acquisition from parsing in the FreeBSD HAL so the parsing logic
can be unit-tested with synthetic fixtures instead of only on a live FreeBSD
host. Each public method becomes a thin wrapper around runNative/readFile, and
a package-private parse method takes the already-read List<String>:

- FreeBsdCentralProcessor: parseProcessorIdFromDmesg (+ DmesgProcessorId
  holder), parseProcModelsAndFlags, parseCachesFromLscpu
- FreeBsdUsbDevice: parseUsbDevices (lshal device tree)
- FreeBsdSoundCard: parseSoundCards (lshal pcm nodes)
- FreeBsdComputerSystem: parseDmiDecode (dmidecode -t system)
- FreeBsdFirmware: parseDmiDecode (dmidecode -t bios)

Fixtures are grounded in real dmesg.boot, lshal, lscpu, and dmidecode output.
The new tests run on every platform and cover each parse method's lines fully.
testProcstatLive asserted getCwd(pid) was nonempty, but procstat resolves a
process cwd on a best-effort basis: on some filesystems (nullfs / memory-backed
CI build dirs) the cwd vnode maps to no path and procstat returns it empty,
which failed the assertion on the vmactions FreeBSD runner. Accept an empty
result, and require an absolute path only when one is actually returned. The
parse logic itself remains fully covered by testParseCwdReturnsFirstCwdPath.
@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0f382432-fa46-4d2e-b248-52f9c7cdde33

📥 Commits

Reviewing files that changed from the base of the PR and between c88d106 and c02ccca.

📒 Files selected for processing (2)
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmware.java
  • oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmwareTest.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmware.java
📜 Recent review details
⏰ Context from checks skipped due to timeout. (14)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
  • GitHub Check: Test JDK 21, macos-latest
  • GitHub Check: Test JDK 26, macos-latest
  • GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 26, windows-latest
  • GitHub Check: Test JDK 26, ubuntu-latest
  • GitHub Check: Test JDK 21, windows-latest
  • GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
  • GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
  • GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
  • GitHub Check: Analyze (java)
🔇 Additional comments (1)
oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmwareTest.java (1)

8-10: LGTM!

Also applies to: 20-46


📝 Walkthrough

Walkthrough

FreeBSD hardware discovery separates command or file acquisition from parsing helpers. CPU, DMI, sound-card, and USB parsers accept supplied output lines, with unit tests covering parsed fields and edge cases. The procstat CWD test now permits empty results.

Changes

FreeBSD CPU and cache parsing

Layer / File(s) Summary
CPU parsing and cache extraction
oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdCentralProcessor.java, oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdCentralProcessorTest.java
CPU identification, topology, and cache parsing now consume supplied command output, with tests covering processor IDs, models, flags, caches, and empty input.

FreeBSD DMI parsing

Layer / File(s) Summary
System and firmware DMI parsing
oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdComputerSystem.java, oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmware.java, oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdComputerSystemTest.java, oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmwareTest.java
DMI command execution is separated from system and BIOS parsing, with caller-level fallbacks and tests for extracted fields, date normalization, and empty input.

FreeBSD sound and USB parsing

Layer / File(s) Summary
Sound and USB lshal parsing
oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdSoundCard.java, oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDevice.java, oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdSoundCardTest.java, oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDeviceTest.java
Sound-card and USB parsers receive lshal output directly, with tests covering filtering, fallback codec values, USB hierarchy, serial decoding, interface skipping, and empty input.

Procstat CWD test contract

Layer / File(s) Summary
CWD result validation
oshi-common/src/test/java/oshi/util/common/platform/unix/freebsd/ProcstatUtilTest.java
The live test requires a non-null CWD and checks absolute-path formatting only when the returned value is non-empty.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • oshi/oshi#3322: Uses related FreeBSD dmesg.boot CPU identity parsing paths.
  • oshi/oshi#3380: Touches the same FreeBSD CPU identity, topology, and cache parsing paths.

Poem

A rabbit hops through dmesg bright,
Parsing caches left and right.
DMI, sound, and USB too,
Now take their lines from queues.
Empty paths may safely be—
A tidy test for you and me!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly captures the two main themes: quieter dmesg.boot access and refactoring FreeBSD command parsing for testability.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.84848% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.53%. Comparing base (9075911) to head (c02ccca).

Files with missing lines Patch % Lines
...n/platform/unix/freebsd/FreeBsdComputerSystem.java 64.70% 0 Missing and 6 partials ⚠️
.../common/platform/unix/freebsd/FreeBsdFirmware.java 66.66% 0 Missing and 3 partials ⚠️
...platform/unix/freebsd/FreeBsdCentralProcessor.java 97.29% 0 Missing and 1 partial ⚠️

❗ There is a different number of reports uploaded between BASE (9075911) and HEAD (c02ccca). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (9075911) HEAD (c02ccca)
solaris 1 0
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3495      +/-   ##
============================================
- Coverage     75.16%   69.53%   -5.64%     
  Complexity       76       76              
============================================
  Files           591      591              
  Lines         21617    21651      +34     
  Branches       3613     3613              
============================================
- Hits          16248    15054    -1194     
- Misses         3412     4829    +1417     
+ Partials       1957     1768     -189     
Flag Coverage Δ
freebsd 29.26% <84.84%> (+0.66%) ⬆️
linux 33.35% <42.42%> (+0.80%) ⬆️
macos 34.49% <42.42%> (+0.76%) ⬆️
openbsd 28.73% <42.42%> (+0.81%) ⬆️
solaris ?
windows 42.43% <42.42%> (+0.78%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmware.java (1)

47-94: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Align the DMI parser fallback contract between FreeBsdFirmware and FreeBsdComputerSystem. Both classes extracted a parseDmiDecode helper in this PR, but they disagree on where the Constants.UNKNOWN/null fallback is applied — one root cause spanning two files.

  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmware.java#L47-L94: move the Constants.UNKNOWN ternaries out of parseDmiDecode's return statement and into readDmiDecode(), so the parser returns raw/null values like its sibling; update FreeBsdFirmwareTest.testParseDmiDecodeEmpty accordingly.
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdComputerSystem.java#L90-L124: no change needed — this file already follows the caller-boundary-fallback pattern described in the PR objective; keep as the reference implementation.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmware.java`
around lines 47 - 94, Align FreeBsdFirmware.readDmiDecode and parseDmiDecode
with the caller-boundary fallback pattern: have parseDmiDecode return raw or
null manufacturer, version, and release-date values, and apply Constants.UNKNOWN
fallbacks in readDmiDecode instead. Update
FreeBsdFirmwareTest.testParseDmiDecodeEmpty for the parser’s raw/null results.
FreeBsdComputerSystem.java lines 90-124 requires no direct change and remains
the reference implementation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmware.java`:
- Around line 47-94: Align FreeBsdFirmware.readDmiDecode and parseDmiDecode with
the caller-boundary fallback pattern: have parseDmiDecode return raw or null
manufacturer, version, and release-date values, and apply Constants.UNKNOWN
fallbacks in readDmiDecode instead. Update
FreeBsdFirmwareTest.testParseDmiDecodeEmpty for the parser’s raw/null results.
FreeBsdComputerSystem.java lines 90-124 requires no direct change and remains
the reference implementation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b83a019c-e4fe-4df2-bda3-6e214a334860

📥 Commits

Reviewing files that changed from the base of the PR and between 9075911 and c88d106.

📒 Files selected for processing (11)
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdCentralProcessor.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdComputerSystem.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmware.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdSoundCard.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDevice.java
  • oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdCentralProcessorTest.java
  • oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdComputerSystemTest.java
  • oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmwareTest.java
  • oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdSoundCardTest.java
  • oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDeviceTest.java
  • oshi-common/src/test/java/oshi/util/common/platform/unix/freebsd/ProcstatUtilTest.java
📜 Review details
⏰ Context from checks skipped due to timeout. (13)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Test JDK 26, windows-latest
  • GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 26, macos-latest
  • GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 21, macos-latest
  • GitHub Check: Test JDK 21, windows-latest
  • GitHub Check: Analyze (java)
  • GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
  • GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
  • GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
  • GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
  • GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2026-04-12T19:22:09.716Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:22:09.716Z
Learning: When reviewing OSHI hardware platform code that uses or implements `CentralProcessor`/`PhysicalProcessor.getEfficiency()`, remember the API’s counterintuitive semantics: a *higher* efficiency-class value indicates *greater performance* (lower efficiency). P-cores/“performance cores” should therefore have higher values (e.g., 1) than E-cores/“efficiency cores” (e.g., 0), as documented in the `CentralProcessor` Javadoc. Do not flag code as incorrect solely because ARM_P_CORES or Intel P-cores are assigned higher efficiency values.

Applied to files:

  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdSoundCard.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDevice.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdComputerSystem.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmware.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdCentralProcessor.java
📚 Learning: 2026-07-06T19:25:59.225Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3432
File: oshi-common/src/main/java/oshi/util/ExceptionUtil.java:26-56
Timestamp: 2026-07-06T19:25:59.225Z
Learning: In this repo’s SLF4J 1.x-compatible logging code, do not flag cases where a logger call uses SLF4J 1.6+ implicit-cause handling—e.g., `log.error("...{}", value, t)` (or similar with a single `{}` placeholder) where `t` is passed as the final/trailing argument. SLF4J will attach `t` as the log event’s cause with the full stack trace; this is equivalent to SLF4J 2.x’s fluent `atLevel(...).setCause(t).log(...)` and is intentionally used to preserve SLF4J 1.x runtime compatibility.

Applied to files:

  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdSoundCard.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDevice.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdComputerSystem.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmware.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdCentralProcessor.java
📚 Learning: 2026-04-12T19:34:56.879Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:34:56.879Z
Learning: In OSHI’s Java platform implementations, `PhysicalProcessor.getEfficiency()` / `EfficiencyClass` follow the same convention as Windows `PROCESSOR_RELATIONSHIP.EfficiencyClass`: a *higher* numeric efficiency class value represents *greater performance* and *less efficiency* (typically P-cores higher than E-cores). When reviewing, do not treat cases where P-cores are assigned higher efficiency/class values as a bug—this is intentional cross-platform consistency.

Applied to files:

  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdCentralProcessor.java
🔇 Additional comments (11)
oshi-common/src/test/java/oshi/util/common/platform/unix/freebsd/ProcstatUtilTest.java (1)

12-13: LGTM!

Also applies to: 78-85

oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdCentralProcessor.java (1)

23-23: LGTM!

Also applies to: 155-343

oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdCentralProcessorTest.java (1)

1-98: LGTM!

oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdComputerSystem.java (1)

9-9: LGTM!

Also applies to: 69-88

oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmware.java (1)

9-9: LGTM!

oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdComputerSystemTest.java (1)

1-53: LGTM!

oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmwareTest.java (1)

1-47: LGTM!

oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdSoundCard.java (1)

45-82: LGTM!

oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDevice.java (1)

38-120: LGTM!

oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdSoundCardTest.java (1)

1-56: LGTM!

oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDeviceTest.java (1)

1-104: LGTM!

…rmware

Mirror FreeBsdComputerSystem: parseDmiDecode returns raw values (null
manufacturer/version, empty release date) and readDmiDecode applies the
Constants.UNKNOWN fallbacks, so the two dmidecode parsers follow the same
caller-boundary pattern. Update testParseDmiDecodeEmpty for the raw results.
@dbwiddis
dbwiddis merged commit 8b1ac06 into oshi:master Jul 20, 2026
18 of 19 checks passed
dbwiddis added a commit that referenced this pull request Jul 20, 2026
…3496)

* NetBSD/OpenBSD: extract testable parse methods from command readers

Extract inline command-output parsing into package-private static
methods that accept List<String>, mirroring the pattern from #3494
(Linux) and #3495 (FreeBSD). This allows fixture-based tests to
exercise the parse logic on every CI platform without requiring the
target OS.

Extractions:
- BsdCentralProcessor: parseTopology, parseDmesgModelsAndCaches,
  parseCacheStr (shared by NetBSD + OpenBSD)
- BsdGraphicsCard: parsePciDump (pcidump -v)
- BsdSoundCard: parseDmesg (dmesg audio/pci)
- BsdUsbDevice: parseUsbDevices (usbdevs -v)
- NetBsdCentralProcessor: parseVmStats, parseFamilyModelStepping,
  parseCpTime
- NetBsdFirmware: parseDmesg (bios0 vendor line)
- OpenBsdCentralProcessor: parseVmStats, cpuidToFamilyModelStepping
- OpenBsdFirmware: parseDmesg (bios0 vendor line)

* Fix firmware vendor extraction to preserve multi-word BIOS vendor names

Both NetBsd and OpenBsd parsers now extract the vendor substring between
the "vendor" keyword and the " version " delimiter, correctly handling
multi-word vendors like "American Megatrends Inc." or "Phoenix
Technologies LTD". Falls back to first-token extraction if no " version "
delimiter is present.
dbwiddis added a commit that referenced this pull request Jul 20, 2026
* Solaris: extract testable parse methods from command readers

Extract inline command-output parsing into package-private static
methods that accept List<String> (or String), mirroring the pattern
from #3494 (Linux), #3495 (FreeBSD), and #3496 (NetBSD/OpenBSD).
This allows fixture-based tests to exercise the parse logic on every
CI platform without requiring Solaris/OpenIndiana.

Extractions:
- SolarisCentralProcessor: parseDmesgCpuInfo (dmesg), parseNumaNodes
  (lgrpinfo -c leaves), parseIsainfoFlags (isainfo -v), sumKstatLong
  (kstat -p cpu_stat)
- SolarisComputerSystem: parseSmbios (smbios), parseSerialFromPrtconf
  (prtconf -pv chassis-sn)
- SolarisGraphicsCard: parsePrtconf (prtconf -pv display class)
- SolarisSoundCard: parseLshal (lshal audio810 driver)
- SolarisVirtualMemory: parseSwapInfo (swap -lk), sumKstatLong
  (kstat -p cpu_stat:::pgswapin/pgswapout)
- SolarisInternetProtocolStats: parseTcpStats and parseUdpStats
  (netstat -s -P tcp/udp/ip), splitOnPrefix made package-private

* Use split("=", 2) in netstat parsers for mixed-prefix lines

When tcpInErr is paired with a non-tcp stat on the same line (e.g.
udpNoPorts), splitOnPrefix finds only one "tcp" occurrence, leaving
the full remainder including a second "=" sign. Limiting split to 2
parts ensures the length check passes and getFirstIntValue extracts
the correct value from the leading portion.
@dbwiddis
dbwiddis deleted the freebsd-dmesg-and-coverage branch July 22, 2026 21:40
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.

1 participant