-
Notifications
You must be signed in to change notification settings - Fork 3
/
dev-badtest.sh
66 lines (54 loc) · 2.1 KB
/
dev-badtest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
set +e # смысл теста в проверке вылета программы, у нашей программы всегда будет ExitCode != 0
cd .. # все операции - от корня проекта
#
# CONFIG
#
SUITE=$1
PACKAGES=$PWD/../packages # docker обязывает все пути указывать как абсолютные при монтировании volume
PROJECT_NAME=$(basename $PWD) # volcano-abc
PROJECT_PACKAGE=${PROJECT_NAME//-/.} # volcano.abc
PYTHON_RUNNER=${PROJECT_NAME}-ci-py-lux
LOG_FILE=$(mktemp)
echo ''
echo '----------------------------------------------------------------'
echo ' Task: BAD TESTS'
echo " Package name: ${PROJECT_PACKAGE} (autodetect)"
echo " Log file: ${LOG_FILE}"
echo " Packages: ${PACKAGES}"
echo '----------------------------------------------------------------'
echo ''
echo 'Renew dockers...'
docker build -t ${PYTHON_RUNNER} dockers/${PYTHON_RUNNER}
for SUITE_PATH in test/bad/*/ ; do
SUITE_NAME=$(basename ${SUITE_PATH})
if [ -z "${SUITE}" ] || [ "${SUITE}" = "${SUITE_NAME}" ] ; then
ARGS=
if [ -f ${SUITE_PATH}/args ]; then
ARGS=$(cat ${SUITE_PATH}/args)
fi
echo '-----------------------------------------------------------------'
echo " Suite: ${SUITE_NAME}"
echo " Search for: $(cat ${SUITE_PATH}/search)"
echo " Arguments: ${ARGS}"
echo '-----------------------------------------------------------------'
docker run -it --rm -v $PWD:/project:ro -v ${PACKAGES}:/packages:ro -w /project/${SUITE_PATH} ${PYTHON_RUNNER} sh -c "
pip3 install -q --find-links=/packages /project;
python3 -m ${PROJECT_PACKAGE} ${ARGS}" > ${LOG_FILE}
cat ${LOG_FILE} | grep -qFf ${SUITE_PATH}/search
if [ $? -ne 0 ] ; then
echo ''
echo " !!! Test failed !!!"
echo ''
cat ${LOG_FILE}
exit 1
else
echo 'OK'
fi
else
echo "Skip -- ${SUITE_NAME}"
fi
done
echo ''
echo 'SUCCESS'
echo ''