Subversion Repositories DevTools

Rev

Rev 4836 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4836 Rev 4837
Line 14... Line 14...
14
use warnings;
14
use warnings;
15
 
15
 
16
# Global variables
16
# Global variables
17
our $ScmPlatform;
17
our $ScmPlatform;
18
our $ScmNoToolsTest;
18
our $ScmNoToolsTest;
19
our $ScmToolsetProcessTests;
-
 
20
 
19
 
21
#   Misc variables
20
#   Misc variables
22
my $UseGcov = 0;
21
my $UseGcov = 0;
-
 
22
my $LcovExplicitBranch = '';
23
my $UseCppcheck = 0;
23
my $UseCppcheck = 0;
24
 
24
 
25
##############################################################################
25
##############################################################################
26
#   Configuration information
26
#   Configuration information
27
#   Cross reference from CrossCompiler Alias to actual paths
27
#   Cross reference from CrossCompiler Alias to actual paths
Line 85... Line 85...
85
       BASE => 'bin/arm-iwmmxt-linux-gnueabi-',
85
       BASE => 'bin/arm-iwmmxt-linux-gnueabi-',
86
       VERSION      => '4.2.4',
86
       VERSION      => '4.2.4',
87
       MACHINE      => 'arm-iwmmxt-linux-gnueabi'
87
       MACHINE      => 'arm-iwmmxt-linux-gnueabi'
88
    },
88
    },
89
 
89
 
-
 
90
    'x86_64-linux-gnu'    => {
-
 
91
       ROOT         => '/usr',
-
 
92
       BASE         => 'bin/',
-
 
93
       PACKAGE_ARCH => 'amd64',
-
 
94
       VERSION      => '4.8',
-
 
95
       MACHINE      => 'x86_64-linux-gnu'
-
 
96
    },
-
 
97
 
-
 
98
 
90
 
99
 
91
    #
100
    #
92
    #   Old (not to be used) version of the embedded toolchain
101
    #   Old (not to be used) version of the embedded toolchain
93
    #   This was deprecated in favor of gcc-4.1.1-glibc-2.5
102
    #   This was deprecated in favor of gcc-4.1.1-glibc-2.5
94
    #   It is not possible to reproduce old packages using the old compiler
103
    #   It is not possible to reproduce old packages using the old compiler
Line 152... Line 161...
152
    $::ScmToolsetVersion = "1.0.0";             # our version
161
    $::ScmToolsetVersion = "1.0.0";             # our version
153
    $::ScmToolsetGenerate = 0;                  # GEN generate optional
162
    $::ScmToolsetGenerate = 0;                  # GEN generate optional
154
    $::ScmToolsetCompilerPath = 1;              # Exports Compiler path to makefile via SCM_COMPILERPATH
163
    $::ScmToolsetCompilerPath = 1;              # Exports Compiler path to makefile via SCM_COMPILERPATH
155
    $::ScmToolsetProgDependancies = 0;          # handle Prog dependancies myself
164
    $::ScmToolsetProgDependancies = 0;          # handle Prog dependancies myself
156
    $::ScmToolsetSoName = 1;                    # Shared library supports SoName
165
    $::ScmToolsetSoName = 1;                    # Shared library supports SoName
157
    $ScmToolsetProcessTests = 0;                # Unit Tests require Pre/Post processing - set later
-
 
158
 
166
 
159
#.. Standard.rul requirements
167
#.. Standard.rul requirements
160
#
168
#
161
    $::s = "asm";
169
    $::s = "asm";
162
    $::o = "o";
170
    $::o = "o";
Line 174... Line 182...
174
            $arg_alias = $1;
182
            $arg_alias = $1;
175
 
183
 
176
        } elsif (/^--UseGcov/) {                # Compile for code coverage
184
        } elsif (/^--UseGcov/) {                # Compile for code coverage
177
            $UseGcov = 1;
185
            $UseGcov = 1;
178
 
186
 
-
 
187
        } elsif (/^--LcovExplicitBranch/) {     # Version of lcov requires explicit branch coverage
-
 
188
            $LcovExplicitBranch = ' --rc lcov_branch_coverage=1';
-
 
189
 
179
        } elsif (/^--UseCppcheck/) {            # Use cppcheck as the lint tool
190
        } elsif (/^--UseCppcheck/) {            # Use cppcheck as the lint tool
180
            $UseCppcheck = 1;
191
            $UseCppcheck = 1;
181
 
192
 
182
        } elsif (/^--CompilerTool=(.*)/) {      # CrossCompiler located in package
193
        } elsif (/^--CompilerTool=(.*)/) {      # CrossCompiler located in package
183
            $compiler_tool = $1;
194
            $compiler_tool = $1;
Line 489... Line 500...
489
    $file = StripExt( $obj );                   # Metric working file
500
    $file = StripExt( $obj );                   # Metric working file
490
    ToolsetGenerate( "\$(OBJDIR)/$file.met" );
501
    ToolsetGenerate( "\$(OBJDIR)/$file.met" );
491
 
502
 
492
    if ( $UseGcov )
503
    if ( $UseGcov )
493
    {
504
    {
494
        $ScmToolsetProcessTests = 1;
-
 
495
        ToolsetGenerate( '$(OBJDIR)/' . $file . '.gcno' );
505
        ToolsetGenerate( '$(OBJDIR)/' . $file . '.gcno' );
496
        ToolsetGenerate( '$(OBJDIR)/' . $file . '.gcda' );
506
        ToolsetGenerate( '$(OBJDIR)/' . $file . '.gcda' );
497
    }
507
    }
498
}
508
}
499
 
509
 
Line 542... Line 552...
542
    $file = StripExt( $obj );                   # Metric working file
552
    $file = StripExt( $obj );                   # Metric working file
543
    ToolsetGenerate( "\$(OBJDIR)/$file.met" );
553
    ToolsetGenerate( "\$(OBJDIR)/$file.met" );
544
 
554
 
545
    if ( $UseGcov )
555
    if ( $UseGcov )
546
    {
556
    {
547
        $ScmToolsetProcessTests = 1;
-
 
548
        ToolsetGenerate( '$(OBJDIR)/' . $file . '.gcno' );
557
        ToolsetGenerate( '$(OBJDIR)/' . $file . '.gcno' );
549
        ToolsetGenerate( '$(OBJDIR)/' . $file . '.gcda' );
558
        ToolsetGenerate( '$(OBJDIR)/' . $file . '.gcda' );
550
    }
559
    }
551
}
560
}
552
 
561
 
Line 946... Line 955...
946
    PackageProgAddFiles ( $name, $full );
955
    PackageProgAddFiles ( $name, $full );
947
    PackageProgAddFiles ( $name, $dbg );
956
    PackageProgAddFiles ( $name, $dbg );
948
 
957
 
949
}
958
}
950
 
959
 
-
 
960
  #-------------------------------------------------------------------------------
-
 
961
# Function        : ToolsetPostprocess 
-
 
962
#
-
 
963
# Description     : Last chance by the toolset to perform processing
-
 
964
#                   All Directives have been processed
-
 
965
#
-
 
966
#                   If automated unit test are being used,
-
 
967
#                   then we need to post process the results
-
 
968
#
-
 
969
# Inputs          : None
-
 
970
#
-
 
971
# Returns         : 
-
 
972
#
-
 
973
sub ToolsetPostprocess
-
 
974
{
-
 
975
    ToolsetPreprocessTests();
-
 
976
    ToolsetPostprocessTests();
-
 
977
    ToolsetCollateTestResults();
-
 
978
}
951
 
979
 
952
###############################################################################
980
###############################################################################
953
# Function        : ToolsetPreprocessTests
981
# Function        : ToolsetPreprocessTests
954
#
982
#
955
# Description     : 
983
# Description     : 
Line 963... Line 991...
963
sub ToolsetPreprocessTests
991
sub ToolsetPreprocessTests
964
{
992
{
965
    my ($io) = ToolsetPrinter::New();
993
    my ($io) = ToolsetPrinter::New();
966
    if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
994
    if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
967
    {
995
    {
968
        #   Force The Pre/Post/Collate rules to be processed
-
 
969
        $ScmToolsetProcessTests = 1;
996
        my $ruleName = 'preprocess_gcov_data';
970
 
-
 
971
        my $finaldir='$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
997
        my $finaldir='$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
972
        my $final=$finaldir . '/lcov-final.info';
998
        my $final=$finaldir . '/lcov-final.info';
973
        
999
        
974
        ToolsetGenerate( '$(OBJDIR)/lcov-baseline.info' );
1000
        ToolsetGenerate( '$(OBJDIR)/lcov-baseline.info' );
-
 
1001
        ToolsetAddUnitTestPreProcess($ruleName);
975
        $io->PrtLn('.PHONY: preprocess_tests' );
1002
        $io->PrtLn('.PHONY: ' . $ruleName );
976
        $io->PrtLn('preprocess_tests:' );
1003
        $io->PrtLn($ruleName . ':' );
977
 
1004
 
978
        my $key;
1005
        my $key;
979
        my $value;
1006
        my $value;
980
        while(($key, $value) = each(%::OBJSOURCE))
1007
        while(($key, $value) = each(%::OBJSOURCE))
981
        {
1008
        {
982
            $io->PrtLn("\t" . '$(XX_PRE)rm -f $(OBJDIR)/' . $key . ".gcda");
1009
            $io->PrtLn("\t" . '$(XX_PRE)rm -f $(OBJDIR)/' . $key . ".gcda");
983
        }
1010
        }
984
        $io->PrtLn("\t" . '${XX_PRE}$(rm) -f ' . $final);
1011
        $io->PrtLn("\t" . '${XX_PRE}$(rm) -f ' . $final);
985
        $io->PrtLn("\t" . '${XX_PRE}lcov'
1012
        $io->PrtLn("\t" . '${XX_PRE}lcov'
986
                      . ' --rc lcov_branch_coverage=1'
1013
                        . $LcovExplicitBranch
987
                      . ' --capture'
1014
                        . ' --capture'
988
                      . ' --initial'
1015
                        . ' --initial'
989
                      . ' --base-directory ' . $::Cwd
1016
                        . ' --base-directory ' . $::Cwd
990
                      . ' --directory $(OBJDIR)'
1017
                        . ' --directory $(OBJDIR)'
991
                      . ' --output-file $(OBJDIR)/lcov-baseline.info' ); 
1018
                        . ' --output-file $(OBJDIR)/lcov-baseline.info' );
-
 
1019
        $io->Newline();
992
    }
1020
    }
993
}
1021
}
994
 
1022
 
995
 
1023
 
996
###############################################################################
1024
###############################################################################
Line 1007... Line 1035...
1007
sub ToolsetPostprocessTests
1035
sub ToolsetPostprocessTests
1008
{
1036
{
1009
    my ($io) = ToolsetPrinter::New();
1037
    my ($io) = ToolsetPrinter::New();
1010
    if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
1038
    if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
1011
    {
1039
    {
-
 
1040
        my $ruleName = 'postprocess_gcov_data';
1012
        my $finaldir='$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
1041
        my $finaldir='$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
1013
        my $final=$finaldir . '/lcov-final.info';
1042
        my $final=$finaldir . '/lcov-final.info';
1014
        
1043
        
1015
        ToolsetGenerate( '$(OBJDIR)/lcov-capture.info' );
1044
        ToolsetGenerate( '$(OBJDIR)/lcov-capture.info' );
1016
        ToolsetGenerate( $final );
1045
        ToolsetGenerate( $final );
-
 
1046
        ToolsetAddUnitTestPostProcess($ruleName);
1017
        
1047
 
1018
        $io->PrtLn('.PHONY: postprocess_tests' );
1048
        $io->PrtLn('.PHONY: ' . $ruleName );
1019
        $io->PrtLn('postprocess_tests:' );
1049
        $io->PrtLn($ruleName . ':' );
1020
        $io->PrtLn("\t" . '$(eval GCDA_COUNT := $(shell find $(OBJDIR) -name "*.gcda"))');
1050
        $io->PrtLn("\t" . '$(eval GCDA_COUNT := $(shell find $(OBJDIR) -name "*.gcda"))');
1021
        
1051
        
1022
        $io->PrtLn  ("\t" . '$(XX_PRE)$(mkdir) -p ' . $finaldir);
1052
        $io->PrtLn  ("\t" . '$(XX_PRE)$(mkdir) -p ' . $finaldir);
1023
        $io->PrtPart("\t" . '$(XX_PRE)if [ "$(GCDA_COUNT)" = "" ]; then');
1053
        $io->PrtPart("\t" . '$(XX_PRE)if [ "$(GCDA_COUNT)" = "" ]; then');
1024
        $io->PrtPart("\t\t" . 'if [ ! -e ' . $final . " ]; then");
1054
        $io->PrtPart("\t\t" . 'if [ ! -e ' . $final . " ]; then");
1025
        $io->PrtPart("\t\t\t" . '$(cp) $(OBJDIR)/lcov-baseline.info ' . $final . ';');
1055
        $io->PrtPart("\t\t\t" . '$(cp) $(OBJDIR)/lcov-baseline.info ' . $final . ';');
1026
        $io->PrtPart("\t\t" . 'else');
1056
        $io->PrtPart("\t\t" . 'else');
1027
        $io->PrtPart("\t\t\t" . 'lcov'
1057
        $io->PrtPart("\t\t\t" . 'lcov'
1028
                          . ' --rc lcov_branch_coverage=1'
1058
                          . $LcovExplicitBranch
1029
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
1059
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
1030
                          . ' --add-tracefile ' . $final
1060
                          . ' --add-tracefile ' . $final
1031
                          . ' --output-file $(OBJDIR)/lcov-merge.info'
1061
                          . ' --output-file $(OBJDIR)/lcov-merge.info'
1032
                          . ';'); 
1062
                          . ';'); 
1033
        $io->PrtPart("\t\t\t" . '$(rm) -f ' . $final . ';');
1063
        $io->PrtPart("\t\t\t" . '$(rm) -f ' . $final . ';');
1034
        $io->PrtPart("\t\t\t" . '$(mv) $(OBJDIR)/lcov-merge.info ' . $final . ';');
1064
        $io->PrtPart("\t\t\t" . '$(mv) $(OBJDIR)/lcov-merge.info ' . $final . ';');
1035
        $io->PrtPart("\t\t" . 'fi' . ';');
1065
        $io->PrtPart("\t\t" . 'fi' . ';');
1036
        $io->PrtPart("\t" . 'else');
1066
        $io->PrtPart("\t" . 'else');
1037
        $io->PrtPart("\t\t" . 'lcov'
1067
        $io->PrtPart("\t\t" . 'lcov'
1038
                        . ' --rc lcov_branch_coverage=1'
1068
                          . $LcovExplicitBranch
1039
                        . ' --capture'
1069
                        . ' --capture'
1040
                        . ' --base-directory ' . $::Cwd
1070
                        . ' --base-directory ' . $::Cwd
1041
                        . ' --directory $(OBJDIR)'
1071
                        . ' --directory $(OBJDIR)'
1042
                        . ' --output-file $(OBJDIR)/lcov-capture.info' 
1072
                        . ' --output-file $(OBJDIR)/lcov-capture.info' 
1043
                        . ';'); 
1073
                        . ';'); 
1044
        $io->PrtPart("\t\t" . 'if [ ! -e ' . $final . " ]; then");
1074
        $io->PrtPart("\t\t" . 'if [ ! -e ' . $final . " ]; then");
1045
        $io->PrtPart("\t\t\t" . 'lcov'
1075
        $io->PrtPart("\t\t\t" . 'lcov'
1046
                          . ' --rc lcov_branch_coverage=1'
1076
                          . $LcovExplicitBranch
1047
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
1077
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
1048
                          . ' --add-tracefile $(OBJDIR)/lcov-capture.info'
1078
                          . ' --add-tracefile $(OBJDIR)/lcov-capture.info'
1049
                          . ' --output-file ' .  $final
1079
                          . ' --output-file ' .  $final
1050
                          . ';'); 
1080
                          . ';'); 
1051
        $io->PrtPart("\t\t" . 'else');
1081
        $io->PrtPart("\t\t" . 'else');
1052
        $io->PrtPart("\t\t\t" . 'lcov'
1082
        $io->PrtPart("\t\t\t" . 'lcov'
1053
                          . ' --rc lcov_branch_coverage=1'
1083
                          . $LcovExplicitBranch
1054
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
1084
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
1055
                          . ' --add-tracefile $(OBJDIR)/lcov-capture.info'
1085
                          . ' --add-tracefile $(OBJDIR)/lcov-capture.info'
1056
                          . ' --add-tracefile ' . $final
1086
                          . ' --add-tracefile ' . $final
1057
                          . ' --output-file $(OBJDIR)/lcov-merge.info'
1087
                          . ' --output-file $(OBJDIR)/lcov-merge.info'
1058
                          . ';'); 
1088
                          . ';'); 
1059
        $io->PrtPart("\t\t\t" . '$(rm) -f ' . $final . ';');
1089
        $io->PrtPart("\t\t\t" . '$(rm) -f ' . $final . ';');
1060
        $io->PrtPart("\t\t\t" . '$(mv) $(OBJDIR)/lcov-merge.info ' . $final . ';');
1090
        $io->PrtPart("\t\t\t" . '$(mv) $(OBJDIR)/lcov-merge.info ' . $final . ';');
1061
        $io->PrtPart("\t\t" . 'fi' . ';');
1091
        $io->PrtPart("\t\t" . 'fi' . ';');
1062
        $io->PrtLn  ("\t" . 'fi');
1092
        $io->PrtLn  ("\t" . 'fi');
-
 
1093
        $io->Newline();
1063
    }
1094
    }
1064
}
1095
}
1065
 
1096
 
1066
 
1097
 
1067
###############################################################################
1098
###############################################################################
Line 1079... Line 1110...
1079
sub ToolsetCollateTestResults
1110
sub ToolsetCollateTestResults
1080
{
1111
{
1081
    my ($io) = ToolsetPrinter::New();
1112
    my ($io) = ToolsetPrinter::New();
1082
    if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
1113
    if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
1083
    {
1114
    {
-
 
1115
        my $ruleName = 'collate_gcov_results';
1084
        my $finaldir='$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
1116
        my $finaldir='$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
1085
        my $final=$finaldir . '/lcov-final.info';
1117
        my $final=$finaldir . '/lcov-final.info';
-
 
1118
 
-
 
1119
        ToolsetAddUnitTestCollateProcess($ruleName);
1086
        
1120
        
1087
        my $reportdir='$(PKGDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
1121
        my $reportdir='$(PKGDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
1088
        my $reportindex=$reportdir . '/index.html';
1122
        my $reportindex=$reportdir . '/index.html';
1089
        
1123
        
1090
        $io->PrtLn('.PHONY: collate_test_results' );
1124
        $io->PrtLn('.PHONY: ' . $ruleName );
1091
        $io->PrtLn('collate_test_results: ' . $reportindex);
1125
        $io->PrtLn($ruleName . ': ' . $reportindex);
1092
        $io->Newline();
1126
        $io->Newline();
1093
        $io->PrtLn($reportindex . ': ' . $final);
1127
        $io->PrtLn($reportindex . ': ' . $final);
1094
        $io->PrtLn("\t" . 'genhtml'
1128
        $io->PrtLn("\t" . 'genhtml'
1095
                      . ' --frames'
1129
                      . ' --frames'
1096
                      . ' --show-details'
1130
                      . ' --show-details'
Line 1098... Line 1132...
1098
                      . ' --branch-coverage'
1132
                      . ' --branch-coverage'
1099
                      . ' --output-directory ' . $reportdir
1133
                      . ' --output-directory ' . $reportdir
1100
                      . ' --legend'
1134
                      . ' --legend'
1101
                      . ' --demangle-cpp'
1135
                      . ' --demangle-cpp'
1102
                      . ' ' . $final);
1136
                      . ' ' . $final);
-
 
1137
        $io->Newline();
1103
    }
1138
    }
1104
}
1139
}
1105
 
1140
 
1106
 
1141
 
1107
###############################################################################
1142
###############################################################################