1
0
Fork 0
mirror of https://github.com/containers/youki synced 2024-04-19 00:04:26 +02:00

clean up the shell script for youki integration test.

This commit is contained in:
utam0k 2022-01-09 17:40:16 +09:00
parent 9dd1c9d835
commit b02f1b8ae3
No known key found for this signature in database
GPG Key ID: CE4B1272D0462168
3 changed files with 35 additions and 24 deletions

View File

@ -36,7 +36,9 @@ jobs:
uses: Swatinem/rust-cache@v1
- run: sudo apt-get -y update
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- name: Build
run: ./build.sh
- name: Validate tests on runc
run: cd ./crates/integration_test && ./tests.sh run runc
run: cd ./crates/integration_test && sudo ./tests.sh run runc
- name: Validate tests on youki
run: cd ./crates/integration_test && ./tests.sh run ./youki
run: cd ./crates/integration_test && sudo ./tests.sh run ../../youki

View File

@ -4,10 +4,10 @@ This provides a test suite to test low level OCI spec compliant container runtim
## Usage
```sh
```console
# in root folder
$ ./build.sh
$ cd youki_integration_test
$ cd crates/youki_integration_test
$ cp ../youki .
$ ./build.sh
# currently root access is required

View File

@ -1,37 +1,46 @@
#!/bin/bash
cd ../../
./build.sh --release
cp ./youki ./crates/integration_test/youki
cp ./youki_integration_test ./crates/integration_test/youki_integration_test
cp ./runtimetest_tool ./crates/integration_test/runtimetest
cd ./crates/integration_test
RUNTIME=./youki
set -e
# syntax is
# test.sh build
# test.sh run
# test.sh run runtime-name
# test.sh runtime-name
if [[ "$1" = "build" ]]; then
exit 0
if test "$(id -u)" != 0; then
echo "Please run as root"
exit 1
fi
PROJECT_ROOT=$(git rev-parse --show-toplevel)
LOGFILE="$PROJECT_ROOT/crates/integration_test/test_log.log"
YOUKI_INTEGRATION_TEST=$PROJECT_ROOT/youki_integration_test
RUNTIMETEST_TOOL=$PROJECT_ROOT/runtimetest_tool
if [ ! -e $YOUKI_INTEGRATION_TEST ]; then
echo "$YOUKI_INTEGRATION_TEST was not found, please try to build."
exit 1
fi
if [ ! -e $RUNTIMETEST_TOOL ]; then
echo "$RUNTIMETEST_TOOL was not found, please try to build."
exit 1
fi
# if second argument is non-empty, consider it as runtime name
# else the consider first argument as runtime name
RUNTIME=$PROJECT_ROOT/youki
if [[ -n "$2" ]]; then
RUNTIME="$2"
RUNTIME=$2
elif [[ -n "$1" ]]; then
RUNTIME="$1"
RUNTIME=$1
fi
touch $LOGFILE
logfile="./test_log.log"
touch $logfile
sudo ./youki_integration_test run --runtime "$RUNTIME" --runtimetest "./runtimetest" > $logfile
if [ 0 -ne $(grep "not ok" $logfile | wc -l ) ]; then
cat $logfile
# FIXME: Tests should pass even if the log level is debug.
YOUKI_LOG_LEVEL="error" $YOUKI_INTEGRATION_TEST run --runtime $RUNTIME --runtimetest $RUNTIMETEST_TOOL > $LOGFILE
if [ 0 -ne $(grep "not ok" $LOGFILE | wc -l ) ]; then
cat $LOGFILE
exit 1
fi
echo "Validation successful for runtime $RUNTIME"
echo "Validation successful for runtime $RUNTIME"