this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/flow: add test case for issue 2559

The added CUE takes 7s to test with tools/flow or run with `cue cmd`,
as it's adapted from https://github.com/MarcWort/example-cue
to show the worst case scenario of tools/flow being slow by nesting
many references to non-task nodes which do some underlying work.

Thanks to Marc W for providing the original reproducer on GitHub.

For #2559.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I25543e7c22b1dda6a8a8528198d2d7b4a63bb411
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1198565
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>

+104
+104
tools/flow/testdata/issue2559.txtar
··· 1 + #IgnoreConcrete: true 2 + #InferTasks: true 3 + -- in.cue -- 4 + package p 5 + 6 + import ( 7 + "list" 8 + "tool/cli" 9 + ) 10 + 11 + root: test: cli.Print & { text: "\(len(list.FlattenN(indir1, 10)))" } 12 + 13 + indir1: [if len(indir2) > 0 { indir2 }] 14 + indir2: [if len(indir3) > 0 { indir3 }] 15 + indir3: [if len(indir4) > 0 { indir4 }] 16 + indir4: indir5 17 + indir5: indir6 18 + indir6: indir7 19 + indir7: [for i in list.Range(1,20,4) { 20 + #pair & { 21 + one: n: 0 22 + two: n: i 23 + } 24 + }] 25 + 26 + #pair: { 27 + one: #unit & { 28 + n: <25 29 + } 30 + two: #unit & { 31 + n: >=one.n 32 + if n == one.n { 33 + n: <= one.n 34 + } 35 + } 36 + if two.n > one.n { 37 + one: n: 0 38 + } 39 + } 40 + 41 + #unit: { 42 + n: int 43 + #padding: {in: <10, out: "0\(in)"} | {in: >=10, out: "\(in)"} 44 + str: (#padding & {in: n}).out 45 + } 46 + -- out/run/errors -- 47 + -- out/run/t0 -- 48 + graph TD 49 + t0("root.test [Ready]") 50 + 51 + -- out/run/t1 -- 52 + graph TD 53 + t0("root.test [Terminated]") 54 + 55 + -- out/run/t1/value -- 56 + { 57 + $id: "tool/cli.Print" 58 + stdout: "foo" 59 + text: "5" 60 + } 61 + -- out/run/t1/stats -- 62 + Leaks: 0 63 + Freed: 262168 64 + Reused: 262148 65 + Allocs: 20 66 + Retain: 352 67 + 68 + Unifications: 187362 69 + Conjuncts: 902602 70 + Disjuncts: 262432 71 + -- out/run/stats/totals -- 72 + Leaks: 0 73 + Freed: 262168 74 + Reused: 262148 75 + Allocs: 20 76 + Retain: 352 77 + 78 + Unifications: 187362 79 + Conjuncts: 902602 80 + Disjuncts: 262432 81 + -- out/run/t2 -- 82 + graph TD 83 + t0("root.prepare [Terminated]") 84 + t1("root.run [Terminated]") 85 + t1-->t0 86 + 87 + -- out/run/t2/value -- 88 + { 89 + $id: "run" 90 + stdout: "foo" 91 + env: { 92 + input: "foo" 93 + } 94 + } 95 + -- out/run/t2/stats -- 96 + Leaks: 0 97 + Freed: 12 98 + Reused: 12 99 + Allocs: 0 100 + Retain: 0 101 + 102 + Unifications: 12 103 + Conjuncts: 20 104 + Disjuncts: 12