Skip to content

Commit

Permalink
Fixed all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KabirSamsi committed Oct 29, 2024
1 parent 53e321c commit 051a35c
Show file tree
Hide file tree
Showing 26 changed files with 54 additions and 50 deletions.
4 changes: 2 additions & 2 deletions progs/incorrect/duplicate_classes.sched
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
classes A, B;

var = rr[A, B];
final = fifo[var, B]; // B is used twice
var = fifo[union[A, B]];
final = rr[var, fifo[B]]; // B is used twice

return final
2 changes: 1 addition & 1 deletion progs/incorrect/duplicate_samepol.sched
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
classes A, B;

x = fifo[A, A];
x = fifo[union[A, A]];

return x
2 changes: 1 addition & 1 deletion progs/incorrect/unbound_var.sched
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
classes X, Y, Z;

foo = strict[X, Y, Z];
foo = strict[fifo[X], fifo[Y], fifo[Z]];

return policy // user probably meant to return `foo`
4 changes: 2 additions & 2 deletions progs/incorrect/unbound_var_hier.sched
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
classes BX, BY, RP, RT;

b_policy = fifo[BX, BY];
r_policy = rr[RP, RT];
b_policy = fifo[union[BX, BY]];
r_policy = rr[fifo[RP], fifo[RT]];
policy = rr[b_policy, r_polic]; // user made a typo, meant to reference `r_policy`

return policy
2 changes: 1 addition & 1 deletion progs/incorrect/undeclared_classes.sched
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
classes X, Y;

pol = strict[X, Z]; // `Z` is undeclared, only `X` and `Y` may be used
pol = strict[fifo[X], fifo[Z]]; // `Z` is undeclared, only `X` and `Y` may be used

return pol
6 changes: 3 additions & 3 deletions progs/incorrect/unused_variable.sched
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
classes A, B, C;

pol_1 = rr[A, B];
pol_2 = rr[B, C];
ans = strict[pol_1, C];
pol_1 = rr[fifo[A], fifo[B]];
pol_2 = rr[fifo[B], fifo[C]];
ans = strict[pol_1, fifo[C]];

return ans
5 changes: 2 additions & 3 deletions progs/non_work_conserving/leaky_2_classes.sched
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
classes A, B;

policy = leakybucket [[A, B], width=5, buffer=10];
policy = leakybucket [[fifo[A], fifo[B]], width=5, buffer=10];
// Interleave packets from flows A and B, allowing at most
// 5 packets to be processed per time cycle,
// and at most 10 packets to be in a buffer at once

return policy

return policy
2 changes: 1 addition & 1 deletion progs/non_work_conserving/rcsp_4_classes.sched
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
classes A, B, C, D;

policy = rcsp [A, B, C, D];
policy = rcsp [fifo[A], fifo[B], fifo[C], fifo[D]];

return policy
4 changes: 2 additions & 2 deletions progs/non_work_conserving/sg_3_classes.sched
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
classes A, B, C;

sub_policy1 = stopandgo[[A, B], width=10];
sub_policy2 = stopandgo[[C], width=10];
sub_policy1 = stopandgo[[fifo[A], fifo[B]], width=10];
sub_policy2 = stopandgo[[fifo[C]], width=10];
policy = stopandgo [[sub_policy1, sub_policy2], width=5];

//Interleaves two sub-policies, with windows of length 10,
Expand Down
4 changes: 2 additions & 2 deletions progs/non_work_conserving/token_2_rr_children.sched
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
classes A, B, C, D;

sub1 = rr [A, B];
sub2 = rr [C, D];
sub1 = rr [fifo[A], fifo[B]];
sub2 = rr [fifo[C], fifo[D]];

policy = tokenbucket [[sub1, sub2], width=20, time=50];

Expand Down
2 changes: 1 addition & 1 deletion progs/work_conserving/drop_a_class.sched
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
classes A, B;

policy = A;
policy = fifo[A];

return policy

Expand Down
2 changes: 1 addition & 1 deletion progs/work_conserving/fifo_1_class.sched
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
classes A;

policy = A;
policy = fifo[A];

return policy
2 changes: 1 addition & 1 deletion progs/work_conserving/fifo_1_class_sugar.sched
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
classes A;

policy = A;
policy = fifo[A];
// Sample test comment

return policy
2 changes: 1 addition & 1 deletion progs/work_conserving/fifo_2_class_union.sched
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
classes A, B;

policy = union[A, B];
policy = fifo[union[A, B]];

return policy
2 changes: 1 addition & 1 deletion progs/work_conserving/fifo_n_classes.sched
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
classes A, B, C;

policy = fifo[A, B, C];
policy = fifo[union[A, B, C]];

return policy
2 changes: 1 addition & 1 deletion progs/work_conserving/rr_1_class.sched
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
classes A;

policy = rr[A];
policy = rr[fifo[A]];

return policy
2 changes: 1 addition & 1 deletion progs/work_conserving/rr_2_classes.sched
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
classes A, B;

policy = rr[A, B];
policy = rr[fifo[union[A, B]]];

return policy
4 changes: 2 additions & 2 deletions progs/work_conserving/rr_hier.sched
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ classes B, RP, RT;
// RP packets are destined for Pittsburgh
// RT packets are destined for Toronto

r_policy = rr[RP, RT];
policy = rr[B, r_policy];
r_policy = rr[fifo[RP], fifo[RT]];
policy = rr[fifo[B], r_policy];

return policy

Expand Down
4 changes: 2 additions & 2 deletions progs/work_conserving/rr_hier_merge_sugar.sched
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ classes BX, BY, RP, RT;
// RP packets are destined for Pittsburgh
// RT packets are destined for Toronto

b_policy = fifo[BX, BY];
r_policy = rr[RP, RT];
b_policy = fifo[union[BX, BY]];
r_policy = rr[fifo[RP], fifo[RT]];
policy = rr[b_policy, r_policy];

return policy
Expand Down
4 changes: 2 additions & 2 deletions progs/work_conserving/rr_hier_sugar.sched
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ classes B, RP, RT;
// RP packets are destined for Pittsburgh
// RT packets are destined for Toronto

r_policy = rr[RP, RT];
policy = rr[B, r_policy];
r_policy = rr[fifo[RP], fifo[RT]];
policy = rr[fifo[B], r_policy];

return policy

Expand Down
4 changes: 2 additions & 2 deletions progs/work_conserving/rr_n_class_hier.sched
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
classes A, B, CU, CV, CW, CX;

c_policy = rr[rr[CU, CV], rr[CW, CX]];
policy = rr[A, B, c_policy];
c_policy = rr[rr[fifo[CU], fifo[CV]], rr[fifo[CW], fifo[CX]]];
policy = rr[fifo[A], fifo[B], c_policy];

return policy

Expand Down
2 changes: 1 addition & 1 deletion progs/work_conserving/rr_n_classes.sched
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
classes A, B, C;

policy = rr[A, B, C];
policy = rr[fifo[A], fifo[B], fifo[C]];

return policy
4 changes: 2 additions & 2 deletions progs/work_conserving/rr_strict_n_classes_hier.sched
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
classes A, B, CU, CV, CW, CX;

c_policy = rr[rr[CU, CV], strict[CW, CX]];
policy = strict[A, B, c_policy];
c_policy = rr[rr[fifo[CU], fifo[CV]], strict[fifo[CW], fifo[CX]]];
policy = strict[fifo[A], fifo[B], c_policy];

return policy

Expand Down
2 changes: 1 addition & 1 deletion progs/work_conserving/strict_n_classes.sched
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
classes A, B, C;

policy = strict[C, B, A];
policy = strict[fifo[C], fifo[B], fifo[A]];

return policy
2 changes: 1 addition & 1 deletion progs/work_conserving/wfq_n_classes.sched
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
classes A, B, C;

policy = wfq[(A, 0.1), (B, 0.2), (C, 0.3)];
policy = wfq[fifo[A], fifo[B], fifo[C]][1, 2, 3];

return policy
29 changes: 17 additions & 12 deletions rio/tests/parsing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,35 @@ let make_error_test name filename exn =
let wc_tests =
[
make_test "single class policy" "progs/work_conserving/drop_a_class.sched"
"A";
"fifo[A]";
make_test "fifo 1 class" "progs/work_conserving/fifo_1_class_sugar.sched"
"A";
make_test "fifo 1 class" "progs/work_conserving/fifo_1_class.sched" "A";
"fifo[A]";
make_test "fifo 1 class" "progs/work_conserving/fifo_1_class.sched"
"fifo[A]";
make_test "fifo of 3" "progs/work_conserving/fifo_n_classes.sched"
"fifo[A, B, C]";
make_test "rr of 1" "progs/work_conserving/rr_1_class.sched" "rr[A]";
make_test "rr of 2" "progs/work_conserving/rr_2_classes.sched" "rr[A, B]";
make_test "rr of 1" "progs/work_conserving/rr_1_class.sched" "rr[fifo[A]]";
make_test "rr of 2" "progs/work_conserving/rr_2_classes.sched"
"rr[fifo[A, B]]";
make_test "multiple assignments"
"progs/work_conserving/rr_hier_merge_sugar.sched"
"rr[fifo[BX, BY], rr[RP, RT]]";
"rr[fifo[BX, BY], rr[fifo[RP], fifo[RT]]]";
make_test "2 assignments w/ substitutions"
"progs/work_conserving/rr_hier.sched" "rr[B, rr[RP, RT]]";
"progs/work_conserving/rr_hier.sched"
"rr[fifo[B], rr[fifo[RP], fifo[RT]]]";
make_test "3 classes with substitutions"
"progs/work_conserving/rr_n_class_hier.sched"
"rr[A, B, rr[rr[CU, CV], rr[CW, CX]]]";
make_test "rr of 3" "progs/work_conserving/rr_n_classes.sched" "rr[A, B, C]";
"rr[fifo[A], fifo[B], rr[rr[fifo[CU], fifo[CV]], rr[fifo[CW], fifo[CX]]]]";
make_test "rr of 3" "progs/work_conserving/rr_n_classes.sched"
"rr[fifo[A], fifo[B], fifo[C]]";
make_test "rr and strict substitutions"
"progs/work_conserving/rr_strict_n_classes_hier.sched"
"strict[A, B, rr[rr[CU, CV], strict[CW, CX]]]";
"strict[fifo[A], fifo[B], rr[rr[fifo[CU], fifo[CV]], strict[fifo[CW], \
fifo[CX]]]]";
make_test "strict of 3" "progs/work_conserving/strict_n_classes.sched"
"strict[C, B, A]";
"strict[fifo[C], fifo[B], fifo[A]]";
make_test "wfq of 3" "progs/work_conserving/wfq_n_classes.sched"
"wfq[(A, 0.10), (B, 0.20), (C, 0.30)]";
"wfq[(fifo[A], 1.00), (fifo[B], 2.00), (fifo[C], 3.00)]";
]

let _nwc_tests =
Expand Down

0 comments on commit 051a35c

Please sign in to comment.