25 return 1
26 print("Found {} intrinsics in auto code".format(len(intrinsics_map)))
27▶ errors = []
28 lines = manual_content.splitlines()
29 pos = 0
· · ·
42 "marker... Aborting...")
43 return 1
44▶ for error in errors:
45 print("ERROR => {}".format(error))
46 return 1 if len(errors) != 0 else 0
· · ·
45▶ print("ERROR => {}".format(error))
46 return 1 if len(errors) != 0 else 0
47 parts = line.split('"')
· · ·
46▶ return 1 if len(errors) != 0 else 0
47 parts = line.split('"')
48 if len(parts) != 5:
· · ·
55 parts[1], pos, intrinsics_map[parts[1]], parts[3]))
56 else:
57▶ errors.append("Duplicated intrinsics: `{}` at line {}. Please remove it "
58 " from manual code".format(parts[1], pos))
59 # Weird but whatever...
+ 1 more matches in this file
89
90 # Allow running a large number of extensive tests. If not set, this script
91▶ # will error out if a threshold is exceeded in order to avoid accidentally
92 # spending huge amounts of CI time.
93 allow_many_extensive: bool = False
· · ·
300
301 skip_tests = False
302▶ error_on_many_tests = False
303 extra_tests = {}
304
· · ·
306 if pr is not None:
307 skip_tests = pr.cfg.skip_extensive
308▶ error_on_many_tests = not pr.cfg.allow_many_extensive
309 for fn_name in pr.cfg.extra_extensive:
310 extra_tests.setdefault(base_name(fn_name)[1], []).append(fn_name)
· · ·
340 eprint(f"total extensive tests: {total_to_test}")
341
342▶ if error_on_many_tests and total_to_test > PrCfg.MANY_EXTENSIVE_THRESHOLD:
343 eprint(
344 f"More than {PrCfg.MANY_EXTENSIVE_THRESHOLD} tests would be run; add"
· · ·
384 """Find the most recent baseline from CI, download it if specified.
385
386▶ This returns rather than erroring, even if the `gh` commands fail. This is to avoid
387 erroring in CI if the baseline is unavailable (artifact time limit exceeded, first
388 run on the branch, etc).
+ 4 more matches in this file
225def diff_and_exit(actual: str, expected: str, name: str):
226 """If the two strings are different, print a diff between them and then exit
227▶ with an error.
228 """
229 if actual == expected:
· · ·
282def main():
283 """By default overwrite the file. If `--check` is passed, print a diff instead and
284▶ error if the files are different.
285 """
286 match sys.argv:
18try:
19 import lzma
20▶except ImportError:
21 lzma = None
22
· · ·
41 try:
42 return cpu_count()
43▶ except NotImplementedError:
44 return 1
45
· · ·
56 try:
57 if url not in checksums:
58▶ raise RuntimeError(
59 (
60 "src/stage0 doesn't contain a checksum for {}. "
· · ·
80 download(temp_path, "{}/{}".format(base, url), True, verbose)
81 if not verify(temp_path, sha256, verbose):
82▶ raise RuntimeError("failed verification")
83 if verbose > 0:
84 eprint("moving {} to {}".format(temp_path, path))
· · ·
103 _download(path, url, probably_big, verbose, True)
104 return
105▶ except RuntimeError:
106 eprint("\nspurious failure, trying again")
107 _download(path, url, probably_big, verbose, False)
+ 38 more matches in this file
37 # Verify this is actually valid TOML.
38 tomllib.loads(build.config_toml)
39▶ except ImportError:
40 print(
41 "WARNING: skipping TOML validation, need at least python 3.11",
· · ·
114 @patch("configure.err")
115 def test_unknown_args(self, err):
116▶ # It should be print an error message if the argument doesn't start with '--'
117 configure.parse_args(["enable-full-tools"])
118 err.assert_called_with("Option 'enable-full-tools' is not recognized")
· · ·
119 err.reset_mock()
120▶ # It should be print an error message if the argument is not recognized
121 configure.parse_args(["--some-random-flag"])
122 err.assert_called_with("Option '--some-random-flag' is not recognized")
· · ·
124 @patch("configure.err")
125 def test_need_value_args(self, err):
126▶ """It should print an error message if a required argument value is missing"""
127 configure.parse_args(["--target"])
128 err.assert_called_with("Option '--target' needs a value (--target=val)")
· · ·
270
271 # This test ends up invoking build_bootstrap_cmd, which searches for
272▶ # the Cargo binary and errors out if it cannot be found. This is not a
273 # problem in most cases, but there is a scenario where it would cause
274 # the test to fail.
358
359def err(msg):
360▶ print("\nconfigure: ERROR: " + msg + "\n")
361 sys.exit(1)
362
· · ·
581 set("dist.compression-formats", value.split(","), config)
582 else:
583▶ raise RuntimeError("unhandled option {}".format(option.name))
584
585
· · ·
626 cur_section = "target"
627 elif "." in cur_section:
628▶ raise RuntimeError(
629 "don't know how to deal with section: {}".format(cur_section)
630 )
· · ·
665 float(value)
666 return True
667▶ except ValueError:
668 return False
669
· · ·
699 )
700 else:
701▶ raise RuntimeError("no toml")
702
703
+ 5 more matches in this file
87elif sys.platform == "win32":
88 from ctypes.wintypes import DWORD
89▶ from ctypes import Structure, windll, WinError, GetLastError, byref
90
91 class FILETIME(Structure):
· · ·
105 )
106
107▶ assert success, WinError(GetLastError())[1]
108
109 self.idle = (idle.dwHighDateTime << 32) | idle.dwLowDateTime
54 sha1 = hashlib.sha1(f.read()).hexdigest()
55 if sha1 != self.sha1:
56▶ raise RuntimeError(
57 "hash mismatch for package "
58 + self.path
· · ·
121 def add(self, packages, name, *, update=True):
122 if name not in packages:
123▶ raise NameError("package not found: " + name)
124 if not update and name in self.packages:
125 return
· · ·
188 subdirs = [d for d in os.listdir(extract_dir) if not d.startswith(".")]
189 if len(subdirs) != 1:
190▶ raise RuntimeError("extracted directory contains more than one dir")
191 # Move the extracted files in the proper directory
192 dest = os.path.join(args.dest, package.path.replace(";", "/"))
· · ·
217 args = parser.parse_args()
218 if not hasattr(args, "func"):
219▶ print("error: a subcommand is required (see --help)")
220 exit(1)
221 args.func(args)
49 retcode = process.poll()
50 if check and retcode:
51▶ raise subprocess.CalledProcessError(retcode, process.args)
52 return subprocess.CompletedProcess(process.args, retcode)
53
· · ·
89 retcode = process.poll()
90 if check and retcode:
91▶ raise subprocess.CalledProcessError(retcode, process.args)
92
93 return buf.getvalue()
· · ·
195 if process.returncode:
196 e = f"llvm-readelf failed for binary {binary} with output {process.stdout}"
197▶ self.env_logger.error(e)
198 raise Exception(e)
199
· · ·
254 ],
255 stdout_handler=log_handler.info,
256▶ stderr_handler=log_handler.error,
257 )
258 return stripped_binary
· · ·
495 )
496 else:
497▶ shutil.rmtree(self.local_pb_path, ignore_errors=True)
498
499 # Look up the product bundle transfer manifest.
+ 8 more matches in this file
24//! These tables enable fast scaling of the significant digits
25//! of a float to the decimal exponent, with minimal rounding
26▶//! errors, in a 128 or 192-bit representation.
27//!
28//! DO NOT MODIFY: Generated by `src/etc/dec2flt_table.py`
· · ·
30
31STATIC_WARNING = """
32▶// Use static to avoid long compile times: Rust compiler errors
33// can have the entire table compiled multiple times, and then
34// emit code multiple times, even if it's stripped out in
17 cmd = f'set substitute-path "{entry["from"]}" "{entry["to"]}"'
18 gdb.execute(cmd)
19▶ except json.JSONDecodeError:
20 print(
21 f"(rust-gdb) warning: invalid JSON on line {idx} of {trim_paths_path}",
· · ·
46 header = json.loads(lines[0])
47 ver = header["v"]
48▶ except json.JSONDecodeError:
49 print(
50 f"(rust-gdb) warning: header line 1 of {trim_paths_path} is not valid JSON",
20try:
21 from html.parser import HTMLParser
22▶except ImportError:
23 from HTMLParser import HTMLParser
24try:
· · ·
25 from xml.etree import cElementTree as ET
26▶except ImportError:
27 from xml.etree import ElementTree as ET
28
· · ·
29try:
30 from html.entities import name2codepoint
31▶except ImportError:
32 from htmlentitydefs import name2codepoint
33
· · ·
55try:
56 unichr # noqa: B018 FIXME: py2
57▶except NameError:
58 unichr = chr
59
· · ·
183 try:
184 args = shlex.split(args)
185▶ except UnicodeEncodeError:
186 args = [
187 arg.decode("utf-8") for arg in shlex.split(args.encode("utf-8"))
+ 8 more matches in this file
1"""Contains the logic that compares variables to `INPUT_DATA` via the entrypoint
2▶`check(var_name, breakpoint_idx, frame)`. These comparisons report errors to stdout, and then return
3a `Result` indicating whether or not the variable matched.
4
· · ·
5▶Checks *do not* stop after the first encountered error. Some redundant information may be ommitted
6(e.g. checking pretty printed type name if the synthetic isn't properly attached to the type).
7"""
· · ·
21 Result,
22 Variable,
23▶ print_error,
24 print_mismatch,
25)
· · ·
52 valobj: lldb.SBValue = frame.var(var_name)
53 if not valobj.IsValid():
54▶ print_error(var_name, "Unable to find variable")
55 return Result.Mismatch
56
· · ·
59 try:
60 expected = INPUT_DATA.breakpoints[breakpoint_idx][var_name]
61▶ except IndexError:
62 print_error("INPUT_DATA", f"No data found for breakpoint #{breakpoint_idx}")
63 return Result.Mismatch
+ 39 more matches in this file
33
34
35▶def print_error(error_source: str, message: str):
36 print(f"{ANSI_RED} [repr error: {error_source}]{ANSI_END} {message}")
37
· · ·
36▶ print(f"{ANSI_RED} [repr error: {error_source}]{ANSI_END} {message}")
37
38
· · ·
47
48def print_mismatch(
49▶ error_source: str, label: str, got: Optional[Any], expected: Optional[Any]
50):
51 print_error(error_source, format_mismatch(label, got, expected))
· · ·
51▶ print_error(error_source, format_mismatch(label, got, expected))
52
53
· · ·
156 # `len(mapping)` == the number of keyword args.
157 return ty(**field_map)
158▶ except KeyError as e:
159 print(
160 f"Unable to convert dict to {ty}: Invalid field name {e}. If the test schema was \
+ 23 more matches in this file
37
38# We use the following lists to dynamically create the enums at run-time (they're used to print
39▶# more meaningful error messages when basic_type and type_class don't match).
40# It takes a few hundred microseconds at runtime to generate these lists, but it means we never have
41# to upkeep version-specific flags. Since the underlying integers are what are stored and tested
· · ·
57class TypeClass(IntFlag):
58 """Direct mapping of `lldb.eTypeClass` bitflags for convenience. Used to print a more meaningful
59▶ error message when Type.type_class does not match.
60 """
61
· · ·
69class BasicType(Enum):
70 """Direct mapping of `lldb.eBasicType` enumerations for convenience. Used to print a more
71▶ meaningful error message when Type.basic_type does not match.
72 """
73
· · ·
143 is_big_endian = data.GetByteOrder() == lldb.eByteOrderBig
144
145▶ buf = data.ReadRawData(lldb.SBError(), 0, data.GetByteSize())
146
147 if is_big_endian or kind == lldb.eBasicTypeChar32:
· · ·
357 valobj = frame.FindVariable(var_name)
358 if not valobj.IsValid():
359▶ # FIXME (todo) error handling
360 raise FromLLDB(f"<bless error: Cannot find variable {var_name}>")
361
+ 1 more matches in this file
105 else:
106 print(
107▶ "Error while trying to register breakpoint callback, id = "
108 + str(breakpoint_id)
109 + ", message = "
· · ·
110▶ + str(res.GetError())
111 )
112 else:
· · ·
113 print(res.GetOutput())
114▶ print(res.GetError())
115
116
· · ·
280 execute_command(command_interpreter, command)
281
282▶ except IOError as e:
283 print(f"Could not read debugging script '{script_path}'.")
284 traceback.print_exception(type(e), e, e.__traceback__, file=sys.stdout)
· · ·
298 from .common import BLESS, INPUT_DATA, BlessMetadata
299
300▶ # `bless` should resolve any errors from mismatched test data, so any errors that reach
301 # this point are either from the `bless` not working properly, or some other issue with
302 # the test itself. In either case, we probably don't want to update the test data until
7from lldb import (
8 SBData,
9▶ SBError,
10 eBasicTypeChar32,
11 eBasicTypeDouble,
· · ·
361 chars = [vec.GetChildAtIndex(i).GetValueAsUnsigned() for i in range(length)]
362 return (
363▶ bytes(chars).decode(errors="replace")
364 if PY3
365 else "".join(chr(char) for char in chars)
· · ·
368
369def read_string(
370▶ process: SBProcess, address: int, length: int, error: Optional[SBError] = None
371) -> str:
372 """Reads a string from running process's memory. If `error` is passed in, it will be passed
· · ·
372▶ """Reads a string from running process's memory. If `error` is passed in, it will be passed
373 to the `SBProcess.ReadMemory` call, and will reflect any errors after the function is called.
374
· · ·
373▶ to the `SBProcess.ReadMemory` call, and will reflect any errors after the function is called.
374
375 If any error or exception occurs, a placeholder byte array of the form "<error: [reason]>" will
+ 15 more matches in this file
18 cmd = f'settings append target.source-map "{entry["from"]}" "{entry["to"]}"'
19 debugger.HandleCommand(cmd)
20▶ except json.JSONDecodeError:
21 print(
22 f"(rust-lldb) warning: invalid JSON on line {idx} of {trim_paths_path}",
· · ·
45 header = json.loads(lines[0])
46 ver = header.get("v")
47▶ except json.JSONDecodeError:
48 print(
49 f"(rust-lldb) warning: header line 1 of {trim_paths_path} is not valid JSON",
18try:
19 import urllib2
20▶ from urllib2 import HTTPError
21except ImportError:
22 import urllib.request as urllib2
· · ·
21▶except ImportError:
22 import urllib.request as urllib2
23 from urllib.error import HTTPError
· · ·
23▶ from urllib.error import HTTPError
24try:
25 import typing # noqa: F401 FIXME: py2
· · ·
26▶except ImportError:
27 pass
28
· · ·
217 github_token,
218 )
219▶ except HTTPError as e:
220 # network errors will simply end up not creating an issue, but that's better
221 # than failing the entire build job
+ 7 more matches in this file
29def _read_utf8(mem):
30 try:
31▶ return mem.tobytes().decode("utf-8", errors="replace")
32 except Exception:
33 return repr(mem.tobytes())
· · ·
68 buf = variant_val["buf"]
69 data = bytes(int(buf[i]) for i in range(length))
70▶ return data.decode("utf-8", errors="replace")
71 except Exception as e:
72 return f"<SmolStr Inline error: {e}>"
· · ·
72▶ return f"<SmolStr Inline error: {e}>"
73
74 if variant_name == "Static":
· · ·
77 return variant_val["__0"]
78 except Exception as e:
79▶ return f"<SmolStr Static error: {e}>"
80
81 if variant_name == "Heap":
· · ·
96 return _read_utf8(mem)
97 except Exception as e:
98▶ return f"<SmolStr Heap error: {e}>"
99
100 return f"<SmolStr: unhandled variant {variant_name}>"