Skip to content
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

eunit test provider #805

Merged
merged 11 commits into from
Sep 29, 2015
Merged

Conversation

talentdeficit
Copy link
Contributor

reworked eunit provider.

improvements:

  • test sets can be specified via {eunit_tests, [...]} in rebar.config
  • now has application, module, file and dir command line flags that mirror the eunit test representations. retains the app and suite command line flags as aliases of application and module
  • prints warnings (or errors with an additional argument) and drops tests that can't be located to run before eunit tries to run them and provides confusing output
  • removes a lot of complexity in actually assembling test sets making it easier to extend

future improvements:

  • once some compiler complications get sorted out will be able to compile modules and directories specified as tests that are not otherwise considered part of the application (and hence, normally uncompiled)
  • the validation could be extended to support more complex test primitives and controls like {spawn, [...]}, {with, [...]}, {inparallel, N, [...]}, etc

possible drawbacks:

  • breaks one feature introduced during beta where rebar3 --app=foo --suite=bar would run the test suite bar only if it were a member of the application foo. as far as i know no one ever used this

@talentdeficit
Copy link
Contributor Author

additionally, i think we should probably include something like https://github.com/seancribbs/eunit_formatters for better output, but i don't want to add any dependencies that aren't necessary

@ferd
Copy link
Collaborator

ferd commented Sep 14, 2015

Regarding the compiler option to compile only some files, I believe the src_dirs and extra_src_dirs options with profiles lets people pick files to compile or not on demand.

Eunit formatters is one of the first piece of code I override away because I always have issues compiling it properly and it's a dep in projects that I require. Though if we do that, I'd sure like not having to carry https://github.com/ferd/cth_readable around all the time :P

@talentdeficit
Copy link
Contributor Author

both ct and eunit can specify a single file as a test set. right now there's no way to compile a single file, just it and everything else in the directory it resides in. it's not a pressing issue though and there's other more important changes i'd like to make to the compiler first

there's probably a way to install the formatters to the rebar cache i bet. i should figure that out for formatters

@talentdeficit
Copy link
Contributor Author

dropped the eunit_first_files and eunit_compile_opts rebar.config keys. if they aren't dropped now we'll be stuck with them even longer, and there are profiles now

@ferd
Copy link
Collaborator

ferd commented Sep 14, 2015

Any risk this last change breaks a lot more eunit stuff?

@talentdeficit
Copy link
Contributor Author

low. the eunit test suite is pretty comprehensive

@ferd
Copy link
Collaborator

ferd commented Sep 14, 2015

I mean anyone who used to use eunit_compile_opts and others won't have their stuff working anymore. I guess it's a good thing to drop it before 3.0.0, but that does seem like a somewhat big piece to drop.

@talentdeficit
Copy link
Contributor Author

i can revert that change. i think they are a misfeature and if we're going to consider cutting them now is the time to do it though. i plan on cutting the ct equivalents also.

if we keep them around i'd like to lobby for a transformation step in the config parser that translates them into more regular forms (so like {eunit_compile_opts, [...]} to {profiles, [{test, [{erl_opts, [...]}]}]} before they make it out to any of the providers

@ferd
Copy link
Collaborator

ferd commented Sep 18, 2015

We'd probably like that change reverted (eunit_compile_opts), as mentioned on IRC yesterday, just because there's hundreds of projects depending on them.

@talentdeficit
Copy link
Contributor Author

ok. i will try to get to it this weekend

@talentdeficit
Copy link
Contributor Author

this is good to merge now i think. reverted the removal of eunit_compile_opts and eunit_first_files and fixed them so they aren't applied to the test profile at large

still not implemented but now much easier with the new provider structure and coming as soon as i cleanup the ct provider and fix the data_dir issue:

  • auto translation of tests specified as paths from their position in the project to the appropriate position in the _build directory
  • auto compilation of dirs and files specified at the command line or in the test spec. currently you have to ensure these are compiled (probably via {extra_src_dirs, []}
  • subapp specific eunit_compile_opts and eunit_first_files. i think this requires changes to how rebar.config inheritance works

tsloughter added a commit that referenced this pull request Sep 29, 2015
@tsloughter tsloughter merged commit 8495964 into erlang:master Sep 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants