diff --git a/.bazelrc b/.bazelrc index 9e7be94..b8df98f 100644 --- a/.bazelrc +++ b/.bazelrc @@ -5,10 +5,6 @@ common --keep_going=yes build --test_output=errors build --test_summary=terse -# Inject DISPLAY into test runner environment for tests that use X. -build --test_env=DISPLAY -build --sandbox_add_mount_pair=/tmp/.X11-unix - # Add `bazel test --config=lint` shortcut for linting. build:lint --test_tag_filters=lint diff --git a/.github/ci_setup.bash b/.github/ci_setup.bash index e129028..537d324 100755 --- a/.github/ci_setup.bash +++ b/.github/ci_setup.bash @@ -2,25 +2,4 @@ set -euxo pipefail -# Downgrade mesa per https://github.com/RobotLocomotion/drake/issues/18726. -sudo apt-get --assume-yes --allow-downgrades install \ - xvfb \ - libegl1 \ - libegl-mesa0=22.0.1-1ubuntu2 \ - libgbm1=22.0.1-1ubuntu2 \ - libgl1-mesa-dri=22.0.1-1ubuntu2 \ - libglapi-mesa=22.0.1-1ubuntu2 \ - libglx-mesa0=22.0.1-1ubuntu2 - -cat << EOF | sudo tee /lib/systemd/system/xvfb.service -[Unit] -After=network.target - -[Service] -ExecStart=/usr/bin/Xvfb :99 -screen 0 1280x1024x24 -ac +extension GLX +extension RANDR +render -noreset - -[Install] -WantedBy=multi-user.target -EOF - -sudo systemctl --now --quiet enable /lib/systemd/system/xvfb.service +sudo apt-get --assume-yes install libegl1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aa0d0d2..efda4d7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,10 +10,6 @@ on: branches: - main -env: - # Always use the Xvfb service's display. - DISPLAY: ":99" - jobs: bazel_test: runs-on: ubuntu-latest @@ -76,6 +72,13 @@ jobs: run: | ln -s .github/ci.bazelrc user.bazelrc ./bazel test //... + # Save the test outputs to allow for eyeball verification when relevant. + - name: Archive test outputs + uses: actions/upload-artifact@v4 + with: + name: test_outputs + path: | + .bazel/testlogs/examples/ball_bin_test/test.outputs/outputs.zip # Save the updated cache snapshots, so we never do the same work twice. # By default, actions/cache only saves after a successful workflow, but # our caches are bags of files where we only ever add new files (not change diff --git a/examples/ball_bin.yaml b/examples/ball_bin.yaml index 5f8f611..8d274c5 100644 --- a/examples/ball_bin.yaml +++ b/examples/ball_bin.yaml @@ -60,8 +60,10 @@ cameras: vtk_camera: name: vtk_camera renderer_name: vtk - renderer_class: !RenderEngineVtkParams {} - show_rgb: True # Use a live on-screen preview. + renderer_class: !RenderEngineVtkParams + backend: EGL + # For `show_rgb: True` you must also set the `backend: GLX` on prior line. + show_rgb: False width: 1024 height: 1024 fps: 8.0 diff --git a/examples/test/ball_bin_test.py b/examples/test/ball_bin_test.py index dbc90e1..5946d2a 100644 --- a/examples/test/ball_bin_test.py +++ b/examples/test/ball_bin_test.py @@ -13,6 +13,9 @@ def setUp(self): self.tmpdir = Path(os.environ["TEST_TMPDIR"]) self.assertTrue(self.tmpdir.exists(), self.tmpdir) + self.out_dir = Path(os.environ["TEST_UNDECLARED_OUTPUTS_DIR"]) + self.assertTrue(self.out_dir.exists(), self.out_dir) + # Find the demo. demo_path = Path("examples/ball_bin").absolute().resolve() self.assertTrue(demo_path.exists(), demo_path) @@ -71,10 +74,10 @@ def test_still_images(self): f"--scenario_file={scenario_file}", ] - result = subprocess.run(run_args, cwd=self.tmpdir) + result = subprocess.run(run_args, cwd=self.out_dir) result.check_returncode() - self.assertTrue((self.tmpdir / "vtk_camera.png").exists()) - self.assertTrue((self.tmpdir / "blender_camera.png").exists()) + self.assertTrue((self.out_dir / "vtk_camera.png").exists()) + self.assertTrue((self.out_dir / "blender_camera.png").exists()) def test_video(self): """Checks that the example creates 2x video files.""" @@ -82,10 +85,10 @@ def test_video(self): run_args = self.default_run_args + [f"--scenario_file={scenario_file}"] - result = subprocess.run(run_args, cwd=self.tmpdir) + result = subprocess.run(run_args, cwd=self.out_dir) result.check_returncode() - self.assertTrue((self.tmpdir / "vtk_camera.mp4").exists()) - self.assertTrue((self.tmpdir / "blender_camera.mp4").exists()) + self.assertTrue((self.out_dir / "vtk_camera.mp4").exists()) + self.assertTrue((self.out_dir / "blender_camera.mp4").exists()) if __name__ == "__main__":