Browse Source

tests: Fix uctypes tests to run on 64bit arch; enable more native tests.

pull/873/head
Damien George 10 years ago
parent
commit
96e20c600f
  1. 5
      tests/basics/bytes.py
  2. 5
      tests/basics/bytes_gen.py
  3. 2
      tests/extmod/uctypes_ptr_le.py
  4. 2
      tests/extmod/uctypes_ptr_native_le.py
  5. 6
      tests/run-tests

5
tests/basics/bytes.py

@ -33,11 +33,6 @@ print(bytes(3))
print(bytes([3, 2, 1])) print(bytes([3, 2, 1]))
print(bytes(range(5))) print(bytes(range(5)))
def gen():
for i in range(4):
yield i
print(bytes(gen()))
# Make sure bytes are not mistreated as unicode # Make sure bytes are not mistreated as unicode
x = b"\xff\x8e\xfe}\xfd\x7f" x = b"\xff\x8e\xfe}\xfd\x7f"
print(len(x)) print(len(x))

5
tests/basics/bytes_gen.py

@ -0,0 +1,5 @@
# construct a bytes object from a generator
def gen():
for i in range(4):
yield i
print(bytes(gen()))

2
tests/extmod/uctypes_ptr_le.py

@ -9,7 +9,7 @@ desc = {
bytes = b"01" bytes = b"01"
addr = uctypes.addressof(bytes) addr = uctypes.addressof(bytes)
buf = addr.to_bytes(4) buf = addr.to_bytes(uctypes.sizeof(desc))
S = uctypes.struct(desc, uctypes.addressof(buf), uctypes.LITTLE_ENDIAN) S = uctypes.struct(desc, uctypes.addressof(buf), uctypes.LITTLE_ENDIAN)

2
tests/extmod/uctypes_ptr_native_le.py

@ -15,7 +15,7 @@ desc = {
bytes = b"01" bytes = b"01"
addr = uctypes.addressof(bytes) addr = uctypes.addressof(bytes)
buf = addr.to_bytes(4) buf = addr.to_bytes(uctypes.sizeof(desc))
S = uctypes.struct(desc, uctypes.addressof(buf), uctypes.NATIVE) S = uctypes.struct(desc, uctypes.addressof(buf), uctypes.NATIVE)

6
tests/run-tests

@ -40,19 +40,17 @@ def run_tests(pyb, tests, args):
# Some tests are known to fail on 64-bit machines # Some tests are known to fail on 64-bit machines
if pyb is None and platform.architecture()[0] == '64bit': if pyb is None and platform.architecture()[0] == '64bit':
skip_tests.add('extmod/uctypes_ptr_le.py') pass
skip_tests.add('extmod/uctypes_ptr_native_le.py')
# Some tests are known to fail with native emitter # Some tests are known to fail with native emitter
# Remove them from the below when they work # Remove them from the below when they work
if args.emit == 'native': if args.emit == 'native':
skip_tests.update({'basics/%s.py' % t for t in 'bytes class_store_class class_super class_super_object closure1 closure2 closure_defargs compare_multi containment del_deref del_local del_name fun3 fun_calldblstar fun_callstar fun_callstardblstar fun_defargs fun_defargs2 fun_kwargs fun_kwonly fun_kwonlydef fun_kwvarargs fun_varargs gen_yield_from gen_yield_from_close gen_yield_from_ducktype gen_yield_from_exc gen_yield_from_iter gen_yield_from_send gen_yield_from_throw generator1 generator2 generator_args generator_close generator_closure generator_exc generator_return generator_send globals_del is_isnot string_format string_join subclass_native2_list subclass_native2_tuple subclass_native3 try2 try_as_var try_finally1 try_finally_loops try_finally_return try_reraise try_reraise2 unary_op unboundlocal with1 with_break with_continue with_return'.split()}) skip_tests.update({'basics/%s.py' % t for t in 'bytes_gen class_store_class class_super class_super_object closure1 closure2 closure_defargs compare_multi containment del_deref del_local fun3 fun_calldblstar fun_callstar fun_callstardblstar fun_defargs fun_defargs2 fun_kwargs fun_kwonly fun_kwonlydef fun_kwvarargs fun_varargs gen_yield_from gen_yield_from_close gen_yield_from_ducktype gen_yield_from_exc gen_yield_from_iter gen_yield_from_send gen_yield_from_throw generator1 generator2 generator_args generator_close generator_closure generator_exc generator_return generator_send globals_del is_isnot string_format string_join subclass_native2_list subclass_native2_tuple try2 try_finally1 try_finally_loops try_finally_return try_reraise try_reraise2 unary_op unboundlocal with1 with_break with_continue with_return'.split()})
skip_tests.add('float/string_format.py') skip_tests.add('float/string_format.py')
skip_tests.add('import/gen_context.py') skip_tests.add('import/gen_context.py')
skip_tests.add('import/import_pkg1.py') skip_tests.add('import/import_pkg1.py')
skip_tests.add('io/file_with.py') skip_tests.add('io/file_with.py')
skip_tests.add('micropython/heapalloc.py') skip_tests.add('micropython/heapalloc.py')
skip_tests.add('micropython/viper.py')
skip_tests.add('misc/features.py') skip_tests.add('misc/features.py')
skip_tests.add('misc/recursion.py') skip_tests.add('misc/recursion.py')
skip_tests.add('misc/rge_sm.py') skip_tests.add('misc/rge_sm.py')

Loading…
Cancel
Save