mavak / trucov

True coverage tool for C / C++
1 stars 1 forks source link

source directories retains defaults #40

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. project with following directory structure:
project/
    src_files/
    include_files/
2. run: trucov report -s src_files -s include_files

expected output:
It should work like normal

actual output:
trucov reports two errors/warnings:
ERROR::Config: /path/to/project/src/ does not exist.
ERROR::Config: /path/to/project/include/ does not exist.

The intent was for config-file/default source directories to accumulate.
And for command line source directories to accumulate.
But the command line source directories should override the
config-file/default source directories.

possible solution pseudo-code:
set_up_source_directory_defaults(); // this should only be done until the
config-file is working
parse_config_file(); // if not using config-file yet skip this step
int orig_count = number_of_source_directories();
parse_command_line();
int new_count = number_of_source_directories();
if( new_count > old_count )
{
    // remove all of the default/config-file source directories.
    for( int i=0; i<old_count; ++i )
    {
        // likely a std::vector<std::string>::pop_front();
        remove_first_source_directory();
    }
}

Original issue reported on code.google.com by j.nick.terry@gmail.com on 21 Jul 2009 at 12:30

GoogleCodeExporter commented 9 years ago

Original comment by millerlyte87@gmail.com on 21 Jul 2009 at 3:13

GoogleCodeExporter commented 9 years ago
The real problem here is that you did not use the -c flag. The source 
directories are
relative to the project directory.

I just finished talking to Ye, and when the user specified source directories 
are not
found, then it uses the defaults... This is why it's printing the two errors 
saying
src/ and include/ were not found.

Ye, if the user specified directories are not found, then it should print an 
error
saying they were not found and exit.

Original comment by millerlyte87@gmail.com on 7 Aug 2009 at 4:29

GoogleCodeExporter commented 9 years ago
When I ran the example above I was in the project dir, so I shouldn't have need 
to
use the -c flag.  I got errors for 'src' and 'include' not src_files and
include_files.  It looks like the -s option is just adding directories to
[src,include] instead of replacing it.

Original comment by j.nick.terry@gmail.com on 7 Aug 2009 at 5:20

GoogleCodeExporter commented 9 years ago
exiting when a source directory isn't found could be a problem.  Consider if 
someone
doesn't like the defaults of src/include and prefers, my_src/my_include.  He 
puts his
preferred defaults in the config file (as he should).  Now he runs trucov on a
project without the my_include directory (the project just doesn't need one).  
Trucov
should not prematurely exit because it didn't find my_include.

trucov shall not exit when a default/config-file directory isn't found.

trucov shall not print a warning for not found default/config-file directories.

trucov shall print a warning when a cmdline directory isn't found.

trucov may exit when a cmdline directory isn't found (do whatever is easier).

These apply to source directories, build directories, etc.

Output directories shall be created if they do not exist.

Original comment by j.nick.terry@gmail.com on 7 Aug 2009 at 5:35

GoogleCodeExporter commented 9 years ago
I run like this....
cd sample_test/test_protocol/
./trucov -s my_include -s my_src -b my_build

Original comment by yekyaw.wsu@gmail.com on 14 Aug 2009 at 5:52

GoogleCodeExporter commented 9 years ago
This was still broken, so I fixed it. 

Lets assume defaults are
 build directories = { build/ }
 source directories = { src/, include/ }

If you do ./trucov  
 The defaults will be used

If you do ./trucov -b b2/ -b b1/ -s mysrc/ -s myinclude/
 build directories = { b2/, b1/ }
 source directories = { src/, include/ }

Assigning to William to verify.

Original comment by millerlyte87@gmail.com on 4 Sep 2009 at 10:51

GoogleCodeExporter commented 9 years ago

Original comment by millerlyte87@gmail.com on 4 Sep 2009 at 10:53

GoogleCodeExporter commented 9 years ago
Verified.

Original comment by william....@gmail.com on 5 Sep 2009 at 6:17