diff options
author | Paul Smith <psmith@gnu.org> | 2016-12-23 13:33:58 -0500 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2016-12-26 09:01:59 -0500 |
commit | 45bf0e3a6757a565dd15050ae46b42a3d534477b (patch) | |
tree | e76f7472f495c6ae0dd409eaa468a29262382848 /tests/test_driver.pl | |
parent | c6966b323811c37acedff05b576b907b06aea5f4 (diff) | |
download | make-git-45bf0e3a6757a565dd15050ae46b42a3d534477b.tar.gz |
Portability changes for the test suite.
* tests/test_driver.pl: Save error strings for later comparison.
* tests/run_make_tests.pl: Create portable commands for later use.
* tests/*: Use these new variables.
Diffstat (limited to 'tests/test_driver.pl')
-rw-r--r-- | tests/test_driver.pl | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_driver.pl b/tests/test_driver.pl index e6cd9f9e..cb0a1b21 100644 --- a/tests/test_driver.pl +++ b/tests/test_driver.pl @@ -55,6 +55,30 @@ $test_timeout = 10 if $^O eq 'VMS'; # Path to Perl $perl_name = $^X; +# Find the strings that will be generated for various error codes. +# We want them from the C locale regardless of our current locale. + +my $loc = undef; +if ($has_POSIX) { + $loc = POSIX::setlocale(POSIX::LC_MESSAGES); + POSIX::setlocale(POSIX::LC_MESSAGES, 'C'); +} + +open(my $F, '<', 'file.none') and die "Opened non-existent file!\n"; +$ERR_no_such_file = "$!"; + +touch('file.out'); +chmod(0444, 'file.out'); +open(my $F, '>', 'file.out') and die "Opened read-only file!\n"; +$ERR_read_only_file = "$!"; + +chmod(0000, 'file.out'); +open(my $F, '<', 'file.out') and die "Opened unreadable file!\n"; +$ERR_unreadable_file = "$!"; + +unlink('file.out'); +$loc and POSIX::setlocale(POSIX::LC_MESSAGES, $loc); + # %makeENV is the cleaned-out environment. %makeENV = (); |