tests: Add lzma feature and add a required_features.lzma flag
This commit is contained in:
parent
08b7a8c498
commit
7dc0224451
|
@ -76,7 +76,7 @@ jobs:
|
||||||
RUSTDOCFLAGS: -D warnings
|
RUSTDOCFLAGS: -D warnings
|
||||||
|
|
||||||
- name: Run tests with image tests
|
- name: Run tests with image tests
|
||||||
run: cargo test --all --locked --features imgtests
|
run: cargo test --all --locked --features imgtests,lzma
|
||||||
env:
|
env:
|
||||||
XDG_RUNTIME_DIR: '' # dummy value, just to silence warnings about it missing
|
XDG_RUNTIME_DIR: '' # dummy value, just to silence warnings about it missing
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ url = "2.3.1"
|
||||||
# since the images we compare against are generated on CI, and may
|
# since the images we compare against are generated on CI, and may
|
||||||
# not match your local machine's Vulkan version / image output.
|
# not match your local machine's Vulkan version / image output.
|
||||||
imgtests = ["ruffle_video_software"]
|
imgtests = ["ruffle_video_software"]
|
||||||
|
lzma = ["ruffle_core/lzma"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
approx = "0.5.1"
|
approx = "0.5.1"
|
||||||
|
|
|
@ -46,6 +46,10 @@ with_video = false # If this test requires a video decoder backend to run.
|
||||||
[image_comparison]
|
[image_comparison]
|
||||||
tolerance = 0 # The tolerance per pixel channel to be considered "the same". Increase as needed with tests that aren't pixel perfect across platforms.
|
tolerance = 0 # The tolerance per pixel channel to be considered "the same". Increase as needed with tests that aren't pixel perfect across platforms.
|
||||||
max_outliers = 0 # Maximum number of outliers allowed over the given tolerance levels. Increase as needed with tests that aren't pixel perfect across platforms.
|
max_outliers = 0 # Maximum number of outliers allowed over the given tolerance levels. Increase as needed with tests that aren't pixel perfect across platforms.
|
||||||
|
|
||||||
|
# Which build features are required for this test to run.
|
||||||
|
[required_features]
|
||||||
|
lzma = false # If LZMA support is enabled in this build
|
||||||
```
|
```
|
||||||
|
|
||||||
## Frame-based tests
|
## Frame-based tests
|
||||||
|
|
|
@ -26,6 +26,7 @@ pub struct TestOptions {
|
||||||
pub approximations: Option<Approximations>,
|
pub approximations: Option<Approximations>,
|
||||||
pub player_options: PlayerOptions,
|
pub player_options: PlayerOptions,
|
||||||
pub log_fetch: bool,
|
pub log_fetch: bool,
|
||||||
|
pub required_features: RequiredFeatures,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for TestOptions {
|
impl Default for TestOptions {
|
||||||
|
@ -42,6 +43,7 @@ impl Default for TestOptions {
|
||||||
approximations: None,
|
approximations: None,
|
||||||
player_options: PlayerOptions::default(),
|
player_options: PlayerOptions::default(),
|
||||||
log_fetch: false,
|
log_fetch: false,
|
||||||
|
required_features: RequiredFeatures::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,6 +91,18 @@ impl Approximations {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Default)]
|
||||||
|
#[serde(default, deny_unknown_fields)]
|
||||||
|
pub struct RequiredFeatures {
|
||||||
|
lzma: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RequiredFeatures {
|
||||||
|
pub fn can_run(&self) -> bool {
|
||||||
|
!self.lzma || cfg!(feature = "lzma")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Default)]
|
#[derive(Deserialize, Default)]
|
||||||
#[serde(default, deny_unknown_fields)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct PlayerOptions {
|
pub struct PlayerOptions {
|
||||||
|
|
|
@ -71,7 +71,8 @@ impl Test {
|
||||||
if self.options.ignore {
|
if self.options.ignore {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
self.options.player_options.can_run(check_renderer)
|
self.options.required_features.can_run()
|
||||||
|
&& self.options.player_options.can_run(check_renderer)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn compare_output(&self, actual_output: &str) -> Result<()> {
|
pub fn compare_output(&self, actual_output: &str) -> Result<()> {
|
||||||
|
|
Loading…
Reference in New Issue