Revert "[analyzer] Teach scan-build how to rebuild index.html without analyzing."
This reverts commit a807a068e6
.
Buildbot failures :)
This commit is contained in:
parent
e90dc7c48b
commit
21efb06f0a
|
@ -1,44 +0,0 @@
|
||||||
// FIXME: Actually, "perl".
|
|
||||||
REQUIRES: shell
|
|
||||||
|
|
||||||
// FIXME: Should ideally work on Windows.
|
|
||||||
UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
RUN: rm -rf %t.output_dir && mkdir %t.output_dir
|
|
||||||
RUN: cp %S/report-1.html %t.output_dir
|
|
||||||
RUN: cp %S/report-2.html %t.output_dir
|
|
||||||
RUN: cp %S/report-3.html %t.output_dir
|
|
||||||
RUN: mkdir %t.output_dir/subdirectory
|
|
||||||
RUN: cp %S/subdirectory/report-4.html %t.output_dir/subdirectory
|
|
||||||
|
|
||||||
RUN: %scan-build --generate-index-only %t.output_dir
|
|
||||||
|
|
||||||
RUN: ls %t.output_dir | FileCheck -check-prefix CHECK-FILES %s
|
|
||||||
|
|
||||||
CHECK-FILES: index.html
|
|
||||||
CHECK-FILES-NEXT: report-1.html
|
|
||||||
CHECK-FILES-NEXT: report-2.html
|
|
||||||
|
|
||||||
// report-3.html is a duplicate of report-1.html so it's not present.
|
|
||||||
CHECK-FILES-NOT: report-3.html
|
|
||||||
CHECK-FILES-NEXT: scanview.css
|
|
||||||
CHECK-FILES-NEXT: sorttable.js
|
|
||||||
CHECK-FILES-NEXT: subdirectory
|
|
||||||
|
|
||||||
RUN: ls %t.output_dir/subdirectory | FileCheck -check-prefix CHECK-SUB %s
|
|
||||||
|
|
||||||
CHECK-SUB: report-4.html
|
|
||||||
|
|
||||||
RUN: cat %t.output_dir/index.html | FileCheck -check-prefix CHECK-INDEX %s
|
|
||||||
|
|
||||||
CHECK-INDEX: cat1
|
|
||||||
CHECK-INDEX-NEXT: bug1
|
|
||||||
CHECK-INDEX-NEXT: cat2
|
|
||||||
CHECK-INDEX-NEXT: bug2
|
|
||||||
CHECK-INDEX-NEXT: cat4
|
|
||||||
CHECK-INDEX-NEXT: bug4
|
|
||||||
|
|
||||||
CHECK-INDEX: report-1.html#EndPath
|
|
||||||
CHECK-INDEX: report-2.html#EndPath
|
|
||||||
CHECK-INDEX-NOT: report-3.html#EndPath
|
|
||||||
CHECK-INDEX: subdirectory/report-4.html#EndPath
|
|
|
@ -1,8 +0,0 @@
|
||||||
<!-- BUGTYPE bug1 -->
|
|
||||||
<!-- BUGFILE file1 -->
|
|
||||||
<!-- BUGPATHLENGTH 1 -->
|
|
||||||
<!-- BUGLINE 1 -->
|
|
||||||
<!-- BUGCATEGORY cat1 -->
|
|
||||||
<!-- BUGDESC desc1 -->
|
|
||||||
<!-- FUNCTIONNAME func1 -->
|
|
||||||
<!-- BUGMETAEND -->
|
|
|
@ -1,8 +0,0 @@
|
||||||
<!-- BUGTYPE bug2 -->
|
|
||||||
<!-- BUGFILE file2 -->
|
|
||||||
<!-- BUGPATHLENGTH 2 -->
|
|
||||||
<!-- BUGLINE 2 -->
|
|
||||||
<!-- BUGCATEGORY cat2 -->
|
|
||||||
<!-- BUGDESC desc2 -->
|
|
||||||
<!-- FUNCTIONNAME func2 -->
|
|
||||||
<!-- BUGMETAEND -->
|
|
|
@ -1,8 +0,0 @@
|
||||||
<!-- BUGTYPE bug1 -->
|
|
||||||
<!-- BUGFILE file1 -->
|
|
||||||
<!-- BUGPATHLENGTH 1 -->
|
|
||||||
<!-- BUGLINE 1 -->
|
|
||||||
<!-- BUGCATEGORY cat1 -->
|
|
||||||
<!-- BUGDESC desc1 -->
|
|
||||||
<!-- FUNCTIONNAME func1 -->
|
|
||||||
<!-- BUGMETAEND -->
|
|
|
@ -1,8 +0,0 @@
|
||||||
<!-- BUGTYPE bug4 -->
|
|
||||||
<!-- BUGFILE file4 -->
|
|
||||||
<!-- BUGPATHLENGTH 4 -->
|
|
||||||
<!-- BUGLINE 4 -->
|
|
||||||
<!-- BUGCATEGORY cat4 -->
|
|
||||||
<!-- BUGDESC desc4 -->
|
|
||||||
<!-- FUNCTIONNAME func4 -->
|
|
||||||
<!-- BUGMETAEND -->
|
|
|
@ -72,9 +72,8 @@ my %Options = (
|
||||||
MaxLoop => 0,
|
MaxLoop => 0,
|
||||||
PluginsToLoad => [],
|
PluginsToLoad => [],
|
||||||
AnalyzerDiscoveryMethod => undef,
|
AnalyzerDiscoveryMethod => undef,
|
||||||
OverrideCompiler => 0, # The flag corresponding to the --override-compiler command line option.
|
OverrideCompiler => 0, # The flag corresponding to the --override-compiler command line option.
|
||||||
ForceAnalyzeDebugCode => 0,
|
ForceAnalyzeDebugCode => 0
|
||||||
GenerateIndex => 0 # Skip the analysis, only generate index.html.
|
|
||||||
);
|
);
|
||||||
lock_keys(%Options);
|
lock_keys(%Options);
|
||||||
|
|
||||||
|
@ -947,41 +946,6 @@ ENDTEXT
|
||||||
return $Num;
|
return $Num;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub Finalize {
|
|
||||||
my $BaseDir = shift;
|
|
||||||
my $ExitStatus = shift;
|
|
||||||
|
|
||||||
Diag "Analysis run complete.\n";
|
|
||||||
if (defined $Options{OutputFormat}) {
|
|
||||||
if ($Options{OutputFormat} =~ /plist/ ||
|
|
||||||
$Options{OutputFormat} =~ /sarif/) {
|
|
||||||
Diag "Analysis results (" .
|
|
||||||
($Options{OutputFormat} =~ /plist/ ? "plist" : "sarif") .
|
|
||||||
" files) deposited in '$Options{OutputDir}'\n";
|
|
||||||
}
|
|
||||||
if ($Options{OutputFormat} =~ /html/) {
|
|
||||||
# Postprocess the HTML directory.
|
|
||||||
my $NumBugs = Postprocess($Options{OutputDir}, $BaseDir,
|
|
||||||
$Options{AnalyzerStats}, $Options{KeepEmpty});
|
|
||||||
|
|
||||||
if ($Options{ViewResults} and -r "$Options{OutputDir}/index.html") {
|
|
||||||
Diag "Viewing analysis results in '$Options{OutputDir}' using scan-view.\n";
|
|
||||||
my $ScanView = Cwd::realpath("$RealBin/scan-view");
|
|
||||||
if (! -x $ScanView) { $ScanView = "scan-view"; }
|
|
||||||
if (! -x $ScanView) { $ScanView = Cwd::realpath("$RealBin/../../scan-view/bin/scan-view"); }
|
|
||||||
exec $ScanView, "$Options{OutputDir}";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($Options{ExitStatusFoundBugs}) {
|
|
||||||
exit 1 if ($NumBugs > 0);
|
|
||||||
exit $ExitStatus;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exit $ExitStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
##----------------------------------------------------------------------------##
|
##----------------------------------------------------------------------------##
|
||||||
# RunBuildCommand - Run the build command.
|
# RunBuildCommand - Run the build command.
|
||||||
##----------------------------------------------------------------------------##
|
##----------------------------------------------------------------------------##
|
||||||
|
@ -1295,12 +1259,6 @@ OPTIONS:
|
||||||
|
|
||||||
View analysis results in a web browser when the build completes.
|
View analysis results in a web browser when the build completes.
|
||||||
|
|
||||||
--generate-index-only <output location>
|
|
||||||
|
|
||||||
Do not perform the analysis, but only regenerate the index.html file
|
|
||||||
from existing report.html files. Useful for making a custom Static Analyzer
|
|
||||||
integration into a build system that isn't otherwise supported by scan-build.
|
|
||||||
|
|
||||||
ADVANCED OPTIONS:
|
ADVANCED OPTIONS:
|
||||||
|
|
||||||
-no-failure-reports
|
-no-failure-reports
|
||||||
|
@ -1592,10 +1550,6 @@ sub ProcessArgs {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($arg eq "-o") {
|
if ($arg eq "-o") {
|
||||||
if (defined($Options{OutputDir})) {
|
|
||||||
DieDiag("Only one of '-o' or '--generate-index-only' can be specified.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
shift @$Args;
|
shift @$Args;
|
||||||
|
|
||||||
if (!@$Args) {
|
if (!@$Args) {
|
||||||
|
@ -1611,27 +1565,6 @@ sub ProcessArgs {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($arg eq "--generate-index-only") {
|
|
||||||
if (defined($Options{OutputDir})) {
|
|
||||||
DieDiag("Only one of '-o' or '--generate-index-only' can be specified.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
shift @$Args;
|
|
||||||
|
|
||||||
if (!@$Args) {
|
|
||||||
DieDiag("'--generate-index-only' option requires a target directory name.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
# Construct an absolute path. Uses the current working directory
|
|
||||||
# as a base if the original path was not absolute.
|
|
||||||
my $OutDir = shift @$Args;
|
|
||||||
mkpath($OutDir) unless (-e $OutDir); # abs_path wants existing dir
|
|
||||||
$Options{OutputDir} = abs_path($OutDir);
|
|
||||||
$Options{GenerateIndex} = 1;
|
|
||||||
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($arg =~ /^--html-title(=(.+))?$/) {
|
if ($arg =~ /^--html-title(=(.+))?$/) {
|
||||||
shift @$Args;
|
shift @$Args;
|
||||||
|
|
||||||
|
@ -1882,6 +1815,11 @@ if (!@ARGV) {
|
||||||
ProcessArgs(\@ARGV);
|
ProcessArgs(\@ARGV);
|
||||||
# All arguments are now shifted from @ARGV. The rest is a build command, if any.
|
# All arguments are now shifted from @ARGV. The rest is a build command, if any.
|
||||||
|
|
||||||
|
if (!@ARGV and !$RequestDisplayHelp) {
|
||||||
|
ErrorDiag("No build command specified.\n\n");
|
||||||
|
$ForceDisplayHelp = 1;
|
||||||
|
}
|
||||||
|
|
||||||
my $ClangNotFoundErrMsg = FindClang();
|
my $ClangNotFoundErrMsg = FindClang();
|
||||||
|
|
||||||
if ($ForceDisplayHelp || $RequestDisplayHelp) {
|
if ($ForceDisplayHelp || $RequestDisplayHelp) {
|
||||||
|
@ -1889,24 +1827,6 @@ if ($ForceDisplayHelp || $RequestDisplayHelp) {
|
||||||
exit $ForceDisplayHelp;
|
exit $ForceDisplayHelp;
|
||||||
}
|
}
|
||||||
|
|
||||||
$CmdArgs = HtmlEscape(join(' ', map(ShellEscape($_), @ARGV)));
|
|
||||||
|
|
||||||
# Make sure to use "" to handle paths with spaces.
|
|
||||||
$ClangVersion = HtmlEscape(`"$Clang" --version`);
|
|
||||||
|
|
||||||
if ($Options{GenerateIndex}) {
|
|
||||||
Finalize($Options{OutputDir}, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!@ARGV and !$RequestDisplayHelp) {
|
|
||||||
ErrorDiag("No build command specified.\n\n");
|
|
||||||
$ForceDisplayHelp = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Determine the output directory for the HTML reports.
|
|
||||||
my $BaseDir = $Options{OutputDir};
|
|
||||||
$Options{OutputDir} = GetHTMLRunDir($Options{OutputDir});
|
|
||||||
|
|
||||||
DieDiag($ClangNotFoundErrMsg) if (defined $ClangNotFoundErrMsg);
|
DieDiag($ClangNotFoundErrMsg) if (defined $ClangNotFoundErrMsg);
|
||||||
|
|
||||||
$ClangCXX = $Clang;
|
$ClangCXX = $Clang;
|
||||||
|
@ -1926,6 +1846,16 @@ if ($Clang !~ /\+\+(\.exe)?$/) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Make sure to use "" to handle paths with spaces.
|
||||||
|
$ClangVersion = HtmlEscape(`"$Clang" --version`);
|
||||||
|
|
||||||
|
# Determine where results go.
|
||||||
|
$CmdArgs = HtmlEscape(join(' ', map(ShellEscape($_), @ARGV)));
|
||||||
|
|
||||||
|
# Determine the output directory for the HTML reports.
|
||||||
|
my $BaseDir = $Options{OutputDir};
|
||||||
|
$Options{OutputDir} = GetHTMLRunDir($Options{OutputDir});
|
||||||
|
|
||||||
# Determine the location of ccc-analyzer.
|
# Determine the location of ccc-analyzer.
|
||||||
my $AbsRealBin = Cwd::realpath($RealBin);
|
my $AbsRealBin = Cwd::realpath($RealBin);
|
||||||
my $Cmd = "$AbsRealBin/../libexec/ccc-analyzer";
|
my $Cmd = "$AbsRealBin/../libexec/ccc-analyzer";
|
||||||
|
@ -2001,4 +1931,33 @@ my %EnvVars = (
|
||||||
my $ExitStatus = RunBuildCommand(\@ARGV, $Options{IgnoreErrors}, $Options{KeepCC},
|
my $ExitStatus = RunBuildCommand(\@ARGV, $Options{IgnoreErrors}, $Options{KeepCC},
|
||||||
$Cmd, $CmdCXX, \%EnvVars);
|
$Cmd, $CmdCXX, \%EnvVars);
|
||||||
|
|
||||||
Finalize($BaseDir, $ExitStatus);
|
if (defined $Options{OutputFormat}) {
|
||||||
|
if ($Options{OutputFormat} =~ /plist/ ||
|
||||||
|
$Options{OutputFormat} =~ /sarif/) {
|
||||||
|
Diag "Analysis run complete.\n";
|
||||||
|
Diag "Analysis results (" .
|
||||||
|
($Options{OutputFormat} =~ /plist/ ? "plist" : "sarif") .
|
||||||
|
" files) deposited in '$Options{OutputDir}'\n";
|
||||||
|
}
|
||||||
|
if ($Options{OutputFormat} =~ /html/) {
|
||||||
|
# Postprocess the HTML directory.
|
||||||
|
my $NumBugs = Postprocess($Options{OutputDir}, $BaseDir,
|
||||||
|
$Options{AnalyzerStats}, $Options{KeepEmpty});
|
||||||
|
|
||||||
|
if ($Options{ViewResults} and -r "$Options{OutputDir}/index.html") {
|
||||||
|
Diag "Analysis run complete.\n";
|
||||||
|
Diag "Viewing analysis results in '$Options{OutputDir}' using scan-view.\n";
|
||||||
|
my $ScanView = Cwd::realpath("$RealBin/scan-view");
|
||||||
|
if (! -x $ScanView) { $ScanView = "scan-view"; }
|
||||||
|
if (! -x $ScanView) { $ScanView = Cwd::realpath("$RealBin/../../scan-view/bin/scan-view"); }
|
||||||
|
exec $ScanView, "$Options{OutputDir}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Options{ExitStatusFoundBugs}) {
|
||||||
|
exit 1 if ($NumBugs > 0);
|
||||||
|
exit $ExitStatus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exit $ExitStatus;
|
||||||
|
|
Loading…
Reference in New Issue