Skip to content

Commit

Permalink
Merge pull request #181 from shxingch/docker-Xvfb
Browse files Browse the repository at this point in the history
[Update] Xvbf virtual display to docker
  • Loading branch information
YoruCathy authored Nov 27, 2024
2 parents 89ce695 + 0d03f61 commit 1cb52f5
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions template/docker-template/run_python.shell
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
#!/bin/bash
set -e

if ! command -v Xvfb &> /dev/null; then
echo "Xvfb is not installed. Installing..."
sudo apt-get update && sudo apt-get install -y xvfb
fi

if xdpyinfo -display :99 >/dev/null 2>&1; then
echo "Display :99 already exists. Skipping virtual display setup."
else
echo "Starting virtual display on :99..."
Xvfb :99 -screen 0 1280x1024x24 &
export DISPLAY=:99
fi

export DISPLAY=:99

echo "Starting test_bathing.py script..."
python ../test_bathing.py || { echo "Failed to run test_bathing.py"; exit 1; }

Expand All @@ -11,5 +26,19 @@ python ../test_dressing.py || { echo "Failed to run test_dressing.py"; exit 1; }

echo "Finished test_dressing.py script."

if [ -f /root/.config/unity3d/RCareWorld/DressingPlayer/spongeScore.json ]; then
echo "Contents of spongeScore.json:"
cat /root/.config/unity3d/RCareWorld/DressingPlayer/spongeScore.json
else
echo "spongeScore.json file not found!"
fi

if [ -f /root/.config/unity3d/RCareWorld/DressingPlayer/dressingScore.json ]; then
echo "Contents of dressingScore.json:"
cat /root/.config/unity3d/RCareWorld/DressingPlayer/dressingScore.json
else
echo "dressingScore.json file not found!"
fi

echo "All scripts have finished running."
sleep infinity

0 comments on commit 1cb52f5

Please sign in to comment.