1/**
2 * \file
3 * \brief Root cnode resizing test
4 */
5
6/*
7 * Copyright (c) 2016, ETH Zurich.
8 * All rights reserved.
9 *
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, Universitaetstr. 6, CH-8092 Zurich. Attn: Systems Group.
13 */
14
15#include <stdio.h>
16#include <barrelfish/barrelfish.h>
17
18#define STEP 256
19
20//{{{1 main
21int main(void)
22{
23    errval_t err;
24    struct capref cap;
25    for (cslot_t i = 0; i < 4*L2_CNODE_SLOTS*L2_CNODE_SLOTS; i++) {
26        err = slot_alloc(&cap);
27        if (err_is_fail(err)) {
28            DEBUG_ERR(err, "slot_alloc");
29            printf("test_rootcn_resize: slot alloc %"PRIuCSLOT" failed\n", i);
30            return 1;
31        }
32        if (i % STEP == 0) {
33            err = cap_copy(cap, cap_vroot);
34            if (err_is_fail(err)) {
35                DEBUG_ERR(err, "cap_copy");
36                printf("test_rootcn_resize: copying cpa to slot %"PRIuCSLOT" failed\n", i);
37            }
38        }
39    }
40    printf("test_rootcn_resize: passed\n");
41    return 0;
42}
43