(actual, desired, fname)
| 15 | |
| 16 | |
| 17 | def assert_features_equal(actual, desired, fname): |
| 18 | __tracebackhide__ = True # Hide traceback for py.test |
| 19 | actual, desired = str(actual), str(desired) |
| 20 | if actual == desired: |
| 21 | return |
| 22 | detected = str(__cpu_features__).replace("'", "") |
| 23 | try: |
| 24 | with open("/proc/cpuinfo") as fd: |
| 25 | cpuinfo = fd.read(2048) |
| 26 | except Exception as err: |
| 27 | cpuinfo = str(err) |
| 28 | |
| 29 | try: |
| 30 | import subprocess |
| 31 | auxv = subprocess.check_output(['/bin/true'], env={"LD_SHOW_AUXV": "1"}) |
| 32 | auxv = auxv.decode() |
| 33 | except Exception as err: |
| 34 | auxv = str(err) |
| 35 | |
| 36 | import textwrap |
| 37 | error_report = textwrap.indent( |
| 38 | f""" |
| 39 | ########################################### |
| 40 | ### Extra debugging information |
| 41 | ########################################### |
| 42 | ------------------------------------------- |
| 43 | --- NumPy Detections |
| 44 | ------------------------------------------- |
| 45 | {detected} |
| 46 | ------------------------------------------- |
| 47 | --- SYS / CPUINFO |
| 48 | ------------------------------------------- |
| 49 | {cpuinfo}.... |
| 50 | ------------------------------------------- |
| 51 | --- SYS / AUXV |
| 52 | ------------------------------------------- |
| 53 | {auxv} |
| 54 | """, prefix='\r') |
| 55 | |
| 56 | raise AssertionError( |
| 57 | "Failure Detection\n" |
| 58 | f" NAME: '{fname}'\n" |
| 59 | f" ACTUAL: {actual}\n" |
| 60 | f" DESIRED: {desired}\n" |
| 61 | f"{error_report}") |
| 62 | |
| 63 | def _text_to_list(txt): |
| 64 | out = txt.strip("][\n").replace("'", "").split(', ') |
no test coverage detected
searching dependent graphs…