TestFile does not delete the file when it is not useful anymore
Denis Steckelmacher
steckdenis at yahoo.fr
Tue Jun 24 13:23:00 UTC 2014
On 06/24/2014 01:09 PM, Milian Wolff wrote:
> On Monday 23 June 2014 20:36:15 Denis Steckelmacher wrote:
>> Hi,
>>
>> The QML/JS plugin imports in each file all the files in the same
>> directory. This way, custom QML modules and global Javascript variables
>> and functions are accessible from everywhere.
>>
>> The code-completion unit tests of the plugin use TestFiles, that are all
>> created in the same directory. This causes problems because each test
>> can see all the ones that were launched previously. Declarations are
>> therefore duplicated or appear when they shouldn't.
>>
>> I currently see two solutions for this problem:
>>
>> * Modifying the unit test so that every symbol is unique (this way, the
>> fact that every file sees the others is not a problem anymore)
>> * Deleting the test file as soon as possible (for instance just after
>> having parsed and added it to the DUChain)
>>
>> What is your preferred solution? The first one involves changing the
>> test code, the second one requires changes in KDevPlatform and could be
>> more invasive.
>
> The TestFile does remove its data from the DUChain when it is destroyed. So
> what you describe above sounds as if the TestFiles are leaked? If so, then
> this is the problem. Which is odd, as the TestFile's are stored in a
> QSharedPointer and should thus be freed properly, no?
>
> So please debug this and ensure the TestFiles get deleted _and_ that the data
> they created is removed from the DUChain at that point.
Very strangely, everything works today: files are deleted and removed
from the DUChain immediately after they have been used, and the unit
tests pass. I don't know what went wrong (maybe an iteration of the test
suite that crashed and left files in /tmp), but everything works
perfectly now.
Denis
More information about the KDevelop-devel
mailing list