1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

81 Commits

Author SHA1 Message Date
david gauchard
85e68093e9
Automatic stack location selection (SYS or HEAP), enable per library AR-chive in arduino build system (#5018)
Automatic stack location selection (SYS or HEAP), enable per library AR-chive in arduino build system 

* enable dot_a_linkage on internal libraries
* add device tests
* boards generator: deprecate --noextra4k/--allowWPS and fix documentation
2018-08-20 14:35:52 +02:00
Earle F. Philhower, III
03ea61a32a Add valgrind and string tests to host_tests (#4939)
* Add valgrind and string tests to host_tests

Valgrind identified an error that was causing intermittent failures in
the host tests, and can check for subtle memory access and allocation bugs.
Add it to the standard host_test suite, and any errors will cause test
failure.

Also start adding string tests, since two undefined behaviors have been
found so far just by inspection.

* Add additional String tests

Looks like a possible bug in the concatenation operator, need to verify
expected behavior.

* Remove verbose from valgrind run

No need to be so chatty on the test.  Errors were a little hard to spot.
Go to normal verbosity.

* Add lcov and more string tests

LCOV and genhtml can generate nice HTML coverage charts hilighting test
coverage issues in a much simpler way than gcov text format.  Generate these
automatically from gcov output.

Add additional string creation and comparison tests.

* Move String coverage to >50%

Additional string tests and checks

* 66% test coverage in String

* Add allocation-unit-sized strings test

Ensure that strings that are right on the edge of the allocation
size are handled properly and account for trailing 0.
2018-07-27 13:10:55 -04:00
Earle F. Philhower, III
794630e068
Remove dependency on SD/SPIFFS from CertStore (#4760)
Due to popular demand, remove the hardcoded dependency on SPIFFS
or SD from the CertStore by factoring out the file interface into
a new class (CertStoreFile) that the user will need to implement
as a thin wrapper around either a SPIFFS.file or a SD.file

Combine the downloaded certificates into a UNIX "ar" archive
and parse that on-the-fly to allow easy inspection and creation
of the Cert Store database.

Examples updated with a new certificate downloader that creates
the certs.ar archive and with a single sample that can be built
for either SPIFFS or SD with a #define.  Users can copy the
implementation of the CertStoreFile they need to their own code
as it is self-contained.

Also move the CertStore to the BearSSL namespace and remove the
suffix and separate SPIFFS/SD sources.

Remove the "deep+" change from the CI build as well (no special
options needed on any PIO or makefile build).

We'll revisit the filesystem wrapper for 2.5.0, hopefully having a
unified template for both filesystem usage at a global level.  For
current users, be aware the interface may change (simplify!) in
release 2.5.0.

Fixes #4740
2018-06-12 19:06:26 -07:00
Earle F. Philhower, III
a1a9b99af6 Add build_even/odd types to split Arduino tests (#4737)
Arduino builds are now taking 49 minutes or more, and failing due to
Travis timeouts.

Split the Arduino build task into even and odd half, where each job
will build every other test.  This will reduce any test's runtime
by 50% and speed up checks to avoid the timeout.
2018-05-21 14:34:15 -04:00
Earle F. Philhower, III
e3c970210f
Add BearSSL client and server, support true bidir, lower memory, modern SSL (#4273)
BearSSL (https://www.bearssl.org) is a TLS(SSL) library written by
Thomas Pornin that is optimized for lower-memory embedded systems
like the ESP8266. It supports a wide variety of modern ciphers and
is unique in that it doesn't perform any memory allocations during
operation (which is the unfortunate bane of the current axTLS).

BearSSL is also absolutely focused on security and by default performs
all its security checks on x.509 certificates during the connection
phase (but if you want to be insecure and dangerous, that's possible
too).

While it does support unidirectional SSL buffers, like axTLS,
as implemented the ESP8266 wrappers only support bidirectional
buffers. These bidirectional buffers avoid deadlocks in protocols
which don't have well separated receive and transmit periods.

This patch adds several classes which allow connecting to TLS servers
using this library in almost the same way as axTLS:
BearSSL::WiFiClientSecure - WiFiClient that supports TLS
BearSSL::WiFiServerSecure - WiFiServer supporting TLS and client certs

It also introduces objects for PEM/DER encoded keys and certificates:
BearSSLX509List - x.509 Certificate (list) for general use
BearSSLPrivateKey - RSA or EC private key
BearSSLPublicKey - RSA or EC public key (i.e. from a public website)

Finally, it adds a Certificate Authority store object which lets
BearSSL access a set of trusted CA certificates on SPIFFS to allow it
to verify the identity of any remote site on the Internet, without
requiring RAM except for the single matching certificate.
CertStoreSPIFFSBearSSL - Certificate store utility

Client certificates are supported for the BearSSL::WiFiClientSecure, and
what's more the BearSSL::WiFiServerSecure can also *require* remote clients
to have a trusted certificate signed by a specific CA (or yourself with
self-signing CAs).

Maximum Fragment Length Negotiation probing and usage are supported, but
be aware that most sites on the Internet don't support it yet.  When
available, you can reduce the memory footprint of the SSL client or server
dramatically (i.e. down to 2-8KB vs. the ~22KB required for a full 16K
receive fragment and 512b send fragment).  You can also manually set a
smaller fragment size and guarantee at your protocol level all data will
fit within it.

Examples are included to show the usage of these new features.

axTLS has been moved to its own namespace, "axtls".  A default "using"
clause allows existing apps to run using axTLS without any changes.

The BearSSL::WiFi{client,server}Secure implements the axTLS
client/server API which lets many end user applications take advantage
of BearSSL with few or no changes.

The BearSSL static library used presently is stored at
https://github.com/earlephilhower/bearssl-esp8266 and can be built
using the standard ESP8266 toolchain.
2018-05-14 20:46:47 -07:00
Muhammad Azeez
4305275f8d fix a very small typo in http client tests (#4633) 2018-04-11 17:38:20 +08:00
Ivan Grokhotkov
dae30eccbe host side tests: update documentation about environment variables 2018-04-11 11:19:21 +08:00
Ivan Grokhotkov
1acaa8b8f6 allow reading test environment from python mocks
This allows requesting environment variable values set in the C++ test
code, from python mock code. Use case is cross-checking test
results against values expected by the host side part of the test.
2018-04-11 11:19:21 +08:00
Ivan Grokhotkov
8bd26f2ded add support for environment variables in device tests
Previously device tests included information such as access point SSID/password at compile time. This made it difficult to compile test binaries once and then send them to multiple test runners for execution.

This change adds a command to the test library to set environment variable on the target device: “setenv key value”. C library setenv/getenv facility is used to store variables.

Test runner, tests, and makefile are updated to use this functionality.
2018-04-11 11:19:21 +08:00
david gauchard
d5cbd91775 device test for #4516 (WiFiClient leaking) (#4549)
* device test for #4516 (WiFiClient leaking)

* simply count the number of connections that do not change heap

* remove unused heapLost

* + python server (to not depend on gateway's opened tcp port)

* remove old&bad define

* fix another old address
2018-03-23 11:30:59 -03:00
david gauchard
2013af1b19
fix minor issues in test runner scripts on device (#4542)
* tests/device/Makefile: use bourne shell compatible "." instead ot "source" (ubuntu's dash does not understand it)

* tests/device: make BEGINTIMEOUT a new error return value instead of a test-process-breaking exception
2018-03-21 17:07:23 +01:00
mrwgx3
3934d10f21 Correct millis() drift, issue #3078 (#4264)
* Correct millis() drift, issue 3078

* Add 'test_millis_mm.ino' runtime benchmark

* Eliminate 'punning' warning

Add union 'acc' in millis() to eliminate 'punning' compiler warning

* Correct minor typo

* Eliminate 'punning' warning

 Add union 'acc' to eliminate 'punning' compiler warning  in 'millis_test'_DEBUG() and 'millis_test()'
2018-03-12 15:28:04 -03:00
Ivan Grokhotkov
e226251b27 ci: check examples code style
Use code style defined in Arduino project to check code style of the
examples. The check is done by formatting all files with astyle and
checking whether any changes have been introduced.
2018-03-08 14:32:06 +08:00
Ivan Grokhotkov
ee5a1e2804 WiFiClient: don’t destroy ClientContext on ::stop
Reported in https://github.com/esp8266/Arduino/issues/4078.

WiFiClient::stopAll, called from a WiFi disconnected event handler,
could be called while WiFiClient::connect was in progress. This issue
was initially fixed in #4194, by testing `this` pointer for being
non-null in ClientContext::connect.

This change delegates deletion of ClientContext to WiFiClient
destructor. WiFiClient::stop only calls ClientContext::stop, which
closes/aborts the connection.
2018-02-20 03:33:55 +03:00
Ivan Grokhotkov
f3f00ed64e gitignore: ignore generated files 2018-02-19 17:11:48 +03:00
Ivan Grokhotkov
0d17639bee ci: check that files generated by boards.txt.py are up to date
Files are re-generated in CI build, and git diff is used to check if
there have been any changes.
2018-02-19 12:43:30 +03:00
Earle F. Philhower, III
f9ac524b13
Add -Werror to acceptance builds for C and CPP (#4369)
Use platform.local.txt to add -Werror to GCC for the build of all
code.  Any warnings on a submitted patch will cause an error.

Several examples and libraries had warnings/errors (missing returns
on functions, types, etc.).  Clean those up with this commit as well.
2018-02-17 18:47:10 -08:00
Ivan Grokhotkov
2c8b2b92ce tests: minor fixes, add README.md 2018-01-09 15:59:08 +08:00
Ivan Grokhotkov
e7127118c6 tests/device: clean up requirements.txt, use latest versions 2018-01-09 15:59:08 +08:00
Ivan Grokhotkov
74ba914ced tests/device: add make target to generate test reports 2018-01-09 15:59:08 +08:00
Ville Skyttä
ed83304179 Python 3.6 invalid escape sequence deprecation fixes
https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior
2018-01-01 17:53:27 +03:00
Ville Skyttä
7dca0727e1 Python 3 syntax fixes 2018-01-01 17:53:27 +03:00
Ville Skyttä
b4653f4d44 Fix URL parameter decoding in web server (#3313)
* Make HTTP server test data easier to examine

* Add HTTP server parameter tests containing & and =

* Fix URL parameter decoding in web server

The parameters string needs to be first split on & and =, and URL
decoding on parts done after that. Otherwise URL encoded & and = within
parameter names and values cause incorrect splitting.
2017-12-30 14:24:37 -03:00
Ivan Grokhotkov
cc9e799fc1 ci: split into multiple jobs 2017-12-13 23:50:57 +08:00
Ivan Kravets
6e75ae49ad
CI: Use updated staging dev/platform without "_stage" suffix 2017-11-30 00:10:50 +02:00
Ivan Kravets
83dd960fe5 Install @PlatformIO Core to user's space 2017-09-12 20:02:30 +03:00
Ivan Kravets
ff4bb73084 Integration with @PlatformIO Build System 2017-08-07 15:41:35 +03:00
Ivan Grokhotkov
3363be0063 ci: fix -e flag not restored in build_sketches on error 2017-05-20 12:13:20 +08:00
Ivan Grokhotkov
a3a7e87df7 ci: build and upload releases on Travis 2017-05-15 03:49:21 -05:00
Sven Eliasson
2404a602af Const-correctness for MD5Builder (#3222)
Resolves #1175
2017-05-12 01:03:14 -05:00
Me No Dev
2364ad4dd0 Web Server Test (#1) (#2231)
* Initial WebServer Test

* ignore .pyc files

* add poster as requirement to virtualenv
2016-07-05 16:18:53 +08:00
Ivan Grokhotkov
7a2d2460f3 Add sample test for WiFiServer
Mostly an example of writing tests for servers
2016-07-04 18:22:27 +08:00
Me No Dev
af3b17c0bb add more begin timeout for networked sketches and actually fail if begin is not received (#2223) 2016-07-04 17:01:57 +08:00
Ivan Grokhotkov
438744044c Add test for mktime and localtime (#1745) 2016-07-04 15:07:23 +08:00
Ivan Grokhotkov
6d3109e8c7 Remove implementations of non-ISO libc functions which are present in newlib 2016-06-27 21:10:41 +08:00
Ivan Grokhotkov
5e3df08273 Add tests for sqrt, fmod (#612) and floating point printf/scanf (#1179) 2016-06-23 17:44:33 +08:00
Ivan Grokhotkov
d7d98d03ca Use libc from newlib (#1752)
* Use newlib libc library

This change adds libcmin.a, which is created from newlib libc by selectively removing some of the object files (mostly related to heap management).
The list of files is available in tools/sdk/lib/make_libcmin.sh. Files which are not needed are commented out.
This change adds support for various functions which were missing, like sscanf, strftime, etc.

* Fix some of the time functions

* Redirect stdout to serial

* Implement __putc_r

* Switch to custom newlib build

Built from https://github.com/igrr/newlib-xtensa using:
./configure --with-newlib --enable-multilib --disable-newlib-io-c99-formats --enable-newlib-supplied-syscalls --enable-target-optspace --program-transform-name="s&^&xtensa-lx106-elf-&" --disable-option-checking --with-target-subdir=xtensa-lx106-elf --target=xtensa-lx106-elf --enable-newlib-nano-formatted-io --enable-newlib-reent-small  --prefix=path-to-arduino-core/tools/sdk/libc
CROSS_CFLAGS="-DMALLOC_PROVIDED -DSIGNAL_PROVIDED -DABORT_PROVIDED" make
make install

* Update tests
2016-06-23 17:27:57 +08:00
Ivan Grokhotkov
e64e32b329 Fix regression in WiFiClientSecure, update HTTPS test case (#2150) 2016-06-15 11:49:51 +08:00
Ivan Grokhotkov
da17d5425a Fix regression in WiFi.onEvent, add testcase (thanks @everslick) 2016-06-14 13:09:46 +08:00
Ivan Grokhotkov
a14ac2cbdd Bring back old semantics to random and randomSeed, add secureRandom (#1710) (#2142) 2016-06-14 07:17:54 +08:00
Ivan Grokhotkov
b9dfe01903 Fix SPIFFS.openDir("") (#2143)
* Update spiffs_api.cpp

Fixes a bug where un-prefixed files are irretrievable with openDir(""). Described: https://github.com/esp8266/Arduino/issues/1818.

* Update FS test cases
2016-06-14 07:15:55 +08:00
Ivan Grokhotkov
063e4cc88f Add tests for MD5Builder, reformat and clean up code 2016-06-13 12:47:33 +08:00
Ivan Grokhotkov
5eb6a7f449 Add mechanism for posting functions to the main loop (#2082)
* Add mechanism for posting functions to the main loop (#1064)

* Fix indentation, add note that API is not stable
2016-06-08 11:22:48 +08:00
Ivan Grokhotkov
dd81336b79 ESP8266HTTPClient: fix duplicate Content-Length headers (#1902) 2016-06-03 16:11:44 +08:00
Ivan Grokhotkov
15aed3b06e Add missing python script for HTTP client test 2016-05-11 14:56:46 +08:00
Ivan Grokhotkov
082a4865fc Tests update 2016-05-10 21:52:26 +08:00
Ivan Grokhotkov
102872a296 More HTTPClient tests 2016-04-26 16:04:19 +08:00
Ivan Grokhotkov
e9f3a3de1f Fix passing of debug level to the builder 2016-04-26 16:04:19 +08:00
Ivan Grokhotkov
ab7af89002 Device side test library and test runner 2016-04-26 16:04:19 +08:00
Ivan Grokhotkov
51880310be Clean build directory after each sketch 2016-03-28 00:28:05 +03:00