Open schnef opened 6 years ago
That sounds like a reasonable avenue for the fix. Would you be willing to trying to submit a PR (with which I can help)? If not, I can see to address this issue, but it may be done over a different time line.
The change to the regexp does not fix the issue since filelib:fold_files/5 used by rebar_utils:find_files/3 already skips hidden files. In the situation that a test directory contains the test suites, the whole directory is copied, including hidden files and other junk. I have no idea how to fix the issue.
are those files created by emacs? the correct place to handle this is probably in the logic we use to copy the test dirs, altho i'm not sure we should ignore dotfiles by default
Yes, these are open unsaved emacs files. So, when you have a test suite from the test directory open in emacs, the dot-files are created. Also, there are '#'-files and '~' files, but these wont cause trouble.
okay so i think the appropriate place to handle this is with a filter in the compiler (rebar_prv_compile
) that drops files that don't match some regex. we can make it configurable via rebar.config
but i'm not sure what a good default value would be. i imagine .#blah.erl
is not a valid source file name but there's probably other invalid filenames we should try to filter
To make it consistent with the behavior of filelib:fold/5 used for selecting tests suites in rebar_prv_common_test, I would suggest dropping all files starting with a dot, at least on non-windows file systems and not make it configurable. Making this configurable would introduce more complexity and probably will never be used. Also, it would leave people wondering why it doesn't work for individual selected test suites. Weird that filelib:fold/5 skips dot-files. What more hidden features does it have?
Environment
Current behaviour
Running ct gives the error {error,'.#rtps_SUITE can not be compiled or loaded'}. I guess this is because I have the file rtps_SUITE.erl open in emacs and the directory _build/test/lib/rtps/test/ contains some unexpected files:
Files starting with a '.' probably should be ignored? The full error message is:
Expected behaviour
Hidden files, starting with a '.' should be ignored.
Fix
In file rebar_prv_common_test.erl, line 526 has:
The regexp should maybe be:
I am not familiar with git and know how to turn all this in a pull request.