tests: Auto detect floating point capabilites of the target.
The floating-point precision of the target is detected (0, 30, 32 or 64) and only those tests which can run on the target will be run.
This commit is contained in:
parent
c408ed9fb1
commit
4a6c0fda78
13
tests/feature_check/float.py
Normal file
13
tests/feature_check/float.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# detect how many bits of precision the floating point implementation has
|
||||||
|
|
||||||
|
try:
|
||||||
|
float
|
||||||
|
except NameError:
|
||||||
|
print(0)
|
||||||
|
else:
|
||||||
|
if float('1.0000001') == float('1.0'):
|
||||||
|
print(30)
|
||||||
|
elif float('1e300') == float('inf'):
|
||||||
|
print(32)
|
||||||
|
else:
|
||||||
|
print(64)
|
1
tests/feature_check/float.py.exp
Normal file
1
tests/feature_check/float.py.exp
Normal file
@ -0,0 +1 @@
|
|||||||
|
64
|
@ -239,6 +239,7 @@ def run_tests(pyb, tests, args, base_path="."):
|
|||||||
skip_tests.add('cmdline/repl_emacs_keys.py')
|
skip_tests.add('cmdline/repl_emacs_keys.py')
|
||||||
|
|
||||||
upy_byteorder = run_feature_check(pyb, args, base_path, 'byteorder.py')
|
upy_byteorder = run_feature_check(pyb, args, base_path, 'byteorder.py')
|
||||||
|
upy_float_precision = int(run_feature_check(pyb, args, base_path, 'float.py'))
|
||||||
has_complex = run_feature_check(pyb, args, base_path, 'complex.py') == b'complex\n'
|
has_complex = run_feature_check(pyb, args, base_path, 'complex.py') == b'complex\n'
|
||||||
has_coverage = run_feature_check(pyb, args, base_path, 'coverage.py') == b'coverage\n'
|
has_coverage = run_feature_check(pyb, args, base_path, 'coverage.py') == b'coverage\n'
|
||||||
cpy_byteorder = subprocess.check_output([CPYTHON3, base_path + '/feature_check/byteorder.py'])
|
cpy_byteorder = subprocess.check_output([CPYTHON3, base_path + '/feature_check/byteorder.py'])
|
||||||
@ -252,6 +253,19 @@ def run_tests(pyb, tests, args, base_path="."):
|
|||||||
skip_tests.add('thread/stress_heap.py') # has reliability issues
|
skip_tests.add('thread/stress_heap.py') # has reliability issues
|
||||||
skip_tests.add('thread/stress_recurse.py') # has reliability issues
|
skip_tests.add('thread/stress_recurse.py') # has reliability issues
|
||||||
|
|
||||||
|
if upy_float_precision == 0:
|
||||||
|
skip_tests.add('extmod/ujson_dumps_float.py')
|
||||||
|
skip_tests.add('extmod/ujson_loads_float.py')
|
||||||
|
skip_tests.add('misc/rge_sm.py')
|
||||||
|
if upy_float_precision < 32:
|
||||||
|
skip_tests.add('float/float2int_intbig.py') # requires fp32, there's float2int_fp30_intbig.py instead
|
||||||
|
skip_tests.add('float/string_format.py') # requires fp32, there's string_format_fp30.py instead
|
||||||
|
skip_tests.add('float/bytes_construct.py') # requires fp32
|
||||||
|
skip_tests.add('float/bytearray_construct.py') # requires fp32
|
||||||
|
if upy_float_precision < 64:
|
||||||
|
skip_tests.add('float/float_divmod.py') # tested by float/float_divmod_relaxed.py instead
|
||||||
|
skip_tests.add('float/float2int_doubleprec_intbig.py')
|
||||||
|
|
||||||
if not has_complex:
|
if not has_complex:
|
||||||
skip_tests.add('float/complex1.py')
|
skip_tests.add('float/complex1.py')
|
||||||
skip_tests.add('float/complex1_intbig.py')
|
skip_tests.add('float/complex1_intbig.py')
|
||||||
@ -272,8 +286,6 @@ def run_tests(pyb, tests, args, base_path="."):
|
|||||||
# Some tests shouldn't be run on pyboard
|
# Some tests shouldn't be run on pyboard
|
||||||
if pyb is not None:
|
if pyb is not None:
|
||||||
skip_tests.add('basics/exception_chain.py') # warning is not printed
|
skip_tests.add('basics/exception_chain.py') # warning is not printed
|
||||||
skip_tests.add('float/float_divmod.py') # tested by float/float_divmod_relaxed.py instead
|
|
||||||
skip_tests.add('float/float2int_doubleprec_intbig.py') # requires double precision floating point to work
|
|
||||||
skip_tests.add('micropython/meminfo.py') # output is very different to PC output
|
skip_tests.add('micropython/meminfo.py') # output is very different to PC output
|
||||||
skip_tests.add('extmod/machine_mem.py') # raw memory access not supported
|
skip_tests.add('extmod/machine_mem.py') # raw memory access not supported
|
||||||
|
|
||||||
@ -282,19 +294,12 @@ def run_tests(pyb, tests, args, base_path="."):
|
|||||||
skip_tests.add('misc/recursion.py') # requires stack checking enabled
|
skip_tests.add('misc/recursion.py') # requires stack checking enabled
|
||||||
skip_tests.add('misc/recursive_data.py') # requires stack checking enabled
|
skip_tests.add('misc/recursive_data.py') # requires stack checking enabled
|
||||||
skip_tests.add('misc/recursive_iternext.py') # requires stack checking enabled
|
skip_tests.add('misc/recursive_iternext.py') # requires stack checking enabled
|
||||||
skip_tests.add('misc/rge_sm.py') # requires floating point
|
|
||||||
skip_tests.update({'extmod/uctypes_%s.py' % t for t in 'bytearray le native_le ptr_le ptr_native_le sizeof sizeof_native array_assign_le array_assign_native_le'.split()}) # requires uctypes
|
skip_tests.update({'extmod/uctypes_%s.py' % t for t in 'bytearray le native_le ptr_le ptr_native_le sizeof sizeof_native array_assign_le array_assign_native_le'.split()}) # requires uctypes
|
||||||
skip_tests.add('extmod/zlibd_decompress.py') # requires zlib
|
skip_tests.add('extmod/zlibd_decompress.py') # requires zlib
|
||||||
skip_tests.add('extmod/ujson_dumps_float.py') # requires floating point
|
|
||||||
skip_tests.add('extmod/ujson_loads_float.py') # requires floating point
|
|
||||||
skip_tests.add('extmod/uheapq1.py') # uheapq not supported by WiPy
|
skip_tests.add('extmod/uheapq1.py') # uheapq not supported by WiPy
|
||||||
skip_tests.add('extmod/urandom_basic.py') # requires urandom
|
skip_tests.add('extmod/urandom_basic.py') # requires urandom
|
||||||
skip_tests.add('extmod/urandom_extra.py') # requires urandom
|
skip_tests.add('extmod/urandom_extra.py') # requires urandom
|
||||||
elif args.target == 'esp8266':
|
elif args.target == 'esp8266':
|
||||||
skip_tests.add('float/float2int_intbig.py') # requires at least fp32, there's float2int_fp30_intbig.py instead
|
|
||||||
skip_tests.add('float/string_format.py') # requires at least fp32, there's string_format_fp30.py instead
|
|
||||||
skip_tests.add('float/bytes_construct.py') # requires fp32
|
|
||||||
skip_tests.add('float/bytearray_construct.py') # requires fp32
|
|
||||||
skip_tests.add('misc/rge_sm.py') # too large
|
skip_tests.add('misc/rge_sm.py') # too large
|
||||||
elif args.target == 'minimal':
|
elif args.target == 'minimal':
|
||||||
skip_tests.add('misc/rge_sm.py') # too large
|
skip_tests.add('misc/rge_sm.py') # too large
|
||||||
|
Loading…
Reference in New Issue
Block a user