fix lcov report output
parent
c3a9fb96d2
commit
7937fef2f7
17
build.py
17
build.py
|
@ -30,9 +30,12 @@ import SCons
|
|||
# to get an ARGUMENTS defined correctly
|
||||
try:
|
||||
ARGUMENTS = SCons.Script.ARGUMENTS
|
||||
COMMAND_LINE_TARGETS = SCons.Script.COMMAND_LINE_TARGETS
|
||||
except AttributeError:
|
||||
from SCons.Script.SConscript import Arguments
|
||||
from SCons.Script.SConscript import CommandLineTargets
|
||||
ARGUMENTS = Arguments
|
||||
COMMAND_LINE_TARGETS = CommandLineTargets
|
||||
|
||||
class Ns3Module:
|
||||
def __init__ (self, name, dir):
|
||||
|
@ -350,14 +353,18 @@ class Ns3:
|
|||
gcov_env.Alias ('lcov-report')
|
||||
if 'lcov-report' in COMMAND_LINE_TARGETS:
|
||||
lcov_report_dir = os.path.join (self.build_dir, 'lcov-report')
|
||||
create_dir_command = "rm -rf " + lcov_report_dir +
|
||||
" && mkdir " + lcov_report_dir + ";"
|
||||
create_dir_command = "rm -rf " + lcov_report_dir
|
||||
create_dir_command += " && mkdir " + lcov_report_dir + ";"
|
||||
gcov_env.Execute (create_dir_command)
|
||||
info_file = os.path.join (lcov_report_dir, 'ns3.info')
|
||||
lcov_command = "utils/lcov/lcov -c -d . -o " info_file
|
||||
lcov_command = "utils/lcov/lcov -c -d . -o " + info_file
|
||||
lcov_command += " --source-dirs=" + os.getcwd ()
|
||||
lcov_command += ":" + os.path.join (os.getcwd (),
|
||||
variant.build_root,
|
||||
'include')
|
||||
gcov_env.Execute (lcov_command)
|
||||
genhtml_command = "utils/lcov/genhtml -o " + lcov_report_data +
|
||||
" " + info_file
|
||||
genhtml_command = "utils/lcov/genhtml -o " + lcov_report_dir
|
||||
genhtml_command += " " + info_file
|
||||
gcov_env.Execute (genhtml_command)
|
||||
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ our $graph_file_extension;
|
|||
our $data_file_extension;
|
||||
our @data_directory;
|
||||
our $test_name = "";
|
||||
our $source_dirs = "";
|
||||
our $quiet;
|
||||
our $help;
|
||||
our $output_filename;
|
||||
|
@ -141,6 +142,7 @@ if ($config)
|
|||
# Parse command line options
|
||||
if (!GetOptions("test-name=s" => \$test_name,
|
||||
"output-filename=s" => \$output_filename,
|
||||
"source-dirs=s" => \$source_dirs,
|
||||
"no-checksum" => \$nochecksum,
|
||||
"version" =>\$version,
|
||||
"quiet" => \$quiet,
|
||||
|
@ -705,6 +707,28 @@ sub process_dafile($)
|
|||
}
|
||||
|
||||
|
||||
# cleanup_path (path)
|
||||
sub cleanup_path($@)
|
||||
{
|
||||
my $result = shift @_;
|
||||
|
||||
# Remove //
|
||||
$result =~ s/\/\//\//g;
|
||||
|
||||
# Remove .
|
||||
$result =~ s/\/\.\//\//g;
|
||||
|
||||
# Solve ..
|
||||
while ($result =~ s/\/[^\/]+\/\.\.\//\//)
|
||||
{
|
||||
}
|
||||
|
||||
# Remove preceding ..
|
||||
$result =~ s/^\/\.\.\//\//g;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
#
|
||||
# solve_relative_path(path, dir)
|
||||
#
|
||||
|
@ -724,19 +748,17 @@ sub solve_relative_path($$)
|
|||
$result = "$path/$result";
|
||||
}
|
||||
|
||||
# Remove //
|
||||
$result =~ s/\/\//\//g;
|
||||
$result = cleanup_path ($result);
|
||||
|
||||
# Remove .
|
||||
$result =~ s/\/\.\//\//g;
|
||||
|
||||
# Solve ..
|
||||
while ($result =~ s/\/[^\/]+\/\.\.\//\//)
|
||||
{
|
||||
if (-f $result) {
|
||||
return $result;
|
||||
}
|
||||
for my $prefix (split (':', $source_dirs)) {
|
||||
$result = cleanup_path ("$prefix/$dir");
|
||||
if (-f $result) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
# Remove preceding ..
|
||||
$result =~ s/^\/\.\.\//\//g;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
@ -134,6 +134,7 @@ our $reset; # If set, reset all coverage data to zero
|
|||
our $capture; # If set, capture data
|
||||
our $output_filename; # Name for file to write coverage data to
|
||||
our $test_name = ""; # Test case name
|
||||
our $source_dirs = "";
|
||||
our $quiet = ""; # If set, suppress information messages
|
||||
our $help; # Help option flag
|
||||
our $version; # Version option flag
|
||||
|
@ -196,6 +197,7 @@ if (!GetOptions("directory|d|di=s" => \@directory,
|
|||
"capture|c" => \$capture,
|
||||
"output-file=s" => \$output_filename,
|
||||
"test-name=s" => \$test_name,
|
||||
"source-dirs=s" => \$source_dirs,
|
||||
"zerocounters" => \$reset,
|
||||
"quiet" => \$quiet,
|
||||
"help" => \$help,
|
||||
|
@ -456,6 +458,7 @@ sub userspace_capture()
|
|||
{
|
||||
@param = (@param, "--no-checksum");
|
||||
}
|
||||
@param = (@param, "--source-dirs", $source_dirs);
|
||||
|
||||
system(@param);
|
||||
exit($? >> 8);
|
||||
|
|
Loading…
Reference in New Issue