Bug 1782323 - Move hazards gather step invocation from analyze.py to mach r=firefox-build-system-reviewers,andi

Differential Revision: https://phabricator.services.mozilla.com/D153294
This commit is contained in:
Steve Fink 2023-01-10 22:33:51 +00:00
Родитель 2eaa97c4df
Коммит 33184dadc8
3 изменённых файлов: 11 добавлений и 63 удалений

Просмотреть файл

@ -37,12 +37,9 @@ class MultiInput(str):
def env(config):
e = dict(os.environ)
e["PATH"] = ":".join(
p for p in (config.get("gcc_bin"), config.get("sixgill_bin"), e["PATH"]) if p
)
e["PATH"] = ":".join(p for p in (config.get("sixgill_bin"), e["PATH"]) if p)
e["XDB"] = "%(sixgill_bin)s/xdb.so" % config
e["SOURCE"] = config["source"]
e["ANALYZED_OBJDIR"] = config["objdir"]
return e
@ -98,21 +95,6 @@ def print_command(command, outfile=None, env=None):
JOBS = {
"dbs": {
"command": [
"{analysis_scriptdir}/run_complete",
"--foreground",
"--no-logs",
"--build-root={objdir}",
"--wrap-dir={sixgill}/scripts/wrap_gcc",
"--work-dir=work",
"-b",
"{sixgill_bin}",
"--buildcommand={buildcommand}",
".",
],
"outputs": [],
},
"list-dbs": {"command": ["ls", "-l"]},
"rawcalls": {
"command": [
@ -206,7 +188,7 @@ JOBS = {
}
# Generator of (i, j, item) tuples:
# Generator of (i, j, item) tuples corresponding to outputs:
# - i is just the index of the yielded tuple (a la enumerate())
# - j is the index of the item in the command list
# - item is command[j]
@ -330,13 +312,6 @@ parser.add_argument(
parser.add_argument(
"--source", metavar="SOURCE", type=str, nargs="?", help="source code to analyze"
)
parser.add_argument(
"--objdir",
metavar="DIR",
type=str,
nargs="?",
help="object directory of compiled files",
)
parser.add_argument(
"--js",
metavar="JSSHELL",
@ -365,21 +340,6 @@ parser.add_argument(
parser.add_argument(
"--list", const=True, nargs="?", type=bool, help="display available steps"
)
parser.add_argument(
"--buildcommand",
"--build",
"-b",
type=str,
nargs="?",
help="command to build the tree being analyzed",
)
parser.add_argument(
"--tag",
"-t",
type=str,
nargs="?",
help='name of job, also sets build command to "build.<tag>"',
)
parser.add_argument(
"--expect-file",
type=str,
@ -412,31 +372,17 @@ for k, v in vars(args).items():
if v is not None:
data[k] = v
if args.tag and not args.buildcommand:
args.buildcommand = "build.%s" % args.tag
if args.jobs is not None:
data["jobs"] = args.jobs
if not data.get("jobs"):
data["jobs"] = max_parallel_jobs()
if args.buildcommand:
data["buildcommand"] = args.buildcommand
elif "BUILD" in os.environ:
data["buildcommand"] = os.environ["BUILD"]
else:
data["buildcommand"] = "make -j{} -s".format(data["jobs"])
if "ANALYZED_OBJDIR" in os.environ:
data["objdir"] = os.environ["ANALYZED_OBJDIR"]
if "GECKO_PATH" in os.environ:
data["source"] = os.environ["GECKO_PATH"]
if "SOURCE" in os.environ:
data["source"] = os.environ["SOURCE"]
steps = [
"dbs",
"gcTypes",
"rawcalls",
"gcFunctions",

Просмотреть файл

@ -8,7 +8,6 @@
import argparse
import json
import os
import sys
import textwrap
# Command files like this are listed in build/mach_initialize.py in alphabetical
@ -236,7 +235,6 @@ def gather_hazard_data(command_context, **kwargs):
source = "{srcdir}"
sixgill = "{sixgill_dir}/usr/libexec/sixgill"
sixgill_bin = "{sixgill_dir}/usr/bin"
gcc_bin = "{gcc_dir}/bin"
"""
).format(
script_dir=script_dir(command_context),
@ -256,11 +254,16 @@ def gather_hazard_data(command_context, **kwargs):
]
)
args = [
sys.executable,
os.path.join(script_dir(command_context), "analyze.py"),
"dbs",
"-v",
os.path.join(script_dir(command_context), "run_complete"),
"--foreground",
"--no-logs",
"--build-root=" + objdir,
"--wrap-dir=" + sixgill_dir() + "/usr/libexec/sixgill/scripts/wrap_gcc",
"--work-dir=work",
"-b",
sixgill_dir() + "/usr/bin",
"--buildcommand=" + buildscript,
".",
]
return command_context.run_process(args=args, cwd=work_dir, pass_thru=True)

Просмотреть файл

@ -103,7 +103,6 @@ sixgill_bin = '{bindir}'
if upto:
cmd += ["--last", upto]
cmd.append("--source=%s" % self.indir)
cmd.append("--objdir=%s" % self.outdir)
cmd.append("--js=%s" % self.cfg.js)
if self.cfg.verbose:
cmd.append("--verbose")