scientific-method-engine 17.0.0__tar.gz → 17.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/PKG-INFO +5 -2
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/README.md +4 -1
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/pyproject.toml +1 -1
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/cli.py +31 -2
- scientific_method_engine-17.0.1/tests/test_config_encoding.py +92 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/.gitignore +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/LICENSE +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/__init__.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/__main__.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ClearNoReturnFunctions.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/CreateFunctions.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ExportBoundedFlow.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ExportCallEdges.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ExportFunctionFingerprints.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ExportFunctionInventory.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/MergeFallThroughFragment.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/RecoverCitedFunctions.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/RepairReturningCallers.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportCallArguments.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportCallPaths.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportCallSitesWithScalars.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportCallsToRange.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportConstantFirstArgumentCalls.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportDataBytes.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportDecompileMatches.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportDecompileWindow.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportFilePatternInMemory.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportFirstArgumentCallSummary.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportFunctionScalarConstants.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportFunctionSummary.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportInstructionContext.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportInstructionWindow.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportMemoryBlockForFileOffset.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportMemoryBlocks.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportRandomnessCandidates.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportRangeBoundaries.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportReferences.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportScalarConstants.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportStringReferences.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/ReportSymbolReferences.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/scientificmethod/FirstArgumentLookBack.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/scientificmethod/InstructionStart.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/scientificmethod/OperandConstants.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/ghidra/scientificmethod/Xxh3.java +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/__init__.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/argument_frames.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/dispatch.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/effect_order.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/image.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/inventory.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/loops.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/machine.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/memory_scopes.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/pcode.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/pcode_backend.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/pe.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/reach.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/relational.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/reports.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/result_flow.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/trace.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/src/scientific_method_engine/x86/values.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/oracle.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_continuation_budget.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_dispatch.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_effect_order.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_enter_frames.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_entry_frame.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_indirect_far_transfers.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_interrupt_models.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_inventory_check.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_join_terms.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_loops.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_memory_scopes.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_nested_frame_request.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_oracle.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_pe.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_reach.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_relational_controls.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_return_checks.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_successor_rule.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_table_continuations.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_term_limit.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_volatile_memory.py +0 -0
- {scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_x86.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: scientific-method-engine
|
|
3
|
-
Version: 17.0.
|
|
3
|
+
Version: 17.0.1
|
|
4
4
|
Summary: Bounded instruction-derived x86 evidence reports for segmented MZ/FBOV and PE32/i386 code.
|
|
5
5
|
Project-URL: Source, https://github.com/kibertoad/refurbished-dinosaurs-toolkit/tree/main/packages/scientific-method-engine
|
|
6
6
|
Author: kibertoad
|
|
@@ -29,7 +29,10 @@ For original MZ/FBOV executables, run reports through
|
|
|
29
29
|
[`@scientific-method/executable-reader`](https://www.npmjs.com/package/@scientific-method/executable-reader). The
|
|
30
30
|
reader derives relocation, fixup and trampoline data from the hash-checked source and pipes a
|
|
31
31
|
prepared config to this engine. Running the engine directly trusts whatever relocation data the
|
|
32
|
-
config supplies, so use it directly only for synthetic inputs, PE32 sources and checked mappings
|
|
32
|
+
config supplies, so use it directly only for synthetic inputs, PE32 sources and checked mappings. A config
|
|
33
|
+
file is read as the reader reads it: UTF-8, with or without one leading byte order mark, and a file starting
|
|
34
|
+
with a UTF-16 or UTF-32 byte order mark or with more than one UTF-8 mark, or bytes that are not UTF-8, are
|
|
35
|
+
refused with the cause named.
|
|
33
36
|
|
|
34
37
|
```sh
|
|
35
38
|
scientific-method-engine trace analysis/query.json
|
|
@@ -13,7 +13,10 @@ For original MZ/FBOV executables, run reports through
|
|
|
13
13
|
[`@scientific-method/executable-reader`](https://www.npmjs.com/package/@scientific-method/executable-reader). The
|
|
14
14
|
reader derives relocation, fixup and trampoline data from the hash-checked source and pipes a
|
|
15
15
|
prepared config to this engine. Running the engine directly trusts whatever relocation data the
|
|
16
|
-
config supplies, so use it directly only for synthetic inputs, PE32 sources and checked mappings
|
|
16
|
+
config supplies, so use it directly only for synthetic inputs, PE32 sources and checked mappings. A config
|
|
17
|
+
file is read as the reader reads it: UTF-8, with or without one leading byte order mark, and a file starting
|
|
18
|
+
with a UTF-16 or UTF-32 byte order mark or with more than one UTF-8 mark, or bytes that are not UTF-8, are
|
|
19
|
+
refused with the cause named.
|
|
17
20
|
|
|
18
21
|
```sh
|
|
19
22
|
scientific-method-engine trace analysis/query.json
|
|
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "scientific-method-engine"
|
|
7
7
|
# The release workflow writes the published version from the package's release tag.
|
|
8
|
-
version = "17.0.
|
|
8
|
+
version = "17.0.1"
|
|
9
9
|
description = "Bounded instruction-derived x86 evidence reports for segmented MZ/FBOV and PE32/i386 code."
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
requires-python = ">=3.12"
|
|
@@ -52,6 +52,24 @@ def ghidra_scripts():
|
|
|
52
52
|
return Path(__file__).resolve().parent / "ghidra"
|
|
53
53
|
|
|
54
54
|
|
|
55
|
+
def _read_config_text(path):
|
|
56
|
+
# Windows PowerShell 5.1 writes a UTF-8 byte order mark with -Encoding utf8 and UTF-16 by default.
|
|
57
|
+
# The reader's readConfigText in report.ts applies the same rules with the same messages.
|
|
58
|
+
data = path.read_bytes()
|
|
59
|
+
if data[:4] in (b"\xff\xfe\x00\x00", b"\x00\x00\xfe\xff"):
|
|
60
|
+
raise ValueError(f"Config {path} is UTF-32 text; save it as UTF-8")
|
|
61
|
+
if data[:2] in (b"\xff\xfe", b"\xfe\xff"):
|
|
62
|
+
raise ValueError(f"Config {path} is UTF-16 text; save it as UTF-8")
|
|
63
|
+
try:
|
|
64
|
+
# utf-8-sig drops one leading byte order mark.
|
|
65
|
+
text = data.decode("utf-8-sig")
|
|
66
|
+
except UnicodeDecodeError:
|
|
67
|
+
raise ValueError(f"Config {path} is not valid UTF-8; save it as UTF-8") from None
|
|
68
|
+
if text.startswith("\ufeff"):
|
|
69
|
+
raise ValueError(f"Config {path} starts with more than one byte order mark; save it as UTF-8 with at most one")
|
|
70
|
+
return text
|
|
71
|
+
|
|
72
|
+
|
|
55
73
|
def main(argv):
|
|
56
74
|
"""Run one command (``argv`` excludes the program name) and print its JSON report."""
|
|
57
75
|
from .x86.image import read_source
|
|
@@ -66,14 +84,22 @@ def main(argv):
|
|
|
66
84
|
if config_path == "-":
|
|
67
85
|
# The reader caps its input at 1 MiB, then adds every source relocation.
|
|
68
86
|
limit, label = PREPARED_CONFIG_LIMIT, "Prepared config exceeds 16 MiB"
|
|
69
|
-
|
|
87
|
+
# The reader writes UTF-8. sys.stdin decodes with the locale's encoding (cp1252 on Windows), which
|
|
88
|
+
# would garble a non-ASCII source path or evidence string, so the bytes are decoded here.
|
|
89
|
+
data = sys.stdin.buffer.read(limit + 1)
|
|
90
|
+
if len(data) > limit:
|
|
91
|
+
raise ValueError(label)
|
|
92
|
+
try:
|
|
93
|
+
text = data.decode("utf-8")
|
|
94
|
+
except UnicodeDecodeError:
|
|
95
|
+
raise ValueError("Prepared config is not valid UTF-8") from None
|
|
70
96
|
base = Path.cwd()
|
|
71
97
|
else:
|
|
72
98
|
limit, label = CONFIG_LIMIT, "Config exceeds 1 MiB"
|
|
73
99
|
path = Path(config_path).resolve()
|
|
74
100
|
if path.stat().st_size > limit:
|
|
75
101
|
raise ValueError(label)
|
|
76
|
-
text, base = path
|
|
102
|
+
text, base = _read_config_text(path), path.parent
|
|
77
103
|
reject_derived = True
|
|
78
104
|
if len(text.encode("utf-8")) > limit:
|
|
79
105
|
raise ValueError(label)
|
|
@@ -110,6 +136,9 @@ def main(argv):
|
|
|
110
136
|
|
|
111
137
|
def run():
|
|
112
138
|
"""Entry point of the ``scientific-method-engine`` command; exits with 1 on any error."""
|
|
139
|
+
# The reader decodes this process's stderr as UTF-8; the locale's encoding (cp1252 on Windows) would
|
|
140
|
+
# garble a non-ASCII path in an error message.
|
|
141
|
+
sys.stderr.reconfigure(encoding="utf-8", errors="backslashreplace")
|
|
113
142
|
try:
|
|
114
143
|
main(sys.argv[1:])
|
|
115
144
|
except (ValueError, TypeError, KeyError, OSError, ImportError) as error:
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""Synthetic machine code and synthetic configs only. No original binaries or analysis artifacts."""
|
|
2
|
+
import json
|
|
3
|
+
import os
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
import subprocess
|
|
6
|
+
import sys
|
|
7
|
+
import tempfile
|
|
8
|
+
import unittest
|
|
9
|
+
|
|
10
|
+
SRC = Path(__file__).resolve().parents[1] / "src"
|
|
11
|
+
import xxhash
|
|
12
|
+
|
|
13
|
+
ENGINE = [sys.executable, "-B", "-m", "scientific_method_engine"]
|
|
14
|
+
ENGINE_ENV = {**os.environ, "PYTHONPATH": os.pathsep.join(filter(None, [str(SRC), os.environ.get("PYTHONPATH")]))}
|
|
15
|
+
|
|
16
|
+
# One resident segment at 1000h: 0000 calls 0004, 0003 returns, 0004 returns.
|
|
17
|
+
CODE = bytes.fromhex("e80100" "c3" "c3")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class ConfigEncodingTests(unittest.TestCase):
|
|
21
|
+
def setUp(self):
|
|
22
|
+
folder = tempfile.TemporaryDirectory()
|
|
23
|
+
self.addCleanup(folder.cleanup)
|
|
24
|
+
self.root = Path(folder.name)
|
|
25
|
+
(self.root / "fixture.bin").write_bytes(CODE)
|
|
26
|
+
# The evidence text holds a non-ASCII letter, so the config's Latin-1 bytes are not UTF-8.
|
|
27
|
+
self.text = json.dumps({
|
|
28
|
+
"source": "fixture.bin", "sourceKind": "synthetic-raw", "xxh3": xxhash.xxh3_128_hexdigest(CODE),
|
|
29
|
+
"regions": [{"name": "resident", "start": 0, "end": len(CODE), "ip": 0, "segment": 0x1000,
|
|
30
|
+
"resident": True, "entries": [0], "evidence": "synthetic code extent, côte"}],
|
|
31
|
+
"target": 4}, ensure_ascii=False)
|
|
32
|
+
|
|
33
|
+
def run_config(self, data):
|
|
34
|
+
path = self.root / "config.json"
|
|
35
|
+
path.write_bytes(data)
|
|
36
|
+
return subprocess.run([*ENGINE, "incoming", str(path)], capture_output=True, text=True, encoding="utf-8",
|
|
37
|
+
env=ENGINE_ENV)
|
|
38
|
+
|
|
39
|
+
def test_a_config_reads_the_same_with_and_without_a_utf8_byte_order_mark(self):
|
|
40
|
+
plain = self.run_config(self.text.encode("utf-8"))
|
|
41
|
+
self.assertEqual(plain.returncode, 0, plain.stderr)
|
|
42
|
+
marked = self.run_config(b"\xef\xbb\xbf" + self.text.encode("utf-8"))
|
|
43
|
+
self.assertEqual(marked.returncode, 0, marked.stderr)
|
|
44
|
+
self.assertEqual(json.loads(marked.stdout), json.loads(plain.stdout))
|
|
45
|
+
self.assertTrue(json.loads(plain.stdout)["confirmed"])
|
|
46
|
+
|
|
47
|
+
def test_a_second_byte_order_mark_is_refused_by_name(self):
|
|
48
|
+
result = self.run_config(b"\xef\xbb\xbf\xef\xbb\xbf" + self.text.encode("utf-8"))
|
|
49
|
+
self.assertEqual(result.returncode, 1)
|
|
50
|
+
self.assertIn("starts with more than one byte order mark", result.stderr)
|
|
51
|
+
|
|
52
|
+
def test_a_prepared_config_on_stdin_is_utf8_whatever_the_locale(self):
|
|
53
|
+
# PYTHONIOENCODING stands in for a Windows locale: sys.stdin would decode the reader's UTF-8 as Latin-1.
|
|
54
|
+
folder = self.root / "côte"
|
|
55
|
+
folder.mkdir()
|
|
56
|
+
(folder / "fixture.bin").write_bytes(CODE)
|
|
57
|
+
prepared = {**json.loads(self.text), "source": str(folder / "fixture.bin"), "preparedProtocol": 3}
|
|
58
|
+
result = subprocess.run([*ENGINE, "incoming", "-"], input=json.dumps(prepared, ensure_ascii=False).encode("utf-8"),
|
|
59
|
+
capture_output=True, env={**ENGINE_ENV, "PYTHONIOENCODING": "latin-1"})
|
|
60
|
+
self.assertEqual(result.returncode, 0, result.stderr)
|
|
61
|
+
self.assertTrue(json.loads(result.stdout)["confirmed"])
|
|
62
|
+
result = subprocess.run([*ENGINE, "incoming", "-"], input=self.text.encode("latin-1"), capture_output=True,
|
|
63
|
+
env=ENGINE_ENV)
|
|
64
|
+
self.assertEqual(result.returncode, 1)
|
|
65
|
+
self.assertIn(b"Prepared config is not valid UTF-8", result.stderr)
|
|
66
|
+
|
|
67
|
+
def test_an_error_naming_a_non_ascii_path_is_written_as_utf8_whatever_the_locale(self):
|
|
68
|
+
# The reader decodes the engine's stderr as UTF-8; PYTHONIOENCODING stands in for a Windows locale.
|
|
69
|
+
folder = self.root / "côte"
|
|
70
|
+
folder.mkdir()
|
|
71
|
+
(folder / "config.json").write_bytes(b"\xff\xfe" + self.text.encode("utf-16-le"))
|
|
72
|
+
result = subprocess.run([*ENGINE, "incoming", str(folder / "config.json")], capture_output=True,
|
|
73
|
+
env={**ENGINE_ENV, "PYTHONIOENCODING": "latin-1"})
|
|
74
|
+
self.assertEqual(result.returncode, 1)
|
|
75
|
+
self.assertIn(f"Config {folder / 'config.json'} is UTF-16 text", result.stderr.decode("utf-8"))
|
|
76
|
+
|
|
77
|
+
def test_utf16_utf32_and_invalid_utf8_configs_are_refused_with_the_encoding_named(self):
|
|
78
|
+
for data in (b"\xff\xfe" + self.text.encode("utf-16-le"), b"\xfe\xff" + self.text.encode("utf-16-be")):
|
|
79
|
+
result = self.run_config(data)
|
|
80
|
+
self.assertEqual(result.returncode, 1)
|
|
81
|
+
self.assertIn("is UTF-16 text; save it as UTF-8", result.stderr)
|
|
82
|
+
for data in (b"\xff\xfe\x00\x00" + self.text.encode("utf-32-le"), b"\x00\x00\xfe\xff" + self.text.encode("utf-32-be")):
|
|
83
|
+
result = self.run_config(data)
|
|
84
|
+
self.assertEqual(result.returncode, 1)
|
|
85
|
+
self.assertIn("is UTF-32 text; save it as UTF-8", result.stderr)
|
|
86
|
+
result = self.run_config(self.text.encode("latin-1"))
|
|
87
|
+
self.assertEqual(result.returncode, 1)
|
|
88
|
+
self.assertIn("is not valid UTF-8; save it as UTF-8", result.stderr)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
if __name__ == "__main__":
|
|
92
|
+
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_effect_order.py
RENAMED
|
File without changes
|
{scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_enter_frames.py
RENAMED
|
File without changes
|
{scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_entry_frame.py
RENAMED
|
File without changes
|
|
File without changes
|
{scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_interrupt_models.py
RENAMED
|
File without changes
|
{scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_inventory_check.py
RENAMED
|
File without changes
|
{scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_join_terms.py
RENAMED
|
File without changes
|
|
File without changes
|
{scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_memory_scopes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_return_checks.py
RENAMED
|
File without changes
|
{scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_successor_rule.py
RENAMED
|
File without changes
|
|
File without changes
|
{scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_term_limit.py
RENAMED
|
File without changes
|
{scientific_method_engine-17.0.0 → scientific_method_engine-17.0.1}/tests/test_volatile_memory.py
RENAMED
|
File without changes
|
|
File without changes
|