Commit Graph

188 Commits

Author SHA1 Message Date
Damien George
4300c7dba2 py: Remove dependency on printf/fwrite in mp_plat_print.
See issue #1500.
2015-10-15 00:05:55 +01:00
Damien George
0334058fa4 Rename "Micro Python" to "MicroPython" in REPL, help, readme's and misc. 2015-10-12 00:06:25 +01:00
Daniel Campora
d5de1bf853 tests: Skip uheapq1 test if target is WiPy. 2015-09-27 18:47:35 +02:00
Daniel Campora
958e273336 tests: Skip extmod machine tests when target is WiPy. 2015-09-27 17:35:45 +02:00
stijn
dfa915a6af tests: Omit process output parsing in case of CalledProcessError
Adding a line-end makes the determination of skip_native fail as it compares
the output against b'CRASH' while it is in fact b'CRASH\n'
2015-09-23 11:50:24 +01:00
Daniel Campora
88ca6c94d9 tests: Ignore exception chain test on the WiPy.
Fails because warnings are not enabled on the CC3200.
2015-09-10 07:59:53 +02:00
Daniel Campora
d5e256486e cc3200: Re-work Pin class according to the new API.
Also add relevant test.
2015-09-10 07:59:35 +02:00
Paul Sokolovsky
1b693543aa tests: Skip exception_chain.py with native emitter. 2015-09-01 11:53:27 +03:00
Paul Sokolovsky
a3fe307400 tests: Consolidate all feature check snippets under feature_check/. 2015-08-30 11:36:42 +03:00
Paul Sokolovsky
0a8b5d160b run-tests: Allow to skip byteorder-dependent tests.
If byteorder of MicroPython under test and host CPython differ.
2015-08-30 00:37:53 +03:00
stijn
dbfba6a20e tests: Fix exceptions when running cmdline tests on windows
- subprocess.check_output can only handle strings on windows, not bytes,
  so convert the arguments as such
- the pty module is for posix systems only so skip the tests needing it
  in case it is not available
2015-08-08 12:35:27 +01:00
stijn
7ede3ec4b1 tests: Always use forward slashes for paths
This is more consistent and fixes run_micropython on windows as it uses
forward slahses to compare paths
2015-08-08 12:35:27 +01:00
Tom Soulanille
89852d38ef run-tests: Test REPL emacs keys, but only if present.
Uses cmdline/repl_emacs_check.py to check for presence of emacs keys in
repl before doing full feature test.
2015-08-06 00:03:44 +01:00
Tom Soulanille
3dd0b69e46 run-tests: Use PTY when running REPL tests. 2015-07-26 15:23:11 +01:00
Daniel Campora
cd14188bc8 tools: Add telnet support to pyboard.py.
The adapter class "TelnetToSerial" is used to access the Telnet
connection using the same API as with the serial connection. The
function pyboard.run-test() has been removed to made the module
generic and because this small test is no longer needed.
2015-07-26 14:02:34 +01:00
Damien George
e44c1d3ace tests: Split out json float tests to separate files. 2015-06-25 10:50:00 +01:00
Daniel Campora
186b355b28 tests: Add support for the WiPy in run-tests script.
The --pyboard param has been replaced by --target which defaults to
'unix'. Possible values at this moment are 'unix', 'pyboard' and
'wipy'. Now is also possible to select the baud rate of the serial
device when calling the script.
2015-06-25 10:45:25 +01:00
Damien George
031278f661 unix: Allow to cat a script into stdin from the command line.
See issue #1306.
2015-06-04 23:42:45 +01:00
Paul Sokolovsky
8b85d14b92 modsys: Add basic sys.exc_info() implementation.
The implementation is very basic and non-compliant and provided solely for
CPython compatibility. The function itself is bad Python2 heritage, its
usage is discouraged.
2015-04-25 03:49:23 +03:00
Damien George
9988618e0e py: Implement full func arg passing for native emitter.
This patch gets full function argument passing working with native
emitter.  Includes named args, keyword args, default args, var args
and var keyword args.  Fully Python compliant.

It reuses the bytecode mp_setup_code_state function to do all the hard
work.  This function is slightly adjusted to accommodate native calls,
and the native emitter is forced a bit to emit similar prelude and
code-info as bytecode.
2015-04-07 22:43:28 +01:00
Damien George
78772ada0d py: Implement calling functions with *args in native emitter. 2015-04-06 22:48:21 +01:00
Damien George
9dd3640464 tests: Add missing tests for builtins, and many other things. 2015-04-04 22:05:30 +01:00
Damien George
4cd9ced8dc py: Implement closures in native code generator.
Currently supports only x64 and Thumb2 archs.
2015-04-03 15:05:53 +01:00
Damien George
23d7fd526d tests: Skip some new tests when testing native emitter. 2015-03-25 23:33:48 +00:00
Damien George
1004535237 tests: Make cmdline tests more stable by using regex for matching. 2015-03-20 17:25:25 +00:00
Damien George
143c34109c tests: Add ability to test uPy cmdline executable.
This allows to test options passed to cmdline executable, as well as the
behaviour of the REPL.
2015-03-13 10:58:34 +00:00
Damien George
72ddcfd9ff tests: Skip basics/boundmeth1.py for native emitter. 2015-03-03 18:06:45 +00:00
Damien George
e8b877be60 tests: Disable float/cmath_fun.py for native emitter. 2015-02-02 20:01:51 +00:00
Damien George
b6e6b5277f py: Implement proper re-raising in native codegen's finally handler.
This allows an exception to propagate correctly through a finally
handler.
2015-01-21 17:00:01 +00:00
Damien George
ad2307c92c py: Temporary fix for conversion of float to int when fits in small int.
Addresses issue #1044 (see also #1040).  Could do with a better fix.
2015-01-07 12:10:47 +00:00
Damien George
816a46a4ab tests: Disable float/float2int.py on pyboard (needs double prec). 2014-12-31 18:46:18 +00:00
Paul Sokolovsky
978f4ca2e1 run-tests: Allow to run testuite against Windows build on Linux (using Wine).
Just adjust line-endings of micropython.exe output, the rest should be
handled by Wine (automagically on properly configured distro).

To run:

MICROPY_MICROPYTHON=../windows/micropython.exe ./run-tests
2014-12-20 16:53:46 +02:00
stijn
f5efefd5a0 windows: Correctly interpret skipped tests, enable uhashlib and ubinascii 2014-12-20 16:52:22 +02:00
Paul Sokolovsky
138562ccd9 run-tests: Skip native/viper tests based on prefix.
Otherwise, new tests are forgotten to be added to explicit lists. Issue
found running on Debian/ARM.
2014-12-13 00:51:24 +02:00
Paul Sokolovsky
1ca28bd570 run-tests: Reset MICROPYPATH, to make sure tests use only builtin modules. 2014-12-12 00:58:07 +02:00
Paul Sokolovsky
dbc7854355 run-tests: PEP8 fix. 2014-12-12 00:58:07 +02:00
Damien George
f905145c6d tests: Disable print_exception test when using native emitter. 2014-12-11 17:34:55 +00:00
Damien George
184182d14c tests: Fix print_exception test and re-enable it on Travis CI.
Issue was with uPy: on local machine with micropython-lib installed, io
module is available.  Not the case on Travis CI, where only _io module
is available in uPy.
2014-12-11 17:10:25 +00:00
Paul Sokolovsky
66a6caa307 run-tests: Skip print_exception.py on TravisCI, as it irreproducibly fails.
TODO: Figure out what's wrong on Travis.
2014-12-11 15:03:29 +02:00
blmorris
9d1ca65b59 Set PYTHONIOENCODING='utf-8' so that unicode tests can pass on CPython on
systems where another encoding is set in the locale
2014-11-19 10:44:31 -05:00
Damien George
5a04e2cca8 tests: Add check for micropython.native and then skip relevant tests.
If micropython.native decorator doesn't compile, then we skill all
native/viper tests.

This patch also re-enables the ujson_loads test on NT.

Addresses issue #861, and partially addresses issue #856.
2014-10-05 22:27:12 +01:00
stijn
dc1ea1156a Exclude some tests which always fail on windows 2014-10-05 09:32:26 +02:00
blmorris
3b064370f8 Enable device keyword option when running pyboard.py --tests and run-tests --pyboard 2014-10-01 23:31:52 +01:00
Damien George
d6230f62c7 py: Make native emitter handle multi-compare and not/is not/not in ops. 2014-09-23 14:15:45 +00:00
Damien George
96e20c600f tests: Fix uctypes tests to run on 64bit arch; enable more native tests. 2014-09-23 14:15:45 +00:00
Damien George
612045f53f py: Add native json printing using existing print framework.
Also add start of ujson module with dumps implemented.  Enabled in unix
and stmhal ports.  Test passes on both.
2014-09-17 22:56:34 +01:00
Damien George
8594ce2280 py: Implement divmod, % and proper // for floating point.
Tested and working on unix and pyboard.
2014-09-13 18:43:09 +01:00
Damien George
c7a79284bb tests: Enable misc tests on pyboard; output 4 sig figs in rge_sm. 2014-09-06 18:38:55 +01:00
Damien George
17598d49e1 unix: Don't use -Wno-error=cpp or #warning; fix strict alias warning.
For the sake of older versions of gcc (and other compilers), don't use
the #warning CPP directive, nor the -Wno-error=cpp option.

Also, fix a strict alias warning in modffi.c for older compilers, and
add a test for ffi module.

Addresses issue #847.
2014-09-06 17:46:52 +01:00
Damien George
15d2fe8da4 tests: Add option to run-tests to enable native emitter. 2014-08-29 19:47:10 +01:00
Damien George
1694bc733d py: Add stream reading of n unicode chars; unicode support by default.
With unicode enabled, this patch allows reading a fixed number of
characters from text-mode streams; eg file.read(5) will read 5 unicode
chars, which can made of more than 5 bytes.

For an ASCII stream (ie no chars > 127) it only needs to do 1 read.  If
there are lots of non-ASCII chars in a stream, then it needs multiple
reads of the underlying object.

Adds a new test for this case.  Enables unicode support by default on
unix and stmhal ports.
2014-07-19 18:34:04 +01:00
Paul Sokolovsky
2cf381081a run-tests: Add option to write CPython's test results to .exp files.
Mostly to run testsuite on targets which doesn't have CPython.
2014-07-12 16:34:51 +03:00
Damien George
41736f8201 tests: Write output in byte mode, not text mode.
This enables testing unicode and non-unicode implementations.
2014-06-28 10:29:12 +01:00
Damien George
4297fed1c3 tests: Run 'micropython' tests on pyboard. 2014-06-08 13:46:03 +01:00
Chris Angelico
047db2299c Turn the Travis CI test skipping mechanism into something more generic 2014-06-06 07:51:01 +10:00
Chris Angelico
88b11b50e5 Figure out the test_name before using it (significant only to Travis skips) 2014-06-06 07:51:01 +10:00
Damien George
a053e37b2c tests: Change --test_dirs to --test-dirs. 2014-05-31 18:11:01 +01:00
stijn
8ac3b578e5 tests: Add argument to allow specifying which directories to test 2014-05-28 14:33:30 +02:00
stijn
a4dbc73e8a tests: Fix handling of newlines from expected output files 2014-05-11 12:45:02 +02:00
Paul Sokolovsky
43d4a6fa31 run-tests: Add support for skipping tests.
MicrpPython test should print single "SKIP" line for test to be skipped.
2014-05-10 16:56:21 +03:00
Damien George
ffae48d750 py, compiler: Add basic support for A=const(123).
You can now do:

    X = const(123)
    Y = const(456 + X)

and the compiler will replace X and Y with their values.

See discussion in issue #266 and issue #573.
2014-05-08 15:58:39 +00:00
Damien George
9102af6afb tests: Add a test for native code on pyboard. 2014-05-07 18:55:31 +01:00
Damien George
c4ccb078a5 tests: Add inline assembler test for pyboard. 2014-05-07 18:31:14 +01:00
Damien George
41f768f3f3 tests: Add a suite of tests specifically for the pyboard.
In tests/pyb is now a suite of tests that tests the pyb module on the
pyboard.  They include expected output files because we can't run
CPython on the pyboard to compare against.

run-tests script has now been updated to allow pyboard tests to be run.
Just pass the option --pyboard.  This runs all basic, float and pyb
tests.  Note that float/math-fun.py currently fails because not all math
functions are implemented in stmhal/.
2014-05-03 16:43:27 +01:00
Damien George
91d0ab9b0f Merge pull request #504 from lurch/patch-4
Allow the uPy used by run-tests to be overridden
2014-04-17 17:20:26 +01:00
Damien George
5cd0b2227f tests: Split out those tests requiring float and import.
Tests in basics (which should probably be renamed to core) should not
rely on float, or import any non-built-in files.  This way these tests
can be run when those features are not available.

All test in basics now pass on the pyboard using stmhal port, except for
string-repr which has some issues with character hex printing.
2014-04-17 16:21:43 +01:00
Andrew Scheller
5709453ca7 Changed the envvar name to MICROPY_MICROPYTHON
As discussed in #504
2014-04-17 01:22:45 +01:00
Andrew Scheller
6ca17bcfb6 Stupid typo 2014-04-16 21:17:28 +01:00
Andrew Scheller
c297ca3327 Allow the uPy used by run-tests to be overridden
with MICROPY_MP_PY envvar, in an analogous way to MICROPY_CPYTHON3 envvar.

(the reason for this will be made clearer by a later PR)
2014-04-16 20:24:16 +01:00
Andrew Scheller
1b997d5244 run-tests can now skip certain tests when run under Travis CI
See the `skip_travis_tests` variable. Fixes #495
(also tidied up usage of os.path.basename() function)
2014-04-16 03:28:40 +01:00
Damien George
48aaa27c6a travis: Diff output, hopefully this works. 2014-04-15 12:20:22 +01:00
Damien George
35443610b1 travis: More tests debugging. 2014-04-15 11:38:30 +01:00
Damien George
4417478d0f tests: Make tests pass on pyboard. 2014-04-13 17:46:30 +01:00
Damien George
b636d024d2 Make pyboard.py have its own exception; update run-tests for pyboard. 2014-04-13 13:48:33 +01:00
Damien George
cdd96dff2c py: Implement more features in native emitter.
On x64, native emitter now passes 70 of the tests.
2014-04-06 12:58:40 +01:00
Paul Sokolovsky
a7752a4540 run-tests: Elaborate python3 command override capabilities. 2014-04-04 17:28:34 +03:00
Damien George
4b34c76fd6 Changes to get unix/ port compiling on Cygwin. 2014-04-03 23:51:16 +01:00
Damien George
2309369291 tests: Allow to run tests on pyboard.
To run the tests on the pyboard you need to set the "test_on_pyboard"
variable to "True", and also have tools/pyboard.py available for import
(easiest is to symlink to it).
2014-04-03 22:44:51 +01:00
Paul Sokolovsky
34e1199b3a run-tests: Allow to override python3 command to use via environment var. 2014-04-03 22:09:12 +03:00
Damien George
929a675a3d Change test scripts to use python3; bytecode tests use python3.4.
I upgraded to Python 3.4.0, so needed to make these changes.  Hopefully
the tests still run with Python 3.3.x (the scripts use python3 so are
agnostic as to the subversion).

Bytecode tests are tightly coupled to the Python version, and now some
fail against Python 3.4.
2014-04-02 15:31:39 +01:00
Damien George
10e21b9770 Add more tests. 2014-04-02 14:23:04 +01:00
Paul Sokolovsky
fd232c3ef7 run-tests: Dump output of failing tests to files again.
This was a long-standing regression from converting script from sh to python.
2014-03-23 01:58:07 +02:00
Damien George
4a74d31e70 run-tests can handle segfault. 2014-01-29 22:32:23 +00:00
Markus Siemens
19ccc6bdc7 Added Windows port (see #233) 2014-01-28 18:21:05 +01:00
Paul Sokolovsky
7280f79088 run-tests: Allow to run tests selectively via command line. 2014-01-21 05:02:58 +02:00
Damien George
7d08935458 Rename unix binary to 'micropython'. 2014-01-20 00:02:39 +00:00
Paul Sokolovsky
9954b4b99d Add directory for I/O tests with basic test for file methods. 2014-01-19 18:46:21 +02:00
Paul Sokolovsky
8c3858b016 Move tests in basic/tests/ up one level preparating to multiple test dirs. 2014-01-19 18:41:55 +02:00