diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2aa736f2c..191047241 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,6 +24,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + submodules: recursive - uses: actions-rs/toolchain@v1 with: toolchain: stable @@ -33,22 +35,5 @@ jobs: - uses: actions/setup-go@v2 with: go-version: "1.11.0" - - name: Build runtime-tools - run: | - mkdir -p $(go env GOPATH)/src/github.com/opencontainers - cd $(go env GOPATH)/src/github.com/opencontainers - git clone https://github.com/opencontainers/runtime-tools - cd runtime-tools - make runtimetest validation-executables - name: Run intetgration tests - run: | - expect_err_num=8 - act_err_num=0 - cd $(go env GOPATH)/src/github.com/opencontainers/runtime-tools - test_cases=("default/default.t" "linux_cgroups_devices/linux_cgroups_devices.t" "linux_cgroups_hugetlb/linux_cgroups_hugetlb.t" "linux_cgroups_pids/linux_cgroups_pids.t", "linux_cgroups_memory/linux_cgroups_memory.t", "linux_cgroups_network/linux_cgroups_network.t") - for case in "${test_cases[@]}"; do - title="Running $case" - if [ 0 -ne $(sudo RUST_BACKTRACE=1 RUNTIME=$GITHUB_WORKSPACE/target/x86_64-unknown-linux-gnu/debug/youki ./validation/$case | grep "not ok" | wc -l) ]; then - exit 1 - fi - done + run: ./integration_test.sh diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..ccbf3c853 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "integration_test/src/github.com/opencontainers/runtime-tools"] + path = integration_test/src/github.com/opencontainers/runtime-tools + url = https://github.com/opencontainers/runtime-tools.git diff --git a/README.md b/README.md index e68c65f8e..1738a1e17 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,12 @@ $ docker run -it --rm --runtime youki busybox ### Integration test -You can use [opencontainers/runtime-rools](https://github.com/opencontainers/runtime-tools) to do integration testing used in CI. -See it's documentation for details. +Go and node-tap are required to run integration test. See the [opencontainers/runtime-tools]((https://github.com/opencontainers/runtime-tools) README for details. + +``` +$ git submodule update --init --recursive +$ ./integration_test.sh +``` # Design and implementation of youki diff --git a/integration_test.sh b/integration_test.sh new file mode 100755 index 000000000..9e6395868 --- /dev/null +++ b/integration_test.sh @@ -0,0 +1,12 @@ +#!/bin/bash -eu + +root=$(pwd) +cd integration_test/src/github.com/opencontainers/runtime-tools +GOPATH=$root/integration_test make runtimetest validation-executables +test_cases=("default/default.t" "linux_cgroups_devices/linux_cgroups_devices.t" "linux_cgroups_hugetlb/linux_cgroups_hugetlb.t" "linux_cgroups_pids/linux_cgroups_pids.t" "linux_cgroups_memory/linux_cgroups_memory.t" "linux_cgroups_network/linux_cgroups_network.t") +for case in "${test_cases[@]}"; do + echo "Running $case" + if [ 0 -ne $(sudo RUST_BACKTRACE=1 RUNTIME=$root/target/x86_64-unknown-linux-gnu/debug/youki $root/integration_test/src/github.com/opencontainers/runtime-tools/validation/$case | grep "not ok" | wc -l) ]; then + exit 1 + fi +done diff --git a/integration_test/src/github.com/opencontainers/runtime-tools b/integration_test/src/github.com/opencontainers/runtime-tools new file mode 160000 index 000000000..59cdde067 --- /dev/null +++ b/integration_test/src/github.com/opencontainers/runtime-tools @@ -0,0 +1 @@ +Subproject commit 59cdde06764be8d761db120664020f0415f36045