From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../python/gyp/test/win/linker-flags/update_pgd.py | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 third_party/python/gyp/test/win/linker-flags/update_pgd.py (limited to 'third_party/python/gyp/test/win/linker-flags/update_pgd.py') diff --git a/third_party/python/gyp/test/win/linker-flags/update_pgd.py b/third_party/python/gyp/test/win/linker-flags/update_pgd.py new file mode 100644 index 0000000000..176e9e5472 --- /dev/null +++ b/third_party/python/gyp/test/win/linker-flags/update_pgd.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +# Copyright (c) 2013 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +from optparse import OptionParser +import glob +import os +import subprocess + +parser = OptionParser() +parser.add_option('--exe', dest='exe') +parser.add_option('--vcbindir', dest='vcbindir') +parser.add_option('--pgd', dest='pgd') +(options, args) = parser.parse_args() + +# Instrumented binaries fail to run unless the Visual C++'s bin dir is included +# in the PATH environment variable. +os.environ['PATH'] = os.environ['PATH'] + os.pathsep + options.vcbindir + +# Run Instrumented binary. The profile will be recorded into *.pgc file. +subprocess.call([options.exe]) + +# Merge *.pgc files into a *.pgd (Profile-Guided Database) file. +subprocess.call(['pgomgr', '/merge', options.pgd]) + +# *.pgc files are no longer necessary. Clear all of them. +pgd_file = os.path.abspath(options.pgd) +pgd_dir = os.path.dirname(pgd_file) +(pgd_basename, _) = os.path.splitext(os.path.basename(pgd_file)) +pgc_filepattern = os.path.join(pgd_dir, '%s!*.pgc' % pgd_basename) +pgc_files= glob.glob(pgc_filepattern) +for pgc_file in pgc_files: + os.unlink(pgc_file) -- cgit v1.2.3