Exemplo n.º 1
0
def test_bup_lutimes(tmpdir):
    if not xstat._bup_lutimes:
        return
    path = tmpdir + b'/foo'
    open(path, 'w').close()
    frac_ts = (0, 10**6 // 2)
    xstat._bup_lutimes(path, (frac_ts, frac_ts))
    st = _helpers.stat(path)
    atime_ts = st[8]
    mtime_ts = st[9]
    WVPASSEQ(atime_ts[0], 0)
    WVPASS(atime_ts[1] == 0 or atime_ts[1] == frac_ts[1] * 1000)
    WVPASSEQ(mtime_ts[0], 0)
    WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1] * 1000)
Exemplo n.º 2
0
def test_bup_lutimes():
    if not xstat._bup_lutimes:
        return
    with no_lingering_errors(), test_tempdir('bup-txstat-') as tmpdir:
        path = tmpdir + '/foo'
        open(path, 'w').close()
        frac_ts = (0, 10**6 / 2)
        xstat._bup_lutimes(path, (frac_ts, frac_ts))
        st = _helpers.stat(path)
        atime_ts = st[8]
        mtime_ts = st[9]
        WVPASSEQ(atime_ts[0], 0)
        WVPASS(atime_ts[1] == 0 or atime_ts[1] == frac_ts[1] * 1000)
        WVPASSEQ(mtime_ts[0], 0)
        WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1] * 1000)
Exemplo n.º 3
0
Arquivo: txstat.py Projeto: bup/bup
def test_bup_lutimes():
    if not xstat._bup_lutimes:
        return
    with no_lingering_errors():
        with test_tempdir('bup-txstat-') as tmpdir:
            path = tmpdir + '/foo'
            open(path, 'w').close()
            frac_ts = (0, 10**6 / 2)
            xstat._bup_lutimes(path, (frac_ts, frac_ts))
            st = _helpers.stat(path)
            atime_ts = st[8]
            mtime_ts = st[9]
            WVPASSEQ(atime_ts[0], 0)
            WVPASS(atime_ts[1] == 0 or atime_ts[1] == frac_ts[1] * 1000)
            WVPASSEQ(mtime_ts[0], 0)
            WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1] * 1000)
Exemplo n.º 4
0
def test_bup_lutimes():
    if not xstat._bup_lutimes:
        return
    tmpdir = tempfile.mkdtemp(prefix="bup-tmetadata-")
    try:
        path = tmpdir + "/foo"
        open(path, "w").close()
        frac_ts = (0, 10 ** 6 / 2)
        xstat._bup_lutimes(path, (frac_ts, frac_ts))
        st = _helpers.stat(path)
        atime_ts = st[8]
        mtime_ts = st[9]
        WVPASSEQ(atime_ts[0], 0)
        WVPASS(atime_ts[1] == 0 or atime_ts[1] == frac_ts[1] * 1000)
        WVPASSEQ(mtime_ts[0], 0)
        WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1] * 1000)
    finally:
        subprocess.call(["rm", "-rf", tmpdir])
Exemplo n.º 5
0
def test_bup_lutimes():
    initial_failures = wvfailure_count()
    if not xstat._bup_lutimes:
        return
    tmpdir = tempfile.mkdtemp(dir=bup_tmp, prefix='bup-txstat-')
    path = tmpdir + '/foo'
    open(path, 'w').close()
    frac_ts = (0, 10**6 / 2)
    xstat._bup_lutimes(path, (frac_ts, frac_ts))
    st = _helpers.stat(path)
    atime_ts = st[8]
    mtime_ts = st[9]
    WVPASSEQ(atime_ts[0], 0)
    WVPASS(atime_ts[1] == 0 or atime_ts[1] == frac_ts[1] * 1000)
    WVPASSEQ(mtime_ts[0], 0)
    WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1] * 1000)
    if wvfailure_count() == initial_failures:
        subprocess.call(['rm', '-rf', tmpdir])
Exemplo n.º 6
0
Arquivo: txstat.py Projeto: 3v/bup
def test_bup_lutimes():
    initial_failures = wvfailure_count()
    if not xstat._bup_lutimes:
        return
    tmpdir = tempfile.mkdtemp(dir=bup_tmp, prefix='bup-txstat-')
    path = tmpdir + '/foo'
    open(path, 'w').close()
    frac_ts = (0, 10**6 / 2)
    xstat._bup_lutimes(path, (frac_ts, frac_ts))
    st = _helpers.stat(path)
    atime_ts = st[8]
    mtime_ts = st[9]
    WVPASSEQ(atime_ts[0], 0)
    WVPASS(atime_ts[1] == 0 or atime_ts[1] == frac_ts[1] * 1000)
    WVPASSEQ(mtime_ts[0], 0)
    WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1] * 1000)
    if wvfailure_count() == initial_failures:
        subprocess.call(['rm', '-rf', tmpdir])