From 19061fdc8f2af1157c1e8a60496bfd1d83a211bf Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Tue, 24 Dec 2024 16:02:40 -0800 Subject: [PATCH] tests: add e2e test for file lock --- tests/test_flock.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/test_flock.sh diff --git a/tests/test_flock.sh b/tests/test_flock.sh new file mode 100644 index 000000000..162d6feff --- /dev/null +++ b/tests/test_flock.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env sh + +# +# Ensure umu-launcher does not download its fetched resources more than once +# when multiple processes of itself are created +# + +tmp1=$(mktemp) +tmp2=$(mktemp) + +UMU_LOG=debug GAMEID=umu-0 "$HOME/.local/bin/umu-run" wineboot -u 2> "$tmp1" & +sleep 1 +UMU_LOG=debug GAMEID=umu-0 "$HOME/.local/bin/umu-run" wineboot -u 2> "$tmp2" & +wait + +grep "exited with wait status" "$tmp1" + +# Ensure the 2nd proc didn't download the runtime +grep "\(latest\), please wait..." "$tmp2" +if [ $? -ne 0 ]; then + exit 1 +fi + +grep "exited with wait status" "$tmp2" + +# Ensure the 2nd proc didn't download Proton +grep "Downloading" "$tmp2" +if [ $? -ne 0 ]; then + exit 1 +fi