[tests] Permit benchmark init to fail on llvm-stress fuzz test.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Fuzz test LLVM backend using llvm-stress."""
+from compiler_gym.datasets import BenchmarkInitError
from compiler_gym.envs import LlvmEnv
from tests.pytest_plugins.random_util import apply_random_trajectory
from tests.test_main import main
@@ -22,6 +23,7 @@ def test_fuzz(env: LlvmEnv, observation_space: str, reward_space: str):
env.observation_space = observation_space
env.reward_space = reward_space
+ try:
env.reset()
apply_random_trajectory(
env,
@@ -29,6 +31,9 @@ def test_fuzz(env: LlvmEnv, observation_space: str, reward_space: str):
timeout=10,
)
print(env.state) # For debugging in case of failure.
+ except BenchmarkInitError:
+ # Benchmark is invalid.
+ pass
if __name__ == "__main__":
