mirror of https://github.com/openssl/openssl.git
Merge 4d84d445ad
into 296f1f6dd8
This commit is contained in:
commit
acd641c01c
|
@ -13,6 +13,9 @@ use warnings;
|
||||||
use Carp;
|
use Carp;
|
||||||
use Test::More 0.96;
|
use Test::More 0.96;
|
||||||
|
|
||||||
|
use File::Basename;
|
||||||
|
use File::Spec::Functions 'catfile';
|
||||||
|
|
||||||
use Exporter;
|
use Exporter;
|
||||||
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
|
||||||
$VERSION = "1.0";
|
$VERSION = "1.0";
|
||||||
|
@ -1292,6 +1295,44 @@ sub __decorate_cmd {
|
||||||
unless $stderr || !$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE};
|
unless $stderr || !$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($ENV{DO_MPROFILE}) {
|
||||||
|
my $file_name;
|
||||||
|
my $glob_pattern = catfile(result_dir(), "$test_name"."*.result");
|
||||||
|
my $index = 0;
|
||||||
|
|
||||||
|
#
|
||||||
|
# some tests execute more than one command, we need to capture
|
||||||
|
# data for each command invocation.
|
||||||
|
#
|
||||||
|
# loop here finds the next index to continue.
|
||||||
|
#
|
||||||
|
foreach $file_name ( glob($glob_pattern) ) {
|
||||||
|
$file_name = basename($file_name);
|
||||||
|
if ($file_name =~ m/.*_(\d+).result/) {
|
||||||
|
if ($index < $1) {
|
||||||
|
$index = $1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$index = $index + 1;
|
||||||
|
$file_name = "$test_name"."_"."$index".".result";
|
||||||
|
open(RESULT, ">$file_name");
|
||||||
|
close(RESULT);
|
||||||
|
# the result is collected in shlib_wrap.sh
|
||||||
|
$ENV{MPROFILE_RESULT}=$file_name;
|
||||||
|
|
||||||
|
#
|
||||||
|
# tcmalloc collects at least one profile record
|
||||||
|
# saved to test_name-xx.yyyy.heap
|
||||||
|
# By default tcmalloc creates such profile for every
|
||||||
|
# GB of memory program allocates. More details
|
||||||
|
# on how to control the collection of data can
|
||||||
|
# be found here:
|
||||||
|
# https://gperftools.github.io/gperftools/heapprofile.html
|
||||||
|
#
|
||||||
|
$file_name = "$test_name"."_"."$index";
|
||||||
|
$ENV{HEAPPROFILE}=$file_name;
|
||||||
|
}
|
||||||
$cmdstr .= "$stdin$stdout$stderr";
|
$cmdstr .= "$stdin$stdout$stderr";
|
||||||
|
|
||||||
if ($debug) {
|
if ($debug) {
|
||||||
|
|
|
@ -105,6 +105,9 @@ NONSTOP_KERNEL)
|
||||||
if [ "$OSTYPE" != msdosdjgpp ]; then
|
if [ "$OSTYPE" != msdosdjgpp ]; then
|
||||||
PATH="${THERE}:$PATH"; export PATH
|
PATH="${THERE}:$PATH"; export PATH
|
||||||
fi
|
fi
|
||||||
|
if [ "${DO_MPROFILE}" -eq 1 ] ; then
|
||||||
|
export LD_PRELOAD="${LIBMPROFILE}"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -129,7 +132,13 @@ fi
|
||||||
cmd="$1"; [ -x "$cmd" ] || cmd="$cmd${EXE_EXT}"
|
cmd="$1"; [ -x "$cmd" ] || cmd="$cmd${EXE_EXT}"
|
||||||
shift
|
shift
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
|
if [ "${DO_MPROFILE}" -eq 1 ] ; then
|
||||||
|
echo "$cmd" > ${MPROFILE_RESULT}
|
||||||
|
fi
|
||||||
exec "$cmd" # old sh, such as Tru64 4.x, fails to expand empty "$@"
|
exec "$cmd" # old sh, such as Tru64 4.x, fails to expand empty "$@"
|
||||||
else
|
else
|
||||||
|
if [ "${DO_MPROFILE}" -eq 1 ] ; then
|
||||||
|
echo "$cmd" "$@" > ${MPROFILE_RESULT}
|
||||||
|
fi
|
||||||
exec "$cmd" "$@"
|
exec "$cmd" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -159,4 +159,16 @@ if ($^O eq 'VMS' && $exitcode != 0) {
|
||||||
+ 2 # Severity: E(rror)
|
+ 2 # Severity: E(rror)
|
||||||
+ 0x10000000; # bit 28 set => the shell stays silent
|
+ 0x10000000; # bit 28 set => the shell stays silent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $ENV{DO_MPROFILE} ) {
|
||||||
|
my $prof = "$ENV{HEAPPROFILE}".".0001.heap";
|
||||||
|
my $result = "$ENV{MPROFILE_RESULT}";
|
||||||
|
my $pprof_cmd = "pprof-symbolize --text --show_bytes --alloc_space";
|
||||||
|
|
||||||
|
$pprof_cmd = "$pprof_cmd "."$cmd[1]"." $prof"." |grep '^Total' >>";
|
||||||
|
$pprof_cmd = "$pprof_cmd"." $result";
|
||||||
|
system $pprof_cmd;
|
||||||
|
unlink( ( $prof ) );
|
||||||
|
}
|
||||||
|
|
||||||
exit($exitcode);
|
exit($exitcode);
|
||||||
|
|
Loading…
Reference in New Issue