Ejemplo n.º 1
0
/**
 * Run a single test with server version smaj.smin and client
 * version cmaj.cmin. Verify that return code is equal to 'error'.
 *
 * Test is run normal, then for a swapped client.
 */
static void request_XIQueryVersion(int smaj, int smin, int cmaj, int cmin, int error)
{
    char n;
    int rc;
    struct test_data versions;
    xXIQueryVersionReq request;
    ClientRec client;

    request_init(&request, XIQueryVersion);
    client = init_client(request.length, &request);
    userdata = (void*)&versions;

    /* Change the server to support smaj.smin */
    XIVersion.major_version = smaj;
    XIVersion.minor_version = smin;

    /* remember versions we send and expect */
    versions.major_client = cmaj;
    versions.minor_client = cmin;
    versions.major_server = XIVersion.major_version;
    versions.minor_server = XIVersion.minor_version;

    request.major_version = versions.major_client;
    request.minor_version = versions.minor_client;
    rc = ProcXIQueryVersion(&client);
    g_assert(rc == error);

    client.swapped = TRUE;

    swaps(&request.length, n);
    swaps(&request.major_version, n);
    swaps(&request.minor_version, n);

    rc = SProcXIQueryVersion(&client);
    g_assert(rc == error);
}