Exemplo n.º 1
0
Arquivo: tserialize.c Projeto: 8l/diod
static void
test_tattach (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_tattach (1, 2, "abc", "xyz", 5)))
        msg_exit ("out of memory in %s", __FUNCTION__); 
    fc2 = _rcv_buf (fc, P9_TATTACH, __FUNCTION__);

    assert (fc->u.tattach.fid == fc2->u.tattach.fid);
    assert (fc->u.tattach.afid == fc2->u.tattach.afid);
    assert (np_str9cmp (&fc->u.tattach.uname, &fc2->u.tattach.uname) == 0);
    assert (np_str9cmp (&fc->u.tattach.aname, &fc2->u.tattach.aname) == 0);
    assert (fc->u.tattach.n_uname == fc2->u.tattach.n_uname);

    free (fc);
    free (fc2);
}
Exemplo n.º 2
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);
}
Exemplo n.º 3
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);
}
Exemplo n.º 4
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);
}
Exemplo n.º 5
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);
}
Exemplo n.º 6
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);
}
Exemplo n.º 7
0
static void
test_tmkdir (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_tmkdir (1, "abc", 2, 3)))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_TMKDIR,  __FUNCTION__);

    assert (fc->u.tmkdir.fid == fc2->u.tmkdir.fid);
    assert (np_str9cmp (&fc->u.tmkdir.name, &fc2->u.tmkdir.name) == 0);
    assert (fc->u.tmkdir.mode == fc2->u.tmkdir.mode);
    assert (fc->u.tmkdir.gid == fc2->u.tmkdir.gid);

    free (fc);
    free (fc2);
}
Exemplo n.º 8
0
static void
test_txattrcreate (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_txattrcreate(1, "abc", 3, 4)))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_TXATTRCREATE,  __FUNCTION__);

    assert (fc->u.txattrcreate.fid == fc2->u.txattrcreate.fid);
    assert (np_str9cmp (&fc->u.txattrcreate.name, &fc2->u.txattrcreate.name) == 0);
    assert (fc->u.txattrcreate.size == fc2->u.txattrcreate.size);
    assert (fc->u.txattrcreate.flag == fc2->u.txattrcreate.flag);

    free (fc);
    free (fc2);
}
Exemplo n.º 9
0
static void
test_rgetlock (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_rgetlock (P9_LOCK_TYPE_WRLCK, 2, 3, 4, "xyz")))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_RGETLOCK,  __FUNCTION__);

    assert (fc->u.rgetlock.type == fc2->u.rgetlock.type);
    assert (fc->u.rgetlock.start == fc2->u.rgetlock.start);
    assert (fc->u.rgetlock.length == fc2->u.rgetlock.length);
    assert (fc->u.rgetlock.proc_id == fc2->u.rgetlock.proc_id);
    assert (np_str9cmp (&fc->u.rgetlock.client_id, &fc2->u.rgetlock.client_id) == 0);

    free (fc);
    free (fc2);
}
Exemplo n.º 10
0
static void
test_tlcreate (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_tlcreate (1, "xyz", 3, 4, 5)))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_TLCREATE,  __FUNCTION__);

    assert (fc->u.tlcreate.fid == fc2->u.tlcreate.fid);
    assert (np_str9cmp (&fc->u.tlcreate.name, &fc2->u.tlcreate.name) == 0);
    assert (fc->u.tlcreate.flags == fc2->u.tlcreate.flags);
    assert (fc->u.tlcreate.mode == fc2->u.tlcreate.mode);
    assert (fc->u.tlcreate.gid == fc2->u.tlcreate.gid);

    free (fc);
    free (fc2);
}
Exemplo n.º 11
0
static void
test_tlock (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_tlock (1, P9_LOCK_TYPE_UNLCK, 3, 4, 5, 6, "xyz")))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_TLOCK,  __FUNCTION__);

    assert (fc->u.tlock.fid == fc2->u.tlock.fid);
    assert (fc->u.tlock.type == fc2->u.tlock.type);
    assert (fc->u.tlock.flags == fc2->u.tlock.flags);
    assert (fc->u.tlock.start == fc2->u.tlock.start);
    assert (fc->u.tlock.length == fc2->u.tlock.length);
    assert (np_str9cmp (&fc->u.tlock.client_id, &fc2->u.tlock.client_id) == 0);

    free (fc);
    free (fc2);
}
Exemplo n.º 12
0
static void
test_tmknod (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_tmknod (1, "xyz", 3, 4, 5, 6)))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_TMKNOD,  __FUNCTION__);

    assert (fc->u.tmknod.fid == fc2->u.tmknod.fid);
    assert (np_str9cmp (&fc->u.tmknod.name, &fc2->u.tmknod.name) == 0);
    assert (fc->u.tmknod.mode == fc2->u.tmknod.mode);
    assert (fc->u.tmknod.major == fc2->u.tmknod.major);
    assert (fc->u.tmknod.minor == fc2->u.tmknod.minor);
    assert (fc->u.tmknod.gid == fc2->u.tmknod.gid);

    free (fc);
    free (fc2);
}