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

CI and local smoke testing #439

Merged
merged 13 commits into from
Feb 15, 2024
Merged

CI and local smoke testing #439

merged 13 commits into from
Feb 15, 2024

Conversation

DJMcNab
Copy link
Member

@DJMcNab DJMcNab commented Feb 14, 2024

To run the tests locally, use:

cargo test --workspace

These are placed in a new (non-publishing) vello_tests crate. The lib.rs of this crate has helpers for creating test cases, adapted from the headless example.

There is currently one additional set of tests, the smoke.rs tests. This has one test with two instantiations (over the value of use_cpu). This test is simple_square, which draws a 50px by 50px square, and confirms that 2500 pixels are red (and that the remainder are black).

There is a debug environment variable, which is VELLO_DEBUG_TESTS. This controls the debug output to PNG of these tests. These png are output into the debug_outputs folder. The environment variable takes a list of tests to debug, separated by commas. E.g. VELLO_DEBUG_TESTS=simple_square_cpu would debug the test simple_square with use_cpu enabled. The cpu/gpu suffices are optional, e.g. VELLO_DEBUG_TESTS=simple_square would output the png for both simple_square_cpu and simple_square_gpu.
There are also three special values:

  • all, which debugs every test
  • cpu, which debugs the CPU version of every test
  • gpu, which debugs the GPU version of every test

In terms of CI, this uses Mesa (and thus lavapipe?) to run the shaders on the CPU of the runner. This is only possible on Ubuntu. In theory, windows has a fallback CPU implementation of DirectX, but I haven't dug into this yet

@DJMcNab DJMcNab changed the title Sketch out what tests could look like Add some very basic tests to allow local and CI validation of trivial properties Feb 15, 2024
@DJMcNab DJMcNab changed the title Add some very basic tests to allow local and CI validation of trivial properties CI and local smoke testing Feb 15, 2024
@DJMcNab DJMcNab marked this pull request as ready for review February 15, 2024 09:32
Copy link
Contributor

@waywardmonkeys waywardmonkeys left a comment

Choose a reason for hiding this comment

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

I think this looks good overall.

@DJMcNab DJMcNab added this pull request to the merge queue Feb 15, 2024
Merged via the queue into linebender:main with commit d902830 Feb 15, 2024
8 checks passed
@DJMcNab DJMcNab deleted the initial-tests branch February 15, 2024 18:33
simbleau pushed a commit that referenced this pull request Feb 20, 2024
* Use `next_multiple_of`

* Sketch out how tests can work

* Fix clippy failure

* build script: rerun properly

* See if lavapipe will get vello working

* Fix the CPU shaders

Co-Authored-By: Chad Brokaw <cbrokaw@gmail.com>

* Make the GPU support conditional

* Make include be strings properly

* Try changing the variable name to not have an underscore

* Add a standard debugging environment variable

* Disable the GPU tests on macOS

* Rename the "concave" tests to "smoke" tests

* Fix clippy issues and make env var match (PR) docs

---------

Co-authored-by: Chad Brokaw <cbrokaw@gmail.com>
This was referenced Jun 10, 2024
github-merge-queue bot pushed a commit to linebender/xilem that referenced this pull request Aug 5, 2024
See also linebender/vello#439

This should open the door to doing much more comprehensive testing at
higher level in the nearish future (including e.g. in `xilem_masonry`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants