Exemplo n.º 1
0
/*
 * These is a test of the resrc library.  The test uses two methods
 * for generating a resrc object.  The first loads an RDL-formatted
 * resource identified by the TESTRESRC_INPUT_FILE environment
 * variable.  The second option generates a resrc object from the node
 * it is running on using the hwloc library.  The test then conducts a
 * number of resrc library operations on each of these resrc objects.
 */
int main (int argc, char *argv[])
{
    int rc1 = 1, rc2 = 1;

    plan (27 + num_temporal_allocation_tests);
    test_temporal_allocation ();
    rc1 = test_using_reader_rdl ();
    rc2 = test_using_reader_hwloc ();
    /* plance holder for testing with other reader types */
    done_testing ();

    return (rc1 | rc2);
}
Exemplo n.º 2
0
/*
 * These is a test of the resrc library.  The test uses two methods
 * for generating a resrc object.  The first loads an RDL-formatted
 * resource identified by the TESTRESRC_INPUT_FILE environment
 * variable.  The second option generates a resrc object from the node
 * it is running on using the hwloc library.  The test then conducts a
 * number of resrc library operations on each of these resrc objects.
 */
int main (int argc, char *argv[])
{
    char *filename = NULL;
    hwloc_topology_t topology;
    int rc1 = 1, rc2 = 1;
    resrc_t *resrc = NULL;
    resrc_flow_t *power_flow = NULL;
    resrc_flow_t *bw_flow = NULL;

    plan (26 + num_temporal_allocation_tests);
    test_temporal_allocation ();

    if ((filename = getenv ("TESTRESRC_INPUT_FILE"))) {
        ok (!(filename == NULL || *filename == '\0'), "resource file provided");
        ok ((access (filename, F_OK) == 0), "resource file exists");
        ok ((access (filename, R_OK) == 0), "resource file readable");

        init_time();
        resrc_init ();
        resrc = resrc_generate_rdl_resources (filename, "default");
        ok ((resrc != NULL), "resource generation from config file took: %lf",
            ((double)get_time())/1000000);
        if (resrc) {
            power_flow = resrc_flow_generate_rdl (filename, "power");
            if (power_flow) {
                if (verbose) {
                    printf ("Listing power tree\n");
                    resrc_flow_print (power_flow);
                    printf ("End of power tree\n");
                }
                bw_flow = resrc_flow_generate_rdl (filename, "bandwidth");
                if (bw_flow) {
                    if (verbose) {
                        printf ("Listing bandwidth tree\n");
                        resrc_flow_print (bw_flow);
                        printf ("End of bandwidth tree\n");
                    }
                } else
                    goto ret;
            } else
                goto ret;

            rc1 = test_a_resrc (resrc, true);
            resrc_flow_destroy (bw_flow);
            resrc_flow_destroy (power_flow);
            resrc_tree_destroy (resrc_phys_tree (resrc), true);
            resrc_fini ();
        }
    }

    init_time();
    resrc_init ();
    ok ((hwloc_topology_init (&topology) == 0),
        "hwloc topology init succeeded");
    ok ((hwloc_topology_load (topology) == 0),
        "hwloc topology load succeeded");
    ok (((resrc = resrc_create_cluster ("cluster")) != 0),
        "cluster resource creation succeeded");
    ok ((resrc_generate_hwloc_resources (resrc, topology, NULL, NULL) != 0),
        "resource generation from hwloc took: %lf",
        ((double)get_time())/1000000);
    hwloc_topology_destroy (topology);
    if (resrc) {
        rc2 = test_a_resrc (resrc, false);
        resrc_tree_destroy (resrc_phys_tree (resrc), true);
        resrc_fini ();
    }
ret:
    done_testing ();
    return (rc1 | rc2);
}