]> rtime.felk.cvut.cz Git - frescor/frsh.git/commitdiff
tests: Update negotiation test and fix problems
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 20 Jun 2010 10:31:16 +0000 (12:31 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 20 Jun 2010 10:31:16 +0000 (12:31 +0200)
frsh_api/tests/negotiation.cc
frsh_api/tests/negotiation.sh

index d4ce749cbcd6ed3448481787a7829401e7509029..5c562f58eb5db84ac77ffc11697d371ef7979179 100644 (file)
@@ -36,7 +36,6 @@ WVTEST_MAIN("basic negotiation")
 //     while ((opt = getopt_long(argc, argv, "l:", &long_opts[0], NULL)) != EOF) {
 //             switch (opt) {
 //                     case 'l':
-       ul_log_domain_arg2levels("forb_proto_inet=6");
 //                             break;
 //                     case 'h':
 //                     /\*default:*\/
@@ -45,19 +44,17 @@ WVTEST_MAIN("basic negotiation")
 //             }
 //     }
 
+       setenv("WVTEST_DIE_FAST", "", 1);
        ret = WVFRSH(frsh_init());
-       if (ret) exit(1);
 
        /* Negotiate N contracts */
        for (i=0; i<N; i++) {
                ret = WVFRSH(frsh_contract_init(&contract[i]));
-               if (ret) exit(1);
 
                ret = WVFRSH(frsh_contract_set_resource_and_label(
                        &contract[i],
                        DUMMY_RESOURCE_TYPE, DUMMY_RESOURCE_ID,
                        NULL));
-               if (ret) exit(1);
 
                budget = fosa_msec_to_rel_time(b[i]);
                period = fosa_msec_to_rel_time(100);
@@ -67,21 +64,17 @@ WVTEST_MAIN("basic negotiation")
                                                            &period,
                                                            FRSH_WT_BOUNDED,
                                                            FRSH_CT_REGULAR));
-               if (ret) exit(1);
                
                ret = WVFRSH(frsh_contract_set_timing_reqs(&contract[i],
                                                           false, &deadline));
-               if (ret) exit(1);
                
                ret = WVFRSH(frsh_contract_negotiate(&contract[i], &vres[i]));
-               if (ret) exit(1);
        }
 }
 
 WVTEST_MAIN("renegotiation")
 {
-       for (i=0; i<2 /*N*/; i++) {
-               // FIXME: There is a bug on the test - the 3rd renegotiation fails
+       for (i=0; i<2; i++) {
                budget = fosa_msec_to_rel_time(2*b[i]);
                period = fosa_msec_to_rel_time(110);
                ret = WVFRSH(frsh_contract_set_basic_params(&contract[i],
@@ -89,11 +82,19 @@ WVTEST_MAIN("renegotiation")
                                                            &period,
                                                            FRSH_WT_BOUNDED,
                                                            FRSH_CT_REGULAR));
-               if (ret) exit(1);
 
                ret = WVFRSH(frsh_contract_renegotiate_sync(&contract[i], vres[i]));
-               if (ret) exit(1);
        }
+
+       budget = fosa_msec_to_rel_time(2*b[2]);
+       period = fosa_msec_to_rel_time(110);
+       ret = WVFRSH(frsh_contract_set_basic_params(&contract[2],
+                                                   &budget,
+                                                   &period,
+                                                   FRSH_WT_BOUNDED,
+                                                   FRSH_CT_REGULAR));
+
+       WVPASS(frsh_contract_renegotiate_sync(&contract[2], vres[2]) == FRSH_ERR_CONTRACT_REJECTED);
 }
 
 WVTEST_MAIN("cancelation")
@@ -101,7 +102,6 @@ WVTEST_MAIN("cancelation")
        /* Cancel N contracts */
        for (i=0; i<N; i++) {
                ret = WVFRSH(frsh_contract_cancel(vres[i]));
-               if (ret) exit(1);
        }
 
        frsh_destroy();
index f92a30973e97faa9de8f1469f93a2ac940b896af..6046f4ec04b9e54123032cf4d21576c34c8f392a 100755 (executable)
@@ -5,10 +5,12 @@
 WVSTART Setup
 WVPASS fcb -dfcb.pid
 WVPASS frm_dummy -dfrm.pid
-WVPASS negotiation.wv
+trap '
 WVSTART Kill
 WVPASS kill `cat fcb.pid`
 WVPASS rm fcb.pid
 WVPASS kill `cat frm.pid`
 WVPASS rm frm.pid
+' 0
+WVPASS negotiation