From 5cb366d9baab63e1d8a8e431def3b4698cb467eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=96R=C3=96K=20Attila?= Date: Mon, 19 Aug 2024 20:54:18 +0200 Subject: [PATCH 1/5] ci: Add support for test kinds (for now, only `render`), mark those as heavy for nextest --- .config/nextest.toml | 7 ++++--- tests/framework/src/options.rs | 4 ++++ tests/framework/src/test.rs | 28 ++++++++++++++++++++++++++++ tests/tests/regression_tests.rs | 4 ++++ 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/.config/nextest.toml b/.config/nextest.toml index 94f524320b29..7000e97dfe8b 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -1,4 +1,5 @@ -# TODO: Figure out why these specific tests are flaky on CI, fix them, then delete this file. +# This is needed so we don't try to run too many visual tests at the same time, +# as they tend to crash on GitHub Actions runners - maybe due to not enough memory. [[profile.ci.overrides]] -filter = "test(avm2/pixelbender_shaderdata) or test(avm2/graphics_round_rects)" -retries = 4 +filter = "test(/^\\[render\\] /)" +threads-required = 4 \ No newline at end of file diff --git a/tests/framework/src/options.rs b/tests/framework/src/options.rs index 068abaf38825..e0d0ab90f090 100644 --- a/tests/framework/src/options.rs +++ b/tests/framework/src/options.rs @@ -218,6 +218,10 @@ impl PlayerOptions { }) } + pub fn needs_renderer(&self) -> bool { + self.with_renderer.is_some() + } + pub fn create_renderer( &self, environment: &impl Environment, diff --git a/tests/framework/src/test.rs b/tests/framework/src/test.rs index c35ce71dec32..ff336695ffd4 100644 --- a/tests/framework/src/test.rs +++ b/tests/framework/src/test.rs @@ -15,6 +15,26 @@ pub struct Font { pub italic: bool, } +#[derive(Clone, Copy)] +pub enum TestKind { + Render, +} + +impl TestKind { + pub fn name(self) -> &'static str { + match self { + TestKind::Render => "render", + } + } + + pub fn ord(kind: &str) -> impl Ord { + match kind { + "render" => 0, + _ => 1, + } + } +} + pub struct Test { pub options: TestOptions, pub swf_path: VfsPath, @@ -43,6 +63,14 @@ impl Test { }) } + pub fn kind(&self) -> Option { + if self.options.player_options.needs_renderer() { + Some(TestKind::Render) + } else { + None + } + } + pub fn create_test_runner(&self, environment: &impl Environment) -> Result { let movie = self.movie()?; let viewport_dimensions = self.options.player_options.viewport_dimensions(&movie); diff --git a/tests/tests/regression_tests.rs b/tests/tests/regression_tests.rs index 3eb4881fe616..07dc9830e789 100644 --- a/tests/tests/regression_tests.rs +++ b/tests/tests/regression_tests.rs @@ -166,6 +166,7 @@ fn run_test(args: &Arguments, file: &Path, name: &str) -> Trial { .unwrap(); let ignore = !test.should_run(!args.list, &NativeEnvironment); + let kind = test.kind(); let mut trial = Trial::test(test.name.to_string(), move || { let test = AssertUnwindSafe(test); @@ -197,6 +198,9 @@ fn run_test(args: &Arguments, file: &Path, name: &str) -> Trial { } } }); + if let Some(kind) = kind { + trial = trial.with_kind(kind.name()); + } if ignore { trial = trial.with_ignored_flag(true); } From b87a5f0a04f7d19becbbe0b66cfc36c5bf91a16e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=96R=C3=96K=20Attila?= Date: Wed, 21 Aug 2024 11:30:41 +0200 Subject: [PATCH 2/5] lets try to capture from stack traces --- .github/workflows/test_rust.yml | 8 ++++++-- bt.sh | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100755 bt.sh diff --git a/.github/workflows/test_rust.yml b/.github/workflows/test_rust.yml index 2e41f26852fb..da982bf534e0 100644 --- a/.github/workflows/test_rust.yml +++ b/.github/workflows/test_rust.yml @@ -58,7 +58,7 @@ jobs: if: runner.os == 'Linux' run: | sudo apt-get update - sudo apt install -y libasound2-dev libxcb-shape0-dev libxcb-xfixes0-dev libgtk-3-dev mesa-vulkan-drivers libpango1.0-dev libudev-dev + sudo apt install -y libasound2-dev gdb libxcb-shape0-dev libxcb-xfixes0-dev libgtk-3-dev mesa-vulkan-drivers libpango1.0-dev libudev-dev # Needed after: https://github.com/rust-lang/rust/pull/124129 # See also: https://github.com/dtolnay/linkme/issues/94 @@ -81,7 +81,10 @@ jobs: - name: Run tests with image tests if: runner.os != 'macOS' - run: cargo nextest run --profile ci --cargo-profile ci --workspace --locked --no-fail-fast -j 4 --features imgtests,lzma,jpegxr + run: | + set +e + cargo nextest run --profile ci --cargo-profile ci --workspace --locked -j 4 --features imgtests,lzma,jpegxr render + cat $(find . -name gdb.bt) env: # This is to counteract the disabling by rust-cache. # See: https://github.com/Swatinem/rust-cache/issues/43 @@ -92,6 +95,7 @@ jobs: # Workaround for: https://github.com/nextest-rs/nextest/issues/1493 # See also: https://github.com/rust-lang/rustup/issues/3825 RUSTUP_WINDOWS_PATH_ADD_BIN: '1' + CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: "./bt.sh" XDG_RUNTIME_DIR: '' # dummy value, just to silence warnings about it missing - name: Run tests without image tests diff --git a/bt.sh b/bt.sh new file mode 100755 index 000000000000..653af6ca3ed5 --- /dev/null +++ b/bt.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# sauce : https://stackoverflow.com/a/63901492 +# kredit: https://blog.cryptomilk.org/2010/12/23/gdb-backtrace-to-file/ + +ex=( + -ex "run" + -ex "set logging overwrite off" + -ex "set logging file gdb.bt" + -ex "set logging on" + -ex "set pagination off" + -ex "handle SIG33 pass nostop noprint" + -ex "echo backtrace:\n" + -ex "backtrace full" + -ex "echo \n\nregisters:\n" + -ex "info registers" + -ex "echo \n\ncurrent instructions:\n" + -ex "x/16i \$pc" + -ex "echo \n\nthreads backtrace:\n" + -ex "thread apply all backtrace" + -ex "set logging off" + -ex "quit" +) +echo 0 | gdb -batch-silent "${ex[@]}" --args "$@" + From 24e66de800cc8bde45576b1f8937492ac1831905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=96R=C3=96K=20Attila?= Date: Wed, 21 Aug 2024 12:33:18 +0200 Subject: [PATCH 3/5] lets try harder --- .config/nextest.toml | 2 +- .github/workflows/test_rust.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/nextest.toml b/.config/nextest.toml index 7000e97dfe8b..25134d438b99 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -2,4 +2,4 @@ # as they tend to crash on GitHub Actions runners - maybe due to not enough memory. [[profile.ci.overrides]] filter = "test(/^\\[render\\] /)" -threads-required = 4 \ No newline at end of file +threads-required = 1 \ No newline at end of file diff --git a/.github/workflows/test_rust.yml b/.github/workflows/test_rust.yml index da982bf534e0..e2e499cc0073 100644 --- a/.github/workflows/test_rust.yml +++ b/.github/workflows/test_rust.yml @@ -83,7 +83,7 @@ jobs: if: runner.os != 'macOS' run: | set +e - cargo nextest run --profile ci --cargo-profile ci --workspace --locked -j 4 --features imgtests,lzma,jpegxr render + cargo nextest run --profile ci --cargo-profile ci --workspace --locked -j 4 --features imgtests,lzma,jpegxr cat $(find . -name gdb.bt) env: # This is to counteract the disabling by rust-cache. From e2e2ea150add75ce4a3c23b03e04f18f51008289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=96R=C3=96K=20Attila?= Date: Sat, 24 Aug 2024 15:02:28 +0200 Subject: [PATCH 4/5] lets try to get debug symbols for lavapipe --- bt.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bt.sh b/bt.sh index 653af6ca3ed5..f08a6ff1821a 100755 --- a/bt.sh +++ b/bt.sh @@ -8,6 +8,7 @@ ex=( -ex "set logging overwrite off" -ex "set logging file gdb.bt" -ex "set logging on" + -ex "set debuginfod enabled" -ex "set pagination off" -ex "handle SIG33 pass nostop noprint" -ex "echo backtrace:\n" From 60e473e91bca3ffbf8d37296a634bb6d7e4b5587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=96R=C3=96K=20Attila?= Date: Fri, 30 Aug 2024 16:17:39 +0200 Subject: [PATCH 5/5] try to get mesa debug info --- .github/workflows/test_rust.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_rust.yml b/.github/workflows/test_rust.yml index e2e499cc0073..6d69e3fc07df 100644 --- a/.github/workflows/test_rust.yml +++ b/.github/workflows/test_rust.yml @@ -57,8 +57,12 @@ jobs: - name: Install Linux dependencies if: runner.os == 'Linux' run: | - sudo apt-get update - sudo apt install -y libasound2-dev gdb libxcb-shape0-dev libxcb-xfixes0-dev libgtk-3-dev mesa-vulkan-drivers libpango1.0-dev libudev-dev + sudo apt update + sudo apt install -y libasound2-dev gdb libxcb-shape0-dev libxcb-xfixes0-dev libgtk-3-dev mesa-vulkan-drivers libpango1.0-dev libudev-dev ubuntu-dbgsym-keyring lsb-release + echo "deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ddebs.list + echo -e "deb http://ddebs.ubuntu.com $(lsb_release -cs)-updates main restricted universe multiverse\ndeb http://ddebs.ubuntu.com $(lsb_release -cs)-proposed main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ddebs.list + sudo apt update + sudo apt install mesa-vulkan-drivers-dbgsym # Needed after: https://github.com/rust-lang/rust/pull/124129 # See also: https://github.com/dtolnay/linkme/issues/94