Ejemplo n.º 1
0
def test_read_greater_than_pagesize():
    f = filepath()
    s = os.sysconf("SC_PAGE_SIZE") * 2 + 1
    with base.posix_open(f, os.O_RDWR | os.O_CREAT) as fd:
        base.random_data(fd, s)
    # time.sleep(1)
    with base.posix_open(f, os.O_RDONLY) as fd:
        assert_equals(s, len(os.read(fd, s)))
Ejemplo n.º 2
0
def test_read_and_stat_size_field():
    f = filepath()
    with base.posix_open(f, os.O_RDWR | os.O_CREAT) as fd:
        written = base.random_data(fd, random.randint(1024, 8192))
    with base.posix_open(f, os.O_RDONLY) as fd:
        data = os.read(fd, 8192)
        stat = os.fstat(fd)
        assert_equals(written, len(data))
        assert_equals(written, stat.st_size)