1
0
mirror of https://github.com/containers/youki synced 2024-11-23 01:11:58 +01:00
This commit is contained in:
Yashodhan Joshi 2022-02-06 16:22:18 +05:30
parent 9ef8695371
commit cd56e28c04
8 changed files with 46 additions and 33 deletions

@ -36,6 +36,6 @@ jobs:
- run: sudo apt-get -y update - run: sudo apt-get -y update
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev - run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- name: Validate tests on runc - name: Validate tests on runc
run: cd scripts && RUNTIME=runc sudo ./rust_integration_test.sh run: cd scripts && RUNTIME=runc ./rust_integration_tests.sh
- name: Validate tests on youki - name: Validate tests on youki
run: cd ./scripts && sudo sudo ./rust_integration_test.sh run: cd ./scripts && sudo ./rust_integration_tests.sh

@ -17,11 +17,13 @@ jobs:
id: filter id: filter
with: with:
filters: | filters: |
./crates/youki: crates/youki/** crates/youki: crates/youki/**
./crates/libcontainer: crates/libcontainer/** crates/libcontainer: crates/libcontainer/**
./crates/libcgroups: crates/libcgroups/** crates/libcgroups: crates/libcgroups/**
./crates/libseccomp: crates/libseccomp/** crates/libseccomp: crates/libseccomp/**
./rust_integration_tests: ./integration_tests/rust-integration-tests/** integration_tests/rust-integration-tests/runtimetest: ./integration_tests/rust-integration-tests/runtimetest
integration_tests/rust-integration-tests/integration_test: ./integration_tests/rust-integration-tests/integration_test
integration_tests/rust-integration-tests/test_framework: ./integration_tests/rust-integration-tests/test_framework
check: check:
needs: [changes] needs: [changes]
if: ${{ !contains(needs.changes.outputs.dirs, '[]') }} if: ${{ !contains(needs.changes.outputs.dirs, '[]') }}
@ -63,7 +65,7 @@ jobs:
- run: sudo apt-get -y update - run: sudo apt-get -y update
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev - run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- name: Run tests - name: Run tests
run: cargo test --all --all-features --no-fail-fast run: cd ./crates && cargo test --all --all-features --no-fail-fast
coverage: coverage:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Run test coverage name: Run test coverage
@ -90,6 +92,7 @@ jobs:
run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- name: Run Test Coverage for youki - name: Run Test Coverage for youki
run: | run: |
cd ./crates
cargo llvm-cov clean --workspace cargo llvm-cov clean --workspace
cargo llvm-cov --no-report cargo llvm-cov --no-report
cargo llvm-cov --no-run --lcov --ignore-filename-regex "libseccomp/src|integration_test/src|test_framework/src|systemd_api.rs" --output-path ./coverage.lcov cargo llvm-cov --no-run --lcov --ignore-filename-regex "libseccomp/src|integration_test/src|test_framework/src|systemd_api.rs" --output-path ./coverage.lcov
@ -122,6 +125,6 @@ jobs:
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev - run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- uses: actions/setup-go@v2 - uses: actions/setup-go@v2
with: with:
go-version: "1.11.0" go-version: "1.17.6"
- name: Run integration tests - name: Run integration tests
run: ./scripts/oci_integration_test.sh run: ./scripts/oci_integration_tests.sh

6
.gitmodules vendored

@ -1,5 +1,5 @@
[submodule "integration_test/src/github.com/opencontainers/runtime-tools"] [submodule "integration_tests/oci-runtime-tests"]
path = integration_tests/oci-runtime-tools/src/github.com/opencontainers/runtime-tools path = integration_tests/oci-runtime-tests/src/github.com/opencontainers/runtime-tools
url = https://github.com/opencontainers/runtime-tools.git url = git@github.com:opencontainers/runtime-tools.git
ignore = dirty ignore = dirty

@ -3,10 +3,10 @@
TGT = x86_64-unknown-linux-gnu TGT = x86_64-unknown-linux-gnu
debug: debug:
cargo build $(TGT) && cp ./target/$(TGT)/debug/youki ./youki_bin cargo build && cp ./target/$(TGT)/debug/youki ./youki_bin
release: release:
cargo build --release $(TGT) && cp ./target/$(TGT)/release/youki ./youki_bin cargo build --release && cp ./target/$(TGT)/release/youki ./youki_bin
clean: clean:
rm ./youki_bin rm ./youki_bin

@ -0,0 +1 @@
Subproject commit 0105384f68e16803891d0a17d9067b1def6a2778

@ -1,12 +1,14 @@
#! /bin/sh #! /bin/sh
cd ../crates ROOT=$(git rev-parse --show-toplevel)
make release
mv ./youki_bin ../scripts/youki
cd ../integration_tests/rust-integration-tests cd ${ROOT}/crates
make release
mv ./youki_bin ${ROOT}/scripts/youki
cd ${ROOT}/integration_tests/rust-integration-tests
make FLAG=--release all make FLAG=--release all
mv ./runtimetest_bin ../../scripts/runtimetest mv ./runtimetest_bin ${ROOT}/scripts/runtimetest
mv ./integration_test_bin ../../scripts/integration_test mv ./integration_test_bin ${ROOT}/scripts/integration_test
exit 0 exit 0

@ -1,12 +1,13 @@
#!/bin/bash -eu #!/bin/bash -eu
./build.sh ROOT=$(git rev-parse --show-toplevel)
SCRIPTS_DIR=$(pwd) ${ROOT}/scripts/build.sh
SCRIPTS_DIR=${ROOT}/scripts
RUNTIME=${SCRIPTS_DIR}/youki RUNTIME=${SCRIPTS_DIR}/youki
OCI_TEST_DIR=../integration_tests/oci-runtime-tools/src/github.com/opencontainers/runtime-tools OCI_TEST_DIR=${ROOT}/integration_tests/oci-runtime-tests/src/github.com/opencontainers/runtime-tools
PATTERN=${1:-.} PATTERN=${1:-.}
cd $OCI_TEST_DIR cd $OCI_TEST_DIR
test_cases=( test_cases=(
@ -89,8 +90,8 @@ check_environment() {
} }
for case in "${test_cases[@]}"; do for case in "${test_cases[@]}"; do
if [[ ! -e "${ROOT}/integration_test/runtime-tools/src/github.com/opencontainers/runtime-tools/validation/$case" ]]; then if [[ ! -e "${OCI_TEST_DIR}/validation/$case" ]]; then
GO111MODULE=auto GOPATH=${ROOT}/integration_test/runtime-tools make runtimetest validation-executables GO111MODULE=auto GOPATH=${ROOT}/integration_tests/oci-runtime-tests make runtimetest validation-executables
break break
fi fi
done done
@ -109,7 +110,7 @@ for case in "${test_cases[@]}"; do
echo "Running $case" echo "Running $case"
logfile="./log/$case.log" logfile="./log/$case.log"
mkdir -p "$(dirname $logfile)" mkdir -p "$(dirname $logfile)"
sudo RUST_BACKTRACE=1 RUNTIME=${RUNTIME} ../integration_test/runtime-tools/src/github.com/opencontainers/runtime-tools/validation/$case >$logfile 2>&1 || (cat $logfile && exit 1) sudo RUST_BACKTRACE=1 RUNTIME=${RUNTIME} ${OCI_TEST_DIR}/validation/$case >$logfile 2>&1 || (cat $logfile && exit 1)
if [ 0 -ne $(grep "not ok" $logfile | wc -l ) ]; then if [ 0 -ne $(grep "not ok" $logfile | wc -l ) ]; then
cat $logfile cat $logfile
exit 1 exit 1

@ -1,15 +1,21 @@
#! /bin/sh #! /bin/sh
ROOT=$(git rev-parse --show-toplevel)
SCRIPT_DIR=${ROOT}/scripts
if [ "$RUNTIME" = "" ]; then if [ "$RUNTIME" = "" ]; then
RUNTIME="./youki" RUNTIME="${SCRIPT_DIR}/youki"
fi fi
LOGFILE="./test.log" LOGFILE="${SCRIPT_DIR}/test.log"
./build.sh cd ${SCRIPT_DIR}
cp ../integration_tests/rust-integration-tests/integration_test/bundle.tar.gz ./bundle.tar.gz ${SCRIPT_DIR}/build.sh
touch ./test.log
cp ${ROOT}/integration_tests/rust-integration-tests/integration_test/bundle.tar.gz ${SCRIPT_DIR}/bundle.tar.gz
touch ${LOGFILE}
YOUKI_LOG_LEVEL="error" sudo ./integration_test run --runtime $RUNTIME --runtimetest ./runtimetest > $LOGFILE YOUKI_LOG_LEVEL="error" sudo ./integration_test run --runtime $RUNTIME --runtimetest ./runtimetest > $LOGFILE