Commit 9608ff14 authored by Marc Vef's avatar Marc Vef
Browse files

Testing: Removing errno 115 FIXME TODOs

Testing on an error code in the successful case has an undefined value
and was therefore removed.
parent ee2a94b4
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ def test_data_integrity(gkfs_daemon, gkfs_client):
            stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 0
    assert ret.errno == 115 #FIXME: Should be 0!

    # test stat on existing dir
    ret = gkfs_client.stat(topdir)
+0 −12
Original line number Diff line number Diff line
@@ -37,11 +37,9 @@ def test_truncate(gkfs_daemon, gkfs_client):
    ret = gkfs_client.write_random(truncfile, buf_length)

    assert ret.retval == buf_length
    assert ret.errno == 115  # FIXME: Should be 0!

    ret = gkfs_client.stat(truncfile)

    assert ret.errno == 115  # FIXME: Should be 0!
    assert ret.statbuf.st_size == buf_length

    # truncate it
@@ -49,12 +47,10 @@ def test_truncate(gkfs_daemon, gkfs_client):
    trunc_size = buf_length // 2
    ret = gkfs_client.truncate(truncfile, trunc_size)

    assert ret.errno == 115  # FIXME: Should be 0!
    assert ret.retval == 0
    # check file length
    ret = gkfs_client.stat(truncfile)

    assert ret.errno == 115  # FIXME: Should be 0!
    assert ret.statbuf.st_size == trunc_size

    # verify contents by writing a new file (random content is seeded) and checksum both
@@ -69,30 +65,25 @@ def test_truncate(gkfs_daemon, gkfs_client):
    ret = gkfs_client.write_random(truncfile_verify, trunc_size)

    assert ret.retval == trunc_size
    assert ret.errno == 115  # FIXME: Should be 0!

    ret = gkfs_client.stat(truncfile_verify)

    assert ret.errno == 115  # FIXME: Should be 0!
    assert ret.statbuf.st_size == trunc_size

    ret = gkfs_client.file_compare(truncfile, truncfile_verify, trunc_size)

    assert ret.retval == 0
    assert ret.errno == 115  # FIXME: Should be 0!

    # trunc at byte 712345 (middle of chunk)
    # TODO feed chunksize into test to make sure it is always in the middle of the chunk
    trunc_size = 712345
    ret = gkfs_client.truncate(truncfile, trunc_size)

    assert ret.errno == 115  # FIXME: Should be 0!
    assert ret.retval == 0

    # check file length
    ret = gkfs_client.stat(truncfile)

    assert ret.errno == 115  # FIXME: Should be 0!
    assert ret.statbuf.st_size == trunc_size

    # verify contents by writing a new file (random content is seeded) and checksum both
@@ -107,14 +98,11 @@ def test_truncate(gkfs_daemon, gkfs_client):
    ret = gkfs_client.write_random(truncfile_verify_2, trunc_size)

    assert ret.retval == trunc_size
    assert ret.errno == 115  # FIXME: Should be 0!

    ret = gkfs_client.stat(truncfile_verify_2)

    assert ret.errno == 115  # FIXME: Should be 0!
    assert ret.statbuf.st_size == trunc_size

    ret = gkfs_client.file_compare(truncfile, truncfile_verify_2, trunc_size)

    assert ret.retval == 0
    assert ret.errno == 115  # FIXME: Should be 0!
+0 −15
Original line number Diff line number Diff line
@@ -42,19 +42,16 @@ def test_mkdir(gkfs_daemon, gkfs_client):
            stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 0
    assert ret.errno == 115 #FIXME: Should be 0!

    # test stat on existing dir
    ret = gkfs_client.stat(topdir)

    assert ret.retval == 0
    assert ret.errno == 115 #FIXME: Should be 0!
    assert stat.S_ISDIR(ret.statbuf.st_mode)

    # open topdir
    ret = gkfs_client.open(topdir, os.O_DIRECTORY)
    assert ret.retval != -1
    assert ret.errno == 115 #FIXME: Should be 0!


    # read and write should be impossible on directories
@@ -77,19 +74,16 @@ def test_mkdir(gkfs_daemon, gkfs_client):
    ret = gkfs_client.opendir(topdir)

    assert ret.dirp is not None
    assert ret.errno == 115 #FIXME: Should be 0!

    ret = gkfs_client.readdir(topdir)

    # XXX: This might change in the future if we add '.' and '..'
    assert len(ret.dirents) == 0
    assert ret.errno == 115 #FIXME: Should be 0!

    # close directory
    # TODO: disabled for now because we have no way to keep DIR* alive
    # between gkfs.io executions
    # ret = gkfs_client.opendir(XXX)
    # assert ret.errno == 115 #FIXME: Should be 0!


    # populate top directory
@@ -99,14 +93,12 @@ def test_mkdir(gkfs_daemon, gkfs_client):
                stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

        assert ret.retval == 0
        assert ret.errno == 115 #FIXME: Should be 0!

    ret = gkfs_client.open(file_a,
                           os.O_CREAT,
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval != -1
    assert ret.errno == 115 #FIXME: Should be 0!

    ret = gkfs_client.readdir(gkfs_daemon.mountdir)

@@ -114,7 +106,6 @@ def test_mkdir(gkfs_daemon, gkfs_client):
    assert len(ret.dirents) == 1
    assert ret.dirents[0].d_name == 'top'
    assert ret.dirents[0].d_type == 4 # DT_DIR
    assert ret.errno == 115 #FIXME: Should be 0!

    expected = [
        ( dir_a.name,  4 ), # DT_DIR
@@ -124,7 +115,6 @@ def test_mkdir(gkfs_daemon, gkfs_client):

    ret = gkfs_client.readdir(topdir)
    assert len(ret.dirents) == len(expected)
    assert ret.errno == 115 #FIXME: Should be 0!

    for d,e in zip(ret.dirents, expected):
        assert d.d_name == e[0]
@@ -141,7 +131,6 @@ def test_mkdir(gkfs_daemon, gkfs_client):
            stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 0
    assert ret.errno == 115 #FIXME: Should be 0!

    expected = [
        ( topdir.name,  4 ), # DT_DIR
@@ -150,7 +139,6 @@ def test_mkdir(gkfs_daemon, gkfs_client):

    ret = gkfs_client.readdir(gkfs_daemon.mountdir)
    assert len(ret.dirents) == len(expected)
    assert ret.errno == 115 #FIXME: Should be 0!

    for d,e in zip(ret.dirents, expected):
        assert d.d_name == e[0]
@@ -162,7 +150,6 @@ def test_mkdir(gkfs_daemon, gkfs_client):
            stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 0
    assert ret.errno == 115 #FIXME: Should be 0!

    expected = [
        ( topdir.name,  4 ), # DT_DIR
@@ -171,7 +158,6 @@ def test_mkdir(gkfs_daemon, gkfs_client):

    ret = gkfs_client.readdir(gkfs_daemon.mountdir)
    assert len(ret.dirents) == len(expected)
    assert ret.errno == 115 #FIXME: Should be 0!

    for d,e in zip(ret.dirents, expected):
        assert d.d_name == e[0]
@@ -184,7 +170,6 @@ def test_mkdir(gkfs_daemon, gkfs_client):
    ret = gkfs_client.readdir(dir_a)

    assert len(ret.dirents) == len(expected)
    assert ret.errno == 115 #FIXME: Should be 0!

    for d,e in zip(ret.dirents, expected):
        assert d.d_name == e[0]
+0 −22
Original line number Diff line number Diff line
@@ -44,14 +44,12 @@ def test_two_io_nodes(gkfwd_daemon_factory, gkfwd_client_factory):
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 10000
    assert ret.errno == 115 #FIXME: Should be 0!

    # write a buffer we know
    buf = b'42'
    ret = c00.write(file, buf, len(buf))

    assert ret.retval == len(buf) # Return the number of written bytes
    assert ret.errno == 115 #FIXME: Should be 0!

    # open the file to read
    ret = c00.open(file,
@@ -59,14 +57,12 @@ def test_two_io_nodes(gkfwd_daemon_factory, gkfwd_client_factory):
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 10000
    assert ret.errno == 115 #FIXME: Should be 0!

    # read the file
    ret = c00.read(file, len(buf))

    assert ret.buf == buf
    assert ret.retval == len(buf) # Return the number of read bytes
    assert ret.errno == 115 #FIXME: Should be 0!


    file = d01.mountdir / "file-c01"
@@ -77,14 +73,12 @@ def test_two_io_nodes(gkfwd_daemon_factory, gkfwd_client_factory):
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 10000
    assert ret.errno == 115 #FIXME: Should be 0!

    # write a buffer we know
    buf = b'42'
    ret = c01.write(file, buf, len(buf))

    assert ret.retval == len(buf) # Return the number of written bytes
    assert ret.errno == 115 #FIXME: Should be 0!

    # open the file to read
    ret = c01.open(file,
@@ -92,14 +86,12 @@ def test_two_io_nodes(gkfwd_daemon_factory, gkfwd_client_factory):
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 10000
    assert ret.errno == 115 #FIXME: Should be 0!

    # read the file
    ret = c01.read(file, len(buf))

    assert ret.buf == buf
    assert ret.retval == len(buf) # Return the number of read bytes
    assert ret.errno == 115 #FIXME: Should be 0!

    # both files should be there and accessible by the two clients
    ret = c00.readdir(d00.mountdir)
@@ -108,11 +100,9 @@ def test_two_io_nodes(gkfwd_daemon_factory, gkfwd_client_factory):

    assert ret.dirents[0].d_name == 'file-c00'
    assert ret.dirents[0].d_type == 8 # DT_REG
    assert ret.errno == 115 #FIXME: Should be 0!

    assert ret.dirents[1].d_name == 'file-c01'
    assert ret.dirents[1].d_type == 8 # DT_REG
    assert ret.errno == 115 #FIXME: Should be 0!

    with open(c00.log) as f:
        lines = f.readlines()
@@ -149,14 +139,12 @@ def test_two_io_nodes_remap(gkfwd_daemon_factory, gkfwd_client_factory):
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 10000
    assert ret.errno == 115 #FIXME: Should be 0!

    # write a buffer we know
    buf = b'42'
    ret = c00.write(file, buf, len(buf))

    assert ret.retval == len(buf) # Return the number of written bytes
    assert ret.errno == 115 #FIXME: Should be 0!

    with open(c00.log) as f:
        lines = f.readlines()
@@ -181,14 +169,12 @@ def test_two_io_nodes_remap(gkfwd_daemon_factory, gkfwd_client_factory):
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 10000
    assert ret.errno == 115 #FIXME: Should be 0!

    # read the file
    buf = b'24'
    ret = c00.write(file, buf, len(buf))

    assert ret.retval == len(buf) # Return the number of read bytes
    assert ret.errno == 115 #FIXME: Should be 0!

    with open(c00.log) as f:
        lines = f.readlines()
@@ -216,14 +202,12 @@ def test_two_io_nodes_operations(gkfwd_daemon_factory, gkfwd_client_factory):
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 10000
    assert ret.errno == 115 #FIXME: Should be 0!

    # write a buffer we know
    buf = b'42'
    ret = c00.write(file, buf, len(buf))

    assert ret.retval == len(buf) # Return the number of written bytes
    assert ret.errno == 115 #FIXME: Should be 0!

    # open the file to read
    ret = c00.open(file,
@@ -231,14 +215,12 @@ def test_two_io_nodes_operations(gkfwd_daemon_factory, gkfwd_client_factory):
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 10000
    assert ret.errno == 115 #FIXME: Should be 0!

    # read the file
    ret = c00.read(file, len(buf))

    assert ret.buf == buf
    assert ret.retval == len(buf) # Return the number of read bytes
    assert ret.errno == 115 #FIXME: Should be 0!

    # open the file to read
    ret = c01.open(file,
@@ -246,14 +228,12 @@ def test_two_io_nodes_operations(gkfwd_daemon_factory, gkfwd_client_factory):
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 10000
    assert ret.errno == 115 #FIXME: Should be 0!

    # read the file
    ret = c01.read(file, len(buf))

    assert ret.buf == buf
    assert ret.retval == len(buf) # Return the number of read bytes
    assert ret.errno == 115 #FIXME: Should be 0!

    # the file should be there and accessible by the two clients
    ret = c00.readdir(d00.mountdir)
@@ -262,7 +242,6 @@ def test_two_io_nodes_operations(gkfwd_daemon_factory, gkfwd_client_factory):

    assert ret.dirents[0].d_name == 'file-c00'
    assert ret.dirents[0].d_type == 8 # DT_REG
    assert ret.errno == 115 #FIXME: Should be 0!

    # the file should be there and accessible by the two clients
    ret = c01.readdir(d01.mountdir)
@@ -271,7 +250,6 @@ def test_two_io_nodes_operations(gkfwd_daemon_factory, gkfwd_client_factory):

    assert ret.dirents[0].d_name == 'file-c00'
    assert ret.dirents[0].d_type == 8 # DT_REG
    assert ret.errno == 115 #FIXME: Should be 0!

    with open(c00.log) as f:
        lines = f.readlines()
+1 −17
Original line number Diff line number Diff line
@@ -35,14 +35,12 @@ def test_read(gkfs_daemon, gkfs_client):
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 10000
    assert ret.errno == 115 #FIXME: Should be 0!

    # write a buffer we know
    buf = b'42'
    ret = gkfs_client.write(file, buf, len(buf))

    assert ret.retval == len(buf) # Return the number of written bytes
    assert ret.errno == 115 #FIXME: Should be 0!

    # open the file to read
    ret = gkfs_client.open(file,
@@ -50,14 +48,12 @@ def test_read(gkfs_daemon, gkfs_client):
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 10000
    assert ret.errno == 115 #FIXME: Should be 0!

    # read the file
    ret = gkfs_client.read(file, len(buf))

    assert ret.buf == buf
    assert ret.retval == len(buf) # Return the number of read bytes
    assert ret.errno == 115 #FIXME: Should be 0!

def test_pread(gkfs_daemon, gkfs_client):

@@ -69,14 +65,12 @@ def test_pread(gkfs_daemon, gkfs_client):
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 10000
    assert ret.errno == 115 #FIXME: Should be 0!

    # write a buffer we know
    buf = b'42'
    ret = gkfs_client.pwrite(file, buf, len(buf), 1024)

    assert ret.retval == len(buf) # Return the number of written bytes
    assert ret.errno == 115 #FIXME: Should be 0!

    # open the file to read
    ret = gkfs_client.open(file,
@@ -84,14 +78,12 @@ def test_pread(gkfs_daemon, gkfs_client):
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 10000
    assert ret.errno == 115 #FIXME: Should be 0!

    # read the file at offset 1024
    ret = gkfs_client.pread(file, len(buf), 1024)

    assert ret.buf == buf
    assert ret.retval == len(buf) # Return the number of read bytes
    assert ret.errno == 115 #FIXME: Should be 0!

def test_readv(gkfs_daemon, gkfs_client):

@@ -103,7 +95,6 @@ def test_readv(gkfs_daemon, gkfs_client):
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 10000
    assert ret.errno == 115 #FIXME: Should be 0!

    # write a buffer we know
    buf_0 = b'42'
@@ -111,7 +102,6 @@ def test_readv(gkfs_daemon, gkfs_client):
    ret = gkfs_client.writev(file, buf_0, buf_1, 2)

    assert ret.retval == len(buf_0) + len(buf_1) # Return the number of written bytes
    assert ret.errno == 115 #FIXME: Should be 0!

    # open the file to read
    ret = gkfs_client.open(file,
@@ -119,7 +109,6 @@ def test_readv(gkfs_daemon, gkfs_client):
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 10000
    assert ret.errno == 115 #FIXME: Should be 0!

    # read the file
    ret = gkfs_client.readv(file, len(buf_0), len(buf_1))
@@ -127,7 +116,6 @@ def test_readv(gkfs_daemon, gkfs_client):
    assert ret.buf_0 == buf_0
    assert ret.buf_1 == buf_1
    assert ret.retval == len(buf_0) + len(buf_1) # Return the number of read bytes
    assert ret.errno == 115 #FIXME: Should be 0!

def test_preadv(gkfs_daemon, gkfs_client):

@@ -139,7 +127,6 @@ def test_preadv(gkfs_daemon, gkfs_client):
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 10000
    assert ret.errno == 115 #FIXME: Should be 0!

    # write a buffer we know
    buf_0 = b'42'
@@ -147,7 +134,6 @@ def test_preadv(gkfs_daemon, gkfs_client):
    ret = gkfs_client.pwritev(file, buf_0, buf_1, 2, 1024)

    assert ret.retval == len(buf_0) + len(buf_1) # Return the number of written bytes
    assert ret.errno == 115 #FIXME: Should be 0!

    # open the file to read
    ret = gkfs_client.open(file,
@@ -155,7 +141,6 @@ def test_preadv(gkfs_daemon, gkfs_client):
                           stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    assert ret.retval == 10000
    assert ret.errno == 115 #FIXME: Should be 0!

    # read the file
    ret = gkfs_client.preadv(file, len(buf_0), len(buf_1), 1024)
@@ -163,4 +148,3 @@ def test_preadv(gkfs_daemon, gkfs_client):
    assert ret.buf_0 == buf_0
    assert ret.buf_1 == buf_1
    assert ret.retval == len(buf_0) + len(buf_1) # Return the number of read bytes
 No newline at end of file
    assert ret.errno == 115 #FIXME: Should be 0!
 No newline at end of file
Loading