Update the nightly builds to submit to coverity
Этот коммит содержится в:
родитель
dfbf2b7be4
Коммит
375f04b277
151
contrib/build-server/hwloc-nightly-coverity.pl
Исполняемый файл
151
contrib/build-server/hwloc-nightly-coverity.pl
Исполняемый файл
@ -0,0 +1,151 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use Getopt::Long;
|
||||
use File::Temp qw/ tempfile tempdir /;
|
||||
use File::Basename;
|
||||
|
||||
my $filename_arg;
|
||||
my $coverity_token_arg;
|
||||
my $dry_run_arg = 0;
|
||||
my $verbose_arg = 0;
|
||||
my $debug_arg = 0;
|
||||
my $logfile_dir_arg;
|
||||
my $configure_args = "";
|
||||
my $make_args = "-j 32";
|
||||
my $help_arg = 0;
|
||||
|
||||
&Getopt::Long::Configure("bundling");
|
||||
my $ok = Getopt::Long::GetOptions("filename=s" => \$filename_arg,
|
||||
"coverity-token=s" => \$coverity_token_arg,
|
||||
"logfile-dir=s" => \$logfile_dir_arg,
|
||||
"configure-args=s" => \$configure_args,
|
||||
"make-args=s" => \$make_args,
|
||||
"dry-run!" => \$dry_run_arg,
|
||||
"verbose!" => \$verbose_arg,
|
||||
"debug!" => \$debug_arg,
|
||||
"help|h" => \$help_arg);
|
||||
|
||||
$ok = 0
|
||||
if (!defined($filename_arg));
|
||||
$ok = 0
|
||||
if (!defined($coverity_token_arg));
|
||||
if (!$ok || $help_arg) {
|
||||
print "Usage: $0 --filename=FILENAME --coverity-token=TOKEN [--dry-run] [--verbose] [--help]\n";
|
||||
exit($ok);
|
||||
}
|
||||
|
||||
die "Cannot read $filename_arg"
|
||||
if (! -r $filename_arg);
|
||||
|
||||
$verbose_arg = 1
|
||||
if ($debug_arg);
|
||||
|
||||
######################################################################
|
||||
|
||||
sub verbose {
|
||||
print @_
|
||||
if ($verbose_arg);
|
||||
}
|
||||
|
||||
# run a command and save the stdout / stderr
|
||||
sub safe_system {
|
||||
my $allowed_to_fail = shift;
|
||||
my $cmd = shift;
|
||||
my $stdout_file = shift;
|
||||
|
||||
# Redirect stdout if requested or not verbose
|
||||
if (defined($stdout_file)) {
|
||||
$stdout_file = "$logfile_dir_arg/$stdout_file";
|
||||
unlink($stdout_file);
|
||||
$cmd .= " >$stdout_file";
|
||||
} elsif (!$debug_arg) {
|
||||
$cmd .= " >/dev/null";
|
||||
}
|
||||
$cmd .= " 2>&1";
|
||||
|
||||
my $rc = system($cmd);
|
||||
if (0 != $rc && !$allowed_to_fail) {
|
||||
# If we die/fail, ensure to change out of the temp tree so
|
||||
# that it can be removed upon exit.
|
||||
chdir("/");
|
||||
print "Command $cmd failed: exit status $rc\n";
|
||||
if (-f $stdout_file) {
|
||||
print "Last command output:\n";
|
||||
system("cat $stdout_file");
|
||||
}
|
||||
die "Cannot continue";
|
||||
}
|
||||
system("cat $stdout_file")
|
||||
if ($debug_arg && defined($stdout_file) && -f $stdout_file);
|
||||
}
|
||||
|
||||
######################################################################
|
||||
|
||||
# Make an area to work
|
||||
|
||||
my $dir = tempdir(CLEANUP => 1);
|
||||
chdir($dir);
|
||||
verbose "*** Working in $dir\n";
|
||||
|
||||
######################################################################
|
||||
|
||||
# Get the coverity tool, put it in our path
|
||||
|
||||
verbose "*** Downloading coverity tool\n";
|
||||
safe_system(0, "wget https://scan.coverity.com/download/linux-64 --post-data \"token=$coverity_token_arg\&project=hwloc\" -O coverity_tool.tgz");
|
||||
safe_system(0, "tar xf coverity_tool.tgz");
|
||||
opendir(my $dh, ".") ||
|
||||
die "Can't opendir .";
|
||||
my @files = grep { /^cov/ && -d "./$_" } readdir($dh);
|
||||
closedir($dh);
|
||||
|
||||
my $cov_dir = "$dir/$files[0]/bin";
|
||||
$ENV{PATH} = "$cov_dir:$ENV{PATH}";
|
||||
|
||||
######################################################################
|
||||
|
||||
# Expand the HWLOC tarball, build it
|
||||
|
||||
verbose "*** Extracting HWLOC tarball\n";
|
||||
safe_system(0, "tar xf $filename_arg");
|
||||
my $tarball_filename = basename($filename_arg);
|
||||
$tarball_filename =~ m/^hwloc-(.+)\.tar.+$/;
|
||||
my $hwloc_ver = $1;
|
||||
chdir("hwloc-$hwloc_ver");
|
||||
|
||||
verbose "*** Configuring HWLOC tarball\n";
|
||||
safe_system(0, "./configure $configure_args", "configure");
|
||||
|
||||
verbose "*** Building HWLOC tarball\n";
|
||||
safe_system(0, "cov-build --dir cov-int make $make_args", "cov-build");
|
||||
|
||||
verbose "*** Checking HWLOC tarball\n";
|
||||
safe_system(0, "cov-build --dir cov-int make check $make_args", "cov-build-check");
|
||||
|
||||
# Tar up the Coverity results
|
||||
verbose "*** Tarring up results\n";
|
||||
safe_system(0, "tar jcf $hwloc_ver-analyzed.tar.bz2 cov-int");
|
||||
|
||||
# If not dry-run, submit to Coverity
|
||||
if ($dry_run_arg) {
|
||||
verbose "*** Would have submitted, but this is a dry run\n";
|
||||
} else {
|
||||
verbose "*** Submitting results\n";
|
||||
safe_system(0, "curl --form token=$coverity_token_arg " .
|
||||
"--form email=jsquyres\@cisco.com " .
|
||||
"--form file=\@$hwloc_ver-analyzed.tar.bz2 " .
|
||||
"--form version=$hwloc_ver " .
|
||||
"--form description=nightly-master " .
|
||||
"https://scan.coverity.com/builds?project=hwloc",
|
||||
"coverity-submit");
|
||||
}
|
||||
|
||||
verbose("*** All done\n");
|
||||
|
||||
# Chdir out of the tempdir so that it can be removed
|
||||
chdir("/");
|
||||
|
||||
exit(0);
|
@ -21,7 +21,7 @@ outputroot=$HOME/hwloc/nightly
|
||||
script_uri=contrib/nightly/make_snapshot_tarball
|
||||
|
||||
# helper scripts dir
|
||||
script_dir=$HOME/scripts
|
||||
script_dir=$HOME/ompi/contrib/build-server
|
||||
|
||||
# The tarballs to make
|
||||
if [ $# -eq 0 ] ; then
|
||||
@ -130,12 +130,12 @@ done
|
||||
|
||||
# If we had any new snapshots to send to coverity, process them now
|
||||
|
||||
#for tarball in `cat $pending_coverity`; do
|
||||
# /home/common/mpiteam/scripts/hwloc-nightly-coverity.pl \
|
||||
# --filename=$tarball \
|
||||
# --coverity-token=$coverity_token \
|
||||
# --verbose \
|
||||
# --logfile-dir=$HOME/coverity \
|
||||
# --make-args="-j8"
|
||||
#done
|
||||
for tarball in `cat $pending_coverity`; do
|
||||
${script_dir}/hwloc-nightly-coverity.pl \
|
||||
--filename=$tarball \
|
||||
--coverity-token=$coverity_token \
|
||||
--verbose \
|
||||
--logfile-dir=$HOME/coverity \
|
||||
--make-args="-j8"
|
||||
done
|
||||
rm -f $pending_coverity
|
||||
|
@ -24,7 +24,7 @@ outputroot=$HOME/openmpi/nightly
|
||||
script_uri=contrib/nightly/create_tarball.sh
|
||||
|
||||
# helper scripts dir
|
||||
script_dir=$HOME/scripts
|
||||
script_dir=$HOME/ompi/contrib/build-server
|
||||
|
||||
# The tarballs to make
|
||||
if [ $# -eq 0 ] ; then
|
||||
@ -144,7 +144,7 @@ done
|
||||
|
||||
for tarball in `cat $pending_coverity`; do
|
||||
echo "=== Submitting $tarball to Coverity..."
|
||||
$HOME/scripts/openmpi-nightly-coverity.pl \
|
||||
${script_dir}/openmpi-nightly-coverity.pl \
|
||||
--filename=$tarball \
|
||||
--coverity-token=$coverity_token \
|
||||
--verbose \
|
||||
|
@ -23,7 +23,7 @@ outputroot=$HOME/pmix/nightly
|
||||
script_uri=contrib/nightly/create_tarball.sh
|
||||
|
||||
# helper scripts dir
|
||||
script_dir=$HOME/scripts
|
||||
script_dir=$HOME/ompi/contrib/build-server
|
||||
|
||||
# The tarballs to make
|
||||
if [ $# -eq 0 ] ; then
|
||||
@ -139,14 +139,14 @@ done
|
||||
|
||||
# If we had any new snapshots to send to coverity, process them now
|
||||
|
||||
#for tarball in `cat $pending_coverity`; do
|
||||
# echo "=== Submitting $tarball to Coverity..."
|
||||
# /home/common/mpiteam/scripts/pmix-nightly-coverity.pl \
|
||||
# --filename=$tarball \
|
||||
# --coverity-token=$coverity_token \
|
||||
# --verbose \
|
||||
# --logfile-dir=$HOME/coverity \
|
||||
# --make-args=-j8 \
|
||||
# --configure-args="$coverity_configure_args"
|
||||
#done
|
||||
for tarball in `cat $pending_coverity`; do
|
||||
echo "=== Submitting $tarball to Coverity..."
|
||||
${script_dir}/pmix-nightly-coverity.pl \
|
||||
--filename=$tarball \
|
||||
--coverity-token=$coverity_token \
|
||||
--verbose \
|
||||
--logfile-dir=$HOME/coverity \
|
||||
--make-args=-j8 \
|
||||
--configure-args="$coverity_configure_args"
|
||||
done
|
||||
rm -f $pending_coverity
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user