-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #600 from utam0k/improvement/integration-test-refa…
…ctoring-1 clean up the shell script for youki integration test.
- Loading branch information
Showing
3 changed files
with
35 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |