summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2017-06-02 12:34:58 -0400
committerJonathan Abrahams <jonathan@mongodb.com>2017-07-11 13:31:42 -0400
commit359ad31c327e14843dd80da6be56003e0c26b02f (patch)
tree21b5185949f2a82944ca6b507535832af1ea0c94
parent0c2d7974a785d6dfabb8857ec974a85e8864277c (diff)
downloadmongo-359ad31c327e14843dd80da6be56003e0c26b02f.tar.gz
SERVER-28596 Upload hanging or failing tests in compile_all to S3
(cherry picked from commit d4eeb742d85e31b95376715dec3454870ae83064)
-rwxr-xr-xbuildscripts/hang_analyzer.py12
-rw-r--r--etc/evergreen.yml54
2 files changed, 60 insertions, 6 deletions
diff --git a/buildscripts/hang_analyzer.py b/buildscripts/hang_analyzer.py
index 87d9e90cff2..73e1cbe6d41 100755
--- a/buildscripts/hang_analyzer.py
+++ b/buildscripts/hang_analyzer.py
@@ -169,8 +169,8 @@ class WindowsDumper(object):
dump_command = ""
if take_dump:
- # Dump to file, dump_<process name>_<pid>.mdmp
- dump_file = "dump_%s_%d.%s" % (os.path.splitext(process_name)[0],
+ # Dump to file, dump_<process name>.<pid>.mdmp
+ dump_file = "dump_%s.%d.%s" % (os.path.splitext(process_name)[0],
pid,
self.get_dump_ext())
dump_command = ".dump /ma %s" % dump_file
@@ -258,8 +258,8 @@ class LLDBDumper(object):
dump_command = ""
if take_dump:
- # Dump to file, dump_<process name>_<pid>.core
- dump_file = "dump_%s_%d.%s" % (process_name, pid, self.get_dump_ext())
+ # Dump to file, dump_<process name>.<pid>.core
+ dump_file = "dump_%s.%d.%s" % (process_name, pid, self.get_dump_ext())
dump_command = "process save-core %s" % dump_file
root_logger.info("Dumping core to %s" % dump_file)
@@ -333,8 +333,8 @@ class GDBDumper(object):
dump_command = ""
if take_dump:
- # Dump to file, dump_<process name>_<pid>.core
- dump_file = "dump_%s_%d.%s" % (process_name, pid, self.get_dump_ext())
+ # Dump to file, dump_<process name>.<pid>.core
+ dump_file = "dump_%s.%d.%s" % (process_name, pid, self.get_dump_ext())
dump_command = "gcore %s" % dump_file
root_logger.info("Dumping core to %s" % dump_file)
diff --git a/etc/evergreen.yml b/etc/evergreen.yml
index a90cf1209fd..3d450777b9e 100644
--- a/etc/evergreen.yml
+++ b/etc/evergreen.yml
@@ -1091,6 +1091,60 @@ post:
display_name: Core Dumps - Execution ${execution}
optional: true
+ # Gather and archive failed unit test binaries.
+ - command: shell.exec
+ params:
+ working_dir: "src"
+ script: |
+ mkdir unittest_binaries
+ # Find all core files
+ core_files=$(/usr/bin/find -H . -name "dump_*.core" -o -name "*.mdmp" 2> /dev/null)
+ for core_file in $core_files
+ do
+ # A core file name does not always have the executable name that generated it.
+ # See http://stackoverflow.com/questions/34801353/core-dump-filename-gets-thread-name-instead-of-executable-name-with-core-pattern
+ # On platforms with GDB, we get the binary name from core file
+ gdb=/opt/mongodbtoolchain/gdb/bin/gdb
+ if [ -f $gdb ]; then
+ binary_file=$($gdb -batch --quiet -ex "core $core_file" 2> /dev/null | grep "Core was generated" | cut -f2 -d "\`" | cut -f1 -d "'")
+ binary_file_locations=$binary_file
+ else
+ # Find the base file name from the core file name, note it may be truncated.
+ # Remove leading 'dump_' and trailing '.<pid>.core' or '.<pid or time>.mdmp'
+ binary_file=$(echo $core_file | sed "s/.*\///;s/dump_//;s/\..*\.core//;s/\..*\.mdmp//")
+ # Locate the binary file. Since the base file name might be truncated, the find
+ # may return more than 1 file.
+ binary_file_locations=$(/usr/bin/find -H . -name "$binary_file*${exe}" 2> /dev/null)
+ fi
+ if [ -z "$binary_file_locations" ]; then
+ echo "Cannot locate the unittest binary file ($binary_file) that generated the core file $core_file"
+ fi
+ for binary_file_location in $binary_file_locations
+ do
+ new_binary_file=unittest_binaries/$(echo $binary_file_location | sed "s/.*\///")
+ if [ ! -f $new_binary_file ]; then
+ mv $binary_file_location $new_binary_file
+ fi
+ done
+ done
+ - command: archive.targz_pack
+ params:
+ target: "mongo-unittests.tgz"
+ source_dir: "src/unittest_binaries"
+ include:
+ - "./*_test${exe}"
+ - command: s3.put
+ params:
+ aws_key: ${aws_key}
+ aws_secret: ${aws_secret}
+ local_file: mongo-unittests.tgz
+ remote_file: mongodb-mongo-master/${build_variant}/${revision}/unittests/mongo-unittests-${build_id}-${task_name}-${execution}.tgz
+ bucket: mciuploads
+ permissions: public-read
+ content_type: ${content_type|application/x-gzip}
+ display_name: Unit tests - Execution ${execution}
+ optional: true
+
# Gather and archive hang_analyzer debugger files.
- command: archive.targz_pack
params: