test: fix TestShell initialization for cmake build directory #31510

pull pinheadmz wants to merge 1 commits into bitcoin:master from pinheadmz:testshell-cmake changing 2 files +12 −4
  1. pinheadmz commented at 4:37 pm on December 16, 2024: member

    The cmake build system creates a build/ directory and writes config.ini there, along with a tree of symlinks to test_framework and all the individual test files. This symlink breaks the fix in #30714 which resolved those symlinks, causing the TestShell to initialize in the original test directory, where config.ini does not exist.

    The fix in this patch is simply not to resolve the symlinks, so TestShell uses:

    • /path/to/bitcoin/build/test/config.ini
    • /path/to/bitcoin/build/test/cache

    Note that any arguments like configfile and cachedir that are passed to setup() will be too late to work around the issue since the constructor TestShell() is invoked with a file path first and that path determines config file and cache location.

    Test script:

     0#!/usr/bin/env python3
     1
     2# USAGE: shell.py /path/to/bitcoin/repo
     3
     4from pathlib import Path
     5import sys
     6REPO = Path(sys.argv.pop())
     7sys.path.insert(0, f"{REPO / 'build' / 'test' / 'functional'}")
     8from test_framework.test_shell import TestShell
     9
    10TestShell().setup(num_nodes=1, setup_clean_chain=True)
    11TestShell().shutdown()
    

    Fails on master:

    0FileNotFoundError: [Errno 2] No such file or directory: '/Users/matthewzipkin/Desktop/work/bitcoin/test/config.ini'
    
  2. test: fix TestShell initialization for cmake build directory fb3782a85a
  3. pinheadmz requested review from theStack on Dec 16, 2024
  4. DrahtBot commented at 4:37 pm on December 16, 2024: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31510.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

  5. DrahtBot added the label Tests on Dec 16, 2024
  6. pinheadmz commented at 4:39 pm on December 16, 2024: member
    whoops just found #31415 closing this as duplicate
  7. pinheadmz closed this on Dec 16, 2024


pinheadmz DrahtBot


theStack

Labels
Tests


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-12-21 12:12 UTC

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