-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Mingw tests (32-bit and 64-bit) #1004
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
Conversation
@lemire thanks for working so hard on this. I'd feel better with it too! And as we're seeing, to the extend simdjson can be used for language bindings, there are benefits to increased support :) I don't think there are many libraries that try this hard for coverage, but it's a reason simdjson will stretch far (I hope). |
@jkeiser It should pass now... essentially (this all works on my PC). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fascinated at doing the real tests in github workflows! At the least it's another source of parallel CI, and at best it might be a place we can migrate more and more stuff to, as it has a massive company funding the machines.
A couple of nits and a lot more comments that don't need to be resolved, it seems good otherwise.
tests/basictests.cpp
Outdated
@@ -69,6 +71,9 @@ namespace number_tests { | |||
if(ulp > maxulp) maxulp = ulp; | |||
if(ulp > 0) { | |||
std::cerr << "JSON '" << buf << " parsed to " << actual << " instead of " << expected << std::endl; | |||
printf("actual: %18.18g\n", actual); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why both this and std::cerr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because C++ has a terrible API for formatting numbers. I will document this choice.
tests/basictests.cpp
Outdated
@@ -152,18 +157,20 @@ namespace number_tests { | |||
std::cout << __func__ << std::endl; | |||
char buf[1024]; | |||
simdjson::dom::parser parser; | |||
for (int i = -1000000; i <= 308; ++i) {// large negative values should be zero. | |||
for (int i = -307; i <= 308; ++i) {// large negative values should be zero. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming this is for speed? Do you feel we have enough coverage at -307, or should it extend a little further just to test that some out of range values yield 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is because the pow function in mingw is busted. But I will change the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. In the next commit, I check if it is busted, if it is, I tell the user about it.
(We try to be correct, but the standard library is not correct on mingw.)
@@ -87,7 +87,11 @@ void found_integer(int64_t result, const uint8_t *buf) { | |||
char *endptr; | |||
long long expected = strtoll((const char *)buf, &endptr, 10); | |||
if ((endptr == (const char *)buf) || (expected != result)) { | |||
#if (!(__MINGW32__) && !(__MINGW64__)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can avoid the ifdef by making a macro:
#if __MINGW32__ || __MINGW64__
#define SIMDJSON_LLD PRId64
#define SIMDJSON_LLU PRIu64
#else
#define SIMDJSON_LLD "lld"
#define SIMDJSON_LLU "llu"
#endif
fprintf(stderr, "Error: parsed %" SIMDJSON_LLD " out of %.32s, ", result, buf);
I'm fine with the 2 ifdefs we have now, but if you mess with common_defs for other reasons, this might be worth it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Both PRIu64 and PRId64 are part of the standard so I don't know why they don't work. But at some point, you run out of steam trying to find out why something that is perfectly fine by the standard does not work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understandable :) I did find a stackoverflow indicating that you can get PRIu64 by including <inttypes.h>. But who knows if THAT exists in all the compilers we support ... and it's not worth spending more of your time right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. Right. I assumed we were importing these in the main library, but I think we do not.
Thanks. (I knew of the header, I just assumed it was there already.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. It is there, look in the files. We have cinttypes. It is another instance where mingw is busted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is flat out a bug on their part.
@@ -12,7 +12,7 @@ | |||
#define JSON_TEST_STRINGS | |||
#endif | |||
|
|||
#ifndef _MSC_VER | |||
#if (!(_MSC_VER) && !(__MINGW32__) && !(__MINGW64__)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given how many places we do this,is there a macro that makes sense and covers these three cases? Better yet, perhaps we should have a <simdjson_dirent.h> somewhere, and get rid of the if entirely :)
Eh. For now it's fine, we should really do the simdjson_dirent.h thing regardless of this patch (which suggests it should be done outside of this patch). I'll file an issue.
@@ -1,4 +1,5 @@ | |||
#ifndef __GETOPT_H__ | |||
/** This file has been modified by D. Lemire for use in simdjson. **/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be happy when we get it all in cxxopts :) Thanks for leaving a changelog in the file!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now cxxopts is not available when git is unavailable and it is not reasonable to deactivate our tests if networking and git are unavailable.
So if we move everything to cxxopts, I think we need to bring a hard copy of cxxopts in the project. Yeah. I know it is unfortunate, but at some point, we need to build on an isolated machine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. It's not terrible as long as we give ourselves a way to check for and update our dependencies (the real reason for a submodule).
# Under Windows, exectuting a bash script works, except that you cannot generally | ||
# do bash C:/path to my script. You need a "mounted" path: /mnt/c/path | ||
|
||
if (BASH AND (NOT WIN32)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh. We're going to just have to get rid of all of our bash scripts at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, if we could convert it to a mounted path, it would work. There may already have a really simple way to do this.
With WSL becoming standard... I bet that people know how to do this.
Holy lord of knickerbockers, it takes over an hour to build and run basictests? |
I have no idea how long it takes, but it takes a really long time. My bet is that we have some kind of quota and our quota has been exhausted. |
That seems likely, given that there are no logs for the tests that have supposedly been running for over and hour. |
@@ -152,18 +155,25 @@ namespace number_tests { | |||
std::cout << __func__ << std::endl; | |||
char buf[1024]; | |||
simdjson::dom::parser parser; | |||
for (int i = -1000000; i <= 308; ++i) {// large negative values should be zero. | |||
|
|||
bool is_pow_correct{1e-308 == std::pow(10,-308)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkeiser I hope you like this better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkeiser Basically, elsewhere we compare the parsed value of "1e-..." against power(10,...). This works. Except if the pow function is inaccurate. Then we get a failing test... not our fault.
@@ -1949,6 +1960,11 @@ int main(int argc, char *argv[]) { | |||
if (simdjson::active_implementation->name() == "unsupported") { | |||
printf("unsupported CPU\n"); | |||
} | |||
// We want to know what we are testing. | |||
std::cout << "Running tests against this implementation: " << simdjson::active_implementation->name(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkeiser For John!
This makes GitHub actions somewhat less useful that it could be. Maybe there is a way to ask for more compute time. |
@jkeiser Can you have a look at my actions. The caching does not work. Without caching, these github actions are crazily expensive. I don't understand what is wrong with my configuration. |
Ok. I figured it out. Merging. |
This adds 32-bit and 64-bit tests under mingw (GCC for Windows). I only compile and run "basictests" because it is slllllooooowwww. If we find a way to run the tests faster, we could easily enable all tests.
You apparently can't have, at the same time, both the 64-bit and the 32-bit GCC compiler. So you need (?) two distinct tests.
Some issues with mingw: