github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/test/runtimes/README.md (about)

     1  # gVisor Runtime Tests
     2  
     3  App Engine uses gvisor to sandbox application containers. The runtime tests aim
     4  to test `runsc` compatibility with these
     5  [standard runtimes](https://cloud.google.com/appengine/docs/standard/runtimes).
     6  The test itself runs the language-defined tests inside the sandboxed standard
     7  runtime container.
     8  
     9  Note: [Ruby runtime](https://cloud.google.com/appengine/docs/standard/ruby) is
    10  currently in beta mode and so we do not run tests for it yet.
    11  
    12  ### Testing Locally
    13  
    14  To run runtime tests individually from a given runtime, use the following table.
    15  
    16  Language | Version | Download Image                              | Run Test(s)
    17  -------- | ------- | ------------------------------------------- | -----------
    18  Go       | 1.12    | `make -C images load-runtimes_go1.12`       | If the test name ends with `.go`, it is an on-disk test: <br> `docker run --runtime=runsc -it gvisor.dev/images/runtimes/go1.12 ( cd /usr/local/go/test ; go run run.go -v -- <TEST_NAME>... )` <br> Otherwise it is a tool test: <br> `docker run --runtime=runsc -it gvisor.dev/images/runtimes/go1.12 go tool dist test -v -no-rebuild ^TEST1$\|^TEST2$...`
    19  Java     | 11      | `make -C images load-runtimes_java11`       | `docker run --runtime=runsc -it gvisor.dev/images/runtimes/java11 jtreg -agentvm -dir:/root/test/jdk -noreport -timeoutFactor:20 -verbose:summary <TEST_NAME>...`
    20  NodeJS   | 12.4.0  | `make -C images load-runtimes_nodejs12.4.0` | `docker run --runtime=runsc -it gvisor.dev/images/runtimes/nodejs12.4.0 python tools/test.py --timeout=180 <TEST_NAME>...`
    21  Php      | 7.3.6   | `make -C images load-runtimes_php7.3.6`     | `docker run --runtime=runsc -it gvisor.dev/images/runtimes/php7.3.6 make test "TESTS=<TEST_NAME>..."`
    22  Python   | 3.7.3   | `make -C images load-runtimes_python3.7.3`  | `docker run --runtime=runsc -it gvisor.dev/images/runtimes/python3.7.3 ./python -m test <TEST_NAME>...`
    23  
    24  To run an entire runtime test locally, use the following table.
    25  
    26  Note: java runtime test take 1+ hours with 16 cores.
    27  
    28  Language | Version | Running the test suite
    29  -------- | ------- | ----------------------------------------
    30  Go       | 1.12    | `make go1.12-runtime-tests{_vfs2}`
    31  Java     | 11      | `make java11-runtime-tests{_vfs2}`
    32  NodeJS   | 12.4.0  | `make nodejs12.4.0-runtime-tests{_vfs2}`
    33  Php      | 7.3.6   | `make php7.3.6-runtime-tests{_vfs2}`
    34  Python   | 3.7.3   | `make python3.7.3-runtime-tests{_vfs2}`
    35  
    36  #### Clean Up
    37  
    38  Sometimes when runtime tests fail or when the testing container itself crashes
    39  unexpectedly, the containers are not removed or sometimes do not even exit. This
    40  can cause some docker commands like `docker system prune` to hang forever.
    41  
    42  Here are some helpful commands (should be executed in order):
    43  
    44  ```bash
    45  docker ps -a  # Lists all docker processes; useful when investigating hanging containers.
    46  docker kill $(docker ps -a -q)  # Kills all running containers.
    47  docker rm $(docker ps -a -q)  # Removes all exited containers.
    48  docker system prune  # Remove unused data.
    49  ```
    50  
    51  ### Testing Infrastructure
    52  
    53  There are 3 components to this tests infrastructure:
    54  
    55  -   [`runner`](runner) - This is the test entrypoint. This is the binary is
    56      invoked by `bazel test`. The runner spawns the target runtime container
    57      using `runsc` and then copies over the `proctor` binary into the container.
    58  -   [`proctor`](proctor) - This binary acts as our agent inside the container
    59      which communicates with the runner and actually executes tests.
    60  -   [`exclude`](exclude) - Holds a CSV file for each language runtime containing
    61      the full path of tests that should be excluded from running along with a
    62      reason for exclusion.