static bool
perform_tests(void *data)
{
    char command[128];
    int n;

    sol_memmap_add_map(&_memmap0);
    sol_memmap_add_map(&_memmap1);

    n = snprintf(command, sizeof(command), "truncate -s0 %s && truncate -s128 %s",
        _memmap0.path, _memmap0.path);
    ASSERT(n > 0 && (size_t)n < sizeof(command));

    n = system(command);
    ASSERT(!n);

    n = snprintf(command, sizeof(command), "truncate -s0 %s && truncate -s128 %s",
        _memmap1.path, _memmap1.path);
    ASSERT(n > 0 && (size_t)n < sizeof(command));

    n = system(command);
    ASSERT(!n);

    write_one();
    read_one(); /* This one should happen before actually writing data */
    sol_timeout_add(0, read_one_after_mainloop, NULL); /* This one should be after a main loop */
    sol_timeout_add(50, write_two_timeout, NULL); /* This, much after */
    sol_timeout_add(1000, read_two_after, NULL); /* Even later */

    sol_timeout_add(2000, write_cancelled_timeout, NULL);

    return false;
}
Пример #2
0
static bool
load_memory_maps(const struct sol_ptr_vector *maps)
{
#ifdef USE_MEMMAP
    struct sol_memmap_map *map;
    int i;

    SOL_PTR_VECTOR_FOREACH_IDX (maps, map, i) {
        if (sol_memmap_add_map(map) < 0)
            return false;
    }

    return true;
#else
    SOL_WRN("Memory map defined on config file, but Solleta was built without support to it");
    return true;
#endif
}