Unit tests: create one top-level temporary directory #12574

issue laanwj openend this issue on March 1, 2018
  1. laanwj commented at 11:29 am on March 1, 2018: member

    Currently, every unit test that needs a temporary directory creates a directory directly under the system tmp path, /tmp/0df0-cbb9-e3f5-5753 and such. This gets cluttered really quickly, especially if tests fail to clean up. If a directory is left behind it can be tricky to find out which test is the culprit.

    I would prefer creating one temporary directory at start of the entire framework, then creating directories under this with the name of the test and optional iteration number. E.g. /tmp/0df0-cbb9-e3f5-5753/dbwrapper_1. This makes it clear if tests leave behind junk, and facilitates cleanup.

    Two different mechanisms are used currently for generating temporary directories:

    • pathTemp = fs::temp_directory_path() / strprintf("test_bitcoin_%lu_%i", (unsigned long)GetTime(), (int)(InsecureRandRange(100000))) ()
    • fs::temp_directory_path() / fs::unique_path()

    This would also be unified, then.

  2. laanwj added the label Tests on Mar 1, 2018
  3. laanwj added the label good first issue on Mar 1, 2018
  4. MarcoFalke referenced this in commit d3dae3ddf9 on Jul 12, 2018
  5. MarcoFalke removed the label good first issue on Jul 12, 2018
  6. MarcoFalke added the label good first issue on Jul 12, 2018
  7. MarcoFalke commented at 11:53 am on July 12, 2018: member
    Closing for now. Let me know if this still an issue.
  8. MarcoFalke closed this on Jul 12, 2018

  9. PastaPastaPasta referenced this in commit 6372283967 on Dec 16, 2020
  10. PastaPastaPasta referenced this in commit 5c7c9a00da on Dec 18, 2020
  11. PastaPastaPasta referenced this in commit 2a69d81fae on Dec 18, 2020
  12. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-23 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me