Private
Public Access
2
0
Commit Graph

31 Commits

Author SHA1 Message Date
Noel Eck
d24457f9a1 ioinit: Update to build/test C++ ioinit
Multiple changes necessary to enable this.  The main goal is to build
and run the C++ ioinit unit tests (which require c++11)

    * Updated mraa required CMake version to 2.8.11 (this is needed for
      the target_xxx_xxx CMake syntax.
    * Added function for adding the c++11 flag give a CMake target.
    * Updated unit tests for range of CMake versions (tested on 2.8.11,
      3.8.2, 3.9.6, and 3.12.0).
    * Added C++ unit test file (more needed here).)

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-29 21:26:50 -07:00
Noel Eck
b3c1c5ac3c initio.c: Re-applied clang-format for source
Ran clang-format to conform to mraa's coding guide.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-23 21:51:58 -07:00
Noel Eck
e772aec69d initio: Handle no-conversion case in mraa_atoi_x
If strtol fails to process any characters, return a failure.

Added protocol chunk string to each parse_xxx method for completeness
when printing to syslog.

Added more tests - passing and failing cases.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-23 21:40:45 -07:00
Noel Eck
4487c98b6f gtest: Organized Gtest unit tests
This commit limits which tests run on which ARCH to allow all tests to
pass on CI.

    * Qualify the FTDI tests with (FTDI4222 AND USBPLAT)
    * Qualify the IO init tests with (DETECTED_ARCH == "MOCK")
    * Renamed all unit tests to start with 'test_unit_' to facilitate
      grouping with tab completion (or any other type of sorting)
    * Updated docker targets with new unit test target name

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-23 21:40:45 -07:00
Mihai Stefanescu
ae391fe9fe String based IO initialization for MRAA
Signed-off-by: Mihai Stefanescu <mihai.stefanescu@rinftech.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-23 21:40:12 -07:00
Noel Eck
b90c0efcb8 gtest: Added headers to unit tests
Added missing headers for the common and platform extender unit test
source files.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-17 09:48:45 -07:00
Noel Eck
fc4b2a554d Platform_extender: FT4222 library refactor
Updates to make the FT4222 platform extender more usable.

Previous implementation opened libft4222.so and loaded symbols as
needed.  This implementation removes dynamic loading of libft4222 in
favor of creating a new shared libary which links against libft4222.so.
The dynamic loading is now done in mraa.c.  One C method is exposed in
libmraa-platform-ft4222.so for finding/initializing an FT4222:

mraa_platform_t mraa_usb_platform_extender(mraa_board_t* board);

Mraa.c attempts to open this platform library and calls the
mraa_usb_platform_extender method.  If an ftdi4222 is connected, the
user gets added IO from the extender.  If no FT4222 device is connected,
continue as normal.

    * Create a new platform library for the FT4222
    * Expose only 1 C method from the library -
      mraa_usb_platform_extender
    * libmraa-platform-ft4222.so contains CXX code (as well as previous
      C code).  All *allocs have been removed in favor of global
      C++ stl containers.
    * Previously, the FT4222 would only initialize correctly if 2 ftdi
      devices existed.  Now, initialize FT4222 devices based on the
      device id.
    * Many fixes for various problems with the FT4222
    * Added unit test for platform extender (minimal functionality w/o hw)
    * Updated to FindFtd4222.cmake module to handle standard arguments
    * Removed CMAKE_C_FLAGS addition of -DFTDID2XX and -DFTDI4222 since
      these are NOT used anywhere in source.
    * Building the FTDI4222 shim requires libft4222.h which requires
      ftd2xx.h.  Updated CMakeLists.txt to require both when building
      the shim.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-06-26 12:57:13 -07:00
Noel Eck
467cf5132d gtest: Added Google Test
Added Google Test for unit testing.  Currently NOT required by
MRAA CMake.

    * Added a test fixture for mraa common C header methods.
    * Added a test fixture for mraa common C++ header methods.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-03-13 16:16:49 -07:00
Alex Tereschenko
e0052acfa7 mock tests cmake cfg: use PYTHON_DEFAULT_INTERP instead of _EXECUTABLE
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-06-19 20:48:29 +02:00
Brendan Le Foll
e1778c811d tests: add USEPYTHON3TESTS to explicitly use python3 for tests
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-06-19 20:48:29 +02:00
Brendan Le Foll
09f8b3ac7b tests: Remove checks for mraa.py python module
As commented by @alext-mkrs - When cmake runs through these lines, the
make naturally hasn't run yet, so there are no such files, so it doesn't
set the PYTHON_DEFAULT_INTERP variable and that causes it not to add
tests to the list later on

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-06-19 20:46:18 +02:00
Brendan Le Foll
131ff46a0d tests/CMakeLists.txt: Fix trying to run tests even if no python interpreter is available
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-05-31 17:17:39 +02:00
Brendan Le Foll
f927bffb16 tests/mock: make all mock tests executable
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-05-31 17:17:39 +02:00
Brendan Le Foll
1d37d3b162 tests/CMakeLists.txt: Clean up cmake tests to work with python 2&3
Adds additional checks and PYTHON_DEFAULT_INTERP var that is used to
find the correct python binary as well as checks to see if the
_python2-mraa or _python3-mraa targets have been built by checking
mraa.py. This does assume that this is all that is needed as checking
for TARGET() is not enough as the target is always 'valid'. We prefer
python2 and will only run the java tests if we can find python2

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-05-30 19:31:34 +02:00
Jon Trulson
e0a0dac47b uart: add tcsendbreak support
Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
2017-05-08 21:15:33 +02:00
Lunghi@Emutex
2a1590fdf1 platform_checks.py: Disable check on non edison platforms
Signed-off-by: Nicola Lunghi <nicola.lunghi@emutex.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-04-02 19:55:21 +02:00
Alex Tereschenko
9f03afbcbc mock: implement UART functionality
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-10-25 12:04:04 +01:00
Alex Tereschenko
bdbbfd03dd mraa mock: Add SPI functionality
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-08-19 16:00:53 +01:00
Alex Tereschenko
346f447c4d mock: added I2C functionality
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-07-27 11:28:53 +01:00
Alex Tereschenko
63b244cfc3 mock: added AIO pin and logic
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-07-11 10:48:43 +01:00
Alex Tereschenko
bcb6adc551 mock: added mraa mock platform infra and GPIO implementation
Mock platform allows one to use mraa without having any real HW.

This commit makes necessary foundational changes and implements
GPIO functionality as well as adds respective tests.

Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-07-05 16:19:05 +01:00
Brendan Le Foll
a177a3f729 cmake: Fix tests with multiple python bindings being built
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-06-01 11:21:20 +01:00
Brendan Le Foll
7088527339 tests/platform_checks.py: Fix test to check for NULL platform
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-03-22 18:12:30 +00:00
Stefan Andritoiu
8b68f3040e java: added sanity checks for sample mapping and bindings
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-01-21 15:28:03 +00:00
Stefan Andritoiu
c564dad68f CMakelists: Made tests building rule independent of the python build
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-01-21 15:28:03 +00:00
Brendan Le Foll
308289497e tests: make tests work on python3
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-09-08 14:42:04 +01:00
Brendan Le Foll
4599f3c12a tests: add cmake ctest infrastructure so make test can run
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-04-07 23:52:39 +01:00
Costin Constantin
8cc957ac64 tests: add python test cases suite
Currently only galileo is supported. This commit removes the old GTEST stuff
and mraa_test.cxx which never did much

Signed-off-by: Costin Constantin <costin.c.constantin@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-04-07 23:42:58 +01:00
Thomas Ingleby
6853997a92 mraa: rename from maa to mraa
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2014-06-24 17:24:54 +01:00
Brendan Le Foll
94941f5100 gtest: fix version test and change test cmake var name
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-05-20 15:40:28 +01:00
Brendan Le Foll
8b715745fc tests: add initial unit test env 2014-04-10 11:07:05 +01:00