Skip to content

New issues from UnityTechnologies #1223

Closed

Description

@mihaipopescu

Hey guys,

I've made an announcement also on uncrustify's googlegroup forum but I'm not sure if the message was received. I'm going to use github to send this message instead while this is not an actual issue.

We have gathered a lot of issues 60+ in our internal issue tracker. I have prepared some scripts to extract them and create github issues. I've been experimenting in my fork which you can review upfront. I'm afraid though some of them will be quite confusing but I will get back with explanations.

Let me know if there are other concerns before proceeding.

Thanks,
Mihai

Activity

  1. CDanU commented on Jul 3, 2017

    @CDanU
    Collaborator

    Nope, I did not even know that there is a google group out there for Uncrustify.
    There are some duplicated issues, but the older ones of those had broken url's, so I assume the problem is fixed and there will be no duplicates in the end.

    Some of the issues are generally a bit older but fortunately it appears that they (all?) have the full version string: # Uncrustify 0.63.584-gd2d8b38e
    The issues were discovered in the unity fork right?
    Some of the issues might not exists anymore, but other than that I see no problems.

    Btw. gmaurel will be unreachable for some weeks.

  2. mihaipopescu commented on Jul 4, 2017

    @mihaipopescu
    CollaboratorAuthor

    The googlegroup mailinglist was created to discuss general topics, design, architecture, plans, etc., not necessarily issues. Also, sometimes it's just too much noise on github. Do not hesitate to propose other means of communication.

    Yes, the issues are created against our fork but they also fail against master. I'll re-run them on latest master and recreate the issues.

  3. mihaipopescu commented on Jul 5, 2017

    @mihaipopescu
    CollaboratorAuthor

    @CDanU I think I'll have to minimize the config as for some tests, we're using new options only present in our fork. I'm going to try your option_reducer.py script.

  4. mihaipopescu commented on Jul 5, 2017

    @mihaipopescu
    CollaboratorAuthor

    I assume the scripts don't support include and tests using the same config. I'll make some scripts to satisfy these requirements.

  5. CDanU commented on Jul 5, 2017

    @CDanU
    Collaborator

    No, includes are not supported, as my goal at that time was to remove them.
    It should be possible to add that functionality, just don't forget that at a later point in the config the included options can be overwritten by the local options.

    I am not entirely sure what you mean by

    tests using the same config

    The option_reducer.py script works on a single config file, but you can specify multiple input- and expected output files

  6. mihaipopescu commented on Jul 6, 2017

    @mihaipopescu
    CollaboratorAuthor

    Ok, cool. I was using auto_reducer.py. Btw, nice scripts. Would be very nice to have them in uncrustify.

  7. CDanU commented on Jul 6, 2017

    @CDanU
    Collaborator

    The problem is that there is a bug somewhere in option_reducer.py as it sometimes deletes the wrong options or leaves options that could be removed (that's the reason why I had to add a second sanity test). It is most likely a logical bug. Some options are quiet intertwined, maybe it is related to the order in which the options are removed.
    To get the best results I sometimes have to run it multiple times.

    Also I had to find out that pythons threading apparently does not really use multiple cores (global interpreter lock - GIL). It just processes something else while it is waiting for I/O. Threads should be replaced by processes.
    Another nice to have would be to let the processes use a job queue instead of the current batch processing in order to let every process work continuously without having to wait until all tests from a batch are finished (possibly including a test that takes much longer than others). This theoretically could increase the speed but I am not entirely sure, the blocking for the queue could make things even slower for the generally fairly small tasks that are processed with this script.

  8. mihaipopescu commented on Jul 6, 2017

    @mihaipopescu
    CollaboratorAuthor

    How does it generate the configs ? How do you remove the config options ?
    Looking at the code, I see that you are removing them one by one and checking if the output is preserved. If not, the option is important and should not be removed. Right?

    Also, set doesn't seems to work, even if there is code that should handle it.

    set = MACRO_FUNC                   ATTRIBUTE_ALIGN
    set = COMMENT                      F_STDCALL
    set = COMMENT                      PLATFORM_EXCEPTION_SAFEGUARD_PROLOG
    set = COMMENT                      WINAPI
    set = COMMENT                      __cdecl 
    

    If I can't make it work, I might just end up commenting our options and see if they produce the same result. I don't think the bugs are not dependent on the options we've added but I thought it would be nice if we can have the configs reduced.

  9. CDanU commented on Jul 6, 2017

    @CDanU
    Collaborator

    How does it generate the configs ? How do you remove the config options ?
    Looking at the code, I see that you are removing them one by one and checking if the output is preserved. If not, the option is important and should not be removed. Right?

    Yes that is how it works. It generates configs where one option is missing and tests if the expected output is still generated, if so the option can be dropped.
    Each thread starts split_write_config_file with a start and end index (each batch has a range it operates in), in a loop every option in that range is set as exclude_idx once and the the config file is written with write_config_file. It writes every option that is not indexed by the exclude_idx into a config file.

    I'll take a look later that day to see what's wrong with the set.
    Reducing the configs is always nice, the options that are unknown to Uncrustify should be removed, if the formatting depends on it the script will complain that it can't generate the expected result from the get go (first sanity run).

  10. mihaipopescu commented on Jul 6, 2017

    @mihaipopescu
    CollaboratorAuthor

    To support include I've wrote this script to take the non-default options using uncrustify. It could be a first step in the option remover script.

  11. CDanU commented on Jul 6, 2017

    @CDanU
    Collaborator

    Yes, that works if you don't mind that the include is removed.

    I had in mind to read the include script, store its options in a separate data structure, check for overwrites of those options, add the non overwritten options to the other options, process them normally and then write the include directives and only the reduced options that where not marked as imported.
    The problem with that would be to handle includes that are not placed at the top of the file.

    You could make a 'fork' of my script and integrate your option. That way we will have one script that in the end, at some point, will be cleansed of the current bugs.
    Alternatively in order to keep the history I can open up a separate github project for the script and give you full access to it (or vice versa). The complete history of that could be later integrated into the Uncrustify repo.

  12. CDanU commented on Jul 6, 2017

    @CDanU
    Collaborator

    Btw. an empty input file with this command should be better:
    uncrustify --check -c cfg -f /dev/null -p dbg

  13. mihaipopescu commented on Jul 6, 2017

    @mihaipopescu
    CollaboratorAuthor

    Ok, I've made a fork but we can have a branch against upstream and we can put them in the scripts folder (where I suppose you have them).

    Yes, using an empty file would be better (unsure if /dev/null will work on Windows though - could be just nul).

  14. mihaipopescu commented on Jul 6, 2017

    @mihaipopescu
    CollaboratorAuthor

    But actually my idea was to generate new configs and leave the old ones behind and edit the .test file instead (or create a new one). If, at the end of the process there are orphan configs we can remove them. It's complicated with include directive as you can't just edit those base config files.

  15. CDanU commented on Jul 6, 2017

    @CDanU
    Collaborator

    I handled the win null device this way:

    NULL_DEV = "/dev/null" if os_name != "nt" else "nul"

    For #1128 I did this:
    In cases where a bunch of tests used for example ben.cfg, I grepped every test that used that config and added all of them with the ben.cfg into the script to reduce the options across all tests.
    Later I just copied that ben.cfg N times for each test and then reduced for each specific test.
    The include files where handled by just replacing (manually if I remember) the include directive with the file contents. That could be handled by the option that you implemented.

    Keeping the old config files until the end is fine by me.

    Ok, I've made a fork but we can have a branch against upstream and we can put them in the scripts folder (where I suppose you have them).

    I had a clean git repo in mind but we also can arrange it like an upstream branch. Yes the scripts dir would be suitable.

  16. guy-maurel commented on Jul 9, 2017

    @guy-maurel
    Contributor

    Fine!
    Lets go on.

  17. added
    Engineering
    on Jul 9, 2017
  18. mihaipopescu commented on Jul 11, 2017

    @mihaipopescu
    CollaboratorAuthor

    First batch of issues are created. I've realised that the config is not helpful as it's includes are not resolved but it can be extracted with a little bit of work out of the .unc file. I can create also a PR against master with all staging tests. Maybe that will help.

  19. mihaipopescu commented on Jul 18, 2017

    @mihaipopescu
    CollaboratorAuthor

    If it helps, unlike other issues, the last batch of 9 issues: #1284, #1285, #1286, #1287, #1288, #1289, #1290, #1291 and #1292 are regressions introduced between 0.63 and latest master.

  20. mihaipopescu commented on Jul 18, 2017

    @mihaipopescu
    CollaboratorAuthor

    Thanks @CDanU for taking a first dive on most of the issues posted.

  21. guy-maurel commented on Feb 16, 2018

    @guy-maurel
    Contributor

    @mihaipopescu : All the issues are solved, Thanks to UT people!
    Please make a test with the current git master, report and move back.

  22. mihaipopescu commented on Feb 17, 2018

    @mihaipopescu
    CollaboratorAuthor

    Will do, thanks @gmaurel!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Engineering

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions