def test_script(script, timeout=60):
    """
    Run script in a subprocess and check its running time.
    Args:
        script: the path to the script
        timeout: script that can run over `timeout` seconds can pass the test

    Returns: None

    """
    # Run your script using subprocess
    process = subprocess.Popen(['python'] + script if isinstance(script, list) else [script])

    # Wait for the script to finish or timeout after 60 seconds
    killed = False
    try:
        process.wait(timeout=timeout)
    except subprocess.TimeoutExpired:
        # If the script is still running after 60 seconds, terminate it and pass the test
        process.kill()
        killed = True
    finally:
        if killed:
            return
            # Check if the process was terminated by a signal
        if process.returncode < 0:
            raise ValueError(f"Process terminated by signal {-process.returncode}.")
        elif process.returncode > 0:
            raise ValueError(f"Process exited with error code {process.returncode}.")

    Run script in a subprocess and check its running time.
    Args:
        script: the path to the script
        timeout: script that can run over `timeout` seconds can pass the test

    Returns: None

    
metadrive/tests/test_examples/test_examples.py