def env(request) -> CompilerEnv: """Create an LLVM environment.""" if request.param == "local": env = gym.make("llvm-v0") env.require_dataset("cBench-v0") try: yield env finally: env.close() else: service = CompilerGymServiceConnection(llvm.LLVM_SERVICE_BINARY) env = LlvmEnv(service=service.connection.url, benchmark="foo") env.require_dataset("cBench-v0") try: yield env finally: env.close() service.close()
def env(request) -> CompilerEnv: # Redefine fixture to test both gym.make(...) and unmanaged service # connections. if request.param == "local": env = gym.make("llvm-v0") env.require_dataset("cBench-v0") try: yield env finally: env.close() else: service = CompilerGymServiceConnection(llvm.LLVM_SERVICE_BINARY) env = LlvmEnv(service=service.connection.url, benchmark="foo") env.require_dataset("cBench-v0") try: yield env finally: env.close() service.close()