-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ test ] Fix spec001 test #3156
Conversation
The only question in my mind is whether this test output was supposed to be useful in spotting a change that actually caused argument numbers to change not just from |
I took a closer look at why these numbers are different. Where they are different, the I bisected locally and it looks like f2e6dc4 introduced the change:
The change adds two functions to the
I don't think we can avoid a bunch of these numbers changing any time we add something to the prelude. Dunno if there is a better solution, other than updating the tests whenever things change. At least the fact that specialization is happening, and the general shape of things are captured in the output. |
I think since there is no specification on what values those numbers have to be and anyway are changed blindly in any change in prelude and/or imported libraries, it is definitely okay for now. As soon as the logic of numbering is changed to be more stable, is can be revised. The only thing, I think, that can be improved is not just hiding those numbers but bijecively mapping them to new ones with a stable numbering (say, local to particular test) so that we can check in a test that equal machine names indeed stay equal in the output, and different ones indeed stay different. But, I think, this is not a thing that should be required for this PR. |
A more complicated awk script might be able to assign new numbers as it finds them in the log (and maintain the mapping of scene stuff). Ideally the So now I've got one of those situations where I've thought through a solution and want to implement it. |
@dunhamsteve that's an impressive |
Should we have a unique function in testutils implementing that cleanup strategy uniformly? |
I think we defintely should! BTW, @dunhamsteve, can I take your code to use in the tests in my own projects, outside the compiler? |
Feel free to use the script elsewhere. In testutils, would this look like a
Or would it be a special version of the |
I'd be in favour of |
I've moved the function into testutils. It is |
Can we use it for the test cases in |
We can use it as-is for many of them, for the others, we’d have to add the [0-9]+:[0-9]+ regex. I guess that is for the FC printing? Probably okay to rewrite those too in all cases. I’ll try to find some time tonight for that. |
I don't mind if the golden values change. Uniformity first and foremost. |
Ok, I've added support for:
Which covers most of the other There was one case that was special for |
Fantastic! |
@dunhamsteve I finally used your script from this PR for tests of my library, and I found out that it renames values unexpectedly. For example, I have the following diff after that: (MkTy <DerivedGen.X>[0, 1, 2, 3]
(IPi. (MW ExplicitArg : IVar Data.Fuel.Fuel)
- -> (MW ExplicitArg {arg:3630} : IVar Prelude.Types.Nat)
- -> (MW ExplicitArg {arg:3633} : IVar Prelude.Types.Nat)
- -> (MW ExplicitArg {arg:3636} : IVar Prelude.Types.Nat)
- -> (MW ExplicitArg {arg:3639} : IVar Prelude.Types.Nat)
+ -> (MW ExplicitArg {arg:1} : IVar Prelude.Types.Nat)
+ -> (MW ExplicitArg {arg:1} : IVar Prelude.Types.Nat)
+ -> (MW ExplicitArg {arg:1} : IVar Prelude.Types.Nat)
+ -> (MW ExplicitArg {arg:1} : IVar Prelude.Types.Nat)
-> (IApp. IVar Test.DepTyCheck.Gen.Gen
$ IVar Test.DepTyCheck.Gen.Emptiness.MaybeEmpty
$ (IApp. IVar DerivedGen.X
- $ IVar {arg:3630}
- $ IVar {arg:3633}
- $ IVar {arg:3636}
- $ IVar {arg:3639}))))
+ $ IVar {arg:1}
+ $ IVar {arg:1}
+ $ IVar {arg:1}
+ $ IVar {arg:1}))))
IDef <DerivedGen.X>[0, 1, 2, 3]
[ PatClause (IApp. IVar <DerivedGen.X>[0, 1, 2, 3] Am I right that your script should have renamed those variables to |
Yeah, that was my intent. That they would get unique names, but a consistent mapping for a given name if it recurs later in the input. I can take a look after work (PST). |
Couldn't resist taking a look now. It seems that it was ignoring the last digit of the name. (I printed diff --git a/tests/testutils.sh b/tests/testutils.sh
index 04b588cb2..d96684324 100755
--- a/tests/testutils.sh
+++ b/tests/testutils.sh
@@ -57,7 +57,7 @@ _awk_clean_name='
while (match($0, /(P:[A-z]+:|arg:|conArg:|ttc[\\\/][0-9]+|[$]resolved)[0-9]+|[A-z.]+:[0-9]+:[0-9]+--[0-9]+:[0-9]+|[A-z]+[.][0-9]+:[0-9]+/)) {
rs = RSTART
rl = RLENGTH
- m = substr($0, rs, rl - 1)
+ m = substr($0, rs, rl)
pfx = "XXX"
if (match(m,/^(\$resolved|arg:|conArg:|ttc[\\\/]|P:[A-z]+:|[A-z.]+:|[A-z]+[.])/)) { pfx = substr(m, RSTART, RLENGTH) }
if (!(m in mapping)) { I had to update a couple of |
Description
The spec001 test appears to be broken in CI because the numbers in the machine names are different in CI in the test output. This is noted in #3155. Inspired by 1aff26e, I'm rewriting the numbers in resolved, arg, and conArg machine names to be XXX in the test output.