Skip to content

Commit

Permalink
Unbreak publishing (#303)
Browse files Browse the repository at this point in the history
* fix symbolic links and other issues preventing publishing

Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* move serial_test to dev-dependencies and gate on sm-test

The #[serial] is used to serialize unit tests, but it is not needed
when building with sm-test feature enabled to expose the functions
to android-example client.

* fix import issue in example/chaos_game.rs

* fix formatting

---------

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
  • Loading branch information
jdm and mukilan authored Sep 2, 2024
1 parent dce7e74 commit f03bad7
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 27 deletions.
2 changes: 1 addition & 1 deletion android-example/app/src/main/assets/blit.fs.glsl
2 changes: 1 addition & 1 deletion android-example/app/src/main/assets/check.fs.glsl
2 changes: 1 addition & 1 deletion android-example/app/src/main/assets/grid.fs.glsl
2 changes: 1 addition & 1 deletion android-example/app/src/main/assets/quad.vs.glsl
2 changes: 1 addition & 1 deletion android-example/app/src/main/assets/tri.fs.glsl
2 changes: 1 addition & 1 deletion android-example/app/src/main/assets/tri.vs.glsl

This file was deleted.

7 changes: 4 additions & 3 deletions android-example/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
name = "surfman_android_threads"
version = "0.1.0"
authors = ["Patrick Walton <pcwalton@mimiga.net>"]
edition = "2018"
edition = "2021"

[lib]
name = "main"
crate_type = ["cdylib"]
crate-type = ["cdylib"]

[profile.dev]
panic = "abort"
Expand All @@ -21,7 +21,8 @@ gl = "0.14"
jni = "0.21"
log = "0.4"
surfman = { version = "0.9.4", features = [ "sm-test" ] }
winit = { version = "0.29.10", features = [ "android-native-activity", "rwh_05" ] }
winit = { version = "0.29.10", features = [ "android-native-activity", "rwh_06" ] }
rwh_06 = { package = "raw-window-handle", version = "0.6" }

[patch.crates-io]
surfman = { path = "../../" }
4 changes: 2 additions & 2 deletions android-example/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ use log::Level;
use std::cell::{Cell, RefCell};
use std::mem;
use std::thread::{self, JoinHandle};
use surfman::platform::android::tests;
use surfman::platform::egl::tests;
use surfman::{Connection, NativeContext, NativeDevice};

#[path = "../../../surfman/examples/threads.rs"]
#[path = "../../../examples/threads.rs"]
mod threads;

thread_local! {
Expand Down
3 changes: 2 additions & 1 deletion examples/chaos_game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use euclid::default::Point2D;
use rand::{self, Rng};
use surfman::{SurfaceAccess, SurfaceType};
use winit::dpi::PhysicalSize;
use winit::event::{DeviceEvent, Event, KeyboardInput, VirtualKeyCode, WindowEvent};
use winit::event::WindowEvent::KeyboardInput;
use winit::event::{DeviceEvent, Event, WindowEvent};
use winit::event_loop::{ControlFlow, EventLoop};
use winit::window::WindowBuilder;

Expand Down
29 changes: 15 additions & 14 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::{ContextAttributeFlags, ContextAttributes, Error, GLApi, GLVersion, G
use crate::{SurfaceType, WindowingApiError};

use euclid::default::Size2D;
#[cfg(not(feature = "sm-test"))]
use serial_test::serial;
use std::os::raw::c_void;
use std::sync::mpsc;
Expand All @@ -40,7 +41,7 @@ static GL_ES_VERSIONS: [GLVersion; 4] = [
];

#[cfg_attr(not(feature = "sm-test"), test)]
#[serial]
#[cfg_attr(not(feature = "sm-test"), serial)]
pub fn test_adapter_creation() {
let connection = Connection::new().unwrap();
connection.create_hardware_adapter().unwrap();
Expand All @@ -49,7 +50,7 @@ pub fn test_adapter_creation() {
}

#[cfg_attr(not(feature = "sm-test"), test)]
#[serial]
#[cfg_attr(not(feature = "sm-test"), serial)]
pub fn test_device_creation() {
let connection = Connection::new().unwrap();
let adapter = connection
Expand All @@ -65,7 +66,7 @@ pub fn test_device_creation() {
}

#[cfg_attr(not(feature = "sm-test"), test)]
#[serial]
#[cfg_attr(not(feature = "sm-test"), serial)]
pub fn test_device_accessors() {
let connection = Connection::new().unwrap();
let adapter = connection.create_low_power_adapter().unwrap();
Expand All @@ -84,7 +85,7 @@ pub fn test_device_accessors() {
// Tests that all combinations of flags result in the creation of valid context descriptors and
// contexts.
#[cfg_attr(not(feature = "sm-test"), test)]
#[serial]
#[cfg_attr(not(feature = "sm-test"), serial)]
pub fn test_context_creation() {
let connection = Connection::new().unwrap();
let adapter = connection
Expand Down Expand Up @@ -164,7 +165,7 @@ pub fn test_context_creation() {

// Tests that newly-created contexts are not immediately made current (issue #7).
#[cfg_attr(not(feature = "sm-test"), test)]
#[serial]
#[cfg_attr(not(feature = "sm-test"), serial)]
pub fn test_newly_created_contexts_are_not_current() {
let connection = Connection::new().unwrap();
let adapter = connection
Expand Down Expand Up @@ -233,7 +234,7 @@ pub fn test_newly_created_contexts_are_not_current() {

// Tests a simple case of one context being shared with another.
#[cfg_attr(not(feature = "sm-test"), test)]
#[serial]
#[cfg_attr(not(feature = "sm-test"), serial)]
pub fn test_context_sharing() {
let connection = Connection::new().unwrap();
let adapter = connection
Expand Down Expand Up @@ -274,7 +275,7 @@ pub fn test_context_sharing() {

// Tests that generic surfaces can be created.
#[cfg_attr(not(feature = "sm-test"), test)]
#[serial]
#[cfg_attr(not(feature = "sm-test"), serial)]
pub fn test_generic_surface_creation() {
let connection = Connection::new().unwrap();
let adapter = connection
Expand Down Expand Up @@ -343,7 +344,7 @@ pub fn test_generic_surface_creation() {

// Tests that basic GL commands work.
#[cfg_attr(not(feature = "sm-test"), test)]
#[serial]
#[cfg_attr(not(feature = "sm-test"), serial)]
pub fn test_gl() {
let mut env = match BasicEnvironment::new() {
None => return,
Expand Down Expand Up @@ -437,7 +438,7 @@ pub fn test_gl() {
}

#[cfg_attr(not(feature = "sm-test"), test)]
#[serial]
#[cfg_attr(not(feature = "sm-test"), serial)]
pub fn test_surface_texture_blit_framebuffer() {
let mut env = match BasicEnvironment::new() {
None => return,
Expand Down Expand Up @@ -504,7 +505,7 @@ pub fn test_surface_texture_blit_framebuffer() {
}

#[cfg_attr(not(feature = "sm-test"), test)]
#[serial]
#[cfg_attr(not(feature = "sm-test"), serial)]
pub fn test_cross_device_surface_texture_blit_framebuffer() {
let mut env = match BasicEnvironment::new() {
None => return,
Expand Down Expand Up @@ -575,7 +576,7 @@ pub fn test_cross_device_surface_texture_blit_framebuffer() {
}

#[cfg_attr(not(feature = "sm-test"), test)]
#[serial]
#[cfg_attr(not(feature = "sm-test"), serial)]
pub fn test_cross_thread_surface_texture_blit_framebuffer() {
let mut env = match BasicEnvironment::new() {
None => return,
Expand Down Expand Up @@ -661,7 +662,7 @@ pub fn test_cross_thread_surface_texture_blit_framebuffer() {

// Tests that surface textures are not upside-down.
#[cfg_attr(not(feature = "sm-test"), test)]
#[serial]
#[cfg_attr(not(feature = "sm-test"), serial)]
pub fn test_surface_texture_right_side_up() {
let mut env = match BasicEnvironment::new() {
None => return,
Expand Down Expand Up @@ -734,7 +735,7 @@ pub fn test_surface_texture_right_side_up() {

#[cfg(not(any(target_os = "android", target_env = "ohos")))]
#[cfg_attr(not(feature = "sm-test"), test)]
#[serial]
#[cfg_attr(not(feature = "sm-test"), serial)]
pub fn test_depth_and_stencil() {
let connection = Connection::new().unwrap();
let adapter = connection
Expand Down Expand Up @@ -856,7 +857,7 @@ pub fn test_depth_and_stencil() {
// Make sure that the current native context can be fetched and that they can be correctly wrapped
// in `surfman` contexts.
#[cfg_attr(not(feature = "sm-test"), test)]
#[serial]
#[cfg_attr(not(feature = "sm-test"), serial)]
pub fn test_get_native_context() {
let mut env = match BasicEnvironment::new() {
None => return,
Expand Down

0 comments on commit f03bad7

Please sign in to comment.