[WIP] Unit test sub-directories - Continued #13067

pull ccdle12 wants to merge 1 commits into bitcoin:master from ccdle12:PR-fixes-ccdle12 changing 7 files +52 −22
  1. ccdle12 commented at 1:53 PM on April 24, 2018: contributor

    fixes #12583

    Continuing on the work of @chrislennon.

    I've applied his changes to the tests and also updated:

    unit_test_directory(const std::string fileName)

    • It now passes in the the current fileName to be used as part of the temp directory file path.

    Any guidance on further improvements or refactored would be very much welcomed

  2. ccdle12 renamed this:
    Pr fixes ccdle12
    [WIP] Unit test sub-directories - Continued
    on Apr 24, 2018
  3. fanquake added the label Tests on Apr 24, 2018
  4. in src/test/test_bitcoin.cpp:71 in 73f239ed07 outdated
      67 | @@ -68,7 +68,7 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha
      68 |  
      69 |          RegisterAllCoreRPCCommands(tableRPC);
      70 |          ClearDatadirCache();
      71 | -        pathTemp = fs::temp_directory_path() / strprintf("test_bitcoin_%lu_%i", (unsigned long)GetTime(), (int)(InsecureRandRange(100000)));
      72 | +        fs::path pathTemp = util_tests::unit_test_directory("test_bitcoin");
    


    MarcoFalke commented at 2:38 PM on April 24, 2018:

    This shadows pathTemp, you might as well rename it m_path_temp according to the developer guidelines

  5. in src/test/util_tests.cpp:32 in 73f239ed07 outdated
      27 | +
      28 | +        std::string sub_dir = "bitcoin_unit_tests";
      29 | +        fs::path dir(fs::temp_directory_path() / sub_dir);
      30 | +        fs::path test_dir(dir / fileName / std::string(boost::unit_test::framework::current_test_case().p_name));
      31 | +
      32 | +        if(!fs::exists(dir))
    


    MarcoFalke commented at 2:41 PM on April 24, 2018:

    The dir will exist when the previous run was not shut down cleanly or when running two test_bitcoin at the same time. I don't think we should silently continue here.

  6. MarcoFalke commented at 2:41 PM on April 24, 2018: member

    Needs rebase

  7. ccdle12 force-pushed on Apr 28, 2018
  8. MarcoFalke commented at 6:11 PM on April 30, 2018: member

    Still needs rebase

  9. ccdle12 commented at 11:03 AM on May 2, 2018: contributor

    Have really made a mess of this PR, appreciate help to remedy it but understand if it would be cleaner to scrap it all together

  10. MarcoFalke commented at 1:04 PM on May 2, 2018: member
    git checkout $your_branch
    git merge 0bc980b1f65f3739bb9667d58abab1137c0f942a # merge all master changes
    git reset --soft 0bc980b1f65f3739bb9667d58abab1137c0f942a # consider all non-master changes to be put in a commit
    git commit -m 'commit message' # Put all non-master changes in this commit
    git push origin $your_branch -f # Force push the rewritten branch
    
  11. ccdle12 force-pushed on May 2, 2018
  12. ccdle12 force-pushed on May 2, 2018
  13. ccdle12 force-pushed on May 20, 2018
  14. ccdle12 force-pushed on May 20, 2018
  15. ccdle12 force-pushed on May 20, 2018
  16. ccdle12 force-pushed on May 20, 2018
  17. ccdle12 force-pushed on May 20, 2018
  18. ccdle12 force-pushed on May 20, 2018
  19. ccdle12 force-pushed on May 20, 2018
  20. ccdle12 force-pushed on May 21, 2018
  21. ccdle12 force-pushed on May 21, 2018
  22. ccdle12 force-pushed on May 21, 2018
  23. ccdle12 force-pushed on May 21, 2018
  24. ccdle12 force-pushed on May 21, 2018
  25. ccdle12 force-pushed on May 21, 2018
  26. ccdle12 force-pushed on May 22, 2018
  27. ccdle12 force-pushed on May 22, 2018
  28. MarcoFalke added the label Needs rebase on Jun 6, 2018
  29. ccdle12 force-pushed on Jun 7, 2018
  30. DrahtBot removed the label Needs rebase on Jun 8, 2018
  31. ccdle12 force-pushed on Jun 8, 2018
  32. ccdle12 force-pushed on Jun 9, 2018
  33. Creating unit test sub-directory folders in temp directory
    Adding namespace util_tests and updating dirname using unit_test_directory
    
    Adding header file for util_tests and exposing namespace util_tests
    
    Adding include statement for util_tests.h and changing pathTemp to m_path_temp
    
    Implementing util_tests function to create temp directory 'test_main'
    
    Implementing util_tests function to create temp directory 'dbwrapper_tests'
    
    Implementing util_tests function to create highest level temp dir 'test_bitcoin'
    
    Refactoring pathTemp to m_path_temp
    d308f943d1
  34. ccdle12 force-pushed on Jun 11, 2018
  35. ccdle12 commented at 8:40 AM on June 11, 2018: contributor

    Currently stuck, would really appreciate any guidance on the following:

    • Can compile bitcoind tests by running $ make -C src/test
    • Tests successfully complete by running the command - $ src/test/test_bitcoin and a common temp folder is created - bitcoin_unit_tests

    Extending these tests to qt tests when running $ make at the root folder returns an error -

    util_tests::unit_test_directory(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
          _main in test_bitcoin_qt-test_main.o
          TestingSetup::TestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in qt_test_test_bitcoin_qt-test_bitcoin.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    

    I've attempted to include test/utils.h in Makefile.qttest.include but that doesn't seem to be the correct solution

  36. ccdle12 commented at 8:26 AM on June 12, 2018: contributor

    Closing this PR as #13145 is looking like the correct solution

  37. ccdle12 closed this on Jun 12, 2018

  38. MarcoFalke referenced this in commit 3f826598a4 on Mar 5, 2020
  39. 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: 2026-04-15 09:15 UTC

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