This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 239271 - Test unit build system cannot recognize changes in interdependent files and dont recompile relevent test files
Summary: Test unit build system cannot recognize changes in interdependent files and d...
Status: RESOLVED DUPLICATE of bug 252885
Alias: None
Product: cnd
Classification: Unclassified
Component: UnitTest Support (show other bugs)
Version: 7.4
Hardware: PC Linux
: P3 normal (vote)
Assignee: Maria Tishkova
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-09 14:25 UTC by sarigalin
Modified: 2015-09-26 12:58 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sarigalin 2013-12-09 14:25:26 UTC
Consider this scenario:
1- create simple test and use some function in your project (e.g. foo)
2- compile and run test using "Test" option by right clicking on the test
3- delete function foo from main project and the cpp file containing it, can be compiled successfully
4- without changing your test, compile and run test like step 2.

build fails in only in linker level. because compiler didn't recompile the test and use the old object file.

I expect, netbeans test suit can detect changes in dependent files and recompile every file depend on changed file.

Sometimes this unawareness cause the test program is not reproduced and the old version file test binary file is executed and don't reflect changes
Comment 1 Maria Tishkova 2013-12-16 12:48:15 UTC
Hello,

   Well.. from the scenario you have provided and  trying our current 7.4 version:

1. The build of the project is invoked before test (you can see the steps executed in the title of the Output Window, I see (Build, Build Tests,..)
2. Looking inside the test file generated by our project system I do not think that comiler can (should??) fail (you can use context menu Compile on the test file and see it can be compiled just fine), the problem can occur only on linker level when trying to find the object file which contains the foo() symbol definition (declaration is on the bottom of test file)

So I will mark the bug as P3 and incomplete, as more information required.
You can attached archived tar with sample project.

Thanks,
Maria
Comment 2 sarigalin 2013-12-18 07:31:46 UTC
Hello Maria,
I completely agree with you that the problem occurs in linker level. and I think it must be occurs in compiler level.

let me show you another scenario:

1- I have this function in my project:
     void foo(int i);
2- Use this function in your test
     foo(2);
3- Run test successfully
4- change foo declaration as 
        void foo(long l);
5-Now Run Test again

at step 5 failure will be occur at linker level : undefined reference to foo(int)!!!!
you see the problem. if the test file be compiled again, and test object file will contain reference to foo(long) NOT foo(int) there will be no error!!!

I hope I could show the problem.
Comment 3 Maria Tishkova 2013-12-18 10:01:29 UTC
Hello,

As I said on my first comment, the problem *cannot* be found on compiler level as you have declaration to foo(int) in your test file. It is not compiler but linking problem. It has nothing to do with the IDE, this is how compiler works.
You can check that you have declaration to void foo(int) in your test file, that's why compiler CAN compiler, but when linker starts work it tries to find where the object is actually defined. and there is not void foo(int).

If you will use Refactoring to change method parametrs (right click on the function foo and use Refactor->Change Function Parameters) the declaration of foo in test file will be changed. And you will not have any linker problems.

Please let me know if it works for you.


Thanks,
Maria
Comment 4 sarigalin 2013-12-18 11:36:59 UTC
Dear Maria,
I think there is a misunderstanding here. As I showed in my second scenario, there is a dependency between the header file (e.g. foo.h) which function foo is declared in it and a test.cpp which included foo.h

When I compile test.cpp successfully in a RUN TEST, test.o will produced. After that, test.cpp will not compiled again until We make some changes in it. Also, If we make any changes in included files (e.g. foo.h), test.cpp which has dependency on foo.h must be recompiled, but it won't. But in regular project files, this will gonna happen. Is it right?
Comment 5 Maria Tishkova 2013-12-18 14:20:52 UTC
Thanks for more details.

Now I understand. I will see what we can do here

Thanks,
Maria
Comment 6 sarigalin 2013-12-18 14:55:00 UTC
Thanks for being patient and listening to my comments,
I know you will do you best to solve our lovely IDE's problems.

Best Regards,
Sari Galin
Comment 7 ilia 2015-09-25 13:11:48 UTC
The described issue is the same with 
  https://netbeans.org/bugzilla/show_bug.cgi?id=252885
which I've already fixed in
  http://hg.netbeans.org/main-silver/rev/fd5e0a4de674

So, closing as a duplicate.

*** This bug has been marked as a duplicate of bug 252885 ***
Comment 8 ilia 2015-09-25 13:41:15 UTC
There is a commit in cnd-main which commit message refers to this bug.

changeset:   292407:e22be98b8330
tag:         tip
user:        Ilia Gromov <ilia@netbeans.org>
date:        Fri Sep 25 14:34:57 2015 +0400
files:       cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/configurations/ConfigurationMakefileWriter.java
description:
Fixed Bug #239271 - Test unit build system cannot recognize changes in interdependent files and dont recompile relevent test files


This commit message is incorrect and this fix is for https://netbeans.org/bugzilla/show_bug.cgi?id=248257
Comment 9 Quality Engineering 2015-09-26 12:58:11 UTC
Integrated into 'main-silver', will be available in build *201509261150* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/e22be98b8330
User: Ilia Gromov <ilia@netbeans.org>
Log: Fixed Bug #239271 - Test unit build system cannot recognize changes in interdependent files and dont recompile relevent test files