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

moldraw2DTest1 failure when building on aarch64 #5899

Closed
vfscalfani opened this issue Dec 26, 2022 · 6 comments · Fixed by #5912
Closed

moldraw2DTest1 failure when building on aarch64 #5899

vfscalfani opened this issue Dec 26, 2022 · 6 comments · Fixed by #5912
Labels
Milestone

Comments

@vfscalfani
Copy link
Contributor

Describe the bug

moldraw2DTest1 fails when building on aarch64 Raspberry Pi OS.

To Reproduce
Hi,

I am trying to build the 2022_09_3 RDKit release on aarch64 (Raspberry Pi OS 64 bit, based on Debian 11).

After building, all tests pass except for one test: moldraw2DTest1. Here are my cmake settings (popcnt off as cmake reported that it was not available on aarch64)

cmake \
 -DRDK_BUILD_INCHI_SUPPORT=ON \
 -DRDK_BUILD_AVALON_SUPPORT=ON \
 -DRDK_BUILD_CAIRO_SUPPORT=ON \
 -DRDK_OPTIMIZE_POPCNT=OFF \
 ..

And here is a snippet of the relevant verbose output of ctest on moldraw2DTest1:

139:  ----------------- Test Github 3305 - change and scale line widths.
139: file testGithub3305_1.png gave hash 255418450U not the expected 316930677U
139: file testGithub3305_2.png gave hash 1774822891U not the expected 3520446560U
139: file testGithub3305_3.png gave hash 970935540U not the expected 3960184199U
139: file testGithub3305_4.png gave hash 667377464U not the expected 411486117U
139: [03:56:23] 
139: 
139: ****
139: Test Assert
139: Expression Failed: 
139: Violation occurred on line 4318 in file /home/pi_test/Downloads/rdkit-Release_2022_09_3/Code/GraphMol/MolDraw2D/test1.cpp
139: Failed Expression: std::regex_search(text, bondMatch, regex) == 1
139: ****
139: 
139: terminate called after throwing an instance of 'Invar::Invariant'
139:   what():  Expression Failed: 
1/1 Test #139: moldraw2DTest1 ...................Child aborted***Exception:  12.19 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =  12.22 sec

The following tests FAILED:
	139 - moldraw2DTest1 (Child aborted)

Looking at the test1.cpp file around line 4318, https://github.com/rdkit/rdkit/blob/master/Code/GraphMol/MolDraw2D/test1.cpp, it looked like maybe turning of freetype support may work, however I recieved the same error with disabling freetype in another build:

 -DRDK_BUILD_FREETYPE_SUPPORT=OFF \

Then, since it was failing on a regex_search, I tried to build with boost regex instead, but the same moldraw2DTest1 failed:

 -DRDK_USE_BOOST_REGEX=ON \

This led me to believe that regex is working correctly, and the test is actually failing. I inspected the testGitHub3305_4.svg file (which is what I believe the following regex in test1.cpp is looking at):

test1.cpp, line 4316:

 R"regex(class='bond-6 atom-6 atom-7' d='M 138.\d+,116.\d+ L 141.\d+,116.\d+.* Z' .*FF7F7F.*stroke-width:0.0px)regex");

And here are the 3 lines in the build output testGitHub3305_4.svg that start with class='bond-6:

<path class='bond-6 atom-6 atom-7' d='M 141.9,116.8 L 134.7,129.2 L 133.1,126.5 L 138.7,116.8 Z' style='fill:#FF7F7F;fill-rule:evenodd;fill-opacity:1;stroke:#FF7F7F;stroke-width:0.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;' />
<path class='bond-6 atom-6 atom-7' d='M 140.3,116.8 L 133.9,127.8' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />
<path class='bond-6 atom-6 atom-7' d='M 138.1,116.8 L 132.8,125.9' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />

I don't think any of those match the expected regex pattern and that this might be a bug.

Many thanks,

Vin

Expected behavior

I expected moldraw2DTest1 to pass.

Screenshots
I have attached the output testGitHub3305_4.svg from the build.

testGithub3305_4

Configuration (please complete the following information):

  • RDKit version: 2022_09_3
  • OS: Raspberry Pi OS 64 bit
  • Python version (if relevant): 3.9.2
  • Are you using conda? No
  • If you are using conda, which channel did you install the rdkit from? N/A
  • If you are not using conda: how did you install the RDKit? building, details above.

Additional context

N/A

@vfscalfani vfscalfani added the bug label Dec 26, 2022
@DavidACosgrove
Copy link
Collaborator

Hi @vfscalfani,
You do get small numerical differences in the output of the drawing code. The regex is supposed to allow for enough slack that differences below 1 drawing unit don’t cause a failure. In this case it looks like that’s not happening. I’ll take a look at it in the next few days. The crucial thing is that the drawing looks correct. A failing test isn’t a good thing, though.
I don’t have access to a raspberry pi, but I’ll see if the test can be improved.
thanks,
Dave

@vfscalfani
Copy link
Contributor Author

Hi @DavidACosgrove

Thanks for your reply, that makes sense. I'm happy to test any changes if that would help.

Vin

@DavidACosgrove
Copy link
Collaborator

Hi @vfscalfani,

I think I have fixed the test. It was a classic case of "all the right notes, not necessarily in the right order" (obscure UK cultural reference : https://vimeo.com/479336770). The convex hull algorithm that is used to create the rectangle for the highlights was returning the corners of the rectangle in a different order for your file, so the regex failed. It now checks for the correct corners in any order. That might mean a non-rectangular shape will pass the test, but we can cross that bridge later if necessary.
The emended code is at https://github.com/DavidACosgrove/rdkit/tree/Github5899. If you could try it on your raspberry pi that would be great. It seems pointless doing the PR until we know it has fixed your problem.

Best,
Dave

@vfscalfani
Copy link
Contributor Author

Hi @DavidACosgrove This is great! Yes, I just built with the new code on my Raspberry Pi and moldraw2DTest1 passed (as well as all other tests). That was with Freetype support. I'm running a build now without Freetype support just in case. It does not look like that should matter, but probably good to check anyway. I will report back on that tomorrow (a build and testing takes about 4 hours on the Pi 400). Thanks a lot for fixing this.

Vin

@vfscalfani
Copy link
Contributor Author

Okay, all tests pass with and without Freetype support. Thanks again @DavidACosgrove

@DavidACosgrove
Copy link
Collaborator

DavidACosgrove commented Dec 31, 2022 via email

@greglandrum greglandrum added this to the 2022_09_4 milestone Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants