ni / nixnet-python

NI-XNET Python API
https://nixnet.readthedocs.io/en/latest/
MIT License
25 stars 22 forks source link

Buffer size errors occur during integration tests with 32-bit Python 3.6.4 #247

Closed d-bohls closed 6 years ago

d-bohls commented 6 years ago

Using 32-bit Python 3.6.4, I run the integration tests as follows:

tox -c tox-integration.ini -- --can-in-interface CAN1 --can-out-interface CAN2

and get the following errors:

================================== FAILURES ===================================
___________________________ test_session_properties ___________________________

can_out_interface = 'CAN2'

    @pytest.mark.integration
    def test_session_properties(can_out_interface):
        """Verify Session properties.

        Ideally, mutable properties would be set to multiple values and we'd test
        for the intended side-effect.  That'll be a massive undertaking.  For now,
        ensure they are settable and getttable.
        """
        database_name = 'NIXNET_example'
        cluster_name = 'CAN_Cluster'
        frame_name = 'CANEventFrame1'

        with nixnet.FrameOutQueuedSession(
                can_out_interface,
                database_name,
                cluster_name,
                frame_name) as output_session:
>           print(output_session.time_current)

tests\test_session.py:66:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nixnet\_session\base.py:383: in time_current
    ctypes.pointer(state_value_ctypes))
nixnet\_funcs.py:158: in nx_read_state
    _errors.check_for_error(result.value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

error_code = 3220582542

    def check_for_error(error_code):
        if error_code & _cconsts.NX_STATUS_ERROR:
            buffer_size = 2048
            error_buffer = ctypes.create_string_buffer(buffer_size)

            _cfuncs.lib.nx_status_to_string(error_code, buffer_size, error_buffer)

>           raise errors.XnetError(error_buffer.value.decode("ascii"), error_code)
E           nixnet.errors.XnetError: NI-XNET:  (Hex 0xBFF6308E) The contents of the property is bigger than the size specified. Use the nxGetPropertySize function to determine the size of the buffer needed.

nixnet\_errors.py:20: XnetError
_____________________ test_session_properties_transition ______________________

can_out_interface = 'CAN2'

    @pytest.mark.integration
    def test_session_properties_transition(can_out_interface):
        """Verify Session properties relationship to session start/stop."""
        database_name = 'NIXNET_example'
        cluster_name = 'CAN_Cluster'
        frame_name = 'CANEventFrame1'

        with nixnet.FrameOutQueuedSession(
                can_out_interface,
                database_name,
                cluster_name,
                frame_name) as output_session:
            with pytest.raises(errors.XnetError):
                print(output_session.time_start)
            with pytest.raises(errors.XnetError):
                print(output_session.time_communicating)
            assert output_session.state == constants.SessionInfoState.STOPPED

            output_session.start()

>           print(output_session.time_start)

tests\test_session.py:123:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nixnet\_session\base.py:395: in time_start
    ctypes.pointer(state_value_ctypes))
nixnet\_funcs.py:158: in nx_read_state
    _errors.check_for_error(result.value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

error_code = 3220582542

    def check_for_error(error_code):
        if error_code & _cconsts.NX_STATUS_ERROR:
            buffer_size = 2048
            error_buffer = ctypes.create_string_buffer(buffer_size)

            _cfuncs.lib.nx_status_to_string(error_code, buffer_size, error_buffer)

>           raise errors.XnetError(error_buffer.value.decode("ascii"), error_code)
E           nixnet.errors.XnetError: NI-XNET:  (Hex 0xBFF6308E) The contents of the property is bigger than the size specified. Use the nxGetPropertySize function to determine the size of the buffer needed.

nixnet\_errors.py:20: XnetError