#!/bin/bash
set +e
WORKSPACE=/home/taskspace
cd /home/taskspace
log() {
echo "==== $(date '+%Y%m%d.%H%M%S') : $* ===="
}
rm -rf /root/ascend/log
export ASCEND_GLOBAL_LOG_LEVEL=2
export ASCEND_SLOG_PRINT_TO_STDOUT=0
log "start run test case"
arm_package="cann-asc-tools_linux-aarch64.run"
wget -nv -O "${arm_package}" "https://ascend-ci.obs.cn-north-4.myhuaweicloud.com/${obs_path}/${arm_package}" 2>/dev/null
if [ ! -f "${arm_package}" ] || [ ! -s "${arm_package}" ]; then
echo "No custom package found, This PR no need execute smoke."
rm -f "${arm_package}"
exit 0
fi
chmod +x "${arm_package}"
source /usr/local/Ascend/cann/set_env.sh
yes "y" | bash "${arm_package}" --full --install-path=/usr/local/Ascend --quiet
python3 -m pip install tensorflow -i https://pypi.tuna.tsinghua.edu.cn/simple
source /usr/local/Ascend/cann/set_env.sh
cd ./scripts && bash run_presmoke.sh 2>&1 | tee -a ./run_test.log
mkdir -p /root/ascend
slog_name="slog.tar.gz"
tar -zcf slog.tar.gz -C /root/ascend log
OBS_KEY="${obs_smoke_path}/plog/${slog_name}"
if python3 /home/upload.py --bucket-name "ascend-ci" --action upload --local-file "slog.tar.gz" --obs-object-key "${OBS_KEY}"; then
echo "::set-output var=plog_url:https://ascend-ci.obs.cn-north-4.myhuaweicloud.com/${OBS_KEY}"
fi
log "checking test results"
date_time=$(date +%Y%m%d.%H%M%S)
if grep -w -e "execute samples success" ./run_test.log; then
echo "$date_time : run test case success"
else
echo "$date_time : run test case failed"
exit 1
fi