def test_port_collision_test(): """Test that attempting to connect to a port that is already in use succeeds.""" with gym.make("llvm-autophase-ic-v0") as env_a: env_a.reset(benchmark="cbench-v1/crc32") with LlvmEnv(service=env_a.service.connection.url) as env_b: env_b.reset(benchmark="cbench-v1/crc32")
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(SERVICE_BIN) env = LlvmEnv(service=service.connection.url, benchmark="foo") env.require_dataset("cBench-v0") try: yield env finally: env.close() service.close()
def test_make_service(benchmark): service = CompilerGymServiceConnection(llvm.LLVM_SERVICE_BINARY) try: benchmark(lambda: LlvmEnv(service=service.connection.url).close()) finally: service.close()