コード例 #1
0
def test_eolfix(params):
    """Test 1: Test creating dumps."""

    # get params
    tempdir = params["tempdir"]
    tempfiles = params["tempfiles"]
    temprepos = params["temprepos"]
    tempwc = params["tempwc"]

    # broken and fixed dumps
    broken = tempdir + "/test_eolfix_1"
    fixed = tempdir + "/test_eolfix_2"
    fixed2 = tempdir + "/test_eolfix_2b"

    # create dump
    py_create_dump_file(broken, "eolfix", data_test1, tempfiles)
    # eolfix
    svndump_eol_fix_cmdline("svndumptest.py",
                            ["-mregexp", "-r", "\\.txt$", broken, fixed])
    # compare broken and fixed
    rc = svndump_diff_cmdline("svndumptest.py",
                              ["-e", "-IEOL", "-ITextLen", "-ITextMD5",
                               broken, fixed])
    add_test_result(params, "test_eolfix", "diff broken fixed", rc)
    if rc != 0:
        print("diffs found :(")
        return 1
    # eolfix and add eol-style
    svndump_eol_fix_cmdline("svndumptest.py",
                            ["-mregexp", "-r", "\\.txt$", "-Enative",
                             broken, fixed2])
    # compare broken and fixed
    rc = svndump_diff_cmdline("svndumptest.py",
                              ["-e", "-IEOL", "-ITextLen", "-ITextMD5",
                               "--ignore-property=svn:eol-style",
                               broken, fixed2])
    add_test_result(params, "test_eolfix", "diff broken fixed2", rc)
    if rc != 0:
        print("diffs found :(")
        return 1

    # done.
    return 0
コード例 #2
0
def test_dumps(params):
    """Test 1: Test creating dumps."""

    # get params
    tempdir = params["tempdir"]
    tempfiles = params["tempfiles"]
    temprepos = params["temprepos"]
    tempwc = params["tempwc"]

    # test1: create a dump with commandline and python classes then compare
    svndmp = tempdir + "/test_dumps_svn"
    pydmp = tempdir + "/test_dumps_py1"
    pydmp2 = tempdir + "/test_dumps_py2"

    # create with cmdline
    svn_create_dump_file(svndmp, "test1", data_test1, temprepos, tempwc)
    # create with python
    py_create_dump_file(pydmp, "test1", data_test1, tempfiles)
    # copy the one created with cmdline
    svndump.copy_dump_file(svndmp, pydmp2)
    # compare svndmp and pydmp2
    rc = run("diff -u '%s' '%s'" % (svndmp, pydmp2))
    add_test_result(params, "test_dumps", "gnu diff svndmp pydmp2", rc)
    if rc != 0:
        print("diffs found :(")
        return 1
    rc = svndump_diff_cmdline("svndumptest.py",
                              [svndmp, pydmp2])
    add_test_result(params, "test_dumps", "diff svndmp pydmp2", rc)
    if rc != 0:
        print("diffs found :(")
        return 1
    # compare svndmp and pydmp
    rc = svndump_diff_cmdline("svndumptest.py",
                              ["-IUUID", "-IRevDate", "-IRevDateStr",
                               "--ignore-revprop=svn:date", svndmp, pydmp])
    add_test_result(params, "test_dumps", "diff svndmp pydmp", rc)
    if rc != 0:
        print("diffs found :(")
        return 1

    # done.
    return 0