tukaani-project / xz

XZ Utils
https://tukaani.org/xz/
Other
532 stars 95 forks source link

[Feature Request]: Copying/installing the built 'make check' suite to a directory #54

Closed cblc closed 1 year ago

cblc commented 1 year ago

Describe the Feature

When cross-compiling to Windows (for example from either Linux or MacOS to Windows, using mingw-w64), I'd like to be able to run the make check suite in a Windows guest in a VM. For this to be possible, I'd need that the tests executables and scripts be copied (or installed) to a given directory, which I could have set up as a shared folder with a virtual machine.

The current behaviour when you cross-compile and issue a make check, is that all test programs are built, but then they are executed (which obviously fails, as you are cross compiling).

If your build system was plain Makefiles, I'd happily volunteer to implement this feature, but I have no Autotools knowledge, so I'm afraid I cannot help writing it.

Perhaps a good way of implementing this would be to add a switch to configure, so that when that switch is present, all the test programs are built but not executed, and are also installed when you do a make install. The only problem I see is that I'm not sure if the main script that runs all tests could be saved as a normal script file or if you are running all the tests directly from the Makefile generated by configure.

Expected Complications

No response

Will I try to implement this new feature?

No

thesamesam commented 1 year ago

Please see the discussion in https://github.com/tukaani-project/xz/pull/52.

cblc commented 1 year ago

Great, thank you very much!

Does the test suite consist in invoking the following executables, or do I need to invoke them in some special way, or are there perhaps other scripts to run? (these executables are what I get in the tests directory when building to 32bit Windows with mingw-w64)

tests/create_compress_files.exe tests/test_check.exe        tests/test_hardware.exe     tests/test_lzip_decoder.exe tests/test_vli.exe
tests/test_bcj_exact_size.exe   tests/test_filter_flags.exe tests/test_index.exe        tests/test_memlimit.exe
tests/test_block_header.exe tests/test_filter_str.exe   tests/test_index_hash.exe   tests/test_stream_flags.exe
cblc commented 1 year ago

Everything clear, I think. I have created this batch file which, AFAIK, runs all the tests that can be run from cross-compilation.

There's an extra step, though, before running this batch file, and it's that you must copy the complete files folder (located under the tests folder in the source code) into the built tests folder, for the script to run:

test_bcj_exact_size.exe || exit /b
test_block_header.exe || exit /b
test_check.exe || exit /b
test_filter_flags.exe || exit /b
test_filter_str.exe || exit /b
test_hardware.exe || exit /b
test_index.exe || exit /b
test_index_hash.exe || exit /b
test_lzip_decoder.exe || exit /b
test_memlimit.exe || exit /b
test_stream_flags.exe || exit /b
test_vli.exe || exit /b
cblc commented 1 year ago

You are free to close this issue, unless you feel that something could be added. Thank you very much!!

JiaT75 commented 1 year ago

Thanks @cblc for reporting this! We had a similar report recently (mentioned by @thesamesam) so we made a much needed update to the INSTALL file. I hope this update helps you and future users with similar questions.