-
Notifications
You must be signed in to change notification settings - Fork 26
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
Start doing testing of compiler components #14
Comments
Is it this function that you're talking about? Also, are you thinking about having an examples-based test or a property-based test for this? Any particular testing framework(s) to be used, such as |
Yeah, that's the one! I was thinking of a property based test, but thinking about it some more that would be fairly involved to get going, since we'll want to generate arbitrary well-typed terms. And an additional complication is that the function doesn't currently satisfy the property. The right way to approach this is probably to get a trivial test, maybe for an Util function, running, and we can make a separate issue for testing simplification. I like tasty since it allows both unit tests and property tests. If that's also your preference I say we should go for that. And you're right about the current testing situation. |
By Util function, do you mean the ones in the I'm new to this but tasty's documentation seems nice, so I'm happy to use it. Would it be better to convert the existing tests first to run with tasty and then add new tests? |
So I already started porting over the tests using Tasty.Golden :P. I've got the success tests working. It seems that about ~25 of those didn't have corresponding After the first review's done, I'll write the rest of the code to incorporate the other existing tests; that part shouldn't take much effort. |
What I meant was that the important thing is to get some test up and running (and not try to do the more complicated simplification test at once) and was suggesting to look in the Running the existing tests with Tasty too sounds like a good idea. Probably easier than hacking shellscripts! Yeah, commit the empty files too. Looking forward to seeing this! |
Quick question: what is the "$@" supposed to do (ex. here)? I've seen it before in the context of makefiles, but I don't think it does anything in bash ... |
|
Okay, so here's the cleaned up version with the success tests working. typesanitizer@97aa8fa I'll do the success multi tests next. For args, it seems like tasty always parses the command line args which is problematic... |
Looks great so far! Skip the arguments for now if it's problematic. |
So I did figure out how to get the options working, the command to run is a bit verbose though:
This is because Tasty tries to capture/use all arguments, so I have to create a dummy argument there, and then forward it to Also, that makes the tests fail because of the verbosity 🙁. So I will replace the 'run' command with the 'test' command and just check the exit code instead of running golden tests (which compare stdin with the golden file, oops...). Furthermore, there is something funny going atm where both inner and outer quotes have to be identical for the above command test to work, otherwise it spews a bunch of crap. Lastly, I noticed something odd: supplying some flags to
The compile command seems to be working fine though, so I don't get what's wrong ... you should be able to reproduce this on b4968e8. |
That way of passing flags seems alright to me (though the quirks seem a bit weird). Having it work with The last thing is probably that the LLVM binary |
Ooh, you're right! I didn't realize that |
Ah, good catch! Should be fixed by aa3b6b8. The problem was that it was using a relative path to the file, but I guess |
We have the setup to do this now thanks to @theindigamer, so it's just a matter of starting to do it when it makes sense. 🎉 |
Currently there are only end-to-end tests. We should have property and unit testing of smaller components in the compiler. An example is the simplifier which should ideally be idempotent (it's currently not, but testing that is the first step to solve that problem).
The text was updated successfully, but these errors were encountered: