Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: tools/archive_crash.py

Issue 145273024: Add support for copying coredumps to /tmp (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
Added: svn:executable
+ *
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file.
6 #
7
8 # A script that copies a core file and binary to GCS
9 # We expect the dumps to be located in /tmp/coredump_PID directory
10 # After we copy out the core files we delete the dumps localy
11
12 import os
13 import shutil
14 import sys
15 import subprocess
16 import tarfile
17 import uuid
18
19 GCS_FOLDER = 'dart-crashes'
20
21 def CreateTarball(dir, tarname):
22 print 'Creating tar file: %s' % (tarname)
23 tar = tarfile.open(tarname, mode='w:gz')
24 tar.add(dir)
25 tar.close()
26
27 def CopyToGCS(filename):
28 gs_location = 'gs://%s/%s/' % (GCS_FOLDER, uuid.uuid4())
29 cmd = ['gsutil', 'cp', filename, gs_location]
30 print 'Running command: %s' % (cmd)
31 subprocess.check_call(cmd)
32 archived_filename = '%s%s' % (gs_location, filename.split('/').pop())
33 print 'Dump now available in %s' % (archived_filename)
34
35 def Main():
36 print 'Looking for crash dumps'
37 num_dumps = 0
38 for v in os.listdir('/tmp'):
39 if v.startswith('coredump'):
40 fullpath = '/tmp/%s' % (v)
41 if os.path.isdir(fullpath):
42 num_dumps += 1
43 tarname = '%s.tar.gz' % fullpath
44 CreateTarball(fullpath, tarname)
45 CopyToGCS(tarname)
46 os.unlink(tarname)
47 shutil.rmtree(fullpath)
48 print 'Found %s core dumps' % (num_dumps)
49
50 if __name__ == '__main__':
51 sys.exit(Main())
OLDNEW
« no previous file with comments | « no previous file | tools/test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698