Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LUCENE-9727: build side support for running Hunspell tests. #2313

Merged
merged 7 commits into from
Feb 8, 2021

Conversation

dweiss
Copy link
Contributor

@dweiss dweiss commented Feb 7, 2021

No description provided.

@dweiss
Copy link
Contributor Author

dweiss commented Feb 7, 2021

@donnerpeter I've done some minor edits so that those checks run via Gradle too. Can you take a peek? I made one change that may affect you - those dictionaries are now scanned recursively without the depth limit - this helps me to run against both repos at once.

* documentation}
* Loads all dictionaries from the directory specified in {@code hunspell.dictionaries} system
* property and prints their memory usage. All *.aff files are traversed directly inside the given
* directory or in its immediate subdirectories. Each *.aff file must have a same-named sibling
Copy link
Contributor

Choose a reason for hiding this comment

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

Not only immediate now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, thanks.

int threads = Runtime.getRuntime().availableProcessors();
ExecutorService executor = Executors.newFixedThreadPool(threads);
try {
Deque<Path> failures = new ConcurrentLinkedDeque<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

synchronizedList might look less surprising to readers :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't matter it a test, but sure.

+ "suffixes="
+ RamUsageTester.humanSizeOf(dic.suffixes)
+ ")";
+ ("words=" + RamUsageTester.humanSizeOf(dic.words) + ", ")
Copy link
Contributor

Choose a reason for hiding this comment

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

A nice trick to save on LOCs in the face of this ruthless spotless formatter :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, such hints and groupings make logical sense and also help with formatting.

Copy link
Contributor

@donnerpeter donnerpeter left a comment

Choose a reason for hiding this comment

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

@donnerpeter I've done some minor edits so that those checks run via Gradle too. Can you take a peek? I made one change that may affect you - those dictionaries are now scanned recursively without the depth limit - this helps me to run against both repos at once.

Thank you very much, LGTM overall! Do you check out both repos into some common parent directory? Looks like a nice idea.

System.err.println("While checking " + aff + ":");
e.printStackTrace();
int threads = Runtime.getRuntime().availableProcessors();
ExecutorService executor = Executors.newFixedThreadPool(threads);
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for parallelization! I've considered it, but never got to do it.

@@ -40,8 +42,15 @@
* en.txt}) in a directory specified in {@code -Dhunspell.corpora=...}
*/
@TestCaseOrdering(TestCaseOrdering.AlphabeticOrder.class)
@Ignore("enable manually")
Copy link
Contributor

Choose a reason for hiding this comment

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

I actually took advantage of this. Running all tests in a package skipped the ignored ones, and so the correctness was checked relatively quickly. Now that'd also include performance/allDict tests, and can become slower :( But I can work around that locally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not if you create a launch config that just has one of those properties (just the hunspell.dictionaries) - then perf tests would be skipped. If you launch everything from the same launcher then indeed this will be a problem. I don't care much but it'd be my preference to control it somehow without modifying the code itself. You could use a custom property, test group annotation... whatever works. I think two properties already separate these tests well enough though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, that's the way to go

@dweiss
Copy link
Contributor Author

dweiss commented Feb 7, 2021

Do you check out both repos into some common parent directory?

Yes, that's what I did. I just wanted a superset of all the dictionaries... Perhaps eventually make it a gradle task to fetch them automatically and then run integration tests on them. Just goofing around with the code though - I'm not trying to step in your way!

@donnerpeter
Copy link
Contributor

donnerpeter commented Feb 7, 2021

Do you check out both repos into some common parent directory?

Yes, that's what I did. I just wanted a superset of all the dictionaries... Perhaps eventually make it a gradle task to fetch them automatically and then run integration tests on them. Just goofing around with the code though - I'm not trying to step in your way!

No worries, and thanks :)

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