ros-tooling / cross_compile

A tool to build ROS and ROS2 workspaces for various targets
Apache License 2.0
188 stars 60 forks source link

Add travis configuration and fix flake8 failures #23

Closed prajakta-gokhale closed 5 years ago

prajakta-gokhale commented 5 years ago

Fixes https://github.com/ros-security/aws-roadmap/issues/34.

Signed-off-by: Prajakta Gokhale prajaktg@amazon.com

emersonknapp commented 5 years ago

This looks pretty good, but should the travis be passing?

prajakta-gokhale commented 5 years ago

This looks pretty good, but should the travis be passing?

I was expecting it to pass, since the tests passed locally using the same commands. I'll double check tomorrow to see why it failed.

thomas-moulard commented 5 years ago
==================================== ERRORS ====================================
_____________ ERROR at setup of test_sysroot_compiler_constructor ______________
file /home/travis/ros2_latest_cross_compile_ws/src/cross_compile/test/test_sysroot_compiler.py, line 97
  def test_sysroot_compiler_constructor(
E       fixture 'tmp_path' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, docker_config, doctest_namespace, mock, mocker, monkeypatch, platform_config, pytestconfig, record_xml_property, recwarn, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.
/home/travis/ros2_latest_cross_compile_ws/src/cross_compile/test/test_sysroot_compiler.py:97
_______________ ERROR at setup of test_write_cc_build_setup_file _______________
file /home/travis/ros2_latest_cross_compile_ws/src/cross_compile/test/test_sysroot_compiler.py, line 110
  def test_write_cc_build_setup_file(platform_config, docker_config, tmp_path):
E       fixture 'tmp_path' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, docker_config, doctest_namespace, mock, mocker, monkeypatch, platform_config, pytestconfig, record_xml_property, recwarn, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.
/home/travis/ros2_latest_cross_compile_ws/src/cross_compile/test/test_sysroot_compiler.py:110
______________ ERROR at setup of test_write_cc_system_setup_file _______________
file /home/travis/ros2_latest_cross_compile_ws/src/cross_compile/test/test_sysroot_compiler.py, line 121
  def test_write_cc_system_setup_file(platform_config, docker_config, tmp_path):
E       fixture 'tmp_path' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, docker_config, doctest_namespace, mock, mocker, monkeypatch, platform_config, pytestconfig, record_xml_property, recwarn, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.
/home/travis/ros2_latest_cross_compile_ws/src/cross_compile/test/test_sysroot_compiler.py:121
=================================== FAILURES ===================================
_________________________________ test_flake8 __________________________________
test/test_flake8.py:61: in test_flake8
    assert not report.total_errors, \
E   AssertionError: flake8 reported 5 errors
E   assert not 5
E    +  where 5 = <flake8.api.legacy.Report object at 0x7fc858ee1c88>.total_errors
----------------------------- Captured stdout call -----------------------------
5     E501 line too long (92 > 79 characters)
----------------------------- Captured stderr call -----------------------------
ERROR:flake8.api.legacy:Could not update option "extend_ignore"
legacy.py                   46 ERROR    Could not update option "extend_ignore"
ERROR:flake8.api.legacy:Could not update option "extend_ignore"
legacy.py                   46 ERROR    Could not update option "extend_ignore"
/home/travis/ros2_latest_cross_compile_ws/src/cross_compile/cross_compile/sysroot_compiler.py:246:80: E501 line too long (86 > 79 characters)
        logger.info('Fetching sysroot base image: %s', self._docker_config.base_image)
                                                                               ^
/home/travis/ros2_latest_cross_compile_ws/src/cross_compile/cross_compile/sysroot_compiler.py:279:80: E501 line too long (88 > 79 characters)
                    'Error building sysroot image. The following error was caught:\n%s',
                                                                               ^
/home/travis/ros2_latest_cross_compile_ws/src/cross_compile/cross_compile/sysroot_compiler.py:281:80: E501 line too long (87 > 79 characters)
                raise docker.errors.BuildError(reason=error_line, build_log=error_line)
                                                                               ^
/home/travis/ros2_latest_cross_compile_ws/src/cross_compile/cross_compile/ros2_cross_compile.py:92:80: E501 line too long (92 > 79 characters)
        help='Base Docker image to use for building the sysroot. Ex. arm64v8/ubuntu:bionic')
                                                                               ^
/home/travis/ros2_latest_cross_compile_ws/src/cross_compile/cross_compile/ros2_cross_compile.py:98:80: E501 line too long (82 > 79 characters)
        help="Docker's network_mode parameter to use for all Docker interactions")
                                                                               ^
flake8 reported 5 errors
------------------------------ Captured log call -------------------------------
legacy.py                   46 ERROR    Could not update option "extend_ignore"
legacy.py                   46 ERROR    Could not update option "extend_ignore"
================= 1 failed, 2 passed, 3 error in 0.64 seconds ==================
---
Finished <<< cross_compile [1.85s]  [ with test failures ]
]0;colcon test [1/1 done] [0 ongoing]
Summary: 1 package finished [3.85s]
  1 package had test failures: cross_compile
The command "colcon test --event-handlers console_cohesion+ --packages-select cross_compile --return-code-on-test-failure" exited with 1.

Usually those discrepancies happen if you're running flake8 from the command line instead of using colcon test

The fixture problem is more concerning to me... maybe a missing import?

prajakta-gokhale commented 5 years ago

The fixture problem is more concerning to me... maybe a missing import?

Looks like the version of pytest used to run the tests doesn't support tmp_path fixture. Changed it to tmpdir which is supported.

thomas-moulard commented 5 years ago

Seems like your attempt to break the build was unsuccessful? (Break travis build is green)

prajakta-gokhale commented 5 years ago

Seems like your attempt to break the build was unsuccessful? (Break travis build is green)

I realized right after pushing that commit that it won't work because CI is still only running on master. Testing CI by breaking the build will have to be done outside of this PR.

emersonknapp commented 5 years ago

@thomas-moulard not ready for review, I will ping you when it is