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

Cleanup test files on Windows after executing test binary #1910

Merged
merged 3 commits into from
Apr 19, 2019

Conversation

wezrule
Copy link
Contributor

@wezrule wezrule commented Apr 18, 2019

The test results on Windows include a lot of noise after most tests:
Could not remove temporary directory: The process cannot access the file because it is being used by another process

These temporary folders can build up after time (many GB in my case). In particular the files which are still held are the logging file and the store/wallet store database files. The logger is set up as a singleton for the duration of the program, so is not easily closed. It's also a nightmare trying to stop the store/wallet store in node::stop as other stuff can still execute in the background which can talk to the database, pending alarm operations in particular. So we need to wait until the node destructor has finished. I could probably add a "stopped" flag in a load of places, but I feel like it could introduce problems and this is only for tests do didn't want to add any regression risks.

An option would be to change all test to use test fixtures and make use of the TearDown () function to contain the cleaning logic. But it involves changing every test, e.g:

TEST (wallet, update_work_action)
becomes:
TEST_F (TestFixtureWithTearDownImplemented, wallet.update_work_action)

Not very ideal, but it would mean all platforms would clean up correctly after each test is run. I will leave this option open for debate.

For now, I've implemented conditional compilation so that on Windows the cleaning up only happens at the end of the test executable. This does mean that early exiting in any test will not clean up any proceeding but it seems better than nothing (and also removes the noisey output). The other platforms remain unchanged.

@wezrule wezrule added the quality improvements This item indicates the need for or supplies changes that improve maintainability label Apr 18, 2019
@wezrule wezrule added this to the V19.0 milestone Apr 18, 2019
@wezrule wezrule requested review from argakiig and cryptocode April 18, 2019 20:02
@wezrule wezrule self-assigned this Apr 18, 2019
@wezrule wezrule changed the title Cleanup test files on Wtraindows after executing test script Cleanup test files on Windows after executing test script Apr 18, 2019
@wezrule wezrule changed the title Cleanup test files on Windows after executing test script Cleanup test files on Windows after executing test binary Apr 18, 2019
@wezrule wezrule removed this from the V19.0 milestone Apr 18, 2019
@wezrule wezrule added this to the V19.0 milestone Apr 18, 2019
Copy link
Contributor

@cryptocode cryptocode left a comment

Choose a reason for hiding this comment

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

LGTM

@wezrule wezrule merged commit ebcd2dd into nanocurrency:master Apr 19, 2019
@wezrule wezrule deleted the cleanup_test_files_windows branch April 19, 2019 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
quality improvements This item indicates the need for or supplies changes that improve maintainability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants