| 1 | from rpython.jit.backend.detect_cpu import * |
| 2 | |
| 3 | |
| 4 | def test_autodetect(): |
| 5 | try: |
| 6 | name = autodetect() |
| 7 | except ProcessorAutodetectError: |
| 8 | pass |
| 9 | else: |
| 10 | assert isinstance(name, str) |
| 11 | |
| 12 | def test_getcpuclassname(): |
| 13 | try: |
| 14 | modname, clsname = getcpuclassname() |
| 15 | except ProcessorAutodetectError: |
| 16 | pass |
| 17 | else: |
| 18 | assert isinstance(modname, str) |
| 19 | assert isinstance(clsname, str) |
| 20 | |
| 21 | def test_getcpuclass(): |
| 22 | try: |
| 23 | cpu = getcpuclass() |
| 24 | except ProcessorAutodetectError: |
| 25 | pass |
| 26 | else: |
| 27 | from rpython.jit.backend.model import AbstractCPU |
| 28 | assert issubclass(cpu, AbstractCPU) |
| 29 | |
| 30 | |
| 31 | def test_detect_model_from_c_compiler(): |
| 32 | info1 = detect_model_from_host_platform() |
| 33 | info2 = detect_model_from_c_compiler() |
| 34 | assert info1 == info2 |
| 35 | |
| 36 | def test_getcpufeatures(): |
| 37 | features = getcpufeatures() |
| 38 | assert isinstance(features, list) |
| 39 | for x in features: |
| 40 | assert x in ['floats', 'singlefloats', 'longlong'] |