Skip to content

Commit

Permalink
internal/core/adt: add tests for 3672 and 3606
Browse files Browse the repository at this point in the history
These tests have the same fix, which will
be addressed in a different CL.

The issues with these tests only manifest themselves
with DebugDeps enabled. So we therefore disable it
to ensure the problem is exposed.

Disabling DebugDeps has the side effect to cause
the counter checks in EvalAlpha to fail. We
therefore also add a check to disable those
checks.

We could have opted to set an option for the tests
to run with DebugDeps disabled. However, the
solution to the bug is to make the use of
"dependencies" official and not disable them
if DebugDeps is disabled. We therefore keep
DebugDeps off in the transition, after which
it can be enabled again.

Notice that this also changes some other tests.
We will address these in the fix as well.

Issue #3606
Issue #3672

Signed-off-by: Marcel van Lohuizen <[email protected]>
Change-Id: I73b0b9925806fae94b0c6da6faf3dd50db500d27
Reviewed-on: https://gerrithub.io/c/cue-lang/cue/+/1207313
Unity-Result: CUE porcuepine <[email protected]>
Reviewed-by: Daniel Martí <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
  • Loading branch information
mpvl committed Jan 16, 2025
1 parent fbfff68 commit d57d885
Show file tree
Hide file tree
Showing 5 changed files with 605 additions and 166 deletions.
167 changes: 132 additions & 35 deletions cue/testdata/cycle/comprehension.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,15 @@ issue2367: {
}

-- out/evalalpha/stats --
Leaks: 782
Freed: 63
Reused: 63
Allocs: 782
Leaks: 795
Freed: 56
Reused: 56
Allocs: 795
Retain: 0

Unifications: 502
Conjuncts: 3031
Disjuncts: 196
Unifications: 506
Conjuncts: 3038
Disjuncts: 198
-- out/evalalpha --
Errors:
selfReferential.insertionError.A: adding field foo3 not allowed as field set was already referenced:
Expand Down Expand Up @@ -450,11 +450,31 @@ Result:
acrossOr: (struct){
t1: (struct){
p1: (struct){
o: (#struct){
retry: (#struct){
reject: (string){ "ok" }
}
}
o: (#struct){ |((#struct){
retry: (struct){
reject: (string){ "ok" }
}
reject: (string){ string }
}, (#struct){
retry: (struct){
reject: (string){ "ok" }
}
resource: (string){ string }
}, (#struct){
retry: (#struct){ |((#struct){
reject: (string){ "ok" }
}, (#struct){
reject: (string){ "ok" }
resource: (string){ string }
}, (#struct){
reject: (string){ "ok" }
retry: (#struct){ |((#struct){
reject: (string){ string }
}, (#struct){
resource: (string){ string }
}) }
}) }
}) }
#AllOutputs: (#struct){
reject: (string){ string }
resource: (string){ string }
Expand Down Expand Up @@ -568,13 +588,33 @@ Result:
}
issue1881: (struct){
p1: (struct){
o: (#struct){
retry: (struct){
output: (#struct){
reject: (string){ "ok" }
o: (#struct){ |((#struct){
retry: (struct){
output: (struct){
reject: (string){ "ok" }
}
}
}
}
reject: (string){ string }
}, (#struct){
retry: (struct){
output: (struct){
reject: (string){ "ok" }
}
}
resource: (string){ string }
}, (#struct){
retry: (struct){
output: (#struct){ |((#struct){
reject: (string){ "ok" }
}, (#struct){
reject: (string){ "ok" }
resource: (string){ string }
}, (#struct){
reject: (string){ "ok" }
retry: ~(issue1881.p1.#AllOutputs.retry)
}) }
}
}) }
#AllOutputs: (#struct){
reject: (string){ string }
resource: (string){ string }
Expand Down Expand Up @@ -778,7 +818,7 @@ diff old new
}
}
}
@@ -127,9 +120,9 @@
@@ -127,19 +120,39 @@
insertionError: (_|_){
// [eval]
A: (_|_){
Expand All @@ -790,10 +830,46 @@ diff old new
}
}
acrossOr: (struct){
@@ -254,27 +247,31 @@
t1: (struct){
p1: (struct){
- o: (#struct){
- retry: (#struct){
- reject: (string){ "ok" }
- }
- }
+ o: (#struct){ |((#struct){
+ retry: (struct){
+ reject: (string){ "ok" }
+ }
+ reject: (string){ string }
+ }, (#struct){
+ retry: (struct){
+ reject: (string){ "ok" }
+ }
+ resource: (string){ string }
+ }, (#struct){
+ retry: (#struct){ |((#struct){
+ reject: (string){ "ok" }
+ }, (#struct){
+ reject: (string){ "ok" }
+ resource: (string){ string }
+ }, (#struct){
+ reject: (string){ "ok" }
+ retry: (#struct){ |((#struct){
+ reject: (string){ string }
+ }, (#struct){
+ resource: (string){ string }
+ }) }
+ }) }
+ }) }
#AllOutputs: (#struct){
reject: (string){ string }
resource: (string){ string }
@@ -253,28 +266,52 @@
}
issue1881: (struct){
p1: (struct){
o: (#struct){
- o: (#struct){
- retry: (#struct){
- output: (#struct){
- reject: (string){ "ok" }
Expand All @@ -815,12 +891,33 @@ diff old new
- reject: (string){ string }
- }, (#struct){
- resource: (string){ string }
+ retry: (struct){
+ output: (#struct){
+ reject: (string){ "ok" }
+ o: (#struct){ |((#struct){
+ retry: (struct){
+ output: (struct){
+ reject: (string){ "ok" }
+ }
+ }
+ }
+ }
+ reject: (string){ string }
+ }, (#struct){
+ retry: (struct){
+ output: (struct){
+ reject: (string){ "ok" }
+ }
+ }
+ resource: (string){ string }
+ }, (#struct){
+ retry: (struct){
+ output: (#struct){ |((#struct){
+ reject: (string){ "ok" }
+ }, (#struct){
+ reject: (string){ "ok" }
+ resource: (string){ string }
+ }, (#struct){
+ reject: (string){ "ok" }
+ retry: ~(issue1881.p1.#AllOutputs.retry)
+ }) }
+ }
+ }) }
+ #AllOutputs: (#struct){
+ reject: (string){ string }
+ resource: (string){ string }
Expand All @@ -843,7 +940,7 @@ diff old new
}) }
}
p2: (struct){
@@ -290,7 +287,7 @@
@@ -290,7 +327,7 @@
}
}
o: (#struct){
Expand All @@ -852,7 +949,7 @@ diff old new
output: (#struct){
reject: (string){ "ok" }
}
@@ -320,7 +317,7 @@
@@ -320,7 +357,7 @@
resource: (string){ string }
}) }
o: (#struct){
Expand All @@ -871,18 +968,18 @@ diff old new
-Reused: 1260
-Allocs: 60
-Retain: 145
+Leaks: 782
+Freed: 63
+Reused: 63
+Allocs: 782
+Leaks: 795
+Freed: 56
+Reused: 56
+Allocs: 795
+Retain: 0

-Unifications: 832
-Conjuncts: 2525
-Disjuncts: 1404
+Unifications: 502
+Conjuncts: 3031
+Disjuncts: 196
+Unifications: 506
+Conjuncts: 3038
+Disjuncts: 198
-- out/eval/stats --
Leaks: 50
Freed: 1270
Expand Down
28 changes: 14 additions & 14 deletions cue/testdata/cycle/issue990.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ out: #sub & {#p: _test.s1}
-- diff/todo/p3 --
Reordering
-- out/evalalpha/stats --
Leaks: 1834
Freed: 197
Reused: 197
Allocs: 1834
Leaks: 1909
Freed: 204
Reused: 204
Allocs: 1909
Retain: 0

Unifications: 243
Conjuncts: 4474
Disjuncts: 396
Unifications: 257
Conjuncts: 4823
Disjuncts: 410
-- out/evalalpha --
(struct){
#AC: (#struct){
Expand Down Expand Up @@ -328,18 +328,18 @@ diff old new
-Reused: 3213
-Allocs: 25
-Retain: 26
+Leaks: 1834
+Freed: 197
+Reused: 197
+Allocs: 1834
+Leaks: 1909
+Freed: 204
+Reused: 204
+Allocs: 1909
+Retain: 0

-Unifications: 2588
-Conjuncts: 12056
-Disjuncts: 3258
+Unifications: 243
+Conjuncts: 4474
+Disjuncts: 396
+Unifications: 257
+Conjuncts: 4823
+Disjuncts: 410
-- diff/-out/evalalpha<==>+out/eval --
diff old new
--- old
Expand Down
Loading

0 comments on commit d57d885

Please sign in to comment.