ros2 / launch

Tools for launching multiple processes and for writing tests involving multiple processes.
Apache License 2.0
126 stars 144 forks source link

Tests on Windows falsely positive reporting passed due to SIGINT handling #767

Open huweiATgithub opened 8 months ago

huweiATgithub commented 8 months ago

Bug report

Required Info:

Steps to reproduce issue

  1. Write a launch file in Python to launch one or more nodes.
  2. Write a gtest executable (for communication) that exit with code 1.
  3. build and test with rostest and launch_testing.asserts.assertExitCodes:

    @pytest.mark.rostest
    def generate_test_description():
        return (
            LaunchDescription(
                [...]
            ),
            {...: ...},
        )
    
    @launch_testing.post_shutdown_test()
    class TestOutcome(unittest.TestCase):
        def test_exit_codes(self, proc_info):
            launch_testing.asserts.assertExitCodes(proc_info)

Expected behavior

Failures are reported through assertExitCodes with a non-zero exit code.

Actual behavior

The test passes.

Additional information

This is related to https://github.com/ros2/launch/pull/94 which sends SIGTERM (it is stated that SIGINT is not supported in Windows). Besides, exit_code=1 is allowed in https://github.com/ros2/launch/blob/d9ffd805e3d9ca42fe4dd0019ae095e9eb0d4d72/launch_testing/launch_testing/asserts/assert_exit_codes.py#L34-L39

Ask for help

@hidmic Do you have some information? (I notice the TODO are assigned to you.)

fujitatomoya commented 8 months ago

Write a gtest executable (for communication) that exit with code 1. Are there any available workarounds for writing tests on Windows?

can you try exit code with different values like 2 or something else, to see if the test completes as expected?