Skip to content

Expand JaCoCo coverage; move util tests to oshi-common - #3155

Merged
dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:more-tests
Apr 13, 2026
Merged

dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:more-tests

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Apr 13, 2026 •

Copy link
Copy Markdown
Member

Coverage Infrastructure

  • Remove JaCoCo excludes for **/platform/**, **/linux/**, **/mac/**, **/windows/** so platform-specific classes are included in coverage reports (unix remains excluded)
  • Update all CI workflows (linux, macos, windows, PR) to upload coverage on JDK 25 with per-OS flags for codecov merging
  • Fix macOS coverage upload condition (macos-13 never matched the matrix; now macos-15)
  • Remove stale continue-on-error: ${{ matrix.experimental }} from Windows CI

Move Util Tests to oshi-common

Move 13 utility test classes and their resources from oshi-core to oshi-common so JaCoCo correctly attributes coverage to the module where the source lives:

  • EdidUtilTest, ExecutingCommandTest, FileSystemUtilTest, FileUtilTest, FormatUtilTest, GlobalConfigTest, MemoizerTest, ParseUtilTest, PrivilegedUtilTest, ProcUtilsTest, TupleTest, UserGroupInfoTest, UtilTest
  • Move sample-proc-net-*.txt test resources
  • Copy simplelogger.properties to oshi-common test resources
  • Add oshi.util and oshi.util.tuples to module-info.test opens

Coverage before/after (oshi-common, macOS)

Class Before After
ParseUtil 11% 97%
FormatUtil 33% 100%
GlobalConfig 44% 92%
FileUtil 15% 74%
FileSystemUtil 0% 93%
EdidUtil 55% 96%
Tuples 0% 100%

After merging this PR, will systematically address coverage gaps based on codecov reports.

Summary by CodeRabbit

  • Chores

    • Updated CI/CD workflows to use Java 25 and newer platform versions for testing.
    • Added Codecov coverage report tagging for improved tracking across platforms.
    • Updated copyright year ranges in test files to 2026.
  • Tests

    • Enhanced test module configuration for reflective access permissions.
    • Added logging configuration for test execution.
    • Expanded code coverage reporting to include platform-specific packages.

…ommon

Move 13 utility test classes and their resources from oshi-core to
oshi-common so JaCoCo correctly attributes coverage to the module
where the source lives.

Relax JaCoCo excludes to include platform/linux/mac/windows classes
(unix remains excluded). Update CI workflows to upload coverage on
JDK 25 with per-OS flags for codecov merging. Fix macOS upload
condition (was macos-13, never matched). Remove stale
continue-on-error from Windows CI.
@coderabbitai

coderabbitai Bot commented Apr 13, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 58f606dd-15d6-4238-b30a-28d1dc37b900

📥 Commits

Reviewing files that changed from the base of the PR and between e25188e and 19159ad.

📒 Files selected for processing (23)
  • .github/workflows/linux.yaml
  • .github/workflows/macos.yaml
  • .github/workflows/pr.yaml
  • .github/workflows/windows.yaml
  • oshi-common/src/test/java/module-info.test
  • oshi-common/src/test/java/oshi/util/EdidUtilTest.java
  • oshi-common/src/test/java/oshi/util/ExecutingCommandTest.java
  • oshi-common/src/test/java/oshi/util/FileSystemUtilTest.java
  • oshi-common/src/test/java/oshi/util/FileUtilTest.java
  • oshi-common/src/test/java/oshi/util/FormatUtilTest.java
  • oshi-common/src/test/java/oshi/util/GlobalConfigTest.java
  • oshi-common/src/test/java/oshi/util/MemoizerTest.java
  • oshi-common/src/test/java/oshi/util/ParseUtilTest.java
  • oshi-common/src/test/java/oshi/util/PrivilegedUtilTest.java
  • oshi-common/src/test/java/oshi/util/ProcUtilsTest.java
  • oshi-common/src/test/java/oshi/util/TupleTest.java
  • oshi-common/src/test/java/oshi/util/UserGroupInfoTest.java
  • oshi-common/src/test/java/oshi/util/UtilTest.java
  • oshi-common/src/test/resources/oshi/util/sample-proc-net-netstat.txt
  • oshi-common/src/test/resources/oshi/util/sample-proc-net-snmp.txt
  • oshi-common/src/test/resources/oshi/util/sample-proc-net-snmp6.txt
  • oshi-common/src/test/resources/simplelogger.properties
  • pom.xml
💤 Files with no reviewable changes (1)
  • pom.xml
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Test JDK 11, windows-latest
  • GitHub Check: Test JDK 25, windows-latest
  • GitHub Check: Test JDK 21, windows-latest
  • GitHub Check: Test JDK 21, macos-latest
  • GitHub Check: Test JDK 11, ubuntu-latest
  • GitHub Check: Test JDK 21, ubuntu-latest
  • GitHub Check: Test JDK 25, macos-latest
  • GitHub Check: Test JDK 11, macos-latest
  • GitHub Check: Test JDK 25, ubuntu-latest
  • GitHub Check: macos-latest
  • GitHub Check: Analyze (java)
  • GitHub Check: windows-latest
  • GitHub Check: ubuntu-latest
  • GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2026-03-29T20:01:06.452Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:06.452Z
Learning: In the oshi project, `oshi-core-java25/src/main/java/module-info.java` intentionally does NOT export `oshi.util.platform.unix.freebsd`, `oshi.util.platform.unix.openbsd`, or `oshi.util.platform.unix.solaris`, because the FFM (Foreign Function & Memory) implementation only supports Windows, macOS, and Linux. This differs from `oshi-core-java11/src/main/java/module-info.java` which exports all Unix platform packages. The asymmetry is by design.

Applied to files:

  • oshi-common/src/test/java/oshi/util/ProcUtilsTest.java
  • oshi-common/src/test/java/oshi/util/UserGroupInfoTest.java
  • oshi-common/src/test/java/oshi/util/MemoizerTest.java
  • oshi-common/src/test/java/oshi/util/FileSystemUtilTest.java
  • oshi-common/src/test/java/oshi/util/EdidUtilTest.java
  • oshi-common/src/test/java/oshi/util/UtilTest.java
  • oshi-common/src/test/java/oshi/util/TupleTest.java
  • oshi-common/src/test/java/oshi/util/FormatUtilTest.java
  • oshi-common/src/test/java/module-info.test
📚 Learning: 2026-04-06T04:45:51.516Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3121
File: oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystem.java:53-53
Timestamp: 2026-04-06T04:45:51.516Z
Learning: In the oshi/oshi project, the public API is strictly limited to interfaces and classes in the `oshi`, `oshi.hardware`, and `oshi.software.os` packages. All platform-specific code under subpackages like `oshi.software.os.linux`, `oshi.hardware.platform.linux`, etc., is considered implementation detail — not public API. Do not flag changes to platform-specific classes (e.g., making `LinuxOperatingSystem` abstract, narrowing constructor visibility, adding abstract methods) as public API breaks.

Applied to files:

  • oshi-common/src/test/java/oshi/util/ProcUtilsTest.java
  • oshi-common/src/test/java/oshi/util/UserGroupInfoTest.java
  • oshi-common/src/test/java/oshi/util/MemoizerTest.java
  • oshi-common/src/test/java/oshi/util/FileSystemUtilTest.java
  • oshi-common/src/test/java/oshi/util/EdidUtilTest.java
  • oshi-common/src/test/java/oshi/util/UtilTest.java
  • oshi-common/src/test/java/oshi/util/TupleTest.java
  • oshi-common/src/test/java/oshi/util/FormatUtilTest.java
  • oshi-common/src/test/java/module-info.test
  • oshi-common/src/test/resources/simplelogger.properties
🔇 Additional comments (14)
oshi-common/src/test/java/oshi/util/MemoizerTest.java (1)

2-2: Header year update looks good.

Non-functional metadata change only; no behavior impact.

oshi-common/src/test/java/oshi/util/UserGroupInfoTest.java (1)

2-2: Copyright header update is clean.

No functional or test-execution impact from this change.

oshi-common/src/test/java/oshi/util/ProcUtilsTest.java (1)

2-2: LGTM on the header year bump.

This is a documentation/header-only change.

oshi-common/src/test/java/oshi/util/FormatUtilTest.java (1)

2-2: Header update approved.

Purely informational change; test logic remains untouched.

oshi-common/src/test/java/oshi/util/EdidUtilTest.java (1)

2-2: Year-range header change looks good.

No code behavior impact detected.

oshi-common/src/test/java/oshi/util/FileSystemUtilTest.java (1)

2-2: Header year extension is fine.

No functional or coverage-behavior risk from this edit.

oshi-common/src/test/java/oshi/util/UtilTest.java (1)

2-2: Approved: copyright header refresh.

This change does not affect runtime behavior or tests.

oshi-common/src/test/java/oshi/util/TupleTest.java (1)

2-2: Header year update is good to merge.

No functional impact in the changed segment.

.github/workflows/linux.yaml (1)

67-71: Coverage gate and Linux flag look correct.

Line 67 correctly scopes upload to JDK 25, and Line 71 adds a stable Linux coverage label for Codecov merging.

.github/workflows/macos.yaml (1)

39-43: macOS coverage condition fix is correct.

Line 39 now targets the intended JDK/runner pair, and Line 43 adds clear macOS flagging for Codecov aggregation.

oshi-common/src/test/java/module-info.test (1)

17-20: Added test-module opens are appropriate.

These new --add-opens entries align with the moved oshi.util test classes and prevent reflective-access failures in JUnit.

.github/workflows/windows.yaml (1)

38-42: Windows coverage upload update looks good.

Line 38 correctly limits upload to one Windows/JDK target, and Line 42 adds the expected OS flag for merged reporting.

.github/workflows/pr.yaml (1)

57-61: PR workflow coverage tagging is a solid improvement.

Limiting uploads to JDK 25 and tagging by matrix OS gives cleaner, attributable PR coverage signals.

oshi-common/src/test/resources/simplelogger.properties (1)

27-35: Test logger defaults are sensible and CI-friendly.

The settings provide stable timestamped output and reduce expected noisy util logs during test runs.


📝 Walkthrough

Walkthrough

The pull request updates CI/CD workflows to use JDK 25 instead of 11 for coverage reporting with platform-specific flags, expands test module visibility for JUnit platform access, adds SLF4J logging configuration, removes platform-specific JaCoCo coverage excludes, and updates copyright years to 2026 across test files.

Changes

Cohort / File(s) Summary
GitHub Actions Workflows
.github/workflows/linux.yaml, .github/workflows/macos.yaml, .github/workflows/pr.yaml, .github/workflows/windows.yaml
Updated Codecov upload conditions to trigger on JDK 25 instead of 11, and added platform-specific flags configuration (linux, macos, ${{ matrix.os }}, windows). Also removed continue-on-error behavior from windows Maven test step.
Test Copyright Headers
oshi-common/src/test/java/oshi/util/EdidUtilTest.java, oshi-common/src/test/java/oshi/util/FileSystemUtilTest.java, oshi-common/src/test/java/oshi/util/FormatUtilTest.java, oshi-common/src/test/java/oshi/util/MemoizerTest.java, oshi-common/src/test/java/oshi/util/ProcUtilsTest.java, oshi-common/src/test/java/oshi/util/TupleTest.java, oshi-common/src/test/java/oshi/util/UserGroupInfoTest.java, oshi-common/src/test/java/oshi/util/UtilTest.java
Updated copyright year ranges to 2026 in file headers; no functional code changes.
Test Configuration
oshi-common/src/test/java/module-info.test, oshi-common/src/test/resources/simplelogger.properties
Extended module reflective access by adding --add-opens directives for oshi.util and oshi.util.tuples packages. Added SLF4J SimpleLogger configuration file setting log levels, timestamps, and output formatting.
Build Configuration
pom.xml
Removed JaCoCo coverage excludes for platform-specific packages (**/platform/**, **/linux/**, **/mac/**, **/windows/**), now included in coverage reporting.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • rohan-coder02

Poem

🐰 Coverage flags now aligned to twenty-five,
Platform-specific markers help tests thrive,
Copyright years dance forward to twenty-six,
Module doors open with reflective fixes,
Copyright hops through 2026! 🌱

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the two main changes: expanding JaCoCo coverage and moving util tests to oshi-common. It is concise and clearly reflects the primary objectives of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

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 and usage tips.

@codecov

codecov Bot commented Apr 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.59%. Comparing base (e25188e) to head (19159ad).
⚠️ Report is 1 commits behind head on master.

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

HEAD has 2 uploads less than BASE
Flag BASE (e25188e) HEAD (19159ad)
2 0
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3155      +/-   ##
============================================
- Coverage     61.91%   54.59%   -7.33%     
- Complexity       12      663     +651     
============================================
  Files            39      211     +172     
  Lines          2329    13476   +11147     
  Branches        407     2193    +1786     
============================================
+ Hits           1442     7357    +5915     
- Misses          777     4987    +4210     
- Partials        110     1132    +1022     
Flag Coverage Δ
macos-latest 28.82% <ø> (?)
ubuntu-latest 16.46% <ø> (?)
windows-latest 28.37% <ø> (?)

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

☔ View full report in Codecov by Sentry.
📢 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.

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