Skip to content

Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)

2.1 KB
Raw Blame
F                                                                        [100%]
=================================== FAILURES ===================================
___________ test_chunk_iterator_does_not_retain_recording_sized_rss ____________

tmp_path = PosixPath('/home/cinna/dopplergeist-w1-bounded-chunks/results/pytest-cache-memory-proc-before/test_chunk_iterator_does_not_r0')

    @pytest.mark.skipif(sys.platform != "linux", reason="Linux /proc resident-memory accounting")
    def test_chunk_iterator_does_not_retain_recording_sized_rss(tmp_path):
        # A synthetic raw-cache stress fixture, not a captured audio recording.
        cache = tmp_path / "long.f32"
        with cache.open("wb") as stream:
            stream.truncate(128 * 1024**2)
        script = """
    import json, sys
    from pathlib import Path
    from aircraft_geoloc.intake import IntakeRecording
    path = Path(sys.argv[1])
    duration = path.stat().st_size / 4 / 4000
    metadata = dict(source_sha256="0" * 64, duration_s=duration, sample_rate_hz=4000,
                    channels=1, source_format="synthetic_raw_cache", time_window=None)
    recording = IntakeRecording(path, metadata, {})
    def rss_kib():
        for line in Path("/proc/self/status").read_text().splitlines():
            if line.startswith("VmRSS:"):
                return int(line.split()[1])
    before = peak = rss_kib()
    checksum = 0.0
    for start, samples in recording.iter_chunks():
        checksum += float(samples.sum())
        peak = max(peak, rss_kib())
    print(json.dumps(dict(growth_kib=peak-before,
                          last_end_s=start+len(samples)/4000, checksum=checksum)))
    """
        result = json.loads(subprocess.check_output([sys.executable, "-c", script, str(cache)], text=True))
>       assert result["growth_kib"] < 32 * 1024, result
E       AssertionError: {'growth_kib': 134880, 'last_end_s': 8388.608, 'checksum': 0.0}
E       assert 134880 < (32 * 1024)

tests/test_intake.py:41: AssertionError
=========================== short test summary info ============================
FAILED tests/test_intake.py::test_chunk_iterator_does_not_retain_recording_sized_rss
1 failed in 0.44s