# HG changeset patch # User Markus Mützel # Date 1680962995 -7200 # Node ID 9b36d30d27e3f81c97a6dc89d9b8fb106113107d # Parent a40fd748bf1f0cb023c991b2965f198ef9d2a6d9 Make tests that fail with libc++ dependent on whether Octave uses it. * libinterp/corefcn/dlmread.cc, libinterp/corefcn/strfcns.cc, libinterp/corefcn/mappers.cc, scripts/general/logspace.m, scripts/io/importdata.m, test/io.tst: Currently, some tests are guarded on whether they execute on MacOS or not. But the test result in fact depends on known differences between libstdc++ and libc++. Use HAVE_LLVM_LIBCXX as the condition for these tests instead. diff -r a40fd748bf1f -r 9b36d30d27e3 libinterp/corefcn/dlmread.cc --- a/libinterp/corefcn/dlmread.cc Sat Apr 08 14:11:13 2023 +0200 +++ b/libinterp/corefcn/dlmread.cc Sat Apr 08 16:09:55 2023 +0200 @@ -601,7 +601,7 @@ %! unlink (file); %! end_unwind_protect -%!testif ; ! ismac () +%!testif ; ! __have_feature__ ("LLVM_LIBCXX") %! file = tempname (); %! unwind_protect %! fid = fopen (file, "wt"); @@ -622,9 +622,8 @@ %! unlink (file); %! end_unwind_protect -%!test <47413> -%! ## Same test code as above, but intended only for test statistics on Mac. -%! if (! ismac ()), return; endif +%!testif HAVE_LLVM_LIBCXX <47413> +%! ## Same test code as above, intended only for test statistics with libc++. %! file = tempname (); %! unwind_protect %! fid = fopen (file, "wt"); @@ -661,7 +660,7 @@ %! unlink (file); %! end_unwind_protect -%!testif ; ! ismac () <*50589> +%!testif ; ! __have_feature__ ("LLVM_LIBCXX") <*50589> %! file = tempname (); %! unwind_protect %! fid = fopen (file, "wt"); @@ -679,9 +678,8 @@ %! unlink (file); %! end_unwind_protect -%!test <47413> -%! ## Same test code as above, but intended only for test statistics on Mac. -%! if (! ismac ()), return; endif +%!testif HAVE_LLVM_LIBCXX <47413> +%! ## Same test code as above, intended only for test statistics with libc++. %! file = tempname (); %! unwind_protect %! fid = fopen (file, "wt"); diff -r a40fd748bf1f -r 9b36d30d27e3 libinterp/corefcn/mappers.cc --- a/libinterp/corefcn/mappers.cc Sat Apr 08 14:11:13 2023 +0200 +++ b/libinterp/corefcn/mappers.cc Sat Apr 08 16:09:55 2023 +0200 @@ -130,14 +130,14 @@ ## Test large magnitude arguments (bug #45507) ## Test fails with older versions of libm, solution is to upgrade. -%!testif ; ! ismac () && ! ispc () <*45507> +%!testif ; ! __have_feature__ ("LLVM_LIBCXX") && ! ispc () <*45507> %! x = [1, -1, i, -i] .* 1e150; %! v = [0, pi, pi/2, pi/2]; %! assert (real (acos (x)), v); -%!testif ; ismac () || ispc () <52627> -%! ## Same test code as above, but intended only for test statistics on Mac and -%! ## Windows. Their trig/hyperbolic functions have huge tolerances. +%!testif ; __have_feature__ ("LLVM_LIBCXX") || ispc () <52627> +%! ## Same test code as above, but intended for test statistics with libc++ or +%! ## on Windows. Their trig/hyperbolic functions have huge tolerances. %! x = [1, -1, i, -i] .* 1e150; %! v = [0, pi, pi/2, pi/2]; %! assert (real (acos (x)), v); @@ -202,14 +202,14 @@ ## Test large magnitude arguments (bug #45507) ## Test fails with older versions of libm, solution is to upgrade. -%!testif ; ! ismac () && ! ispc () <*45507> +%!testif ; ! __have_feature__ ("LLVM_LIBCXX") && ! ispc () <*45507> %! x = [1, -1, i, -i] .* 1e150; %! v = [0, pi, pi/2, -pi/2]; %! assert (imag (acosh (x)), v); -%!testif ; ismac () || ispc () <52627> -%! ## Same test code as above, but intended only for test statistics on Mac and -%! ## Windows. Their trig/hyperbolic functions have huge tolerances. +%!testif ; __have_feature__ ("LLVM_LIBCXX") || ispc () <52627> +%! ## Same test code as above, but intended for test statistics with libc++ or +%! ## on Windows. Their trig/hyperbolic functions have huge tolerances. %! x = [1, -1, i, -i] .* 1e150; %! v = [0, pi, pi/2, -pi/2]; %! assert (imag (acosh (x)), v); @@ -336,14 +336,14 @@ ## Test large magnitude arguments (bug #45507) ## Test fails with older versions of libm, solution is to upgrade. -%!testif ; ! ismac () && ! ispc () <*45507> +%!testif ; ! __have_feature__ ("LLVM_LIBCXX") && ! ispc () <*45507> %! x = [1, -1, i, -i] .* 1e150; %! v = [pi/2, -pi/2, 0, -0]; %! assert (real (asin (x)), v); -%!testif ; ismac () || ispc () <52627> -%! ## Same test code as above, but intended only for test statistics on Mac and -%! ## Windows. Their trig/hyperbolic functions have huge tolerances. +%!testif ; __have_feature__ ("LLVM_LIBCXX") || ispc () <52627> +%! ## Same test code as above, but intended for test statistics with libc++ or +%! ## on Windows. Their trig/hyperbolic functions have huge tolerances. %! x = [1, -1, i, -i] .* 1e150; %! v = [pi/2, -pi/2, 0, -0]; %! assert (real (asin (x)), v); @@ -378,14 +378,14 @@ ## Test large magnitude arguments (bug #45507) ## Test fails with older versions of libm, solution is to upgrade. -%!testif ; ! ismac () && ! ispc () <*45507> +%!testif ; ! __have_feature__ ("LLVM_LIBCXX") && ! ispc () <*45507> %! x = [1, -1, i, -i] .* 1e150; %! v = [0, 0, pi/2, -pi/2]; %! assert (imag (asinh (x)), v); -%!testif ; ismac () || ispc () <52627> -%! ## Same test code as above, but intended only for test statistics on Mac and -%! ## Windows. Their trig/hyperbolic functions have huge tolerances. +%!testif ; __have_feature__ ("LLVM_LIBCXX") || ispc () <52627> +%! ## Same test code as above, but intended for test statistics with libc++ or +%! ## on Windows. Their trig/hyperbolic functions have huge tolerances. %! x = [1, -1, i, -i] .* 1e150; %! v = [0, 0, pi/2, -pi/2]; %! assert (imag (asinh (x)), v); diff -r a40fd748bf1f -r 9b36d30d27e3 libinterp/corefcn/strfns.cc --- a/libinterp/corefcn/strfns.cc Sat Apr 08 14:11:13 2023 +0200 +++ b/libinterp/corefcn/strfns.cc Sat Apr 08 16:09:55 2023 +0200 @@ -832,11 +832,10 @@ /* %!assert (str2double ("1"), 1) %!assert (str2double ("-.1e-5"), -1e-6) -%!testif ; ! ismac () +%!testif ; ! __have_feature__ ("LLVM_LIBCXX") %! assert (str2double (char ("1", "2 3", "4i")), [1; NaN; 4i]); -%!test <47413> -%! ## Same test code as above, but intended only for test statistics on Mac. -%! if (! ismac ()), return; endif +%!testif HAVE_LLVM_LIBCXX <47413> +%! ## Same test code as above, intended only for test statistics with libc++. %! assert (str2double (char ("1", "2 3", "4i")), [1; NaN; 4i]); %!assert (str2double ("1,222.5"), 1222.5) %!assert (str2double ("i"), i) @@ -860,15 +859,13 @@ %!assert (str2double ("NaN + Inf*i"), complex (NaN, Inf)) %!assert (str2double ("Inf - Inf*i"), complex (Inf, -Inf)) %!assert (str2double ("-i*NaN - Inf"), complex (-Inf, -NaN)) -%!testif ; ! ismac () +%!testif ; ! __have_feature__ ("LLVM_LIBCXX") %! assert (str2double ({"abc", "4i"}), [NaN + 0i, 4i]); -%!test <47413> -%! if (! ismac ()), return; endif +%!testif HAVE_LLVM_LIBCXX <47413> %! assert (str2double ({"abc", "4i"}), [NaN + 0i, 4i]); -%!testif ; ! ismac () +%!testif ; ! __have_feature__ ("LLVM_LIBCXX") %! assert (str2double ({2, "4i"}), [NaN + 0i, 4i]) -%!test <47413> -%! if (! ismac ()), return; endif +%!testif HAVE_LLVM_LIBCXX <47413> %! assert (str2double ({2, "4i"}), [NaN + 0i, 4i]) %!assert (str2double (zeros (3,1,2)), NaN) %!assert (str2double (''), NaN) diff -r a40fd748bf1f -r 9b36d30d27e3 scripts/general/logspace.m --- a/scripts/general/logspace.m Sat Apr 08 14:11:13 2023 +0200 +++ b/scripts/general/logspace.m Sat Apr 08 16:09:55 2023 +0200 @@ -118,16 +118,16 @@ ## Edge cases %!assert (logspace (Inf, Inf, 3), [Inf, Inf, Inf]) %!assert (logspace (-Inf, Inf, 3), [0, 1, Inf]) -%!testif ; ! ismac () +%!testif ; ! __have_feature__ ("LLVM_LIBCXX") %! assert (logspace (Inf + 1i, Inf + 1i, 3), %! repmat (complex (-Inf,Inf), [1, 3])) -%!testif ; ismac () <55538> +%!testif HAVE_LLVM_LIBCXX <55538> %! assert (logspace (Inf + 1i, Inf + 1i, 3), %! repmat (complex (-Inf,Inf), [1, 3])) -%!testif ; ! ismac () +%!testif ; ! __have_feature__ ("LLVM_LIBCXX") %! assert (logspace (-Inf + 1i, Inf + 1i, 3), %! [0, NaN + NaN * 1i, complex(-Inf, Inf)]) -%!testif ; ismac () <55538> +%!testif HAVE_LLVM_LIBCXX <55538> %! assert (logspace (-Inf + 1i, Inf + 1i, 3), %! [0, NaN + NaN * 1i, complex(-Inf, Inf)]) %!assert (logspace (0, Inf, 3), [1, Inf, Inf]) diff -r a40fd748bf1f -r 9b36d30d27e3 scripts/io/importdata.m --- a/scripts/io/importdata.m Sat Apr 08 14:11:13 2023 +0200 +++ b/scripts/io/importdata.m Sat Apr 08 16:09:55 2023 +0200 @@ -522,7 +522,7 @@ %! assert (d, "\t"); %! assert (h, 0); -%!testif ; ! ismac () +%!testif ; ! __have_feature__ ("LLVM_LIBCXX") %! ## Complex numbers %! A = [3.1 -7.2 0-3.4i; 0.012 -6.5+7.2i 128]; %! fn = tempname (); @@ -535,9 +535,8 @@ %! assert (d, "\t"); %! assert (h, 0); -%!test <47413> -%! ## Same test code as above, but intended only for test statistics on Mac. -%! if (! ismac ()), return; endif +%!testif HAVE_LLVM_LIBCXX <47413> +%! ## Same test code as above, intended only for test statistics with libc++. %! ## Complex numbers %! A = [3.1 -7.2 0-3.4i; 0.012 -6.5+7.2i 128]; %! fn = tempname (); diff -r a40fd748bf1f -r 9b36d30d27e3 test/io.tst --- a/test/io.tst Sat Apr 08 14:11:13 2023 +0200 +++ b/test/io.tst Sat Apr 08 16:09:55 2023 +0200 @@ -339,48 +339,45 @@ %!assert (sscanf ('7777777777777777', '%lo', 'C'), 281474976710655) %!assert (sscanf ('ffffffffffff', '%lx', 'C'), 281474976710655) -%!testif ; ! ismac () +%!testif ; ! __have_feature__ ("LLVM_LIBCXX") %! [val, count, msg, pos] = sscanf ("3I2", "%f"); %! assert (val, 3); %! assert (count, 1); %! assert (msg, "sscanf: format failed to match"); %! assert (pos, 2); -%!test <47413> -%! ## Same test code as above, but intended only for test statistics on Mac. -%! if (! ismac ()), return; endif +%!testif HAVE_LLVM_LIBCXX <47413> +%! ## Same test code as above, intended only for test statistics with libc++. %! [val, count, msg, pos] = sscanf ("3I2", "%f"); %! assert (val, 3); %! assert (count, 1); %! assert (msg, "sscanf: format failed to match"); %! assert (pos, 2); -%!testif ; ! ismac () +%!testif ; ! __have_feature__ ("LLVM_LIBCXX") %! [val, count, msg, pos] = sscanf ("3In2", "%f"); %! assert (val, 3); %! assert (count, 1); %! assert (msg, "sscanf: format failed to match"); %! assert (pos, 2); -%!test <47413> -%! ## Same test code as above, but intended only for test statistics on Mac. -%! if (! ismac ()), return; endif +%!testif HAVE_LLVM_LIBCXX <47413> +%! ## Same test code as above, intended only for test statistics with libc++. %! [val, count, msg, pos] = sscanf ("3In2", "%f"); %! assert (val, 3); %! assert (count, 1); %! assert (msg, ""); %! assert (pos, 2); -%!testif ; ! ismac () +%!testif ; ! __have_feature__ ("LLVM_LIBCXX") %! [val, count, msg, pos] = sscanf ("3Inf2", "%f"); %! assert (val, [3; Inf; 2]); %! assert (count, 3); %! assert (msg, ""); %! assert (pos, 6); -%!test <47413> -%! ## Same test code as above, but intended only for test statistics on Mac. -%! if (! ismac ()), return; endif +%!testif HAVE_LLVM_LIBCXX <47413> +%! ## Same test code as above, intended only for test statistics with libc++. %! [val, count, msg, pos] = sscanf ("3Inf2", "%f"); %! assert (val, [3; Inf; 2]); %! assert (count, 3);