10 int b[N] = { 10, 20, 30 };
12 // TODO: Allow specifying loglevel in evironment
14 // static struct option long_opts[] = {
15 // { "loglevel", 1, 0, 'l' },
22 // printf("usage: negotiation [ options ]\n");
23 // printf(" -l, --loglevel <number>|<domain>=<number>,...\n");
27 frsh_contract_t contract[N];
28 frsh_vres_id_t vres[N];
29 frsh_rel_time_t budget, period, deadline;
32 WVTEST_MAIN("basic negotiation")
36 // while ((opt = getopt_long(argc, argv, "l:", &long_opts[0], NULL)) != EOF) {
43 // exit(opt == 'h' ? 0 : 1);
47 setenv("WVTEST_DIE_FAST", "", 1);
48 ret = WVFRSH(frsh_init());
50 /* Negotiate N contracts */
52 ret = WVFRSH(frsh_contract_init(&contract[i]));
54 ret = WVFRSH(frsh_contract_set_resource_and_label(
56 DUMMY_RESOURCE_TYPE, DUMMY_RESOURCE_ID,
59 budget = fosa_msec_to_rel_time(b[i]);
60 period = fosa_msec_to_rel_time(100);
61 deadline = fosa_msec_to_rel_time(50);
62 ret = WVFRSH(frsh_contract_set_basic_params(&contract[i],
68 ret = WVFRSH(frsh_contract_set_timing_reqs(&contract[i],
71 ret = WVFRSH(frsh_contract_negotiate(&contract[i], &vres[i]));
75 WVTEST_MAIN("renegotiation")
78 budget = fosa_msec_to_rel_time(2*b[i]);
79 period = fosa_msec_to_rel_time(110);
80 ret = WVFRSH(frsh_contract_set_basic_params(&contract[i],
86 ret = WVFRSH(frsh_contract_renegotiate_sync(&contract[i], vres[i]));
89 budget = fosa_msec_to_rel_time(2*b[2]);
90 period = fosa_msec_to_rel_time(110);
91 ret = WVFRSH(frsh_contract_set_basic_params(&contract[2],
97 WVPASS(frsh_contract_renegotiate_sync(&contract[2], vres[2]) == FRSH_ERR_CONTRACT_REJECTED);
100 WVTEST_MAIN("cancelation")
102 /* Cancel N contracts */
103 for (i=0; i<N; i++) {
104 ret = WVFRSH(frsh_contract_cancel(vres[i]));