Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test1148: disable if decimal separator is not a point #2786

Closed
wants to merge 1 commit into from

Conversation

MarcelRaad
Copy link
Member

LC_NUMERIC doesn't work on Windows, so just replace the decimal comma
with a decimal point in the expected result.

@dfandrich
Copy link
Contributor

dfandrich commented Jul 25, 2018 via email

@MarcelRaad
Copy link
Member Author

MarcelRaad commented Jul 25, 2018

There are other decimal separators, but I couldn't find any others that are for Hindu-Arabic numerals. Good point, I have to test what happens with languages with other numeral systems. Removing <setenv> is probably bad then.

How would you implement skipping such tests? Using <precheck>?

@MarcelRaad
Copy link
Member Author

I tried with locales ps_AF.UTF-8 and prs_AF.UTF-8 and they both failed with removing setenv while succeeding before, so this cannot go in as-is.

This happens when building for native Windows (e.g. using MSVC or MinGW), but not when building for MSYS, so there's probably no good solution without running any code.

@dfandrich
Copy link
Contributor

dfandrich commented Jul 25, 2018 via email

MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Jul 26, 2018
Modifying the locale with environment variables doesn't work for native
Windows applications. Just disable the test in this case if the decimal
separator is something different than a point. Use a precheck with a
small C program to achieve that.

Closes curl#2786
@MarcelRaad
Copy link
Member Author

MarcelRaad commented Jul 26, 2018

That was fun! Something like this?

Unfortunately, Perl is not my native language and this is the first time I touched an automake file, so I'm not sure if I got this right. But it does work - the test is skipped in my German MSYS2 MinGW shell, where it previously failed, but not in my German MSYS2 MSYS shell, where it succeeds.

But, when I had chkdecimalpoint_SOURCES = chkdecimalpoint.c ../../lib/mprintf.c like many other test programs, I got errors about redefining the functions in mprintf.c without __declspec(dllexport) or something like this. I haven't managed to find out what I'm doing differently yet.
Also, I'm not entirely sure about the location of the helper program - chkhostname is located in libtest and used by non-lib curl tests, so I put it there too.

I still have to update potential other tests setting LC_NUMERIC as soon as this is OK.

@MarcelRaad MarcelRaad changed the title test1148: use substitution for decimal sign test1148: don't fail on Windows if decimal sign is not a point Jul 26, 2018
@MarcelRaad MarcelRaad changed the title test1148: don't fail on Windows if decimal sign is not a point test1148: don't fail on Windows if decimal separator is not a point Jul 26, 2018
@MarcelRaad MarcelRaad changed the title test1148: don't fail on Windows if decimal separator is not a point test1148: disable if decimal separator is not a point Jul 26, 2018
@gvanem
Copy link
Contributor

gvanem commented Jul 27, 2018

I got errors about redefining the functions in mprintf.c without __declspec(dllexport) or something
like this.

Try adding -DBUILDING_LIBCURL while compiling chkdecimalpoint.c.

MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Jul 27, 2018
Modifying the locale with environment variables doesn't work for native
Windows applications. Just disable the test in this case if the decimal
separator is something different than a point. Use a precheck with a
small C program to achieve that.

Closes curl#2786
@dfandrich
Copy link
Contributor

dfandrich commented Jul 27, 2018 via email

@MarcelRaad
Copy link
Member Author

Thanks to both of you!

I wasn't sure if there was a difference between perl and C. But if perl-only works, that's better. I'll make sure it generates the same result and update the PR accordingly.

@MarcelRaad
Copy link
Member Author

Unfortunately, that doesn't work because MSYS2's perl always respects LC_NUMERIC, probably because it's an MSYS program - there's only one perl in /usr/bin for both environments.

MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Jul 28, 2018
Modifying the locale with environment variables doesn't work for native
Windows applications. Just disable the test in this case if the decimal
separator is something different than a point. Use a precheck with a
small C program to achieve that.

Closes curl#2786
MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Jul 29, 2018
Modifying the locale with environment variables doesn't work for native
Windows applications. Just disable the test in this case if the decimal
separator is something different than a point. Use a precheck with a
small C program to achieve that.

Closes curl#2786
@MarcelRaad
Copy link
Member Author

Fixed the MSVC static CMake build, breaking the autotools build. Fixed that, breaking the Linux CMake build 😃
I still don't understand what parts of Makefile.inc are used for CMake, the CPPFLAGS are not...

Modifying the locale with environment variables doesn't work for native
Windows applications. Just disable the test in this case if the decimal
separator is something different than a point. Use a precheck with a
small C program to achieve that.

Closes curl#2786
@MarcelRaad
Copy link
Member Author

Finally all configurations are passing. I haven't found any other curl test setting LC_NUMERIC.

@MarcelRaad MarcelRaad deleted the test1148_decimal_comma branch August 24, 2018 17:23
xquery pushed a commit to xquery/curl that referenced this pull request Sep 3, 2018
Modifying the locale with environment variables doesn't work for native
Windows applications. Just disable the test in this case if the decimal
separator is something different than a point. Use a precheck with a
small C program to achieve that.

Closes curl#2786
falconindy pushed a commit to falconindy/curl that referenced this pull request Sep 10, 2018
Modifying the locale with environment variables doesn't work for native
Windows applications. Just disable the test in this case if the decimal
separator is something different than a point. Use a precheck with a
small C program to achieve that.

Closes curl#2786
@lock lock bot locked as resolved and limited conversation to collaborators Nov 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

3 participants