-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.sh
52 lines (41 loc) · 1.33 KB
/
util.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
#!/bin/bash
# util to test, make submit file
# require:
# docker
#
# usage:
# ./util.sh test
# ./util.sh submit
# please provide info
STUDENT_ID="2112070"
# python or java
PROJ_P_LANG="python"
# DO NOT CHANGE BELOW VARIABLES
S_OUT="/`pwd`/$STUDENT_ID/output"
S_IN="/`pwd`/input"
# default: do nothing
function run_ { echo "Please give either command submit/test" ; }
function run_test {
# run and make output, similar when grading your assignment
# make sure ./input folder exits
# check results in $S_OUT
echo "run test your assignment"
# cur=`pwd`
# cd $PROJ_P_LANG
# docker build --network=host -t student-image .
docker build -t student-image .
# docker run --rm -v $S_OUT:/nlp/output -v $S_IN:/nlp/input student-image
docker run --rm -v $S_OUT:/nlp/output student-image
# cd $cur
echo "please check output in $S_OUT"
}
function run_submit {
# make submit file, just needed directories/files
# require: zip
echo "make submit file $STUDENT_ID.zip"
# zip PROJ_P_LANG -o $STUDENT_ID.zip
# docker run --rm -ti -v `pwd`:/data thanhhungqb/images:zip-2023 zip -r /data/$STUDENT_ID.zip python java util.sh
docker run --rm -ti -v /`pwd`:/data thanhhungqb/images:zip-2023 zip -r /data/$STUDENT_ID.zip src main.py util.sh
echo "Please check file $STUDENT_ID.zip to make sure all correct directories/files included"
}
run_$1 "${@:2}"