-
Notifications
You must be signed in to change notification settings - Fork 0
/
manual_test.sh
executable file
·110 lines (85 loc) · 2.24 KB
/
manual_test.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
## **@AUTHOR**: Lain Pavot - [email protected]
## **@DATE**: 22/06/2022
envs_directory=$(pwd)
envs_directory=/tmp/history_metadata_extractor-envs
mkdir -p ${envs_directory}
VENV=${envs_directory}/.manual-venv
CENV=${envs_directory}/.manual-conda
MAMBA_SOLVER=
## comment to deactivate mamba solver
MAMBA_SOLVER="--experimental-solver libmamba"
ENV_NAME=history_metadata_extractor
XML_PATH=./history_metadata_extractor.xml
SCRIPT_NAME=history_metadata_extractor.py
output_name=out.html
options=" \
-d ./test-data/datasets_attrs.txt \
-j ./test-data/jobs_attrs.txt \
-o ./${output_name} \
"
expected_result=test-data/out.html
runner=python3.10
dependencies=python=3.10.5
miniconda_version=py37_4.12.0-Linux-x86_64
if [ ! -e "${VENV}" ];then
echo "virtualenv not created yet, creating..."
python3 -m virtualenv "${VENV}"
echo "venv created"
else
echo "virtualenv already exist: ok"
fi
. ${VENV}/bin/activate
if [ ! -e "${CENV}" ];then
echo "conda env not created yet, creating..."
if [ ! -e ./install_conda.sh ];then
wget \
-O install_conda.sh \
https://repo.anaconda.com/miniconda/Miniconda3-${miniconda_version}.sh \
;
fi
bash ./install_conda.sh -b -p "${CENV}"
${CENV}/bin/conda install -y -n base conda-libmamba-solver
${CENV}/bin/conda create \
-y \
--quiet \
--override-channels \
--channel conda-forge \
--channel bioconda \
--channel defaults \
--name "${ENV_NAME}" \
${MAMBA_SOLVER} \
${dependencies}
echo "conda env created"
fi
echo ""
echo "===== preparing ====="
oldwd=$(pwd)
tmp=$(mktemp -d)
echo "Working in ${tmp}"
files=$(find . -maxdepth 1 -regex "./.+")
cd "${tmp}"
echo "creating links..."
echo "${files}" | xargs -I file ln -s "${oldwd}"/file file
echo "ready to work"
echo ""
echo "===== processing ====="
. "${CENV}/bin/activate" "${CENV}/envs/${ENV_NAME}" ;
${runner} ./${SCRIPT_NAME} ${options};
echo ""
echo "Error code: ${?}" ;
lines=$(diff "${output_name}" "${expected_result}" 2>&1)
echo ""
echo "===== results ====="
if [ "${lines}" = "" ];then
echo "Result equal to expected."
else
echo "Some lines are different:"
echo "${lines}"
fi
echo ""
echo "===== cleaning ====="
echo "Removing ${tmp}..."
rm -rf "${tmp}"
echo ""
echo "Done."