コード例 #1
0
ファイル: test_xstat.py プロジェクト: yuchangyuan/bup
def test_bup_utimensat(tmpdir):
    if not xstat._bup_utimensat:
        return
    path = tmpdir + b'/foo'
    open(path, 'w').close()
    frac_ts = (0, 10**9 // 2)
    xstat._bup_utimensat(_helpers.AT_FDCWD, path, (frac_ts, frac_ts), 0)
    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])
    WVPASSEQ(mtime_ts[0], 0)
    WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1])
コード例 #2
0
ファイル: txstat.py プロジェクト: tforsberg/bup
def test_bup_utimensat():
    if not xstat._bup_utimensat:
        return
    with no_lingering_errors(), test_tempdir('bup-txstat-') as tmpdir:
        path = tmpdir + '/foo'
        open(path, 'w').close()
        frac_ts = (0, 10**9 / 2)
        xstat._bup_utimensat(_helpers.AT_FDCWD, path, (frac_ts, frac_ts), 0)
        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])
        WVPASSEQ(mtime_ts[0], 0)
        WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1])
コード例 #3
0
ファイル: txstat.py プロジェクト: bup/bup
def test_bup_utimensat():
    if not xstat._bup_utimensat:
        return
    with no_lingering_errors():
        with test_tempdir('bup-txstat-') as tmpdir:
            path = tmpdir + '/foo'
            open(path, 'w').close()
            frac_ts = (0, 10**9 / 2)
            xstat._bup_utimensat(_helpers.AT_FDCWD, path, (frac_ts, frac_ts), 0)
            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])
            WVPASSEQ(mtime_ts[0], 0)
            WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1])
コード例 #4
0
ファイル: txstat.py プロジェクト: kwharrigan/bup
def test_bup_utimensat():
    if not xstat._bup_utimensat:
        return
    tmpdir = tempfile.mkdtemp(prefix="bup-tmetadata-")
    try:
        path = tmpdir + "/foo"
        open(path, "w").close()
        frac_ts = (0, 10 ** 9 / 2)
        xstat._bup_utimensat(_helpers.AT_FDCWD, path, (frac_ts, frac_ts), 0)
        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])
        WVPASSEQ(mtime_ts[0], 0)
        WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1])
    finally:
        subprocess.call(["rm", "-rf", tmpdir])
コード例 #5
0
ファイル: txstat.py プロジェクト: wheelcomplex/bup
def test_bup_utimensat():
    initial_failures = wvfailure_count()
    if not xstat._bup_utimensat:
        return
    tmpdir = tempfile.mkdtemp(dir=bup_tmp, prefix='bup-txstat-')
    path = tmpdir + '/foo'
    open(path, 'w').close()
    frac_ts = (0, 10**9 / 2)
    xstat._bup_utimensat(_helpers.AT_FDCWD, path, (frac_ts, frac_ts), 0)
    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])
    WVPASSEQ(mtime_ts[0], 0)
    WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1])
    if wvfailure_count() == initial_failures:
        subprocess.call(['rm', '-rf', tmpdir])
コード例 #6
0
ファイル: txstat.py プロジェクト: 3v/bup
def test_bup_utimensat():
    initial_failures = wvfailure_count()
    if not xstat._bup_utimensat:
        return
    tmpdir = tempfile.mkdtemp(dir=bup_tmp, prefix='bup-txstat-')
    path = tmpdir + '/foo'
    open(path, 'w').close()
    frac_ts = (0, 10**9 / 2)
    xstat._bup_utimensat(_helpers.AT_FDCWD, path, (frac_ts, frac_ts), 0)
    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])
    WVPASSEQ(mtime_ts[0], 0)
    WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1])
    if wvfailure_count() == initial_failures:
        subprocess.call(['rm', '-rf', tmpdir])