-
Notifications
You must be signed in to change notification settings - Fork 9
/
exec_back_end.sh
49 lines (40 loc) · 1.6 KB
/
exec_back_end.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
# <copyright_statement>
# CodeBuddy: A programming assignment management system for short-form exercises
# Copyright (C) 2024 Stephen Piccolo
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
# </copyright_statement>
do_verification=$1
output_type=$2
base_dir="$(pwd)"
done_with_verification=False
cd tests
for test_title in *
do
cd "${base_dir}/tests/${test_title}"
if [[ "${do_verification}" == "True" ]]
then
if [[ "${done_with_verification}" == "False" ]]
then
cp main_code code
value="$(bash /verify_code.sh ${base_dir}/verification_code 2>&1)"
rm -f code
if [[ "$value" ]]
then
echo "$value" &> txt_output
exit
fi
done_with_verification=True
fi
fi
if [[ "${output_type}" == "jpg" ]]
then
# We may get some text output when creating images.
bash /exec_code_jpg_output.sh &>> txt_output
else
bash /exec_code_txt_output.sh &>> txt_output
fi
if [ -f /clean_txt_output.py ]
then
python3 /clean_txt_output.py > /dev/null 2>&1
fi
done