Skip to content

Conversation

currenjin
Copy link
Contributor

@currenjin currenjin commented Aug 9, 2025

cc. @maxandersen @marcphilipp

Summary

Detect and log non-existent, unreadable, or non-dir/jar classpath roots in ConsoleLauncher before discovery.

This change improves diagnostics when using --scan-class-path with invalid entries, addressing issue #4772.

Motivation

Currently, invalid search path roots are silently ignored, which may cause users to miss that some tests are not being discovered.

This PR makes such issues visible by logging them at INFO -> WARN level, helping users
quickly identify and fix misconfigured paths.

Changes

  • Added validateAndLogInvalidRoots() to DiscoveryRequestCreator
  • Logs invalid roots with the format:
    "Ignoring invalid search path root: %s (exists=%s, readable=%s, dirOrJar=%s)"
  • Retains the existing behaviour of skipping invalid roots
  • Added a test verifying that an invalid root triggers the log entry
  • Updated User Guide to mention this logging behaviour

Before / After Example

Before (invalid path silently ignored):

0 tests found

After:

Ignoring invalid search path root: /does/not/exist (exists=false, readable=false, dirOrJar=false)
0 tests found

Related Issue

Closes #4772


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

@sormuras sormuras changed the title feat: log invalid search path roots (#4772) Log invalid search path roots Aug 9, 2025
@sormuras
Copy link
Member

sormuras commented Aug 9, 2025

I note that javac emits the following messages for invalid entries in search paths:

warning: [path] bad path element "${PATH}": no such file or directory

@currenjin
Copy link
Contributor Author

@sormuras
Yes, exactly. This change makes the ConsoleLauncher behave more like javac in that it logs invalid classpath roots instead of silently ignoring them. While javac emits a warning to stderr, JUnit logs them at INFO level so that users can see misconfigurations during discovery.

@maxandersen
Copy link

Love it.

But should this not be WARN's ? Or as pointed out for javac - stderr message ?

@currenjin
Copy link
Contributor Author

@maxandersen

Good point. Updated the log level from INFO to WARN so that users can better notice invalid search path roots.

@currenjin
Copy link
Contributor Author

@maxandersen

Thanks for the feedback! I switched the level to WARN, but that surfaced an issue in platform-tooling-support-tests (StandaloneTests.execute*) where console output expectations are strict.

To keep the console output stable while still alerting users, would you prefer:

  1. WARN only for explicitly provided roots (e.g., via --scan-class-path <paths> or --classpath), while system-derived roots are filtered silently (or at DEBUG), or

  2. WARN for all invalid roots, but accept extra warnings on stderr and update the expected output accordingly?

I can implement (1) right away; it avoids changing the console output in common scenarios and keeps the tests green. If you’d rather go with (2), I’ll update the tests and docs.

Also, do we want to mention this behavior in the User Guide (ConsoleLauncher section)?

@currenjin
Copy link
Contributor Author

currenjin commented Aug 10, 2025

@maxandersen

Found the root cause of the test failure.

I was running the build in Korea (ko_KR locale), and the execute-related tests did not explicitly set the language.
This caused JUL log levels in the output to be localized (INFO → 정보), so the expected-err.txt assertions failed.

I fixed this by forcing -Duser.language=en and -Duser.country=US in the relevant tests.

@currenjin currenjin force-pushed the feat/issue-4772-log-invalid-roots branch from 744c29a to cb782d9 Compare August 10, 2025 10:43
@currenjin currenjin force-pushed the feat/issue-4772-log-invalid-roots branch from c161e9b to d38f38c Compare August 14, 2025 15:46
@currenjin currenjin force-pushed the feat/issue-4772-log-invalid-roots branch from d38f38c to 0a6ba3d Compare August 14, 2025 15:48
@currenjin
Copy link
Contributor Author

@marcphilipp Thanks! All suggested changes have been applied — please take a look when you can.

@currenjin currenjin requested a review from marcphilipp August 15, 2025 15:03
Copy link
Member

@marcphilipp marcphilipp left a comment

Choose a reason for hiding this comment

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

Could you please add an entry to documentation/src/docs/asciidoc/release-notes/release-notes-6.0.0-RC1.adoc in the "JUnit Platform" > "New Features and Improvements" section?

@currenjin
Copy link
Contributor Author

Added a new entry in release-notes-6.0.0-RC1.adoc under JUnit Platform > New Features and Improvements documenting the improved validation of additional classpath roots.

@currenjin currenjin requested a review from marcphilipp August 15, 2025 15:11
@marcphilipp marcphilipp merged commit da404fe into junit-team:main Aug 18, 2025
14 checks passed
@marcphilipp
Copy link
Member

Thank you for you contribution, @currenjin! 🙇

@currenjin currenjin deleted the feat/issue-4772-log-invalid-roots branch August 18, 2025 13:27
mergify bot added a commit to robfrank/linklift that referenced this pull request Oct 7, 2025
Bumps `junit.version` from 5.13.4 to 6.0.0.
Updates `org.junit.jupiter:junit-jupiter-engine` from 5.13.4 to 6.0.0
Release notes

*Sourced from [org.junit.jupiter:junit-jupiter-engine's releases](https://github.com/junit-team/junit-framework/releases).*

> JUnit 6.0.0 = Platform 6.0.0 + Jupiter 6.0.0 + Vintage 6.0.0
>
> See [Release Notes](https://docs.junit.org/6.0.0/release-notes/).
>
> New Contributors
> ----------------
>
> * [`@​2897robo`](https://github.com/2897robo) made their first contribution in [junit-team/junit-framework#4525](https://github.com/junit-team/junit-framework/pull/4525)
> * [`@​strangelookingnerd`](https://github.com/strangelookingnerd) made their first contribution in [junit-team/junit-framework#4683](https://github.com/junit-team/junit-framework/pull/4683)
> * [`@​eric6iese`](https://github.com/eric6iese) made their first contribution in [junit-team/junit-framework#4717](https://github.com/junit-team/junit-framework/pull/4717)
> * [`@​raccoonback`](https://github.com/raccoonback) made their first contribution in [junit-team/junit-framework#4822](https://github.com/junit-team/junit-framework/pull/4822)
> * [`@​currenjin`](https://github.com/currenjin) made their first contribution in [junit-team/junit-framework#4823](https://github.com/junit-team/junit-framework/pull/4823)
> * [`@​mehulimukherjee`](https://github.com/mehulimukherjee) made their first contribution in [junit-team/junit-framework#4913](https://github.com/junit-team/junit-framework/pull/4913)
> * [`@​lslonina`](https://github.com/lslonina) made their first contribution in [junit-team/junit-framework#4629](https://github.com/junit-team/junit-framework/pull/4629)
>
> **Full Changelog**: <junit-team/junit-framework@r5.14.0...r6.0.0>
>
> JUnit 6.0.0-RC3 = Platform 6.0.0-RC3 + Jupiter 6.0.0-RC3 + Vintage 6.0.0-RC3
>
> See [Release Notes](https://docs.junit.org/6.0.0-RC3/release-notes/).
>
> New Contributors
> ----------------
>
> * [`@​mehulimukherjee`](https://github.com/mehulimukherjee) made their first contribution in [junit-team/junit-framework#4913](https://github.com/junit-team/junit-framework/pull/4913)
> * [`@​lslonina`](https://github.com/lslonina) made their first contribution in [junit-team/junit-framework#4629](https://github.com/junit-team/junit-framework/pull/4629)
>
> **Full Changelog**: <junit-team/junit-framework@r6.0.0-RC2...r6.0.0-RC3>
>
> JUnit 6.0.0-RC2 = Platform 6.0.0-RC2 + Jupiter 6.0.0-RC2 + Vintage 6.0.0-RC2
>
> See [Release Notes](https://docs.junit.org/6.0.0-RC2/release-notes/).
>
> **Full Changelog**: <junit-team/junit-framework@r6.0.0-RC1...r6.0.0-RC2>
>
> JUnit 6.0.0-RC1 = Platform 6.0.0-RC1 + Jupiter 6.0.0-RC1 + Vintage 6.0.0-RC1
>
> See [Release Notes](https://docs.junit.org/6.0.0-RC1/release-notes/).
>
> New Contributors
> ----------------
>
> * [`@​raccoonback`](https://github.com/raccoonback) made their first contribution in [junit-team/junit-framework#4822](https://github.com/junit-team/junit-framework/pull/4822)
> * [`@​currenjin`](https://github.com/currenjin) made their first contribution in [junit-team/junit-framework#4823](https://github.com/junit-team/junit-framework/pull/4823)
>
> **Full Changelog**: <junit-team/junit-framework@r6.0.0-M2...r6.0.0-RC1>
>
> JUnit 6.0.0-M2 = Platform 6.0.0-M2 + Jupiter 6.0.0-M2 + Vintage 6.0.0-M2
>
> See [Release Notes](https://docs.junit.org/6.0.0-M2/release-notes/).
>
> New Contributors
> ----------------
>
> * [`@​eric6iese`](https://github.com/eric6iese) made their first contribution in [junit-team/junit-framework#4717](https://github.com/junit-team/junit-framework/pull/4717)
>
> **Full Changelog**: <junit-team/junit-framework@r6.0.0-M1...r6.0.0-M2>

... (truncated)


Commits

* [`4f79594`](junit-team/junit-framework@4f79594) Release 6.0.0
* [`55af30a`](junit-team/junit-framework@55af30a) Revert "Use `develop/6.x` branch for junit-examples during release build"
* [`df3cfdd`](junit-team/junit-framework@df3cfdd) Release 5.14.0
* [`fcb84a2`](junit-team/junit-framework@fcb84a2) Disable backward compatibility check when offline
* [`c9c8344`](junit-team/junit-framework@c9c8344) Prune 5.14.0 release notes
* [`03d8a72`](junit-team/junit-framework@03d8a72) Update broken link to using API Gaurdian with bndtools
* [`3a0b29b`](junit-team/junit-framework@3a0b29b) Use temporary JUnit 6 logo
* [`6603caa`](junit-team/junit-framework@6603caa) Rename `eclipseClasspath` to `eclipseConventions` to avoid confusion
* [`ab3470b`](junit-team/junit-framework@ab3470b) Make sealed `MediaType` work in Eclipse
* [`a8cd41e`](junit-team/junit-framework@a8cd41e) Remove annotations not visible in Eclipse
* Additional commits viewable in [compare view](junit-team/junit-framework@r5.13.4...r6.0.0)
  
Updates `org.junit.jupiter:junit-jupiter-params` from 5.13.4 to 6.0.0
Release notes

*Sourced from [org.junit.jupiter:junit-jupiter-params's releases](https://github.com/junit-team/junit-framework/releases).*

> JUnit 6.0.0 = Platform 6.0.0 + Jupiter 6.0.0 + Vintage 6.0.0
>
> See [Release Notes](https://docs.junit.org/6.0.0/release-notes/).
>
> New Contributors
> ----------------
>
> * [`@​2897robo`](https://github.com/2897robo) made their first contribution in [junit-team/junit-framework#4525](https://github.com/junit-team/junit-framework/pull/4525)
> * [`@​strangelookingnerd`](https://github.com/strangelookingnerd) made their first contribution in [junit-team/junit-framework#4683](https://github.com/junit-team/junit-framework/pull/4683)
> * [`@​eric6iese`](https://github.com/eric6iese) made their first contribution in [junit-team/junit-framework#4717](https://github.com/junit-team/junit-framework/pull/4717)
> * [`@​raccoonback`](https://github.com/raccoonback) made their first contribution in [junit-team/junit-framework#4822](https://github.com/junit-team/junit-framework/pull/4822)
> * [`@​currenjin`](https://github.com/currenjin) made their first contribution in [junit-team/junit-framework#4823](https://github.com/junit-team/junit-framework/pull/4823)
> * [`@​mehulimukherjee`](https://github.com/mehulimukherjee) made their first contribution in [junit-team/junit-framework#4913](https://github.com/junit-team/junit-framework/pull/4913)
> * [`@​lslonina`](https://github.com/lslonina) made their first contribution in [junit-team/junit-framework#4629](https://github.com/junit-team/junit-framework/pull/4629)
>
> **Full Changelog**: <junit-team/junit-framework@r5.14.0...r6.0.0>
>
> JUnit 6.0.0-RC3 = Platform 6.0.0-RC3 + Jupiter 6.0.0-RC3 + Vintage 6.0.0-RC3
>
> See [Release Notes](https://docs.junit.org/6.0.0-RC3/release-notes/).
>
> New Contributors
> ----------------
>
> * [`@​mehulimukherjee`](https://github.com/mehulimukherjee) made their first contribution in [junit-team/junit-framework#4913](https://github.com/junit-team/junit-framework/pull/4913)
> * [`@​lslonina`](https://github.com/lslonina) made their first contribution in [junit-team/junit-framework#4629](https://github.com/junit-team/junit-framework/pull/4629)
>
> **Full Changelog**: <junit-team/junit-framework@r6.0.0-RC2...r6.0.0-RC3>
>
> JUnit 6.0.0-RC2 = Platform 6.0.0-RC2 + Jupiter 6.0.0-RC2 + Vintage 6.0.0-RC2
>
> See [Release Notes](https://docs.junit.org/6.0.0-RC2/release-notes/).
>
> **Full Changelog**: <junit-team/junit-framework@r6.0.0-RC1...r6.0.0-RC2>
>
> JUnit 6.0.0-RC1 = Platform 6.0.0-RC1 + Jupiter 6.0.0-RC1 + Vintage 6.0.0-RC1
>
> See [Release Notes](https://docs.junit.org/6.0.0-RC1/release-notes/).
>
> New Contributors
> ----------------
>
> * [`@​raccoonback`](https://github.com/raccoonback) made their first contribution in [junit-team/junit-framework#4822](https://github.com/junit-team/junit-framework/pull/4822)
> * [`@​currenjin`](https://github.com/currenjin) made their first contribution in [junit-team/junit-framework#4823](https://github.com/junit-team/junit-framework/pull/4823)
>
> **Full Changelog**: <junit-team/junit-framework@r6.0.0-M2...r6.0.0-RC1>
>
> JUnit 6.0.0-M2 = Platform 6.0.0-M2 + Jupiter 6.0.0-M2 + Vintage 6.0.0-M2
>
> See [Release Notes](https://docs.junit.org/6.0.0-M2/release-notes/).
>
> New Contributors
> ----------------
>
> * [`@​eric6iese`](https://github.com/eric6iese) made their first contribution in [junit-team/junit-framework#4717](https://github.com/junit-team/junit-framework/pull/4717)
>
> **Full Changelog**: <junit-team/junit-framework@r6.0.0-M1...r6.0.0-M2>

... (truncated)


Commits

* [`4f79594`](junit-team/junit-framework@4f79594) Release 6.0.0
* [`55af30a`](junit-team/junit-framework@55af30a) Revert "Use `develop/6.x` branch for junit-examples during release build"
* [`df3cfdd`](junit-team/junit-framework@df3cfdd) Release 5.14.0
* [`fcb84a2`](junit-team/junit-framework@fcb84a2) Disable backward compatibility check when offline
* [`c9c8344`](junit-team/junit-framework@c9c8344) Prune 5.14.0 release notes
* [`03d8a72`](junit-team/junit-framework@03d8a72) Update broken link to using API Gaurdian with bndtools
* [`3a0b29b`](junit-team/junit-framework@3a0b29b) Use temporary JUnit 6 logo
* [`6603caa`](junit-team/junit-framework@6603caa) Rename `eclipseClasspath` to `eclipseConventions` to avoid confusion
* [`ab3470b`](junit-team/junit-framework@ab3470b) Make sealed `MediaType` work in Eclipse
* [`a8cd41e`](junit-team/junit-framework@a8cd41e) Remove annotations not visible in Eclipse
* Additional commits viewable in [compare view](junit-team/junit-framework@r5.13.4...r6.0.0)
  
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add logging to have console launcher inform about bad/missing searchpath roots
4 participants