Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

C++ (render) test runner - #14941

Merged
brunoabinader merged 8 commits into
masterfrom
bruno-test-runner
Jun 25, 2019
Merged

brunoabinader merged 8 commits into
masterfrom
bruno-test-runner

Conversation

@brunoabinader

Copy link
Copy Markdown
Contributor

This PR:

  • Adds cppcodec dependency: for encoding data in base64 format - we encode PNG images in base64 format when generating the render tests HTML results page.
  • Adds a polyfill for filesystem - we use the C++ filesystem API for assisting IO operations in the test runner. Unfortunately, this API is not stable among all the different platforms we support, so using a polyfill instead.
  • Adds an option for DefaultFileSource to disable cache-only requests support. This is needed to mimic the Node.js file source behavior, and to avoid the tile loader from populating the tile pyramid with intermediary tiles that could cause a render test failure.
  • Fixes a crash in macOS when running expression-tests/to-number/2-ary - for some reason macOS' clang compiler does not capture the incoming std::invalid_argument exception, so using a generic ... instead.
  • Replaces Node.js-based render test runner with a new C++ based one.

For the C++ render test runner, we're no longer relying on NPM dependencies, thus adding mvt-fixtures and mapbox-gl-styles as submodule dependencies instead. We're also no longer relying on adding a macro to the custom Makefile, but instead using pure CMake build commands. These two changes cause the C++ render test runner to be easily built and run in an embedded/mobile environment.

This PR also adds two new CI jobs: macos-render-tests and linux-render-tests, and removes the render test step from node-macos-release and node-clang39-release. Eventually, once the expression tests and query tests have been ported to C++, we could then remove these last two CI jobs.

One caveat I found when adding CI support for macOS was that RunLoop::runOnce() (used in HeadlessFrontend::render when rendering a still image) was not causing the run loop to eventually become idle again, thus blocking the test execution. The only workaround I could find so far was adding a minimal 16ms here: https://github.com/mapbox/mapbox-gl-native/blob/master/platform/darwin/src/run_loop.cpp#L41

@brunoabinader brunoabinader added tests Core The cross-platform C++ core, aka mbgl labels Jun 17, 2019
@brunoabinader
brunoabinader requested a review from 1ec5 as a code owner June 17, 2019 15:00
@brunoabinader
brunoabinader requested a review from a team June 17, 2019 15:00
@brunoabinader brunoabinader self-assigned this Jun 17, 2019
Comment thread .gitmodules Resolved
Comment thread test-runner/runner.cpp Resolved
Comment thread CMakeLists.txt Resolved
@brunoabinader
brunoabinader force-pushed the bruno-test-runner branch 5 times, most recently from d5dddf3 to 9c50269 Compare June 24, 2019 14:33
@brunoabinader

Copy link
Copy Markdown
Contributor Author

@mapbox/gl-native please review.

Comment thread include/mbgl/util/filesystem.hpp Resolved
Comment thread platform/darwin/src/run_loop.cpp Resolved
Comment thread render-test/parser.cpp Resolved
Comment thread render-test/runner.cpp
metadata.diff = mbgl::encodePNG(diff);

#if !TEST_READ_ONLY
mbgl::util::write_file(base + "/diff.png", metadata.diff);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about if we write the new test expectations only if the diff fails?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only overwrite the test expectation when UPDATE envvar is set - which is the same logic inherited from the Node.js test suite. We always overwrite the test actual result and the diff on each test run, which also follows the prior logic.

Comment thread src/mbgl/style/expression/coercion.cpp Resolved
@tmpsantos

Copy link
Copy Markdown
Contributor

Kudos big time for working on this!

Comment thread render-test/runner.cpp

pixels = // implicitly converting from uint64_t
mapbox::pixelmatch(actual.data.get(), expected.data.get(), expected.size.width,
expected.size.height, diff.data.get(), 0.16); // GL JS uses 0.1285

@astojilj astojilj Aug 6, 2019 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

post merging comment:

0.16); // GL JS uses 0.1285

This is significant change. 0.1285 is set because we had some failures passing under the radar.
Let's not remove node render tests until the tolerance is the same - we could have node render tests running on one bot at least.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Core The cross-platform C++ core, aka mbgl tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants