PEGTL icon indicating copy to clipboard operation
PEGTL copied to clipboard

MSYS2 environment is not considered in tests

Open Totto16 opened this issue 1 year ago • 3 comments

3 Tests fail on msys, since wrong file names are used in those cases.

src/test/pegtl/file_file.cpp src/test/pegtl/file_mmap.cpp src/test/pegtl/file_read.cpp

In this code MSYS isn't considered and handled incorrectly

src/test/pegtl/verify_file.hpp:11

#if defined( _MSC_VER )
#define TAO_PEGTL_TEST_FILENAME u"src/test/pegtl/file_äöü𝄞_data.txt"
#else
#define TAO_PEGTL_TEST_FILENAME "src/test/pegtl/file_äöü𝄞_data.txt"
#endif

I think fixing this is easy, just detect msys2 and use the correct string format there.

See e.g. this CI run as example

Totto16 avatar Aug 10 '24 19:08 Totto16

That does sound like an easy fix, however I'm not sure what "the correct format" for MSYS2 is, and I don't have an environment to test it myself. In other words, can you please let me know whether

#if defined( _MSC_VER ) || defined( __MSYS__ )
#define TAO_PEGTL_TEST_FILENAME u"src/test/pegtl/file_äöü𝄞_data.txt"
#else
#define TAO_PEGTL_TEST_FILENAME "src/test/pegtl/file_äöü𝄞_data.txt"
#endif

or

#if defined( _MSC_VER ) && !defined( __MSYS__ )
#define TAO_PEGTL_TEST_FILENAME u"src/test/pegtl/file_äöü𝄞_data.txt"
#else
#define TAO_PEGTL_TEST_FILENAME "src/test/pegtl/file_äöü𝄞_data.txt"
#endif

is needed?

ColinH avatar Aug 11 '24 06:08 ColinH

Note to self: https://www.msys2.org/wiki/Porting/

ColinH avatar Aug 11 '24 06:08 ColinH

That does sound like an easy fix, however I'm not sure what "the correct format" for MSYS2 is, and I don't have an environment to test it myself. In other words, can you please let me know whether

#if defined( _MSC_VER ) || defined( __MSYS__ )
#define TAO_PEGTL_TEST_FILENAME u"src/test/pegtl/file_äöü𝄞_data.txt"
#else
#define TAO_PEGTL_TEST_FILENAME "src/test/pegtl/file_äöü𝄞_data.txt"
#endif

or

#if defined( _MSC_VER ) && !defined( __MSYS__ )
#define TAO_PEGTL_TEST_FILENAME u"src/test/pegtl/file_äöü𝄞_data.txt"
#else
#define TAO_PEGTL_TEST_FILENAME "src/test/pegtl/file_äöü𝄞_data.txt"
#endif

is needed?

I am not entirely sure myself either, but I can test it, if msys support is planned a CI would be helpful too, maybe I can contribute one

Totto16 avatar Aug 11 '24 13:08 Totto16