This repository was archived by the owner on Apr 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 254
Add malioc runner script #744
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Copyright 2013 The Flutter Authors. All rights reserved. | ||
| # Use of this source code is governed by a BSD-style license that can be | ||
| # found in the LICENSE file. | ||
|
|
||
| """Helper script for GN to run malioc. | ||
|
|
||
| This is the same as `gn_run_binary.py`, except an extra parameter is included | ||
| for the malioc output file. When the malioc run fails, errors are placed in the | ||
| json output file. This script attempts to read the output file and dump it to | ||
| stdout upon failure. | ||
|
|
||
| Run with: | ||
| python gn_run_malioc.py <binary_name> <output_path> [args ...] | ||
| """ | ||
|
|
||
| import json | ||
| import os | ||
| import sys | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: alphabetize imports |
||
| import subprocess | ||
|
|
||
| # This script is designed to run binaries produced by the current build. We | ||
| # always prefix it with "./" to avoid picking up system versions that might | ||
| # also be on the path. | ||
| path = './' + sys.argv[1] | ||
|
|
||
| malioc_output = sys.argv[2] | ||
|
|
||
| # The rest of the arguements are passed directly to the executable. | ||
| args = [path, '--output', malioc_output] + sys.argv[3:] | ||
|
|
||
| try: | ||
| subprocess.check_output(args, stderr=subprocess.STDOUT) | ||
| except subprocess.CalledProcessError as ex: | ||
| print(ex.output.decode('utf-8', errors='replace')) | ||
| if os.path.exists(malioc_output): | ||
| with open(malioc_output, 'r') as malioc_file: | ||
| malioc_json = malioc_file.read() | ||
|
|
||
| print('malioc output:') | ||
| # Attempt to pretty print the json output, but fall back to printing the | ||
| # raw output if doing so fails. | ||
| try: | ||
| parsed = json.load(malioc_json) | ||
| print(json.dumps(parsed, indent=2)) | ||
| except: | ||
| print(malioc_json) | ||
|
|
||
| else: | ||
| print( | ||
| 'Unable to find the malioc output file in order to print contained' | ||
| 'errors:', | ||
| malioc_output, | ||
| ) | ||
| sys.exit(ex.returncode) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit uncertain about the need for this wrapper script since the script that it wraps is already a wrapper around the underlying malioc binary. Is there some way to merge this functionality into the existing wrapper script in the engine repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh shoot, I should have read malioc.gni more closely. I mistakenly thought it was running malioc directly.