From 218bdbdda4da518b5fdbb5f74924cc1dc7d14d02 Mon Sep 17 00:00:00 2001 From: ZhangXinyi <9880220+zhangxinyi1024@user.noreply.gitee.com> Date: Fri, 22 Nov 2024 10:37:14 +0800 Subject: [PATCH] add some selftest for ci testing --- conf/functional/mooncake-selftests.conf | 3 ++ tests/mooncake-selftests/Readme.md | 19 ++++++++++++ tests/mooncake-selftests/install.sh | 21 +++++++++++++ tests/mooncake-selftests/run.sh | 39 +++++++++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 conf/functional/mooncake-selftests.conf create mode 100644 tests/mooncake-selftests/Readme.md create mode 100644 tests/mooncake-selftests/install.sh create mode 100644 tests/mooncake-selftests/run.sh diff --git a/conf/functional/mooncake-selftests.conf b/conf/functional/mooncake-selftests.conf new file mode 100644 index 0000000..0e45376 --- /dev/null +++ b/conf/functional/mooncake-selftests.conf @@ -0,0 +1,3 @@ +test +transfer-engine-selftests +transfer-engine-examples \ No newline at end of file diff --git a/tests/mooncake-selftests/Readme.md b/tests/mooncake-selftests/Readme.md new file mode 100644 index 0000000..c8f602b --- /dev/null +++ b/tests/mooncake-selftests/Readme.md @@ -0,0 +1,19 @@ + +# mooncake-selftest +## Description +test for mooncake +## Homepage +[https://github.com/kvcache-ai/Mooncake](https://github.com/kvcache-ai/Mooncake) +## Version +## Category +functional +## Parameters +- test : 指定的测试 +## Results +``` +Pass/Skip/Fail +``` +## Manual Run +``` +See the document in repo +``` \ No newline at end of file diff --git a/tests/mooncake-selftests/install.sh b/tests/mooncake-selftests/install.sh new file mode 100644 index 0000000..bb17080 --- /dev/null +++ b/tests/mooncake-selftests/install.sh @@ -0,0 +1,21 @@ +#!/bin/bash +INSTALL_DEP=${INSTALL_DEP:-"0"} + +build() +{ + git clone git@github.com:kvcache-ai/mooncake-dev.git $TONE_BM_BUILD_DIR/mooncake + set -x + cd $TONE_BM_BUILD_DIR/mooncake + if [[ "$INSTALL_DEP" == 1 ]]; then + bash dependencies.sh + fi + mkdir build + cd build + cmake .. + make -j +} + +install() +{ + cp -a $TONE_BM_BUILD_DIR/* $TONE_BM_RUN_DIR +} \ No newline at end of file diff --git a/tests/mooncake-selftests/run.sh b/tests/mooncake-selftests/run.sh new file mode 100644 index 0000000..45d0847 --- /dev/null +++ b/tests/mooncake-selftests/run.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +setup() +{ + if ! which etcd | grep -q etcd; then + apt install -y etcd + systemctl restart networkd-dispatcher.service + systemctl restart unattended-upgrades.service + fi +} + +run() +{ + set -x + export LD_LIBRARY_PATH=/usr/local/lib/ + [ -f $TONE_BM_RUN_DIR/result.log ] && rm $TONE_BM_RUN_DIR/result.log + touch $TONE_BM_RUN_DIR/result.log + if [[ "$test" == "transfer-engine-selftests" ]]; then + cd $TONE_BM_RUN_DIR/mooncake/build/mooncake-transfer-engine/tests + for case in $(ls | grep test); do + if echo $case | grep rdma; then + echo "$case: Skip" >> $TONE_BM_RUN_DIR/result.log + else + eval "timeout 300s ./$case" + if [[ $? -eq 0 ]];then + echo "$case: Pass" >> $TONE_BM_RUN_DIR/result.log + else + echo "$case: Fail" >> $TONE_BM_RUN_DIR/result.log + fi + fi + done + fi +} + + +parse() +{ + cat $TONE_BM_RUN_DIR/result.log +} \ No newline at end of file -- Gitee