Skip to content

Commit

Permalink
Run tests headless with EGL (#41)
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <[email protected]>
  • Loading branch information
chapulina authored Oct 28, 2021
1 parent 2c517c3 commit 299ba72
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/build-and-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ export COLCON_WS_SRC=${COLCON_WS}/src
export DEBIAN_FRONTEND=noninteractive
export ROS_PYTHON_VERSION=3

# For headless rendering
export DISPLAY=:1.0
export MESA_GL_VERSION_OVERRIDE=3.3

apt update -qq
apt install -qq -y lsb-release wget curl build-essential

Expand All @@ -26,8 +30,7 @@ curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key
apt-get update -qq
apt-get install -y $IGN_DEPS \
python3-colcon-common-extensions \
python3-rosdep \
xvfb
python3-rosdep

rosdep init
rosdep update
Expand All @@ -39,11 +42,6 @@ cp -r $GITHUB_WORKSPACE $COLCON_WS_SRC
# Install ROS dependencies
rosdep install --from-paths $COLCON_WS_SRC -i -y -r --rosdistro $ROS_DISTRO

# Rendering setup
Xvfb :1 -ac -noreset -core -screen 0 1280x1024x24 &
export DISPLAY=:1.0
export MESA_GL_VERSION_OVERRIDE=3.3

# Build
source /opt/ros/$ROS_DISTRO/setup.bash
cd $COLCON_WS
Expand Down
6 changes: 5 additions & 1 deletion dolly_tests/test/follow_ignition_TEST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ TEST(DollyTests, Follow)

// Instantiate test fixture. It starts a simulation server and provides
// hooks that we'll use to inspect the running simulation.
ignition::gazebo::TestFixture fixture(ignition::common::joinPaths(
ignition::gazebo::ServerConfig config;
config.SetSdfFile(ignition::common::joinPaths(
std::string(PROJECT_SOURCE_PATH), "worlds", "empty.sdf"));
config.SetHeadlessRendering(true);

ignition::gazebo::TestFixture fixture(config);

// Variables that will be populated during the simulation
int iterations{0};
Expand Down

0 comments on commit 299ba72

Please sign in to comment.