ingydotnet / inline-c-pm

10 stars 19 forks source link

Use File::Path for creating temporary directories in the tests #102

Closed ppisar closed 2 years ago

ppisar commented 2 years ago

The tests used to create a temporary tree under a working directory. But that does not work if that location is read-only:

$ perl t/01syntax.t Uncaught exception from user code: _Inline_01syntax.17483: Permission denied BEGIN failed--compilation aborted at /usr/libexec/perl-Inline-C/t/TestInlineSetup.pm line 30. Compilation failed in require at t/01syntax.t line 6. BEGIN failed--compilation aborted at t/01syntax.t line 6.

Also the code tried hard to pick up a unique name to allow testing in parallel. And then cleaning up when exiting.

This patch replaced that code with File::Temp. Not only it replaces complex code, it also enables testing from a read only location because File::Test utilizes a system-wide temporary path.

I cannot test it on Win32 platform. But I believe it should correctly work there because the cleanup is performed when the File::Temp object goes out of scope which should be after END block.

ppisar commented 2 years ago

I removed the File::Spec shuffle.

mohawk2 commented 2 years ago

Thank you! Dev-released as 0.82_001. @ingydotnet @perlpunk FYI