Exemple #1
0
static void
test_rwalk (void)
{
    Npfcall *fc, *fc2;
    struct p9_qid wqids [P9_MAXWELEM] = { 
        { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 },
        { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 },
        { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 },
        { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 },
    };
    int i;

    assert (P9_MAXWELEM == 16);

    if (!(fc = np_create_rwalk (P9_MAXWELEM, wqids)))
        msg_exit ("out of memory in %s", __FUNCTION__); 
    fc2 = _rcv_buf (fc, P9_RWALK, __FUNCTION__);

    assert (fc->u.rwalk.nwqid == P9_MAXWELEM);
    assert (fc->u.rwalk.nwqid == fc2->u.rwalk.nwqid);

    for (i = 0; i < P9_MAXWELEM; i++) {
        assert (fc->u.rwalk.wqids[i].type == fc2->u.rwalk.wqids[i].type);
        assert (fc->u.rwalk.wqids[i].version == fc2->u.rwalk.wqids[i].version);
        assert (fc->u.rwalk.wqids[i].path == fc2->u.rwalk.wqids[i].path);
    }

    free (fc);
    free (fc2);
}
Exemple #2
0
static void
test_twalk (void)
{
    Npfcall *fc, *fc2;
    char *wnames[P9_MAXWELEM] = {
        "abc", "def", "ghi", "jkl",
        "abc", "def", "ghi", "jkl",
        "abc", "def", "ghi", "jkl",
        "abc", "def", "ghi", "jkl",
    };
    int i;

    assert (P9_MAXWELEM == 16);
    if (!(fc = np_create_twalk (1, 2, P9_MAXWELEM, wnames)))
        msg_exit ("out of memory in %s", __FUNCTION__); 
    fc2 = _rcv_buf (fc, P9_TWALK, __FUNCTION__);

    assert (fc->u.twalk.fid == fc2->u.twalk.fid);
    assert (fc->u.twalk.newfid == fc2->u.twalk.newfid);
    assert (fc->u.twalk.nwname == fc2->u.twalk.nwname);
    assert (fc->u.twalk.nwname == P9_MAXWELEM);

    for (i = 0; i < P9_MAXWELEM; i++) {
        assert (np_str9cmp (&fc->u.twalk.wnames[i], &fc2->u.twalk.wnames[i]) ==0);
    }

    free (fc);
    free (fc2);
}
Exemple #3
0
static void
test_rflush (void)
{
    Npfcall *fc, *fc2;
    char buf[STATIC_RFLUSH_SIZE];

    if (!(fc = np_create_rflush ()))
        msg_exit ("out of memory in %s", __FUNCTION__); 
    fc2 = _rcv_buf (fc, P9_RFLUSH, __FUNCTION__);

    free (fc);
    free (fc2);

    if (!(fc = np_create_rflush_static (buf, sizeof(buf))))
        msg_exit ("out of memory in %s", __FUNCTION__); 
    fc2 = _rcv_buf (fc, P9_RFLUSH, __FUNCTION__);

    free (fc2);
}
Exemple #4
0
static void
test_rxattrcreate (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_rxattrcreate()))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_RXATTRCREATE,  __FUNCTION__);

    free (fc);
    free (fc2);
}
Exemple #5
0
static void
test_rfsync (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_rfsync()))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_RFSYNC,  __FUNCTION__);

    free (fc);
    free (fc2);
}
Exemple #6
0
static void
test_rremove (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_rremove ()))
        msg_exit ("out of memory in %s", __FUNCTION__); 
    fc2 = _rcv_buf (fc, P9_RREMOVE, __FUNCTION__);

    free (fc);
    free (fc2);
}
Exemple #7
0
static void
test_rrenameat (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_rrenameat ()))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_RRENAMEAT,  __FUNCTION__);

    free (fc);
    free (fc2);
}
Exemple #8
0
static void
test_runlinkat (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_runlinkat ()))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_RUNLINKAT,  __FUNCTION__);

    free (fc);
    free (fc2);
}
Exemple #9
0
static void
test_rflush (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_rflush ()))
        msg_exit ("out of memory in %s", __FUNCTION__); 
    fc2 = _rcv_buf (fc, P9_RFLUSH, __FUNCTION__);

    free (fc);
    free (fc2);
}
Exemple #10
0
static void
test_rsetattr (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_rsetattr ()))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_RSETATTR,  __FUNCTION__);

    free (fc);
    free (fc2);
}
Exemple #11
0
static void
test_rlerror (void)
{
    Npfcall *fc, *fc2;
    char buf[STATIC_RLERROR_SIZE];

    if (!(fc = np_create_rlerror (42)))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_RLERROR,  __FUNCTION__);

    assert (fc->u.rlerror.ecode == fc2->u.rlerror.ecode);

    free (fc);
    free (fc2);

    fc = np_create_rlerror_static (42, buf, sizeof(buf));
    fc2 = _rcv_buf (fc, P9_RLERROR,  __FUNCTION__);

    assert (fc->u.rlerror.ecode == fc2->u.rlerror.ecode);

    free (fc2);
}
Exemple #12
0
static void
test_treadlink (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_treadlink (1)))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_TREADLINK,  __FUNCTION__);

    assert (fc->u.treadlink.fid == fc2->u.treadlink.fid);

    free (fc);
    free (fc2);
}
Exemple #13
0
static void
test_rlock (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_rlock (1)))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_RLOCK,  __FUNCTION__);

    assert (fc->u.rlock.status == fc2->u.rlock.status);

    free (fc);
    free (fc2);
}
Exemple #14
0
static void
test_rxattrwalk (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_rxattrwalk(1)))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_RXATTRWALK,  __FUNCTION__);

    assert (fc->u.rxattrwalk.size == fc2->u.rxattrwalk.size);

    free (fc);
    free (fc2);
}
Exemple #15
0
static void
test_rreadlink (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_rreadlink ("xyz")))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_RREADLINK,  __FUNCTION__);

    assert (np_str9cmp (&fc->u.rreadlink.target, &fc2->u.rreadlink.target) == 0);

    free (fc);
    free (fc2);
}
Exemple #16
0
static void
test_rwrite (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_rwrite (1)))
        msg_exit ("out of memory in %s", __FUNCTION__); 
    fc2 = _rcv_buf (fc, P9_RWRITE, __FUNCTION__);

    assert (fc->u.rwrite.count == fc2->u.rwrite.count);

    free (fc);
    free (fc2);
}
Exemple #17
0
static void
test_rlerror (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_rlerror (42)))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_RLERROR,  __FUNCTION__);

    assert (fc->u.rlerror.ecode == fc2->u.rlerror.ecode);

    free (fc);
    free (fc2);
}
Exemple #18
0
static void
test_tflush (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_tflush (1)))
        msg_exit ("out of memory in %s", __FUNCTION__); 
    fc2 = _rcv_buf (fc, P9_TFLUSH, __FUNCTION__);

    assert (fc->u.tflush.oldtag == fc2->u.tflush.oldtag);

    free (fc);
    free (fc2);
}
Exemple #19
0
static void
test_tclunk (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_tclunk (1)))
        msg_exit ("out of memory in %s", __FUNCTION__); 
    fc2 = _rcv_buf (fc, P9_TCLUNK, __FUNCTION__);

    assert (fc->u.tclunk.fid == fc2->u.tclunk.fid);

    free (fc);
    free (fc2);
}
Exemple #20
0
static void
test_tremove (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_tremove (1)))
        msg_exit ("out of memory in %s", __FUNCTION__); 
    fc2 = _rcv_buf (fc, P9_TREMOVE, __FUNCTION__);

    assert (fc->u.tremove.fid == fc2->u.tremove.fid);

    free (fc);
    free (fc2);
}
Exemple #21
0
static void
test_tfsync (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_tfsync(1)))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_TFSYNC,  __FUNCTION__);

    assert (fc->u.tfsync.fid == fc2->u.treaddir.fid);

    free (fc);
    free (fc2);
}
Exemple #22
0
static void
test_tstatfs (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_tstatfs (42)))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_TSTATFS,  __FUNCTION__);

    assert (fc->u.tstatfs.fid == fc2->u.tstatfs.fid);

    free (fc);
    free (fc2);
}
Exemple #23
0
static void
test_rversion (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_rversion (TEST_MSIZE, "9p2000.L")))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_RVERSION, __FUNCTION__);

    assert (fc->u.rversion.msize == fc2->u.rversion.msize);
    assert (np_str9cmp (&fc->u.rversion.version, &fc2->u.rversion.version) == 0);

    free (fc);
    free (fc2);
}
Exemple #24
0
static void
test_tgetattr (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_tgetattr (42, 5000)))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_TGETATTR, __FUNCTION__);

    assert (fc->u.tgetattr.fid == fc2->u.tgetattr.fid);
    assert (fc->u.tgetattr.request_mask == fc2->u.tgetattr.request_mask);

    free (fc);
    free (fc2);
}
Exemple #25
0
static void
test_tlopen (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_tlopen (1, 2)))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_TLOPEN,  __FUNCTION__);

    assert (fc->u.tlopen.fid == fc2->u.tlopen.fid);
    assert (fc->u.tlopen.flags == fc2->u.tlopen.flags);

    free (fc);
    free (fc2);
}
Exemple #26
0
static void
test_tunlinkat (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_tunlinkat(1, "abc", 2)))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_TUNLINKAT,  __FUNCTION__);

    assert (fc->u.tunlinkat.dirfid == fc2->u.tunlinkat.dirfid);
    assert (np_str9cmp (&fc->u.tunlinkat.name, &fc2->u.tunlinkat.name) == 0);
    assert (fc->u.tunlinkat.flags == fc2->u.tunlinkat.flags);

    free (fc);
    free (fc2);
}
Exemple #27
0
static void
test_tlink (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_tlink (1, 2, "xyz")))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_TLINK,  __FUNCTION__);

    assert (fc->u.tlink.dfid == fc2->u.tlink.dfid);
    assert (fc->u.tlink.fid == fc2->u.tlink.fid);
    assert (np_str9cmp (&fc->u.tlink.name, &fc2->u.tlink.name) == 0);

    free (fc);
    free (fc2);
}
Exemple #28
0
static void
test_treaddir (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_treaddir(1, 2, 3)))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_TREADDIR,  __FUNCTION__);

    assert (fc->u.treaddir.fid == fc2->u.treaddir.fid);
    assert (fc->u.treaddir.offset == fc2->u.treaddir.offset);
    assert (fc->u.treaddir.count == fc2->u.treaddir.count);

    free (fc);
    free (fc2);
}
Exemple #29
0
static void
test_txattrwalk (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_txattrwalk(1, 2, "abc")))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_TXATTRWALK,  __FUNCTION__);

    assert (fc->u.txattrwalk.fid == fc2->u.txattrwalk.fid);
    assert (fc->u.txattrwalk.attrfid == fc2->u.txattrwalk.attrfid);
    assert (np_str9cmp (&fc->u.txattrwalk.name, &fc2->u.txattrwalk.name) == 0);

    free (fc);
    free (fc2);
}
Exemple #30
0
static void
test_rattach (void)
{
    Npfcall *fc, *fc2;
    struct p9_qid qid = { 1, 2, 3 };

    if (!(fc = np_create_rattach (&qid)))
        msg_exit ("out of memory in %s", __FUNCTION__); 
    fc2 = _rcv_buf (fc, P9_RATTACH, __FUNCTION__);

    assert (fc->u.rattach.qid.type == fc2->u.rattach.qid.type);
    assert (fc->u.rattach.qid.version == fc2->u.rattach.qid.version);
    assert (fc->u.rattach.qid.path == fc2->u.rattach.qid.path);

    free (fc);
    free (fc2);
}