Ejemplo n.º 1
0
def test_metadata_method():
    initial_failures = wvfailure_count()
    tmpdir = tempfile.mkdtemp(dir=bup_tmp, prefix='bup-tmetadata-')
    bup_dir = tmpdir + '/bup'
    data_path = tmpdir + '/foo'
    os.mkdir(data_path)
    ex('touch', data_path + '/file')
    ex('ln', '-s', 'file', data_path + '/symlink')
    test_time1 = 13 * 1000000000
    test_time2 = 42 * 1000000000
    utime(data_path + '/file', (0, test_time1))
    lutime(data_path + '/symlink', (0, 0))
    utime(data_path, (0, test_time2))
    ex(bup_path, '-d', bup_dir, 'init')
    ex(bup_path, '-d', bup_dir, 'index', '-v', data_path)
    ex(bup_path, '-d', bup_dir, 'save', '-tvvn', 'test', data_path)
    git.check_repo_or_die(bup_dir)
    top = vfs.RefList(None)
    n = top.lresolve('/test/latest' + realpath(data_path))
    m = n.metadata()
    WVPASS(m.mtime == test_time2)
    WVPASS(len(n.subs()) == 2)
    WVPASS(n.name == 'foo')
    WVPASS(set([x.name for x in n.subs()]) == set(['file', 'symlink']))
    for sub in n:
        if sub.name == 'file':
            m = sub.metadata()
            WVPASS(m.mtime == test_time1)
        elif sub.name == 'symlink':
            m = sub.metadata()
            WVPASS(m.mtime == 0)
    if wvfailure_count() == initial_failures:
        subprocess.call(['rm', '-rf', tmpdir])
Ejemplo n.º 2
0
def test_metadata_method():
    tmpdir = tempfile.mkdtemp(prefix='bup-tmetadata-')
    try:
        bup_dir = tmpdir + '/bup'
        data_path = tmpdir + '/foo'
        os.mkdir(data_path)
        ex('touch', data_path + '/file')
        ex('ln', '-s', 'file', data_path + '/symlink')
        test_time1 = 13 * 1000000000
        test_time2 = 42 * 1000000000
        utime(data_path + '/file', (0, test_time1))
        lutime(data_path + '/symlink', (0, 0))
        utime(data_path, (0, test_time2))
        ex(bup_path, '-d', bup_dir, 'init')
        ex(bup_path, '-d', bup_dir, 'index', '-v', data_path)
        ex(bup_path, '-d', bup_dir, 'save', '-tvvn', 'test', data_path)
        git.check_repo_or_die(bup_dir)
        top = vfs.RefList(None)
        n = top.lresolve('/test/latest' + realpath(data_path))
        m = n.metadata()
        WVPASS(m.mtime == test_time2)
        WVPASS(len(n.subs()) == 2)
        WVPASS(n.name == 'foo')
        WVPASS(set([x.name for x in n.subs()]) == set(['file', 'symlink']))
        for sub in n:
            if sub.name == 'file':
                m = sub.metadata()
                WVPASS(m.mtime == test_time1)
            elif sub.name == 'symlink':
                m = sub.metadata()
                WVPASS(m.mtime == 0)
    finally:
        subprocess.call(['rm', '-rf', tmpdir])
Ejemplo n.º 3
0
def test_metadata_method():
    tmpdir = tempfile.mkdtemp(prefix="bup-tmetadata-")
    try:
        bup_dir = tmpdir + "/bup"
        data_path = tmpdir + "/foo"
        os.mkdir(data_path)
        ex("touch", data_path + "/file")
        ex("ln", "-s", "file", data_path + "/symlink")
        test_time1 = 13 * 1000000000
        test_time2 = 42 * 1000000000
        utime(data_path + "/file", (0, test_time1))
        lutime(data_path + "/symlink", (0, 0))
        utime(data_path, (0, test_time2))
        ex(bup_path, "-d", bup_dir, "init")
        ex(bup_path, "-d", bup_dir, "index", "-v", data_path)
        ex(bup_path, "-d", bup_dir, "save", "-tvvn", "test", data_path)
        git.check_repo_or_die(bup_dir)
        top = vfs.RefList(None)
        n = top.lresolve("/test/latest" + realpath(data_path))
        m = n.metadata()
        WVPASS(m.mtime == test_time2)
        WVPASS(len(n.subs()) == 2)
        WVPASS(n.name == "foo")
        WVPASS(set([x.name for x in n.subs()]) == set(["file", "symlink"]))
        for sub in n:
            if sub.name == "file":
                m = sub.metadata()
                WVPASS(m.mtime == test_time1)
            elif sub.name == "symlink":
                m = sub.metadata()
                WVPASS(m.mtime == 0)
    finally:
        subprocess.call(["rm", "-rf", tmpdir])