tests.test_binary module¶
Tests for binary verification.
- tests.test_binary.make_elf(machine)[source]¶
Craft a minimal 64-bit little-endian ELF header with no sections.
- Return type:
- tests.test_binary.pack_macho_version(version)[source]¶
Pack a
major.minorstring into a Mach-O version integer.- Return type:
- tests.test_binary.make_macho(cpu_type, min_os='11.0')[source]¶
Craft a minimal 64-bit Mach-O header with one LC_BUILD_VERSION command.
- Return type:
- tests.test_binary.make_fat(slices)[source]¶
Wrap Mach-O slices into a universal (fat) container.
- Return type:
- tests.test_binary.make_pe(machine)[source]¶
Craft a minimal PE header exposing only the COFF machine type.
- Return type:
- tests.test_binary.test_all_targets_present(target)[source]¶
All expected targets are in the mapping.
- tests.test_binary.test_pack_binary_assets(tmp_path)[source]¶
Aliases are byte-identical copies; Python distributions are skipped.
- tests.test_binary.test_version_key_ordering()[source]¶
Dotted versions compare numerically, not lexically.
- tests.test_binary.test_binary_format_detection(tmp_path, payload, expected)[source]¶
Executable formats are recognized from their magic bytes.
- tests.test_binary.test_matching_arch(tmp_path, target, payload)[source]¶
Binary with matching architecture passes verification.
- tests.test_binary.test_mismatched_arch(tmp_path, target, payload)[source]¶
Binary with mismatched architecture or format raises ValueError.
- tests.test_binary.test_elf_info_without_verneed(tmp_path)[source]¶
A sectionless ELF reports its machine and no glibc requirement.
- tests.test_binary.test_elf_info_skips_glibc_feature_versions(tmp_path)[source]¶
A feature entry like
GLIBC_ABI_DT_RELRsets no glibc floor.Files linked with packed relocations require it, like the Python interpreter Arch Linux ships.
- tests.test_binary.test_macho_info_fat_slices(tmp_path)[source]¶
CPU types accumulate and the floor maxes across fat slices.
- tests.test_binary.test_pe_machine_parsing(tmp_path)[source]¶
The COFF machine field is read from PE headers, None elsewhere.
- tests.test_binary.test_running_interpreter_parses()[source]¶
The parsers agree with the running interpreter’s own executable.
- tests.test_binary.test_floor_within_bounds_macos(tmp_path)[source]¶
Files at or below the declared macOS floor pass verification.
- tests.test_binary.test_floor_exceeded_macos(tmp_path)[source]¶
A dist file above the declared macOS floor fails verification.
- tests.test_binary.test_floor_linux(tmp_path, measured, passes)[source]¶
Linux floors compare the measured glibc requirement to the declared floor.
- tests.test_binary.test_floor_windows_is_documentation_only(tmp_path)[source]¶
Windows targets have no enforceable floor and always pass.
- tests.test_binary.ASSET_ARCH_LABELS = {Architecture(id='aarch64', name='ARM64 (AArch64)'): 'arm64', Architecture(id='x86_64', name='x86-64 (AMD64)'): 'x64'}¶
Short architecture spellings frozen into the published release-asset names.
BuildTarget.archcarries the canonical extra-platforms id (aarch64,x86_64), while every published download URL saysarm64orx64. This maps one onto the other, so a target key and its fields cannot drift apart.
- tests.test_binary.test_matrix_entry_is_json_safe(target_id, build_target)[source]¶
No extra-platforms trait may leak into the GitHub matrix.
build_targetsandnuitka_matrixare serialized into the metadata JSON the release workflow reads, so anArchitectureobject reaching one of those dicts breaks the whole release lane at metadata time.- Return type:
- tests.test_binary.test_enforced_floor_follows_binary_format(target_id, build_target)[source]¶
Only ELF and Mach-O record a floor a scan can measure.
A PE carries a nominal version header, so its declared floor stays documentation and
verify_binary_floorhas nothing to enforce. The format’sfloor_labelis what says which of the two a target is in.- Return type:
- tests.test_binary.test_skip_binary_build_branches_constant()[source]¶
Test that SKIP_BINARY_BUILD_BRANCHES contains expected branch names.
- tests.test_binary.test_skip_binary_build_disjoint_from_version_bumps()[source]¶
Version-bump branches rewrite the version string baked into the Nuitka binary, so they must not appear in SKIP_BINARY_BUILD_BRANCHES.
- tests.test_binary.test_skip_binary_build_release_workflow_push(workflow_file)[source]¶
A push that only touches a release-pipeline workflow must rebuild binaries.
Those workflows define how binaries are compiled and self-tested, so any change there needs a full matrix revalidation. Regression test for the
release.yamlsplit leaving_release-engine.yamloutsideBINARY_AFFECTING_PATHS, which let engine-only fixes skip the Nuitka matrix.