def test_insert(repository):
    cmd = 'bin/copyright_header.py insert -h'
    print(exec_cmd_no_error(cmd))
    check_cmd = "bin/copyright_header.py check %s" % repository
    modify_cmd = "bin/copyright_header.py insert %s/src/" % repository
    exec_modify_doesnt_fix_check(repository, check_cmd, modify_cmd)
    repository.reset_hard_head()
    # results in no-op if already has a valid header
    cmd = "bin/copyright_header.py insert %s/src/init.cpp" % repository
    print(exec_cmd_no_error(cmd))
    repository.assert_not_dirty()
def test_check(repository):
    cmd = 'bin/basic_style.py check -h'
    print(exec_cmd_no_error(cmd))
    cmd = 'bin/basic_style.py check -j3 %s' % repository
    e, out = exec_cmd_error(cmd)
    print("%d\n%s" % (e, out))
    cmd = 'bin/basic_style.py check --json %s' % repository
    e, out = exec_cmd_json_error(cmd)
    print("%d\n%s" % (e, out))
    cmd = 'bin/basic_style.py check %s/src/init.cpp' % repository
    print(exec_cmd_no_error(cmd))
def tests(settings):
    bitcoin_clone_dir = os.path.join(settings.tmp_directory, "bitcoin-clone")
    elements_clone_dir = os.path.join(settings.tmp_directory, "elements-clone")
    cmd = 'bin/clone_configure_build.py -h'
    print(exec_cmd_no_error(cmd))
    cmd = 'bin/clone_configure_build.py -j3 -b v0.14.0 %s' % bitcoin_clone_dir
    print(exec_cmd_no_error(cmd))
    shutil.rmtree(bitcoin_clone_dir)
    cmd = (
        "bin/clone_configure_build.py -u "
        "https://github.com/ElementsProject/elements -b elements-0.13.1 %s" %
        elements_clone_dir)
    print(exec_cmd_no_error(cmd))
    shutil.rmtree(elements_clone_dir)
def test_fix(repository):
    cmd = 'bin/basic_style.py fix -h'
    print(exec_cmd_no_error(cmd))
    check_cmd = "bin/basic_style.py check %s" % repository
    modify_cmd = "bin/basic_style.py fix %s" % repository
    exec_modify_fixes_check(repository, check_cmd, modify_cmd)
    repository.reset_hard_head()
def test_update(repository):
    cmd = 'bin/copyright_header.py update -h'
    print(exec_cmd_no_error(cmd))
    check_cmd = "bin/copyright_header.py check %s" % repository
    modify_cmd = "bin/copyright_header.py update %s" % repository
    exec_modify_doesnt_fix_check(repository, check_cmd, modify_cmd)
    repository.reset_hard_head()
Example #6
0
def test_check(repository, test_bin_dir, test_style_file):
    cmd = 'bin/clang_format.py check -h'
    print(exec_cmd_no_error(cmd))
    cmd = 'bin/clang_format.py check -j3 --force %s' % repository
    print("%d\n%s" % exec_cmd_error(cmd))
    cmd = 'bin/clang_format.py check --json --force %s' % repository
    e, out = exec_cmd_json_error(cmd)
    print("%d\n%s" % (e, out))
    cmd = ('bin/clang_format.py check --force %s/src/bench/bench_bitcoin.cpp' %
           repository)
    print(exec_cmd_no_error(cmd))
    cmd = 'bin/clang_format.py check --force -b %s %s' % (test_bin_dir,
                                                          repository)
    print("%d\n%s" % exec_cmd_error(cmd))
    cmd = 'bin/clang_format.py check -s %s %s' % (test_style_file, repository)
    print("%d\n%s" % exec_cmd_error(cmd))
Example #7
0
def tests(settings):
    cmd = 'bin/reports.py -h'
    print(exec_cmd_no_error(cmd))
    cmd = 'bin/reports.py --json -j3 %s' % settings.repository
    print(exec_cmd_json_no_error(cmd))
    cmd = 'bin/reports.py -b %s -s %s -j3 %s' % (settings.test_bin_dir,
                                                 settings.test_style_file,
                                                 settings.repository)
    print(exec_cmd_no_error(cmd))
    # put the results in a different directory:
    test_tmp_dir = os.path.join(settings.tmp_directory,
                                "another-tmp-directory")
    # no specified targets runs it on the path/repository it is invoked from:
    cmd = 'bin/reports.py -t %s' % test_tmp_dir
    original = os.getcwd()
    os.chdir(str(settings.repository))
    print(exec_cmd_no_error(cmd))
    os.chdir(original)
def test_report(repository):
    cmd = 'bin/basic_style.py report -h'
    print(exec_cmd_no_error(cmd))
    cmd = 'bin/basic_style.py report %s' % repository
    print(exec_cmd_no_error(cmd))
    cmd = 'bin/basic_style.py report -j3 %s' % repository
    print(exec_cmd_no_error(cmd))
    cmd = ('bin/basic_style.py report -j3 %s/src/init.cpp %s/src/qt/' %
           (repository, repository))
    print(exec_cmd_no_error(cmd))
    cmd = 'bin/basic_style.py report --json %s' % repository
    print(exec_cmd_json_no_error(cmd))
    cmd = ('bin/basic_style.py report --json %s/src/init.cpp %s/src/qt/' %
           (repository, repository))
    print(exec_cmd_json_no_error(cmd))
    # no specified targets runs it on the path/repository it is invoked from:
    cmd = 'bin/basic_style.py report'
    original = os.getcwd()
    os.chdir(str(repository))
    print(exec_cmd_no_error(cmd))
    os.chdir(original)
Example #9
0
def test_format(repository):
    cmd = 'bin/clang_format.py format -h'
    print(exec_cmd_no_error(cmd))
    check_cmd = "bin/clang_format.py check --force %s" % repository
    modify_cmd = "bin/clang_format.py format --force %s" % repository
    # Two rounds of 'format' are needed to adjust the style of
    # src/validation.cpp to match, so this fails.
    exec_modify_doesnt_fix_check(repository, check_cmd, modify_cmd)
    repository.reset_hard_head()
    check_cmd = ("bin/clang_format.py check --force %s/src/init.cpp" %
                 repository)
    modify_cmd = ("bin/clang_format.py format --force %s/src/init.cpp" %
                  repository)
    exec_modify_fixes_check(repository, check_cmd, modify_cmd)
    repository.reset_hard_head()
Example #10
0
def test_report(repository, test_bin_dir, test_style_file):
    cmd = 'bin/clang_format.py report -h'
    print(exec_cmd_no_error(cmd))
    cmd = 'bin/clang_format.py report %s' % repository
    print(exec_cmd_no_error(cmd))
    cmd = ('bin/clang_format.py report -j3 %s/src/init.cpp %s/src/qt/' %
           (repository, repository))
    print(exec_cmd_no_error(cmd))
    cmd = 'bin/clang_format.py report --json %s' % repository
    print(exec_cmd_json_no_error(cmd))
    cmd = 'bin/clang_format.py report -b %s %s' % (test_bin_dir, repository)
    print(exec_cmd_no_error(cmd))
    cmd = 'bin/clang_format.py report -s %s %s' % (test_style_file, repository)
    print(exec_cmd_no_error(cmd))
    # no specified targets runs it on the path/repository it is invoked from:
    cmd = 'bin/clang_format.py report'
    original = os.getcwd()
    os.chdir(str(repository))
    print(exec_cmd_no_error(cmd))
    os.chdir(original)
def test_help(repository):
    cmd = 'bin/basic_style.py -h'
    print(exec_cmd_no_error(cmd))
def test_help(repository):
    cmd = 'bin/copyright_header.py -h'
    print(exec_cmd_no_error(cmd))
Example #13
0
def test_help(repository):
    cmd = 'bin/clang_format.py -h'
    print(exec_cmd_no_error(cmd))