From 2deac87b603b3705d3f35065c4bfed9b0785772f Mon Sep 17 00:00:00 2001 From: Matthew Kilgore Date: Fri, 16 Sep 2022 23:59:07 -0400 Subject: [PATCH] Fix Linux build agent audio problems It's still not entirely clear what the underlying issue is, but the ALSA device provided by pulseaudio stops working after so many tests use it. I've tried various approaches, but simply restarting pulseaudio after every test is a bruteforce but successful solution. In practice it also doesn't have any noticeable performance penalty, so it seems like a file solution. The `CI_TESTING` environment variable is used to avoid restarting pulseaudio if the tests aren't being run in the CI environment (we don't want to restart your pulseaudio instance if you're running them locally!) --- .github/workflows/build-process.yml | 2 ++ tests/compile_tests.sh | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/.github/workflows/build-process.yml b/.github/workflows/build-process.yml index cfc8e4216..9115fd6a7 100644 --- a/.github/workflows/build-process.yml +++ b/.github/workflows/build-process.yml @@ -82,6 +82,8 @@ jobs: - name: Test shell: bash + env: + CI_TESTING: y run: tests/run_tests.sh - name: Create QB64-PE Artifact diff --git a/tests/compile_tests.sh b/tests/compile_tests.sh index 79783667b..dc2670a27 100755 --- a/tests/compile_tests.sh +++ b/tests/compile_tests.sh @@ -87,6 +87,13 @@ do [ "$testResult" == "$expectedResult" ] assert_success_named "result" "Result is wrong:" show_incorrect_result "$expectedResult" "$testResult" + + # Restart pulseaudio between each test to make sound tests work on Linux + if [ "$CI_TESTING" == "y" ] && command -v pulseaudio > /dev/null + then + pulseaudio -k + pulseaudio -D + fi else ! (exit $ERR) assert_success_named "Compile" "Compilation Success, was expecting error:" show_failure "$category" "$testName"