Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add C and CPP available for assignment #98

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/images/control-ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN apt-get dist-upgrade


RUN echo "deb http://archive.ubuntu.com/ubuntu vivid main restricted universe" >> /etc/apt/sources.list # libffi-dev
RUN apt-get install -y ssh openssh-server sudo curl vim git openssh-client telnet net-tools nginx python3.8 python3-pip libc-dev libffi-dev gcc cron dnsutils tzdata
RUN apt-get install -y ssh openssh-server sudo curl vim git openssh-client telnet net-tools nginx python3.8 python3-pip libc-dev libffi-dev gcc g++ cron dnsutils tzdata

## TZ
ENV TZ=Asia/Seoul
Expand Down
2 changes: 1 addition & 1 deletion resources/images/professor-ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN apt-get autoclean
RUN apt-get dist-upgrade

RUN echo "deb http://archive.ubuntu.com/ubuntu vivid main restricted universe" >> /etc/apt/sources.list # libffi-dev
RUN apt-get install -y ssh openssh-server sudo curl vim git openssh-client telnet net-tools nginx python3.8 python3-pip libc-dev libffi-dev gcc cron tzdata
RUN apt-get install -y ssh openssh-server sudo curl vim git openssh-client telnet net-tools nginx python3.8 python3-pip libc-dev libffi-dev gcc g++ cron tzdata

## TZ
ENV TZ=Asia/Seoul
Expand Down
12 changes: 12 additions & 0 deletions resources/images/professor-ubuntu/server/getValueAndTime_c.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

start=`date +%s.%N`

/usr/bin/gcc $1 -o $2/test.out
$2/test.out > values.txt

finish=`date +%s.%N`


diff=$( echo "$finish - $start" | bc -l )
/usr/bin/echo $diff > time.txt
12 changes: 12 additions & 0 deletions resources/images/professor-ubuntu/server/getValueAndTime_cpp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

start=`date +%s.%N`

/usr/bin/g++ -o $2/test $1
$2/test > values.txt

finish=`date +%s.%N`


diff=$( echo "$finish - $start" | bc -l )
/usr/bin/echo $diff > time.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ start=`date +%s.%N`
/usr/bin/python3 $1 > values.txt

finish=`date +%s.%N`
diff=$( echo "$finish - $start" | bc -l )


diff=$( echo "$finish - $start" | bc -l )
/usr/bin/echo $diff > time.txt
13 changes: 12 additions & 1 deletion resources/images/professor-ubuntu/server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,18 @@ async def get_assignment(id: str, assignment_id: str):
content = f.read()
return_dict["content"] = content
f.close()
os.system(f"/bin/bash {curr_path}/getValueAndTime.sh {file_path}")
# Complie differs by extension
if file_path.split(".")[-1] == "py":
os.system(
f"/bin/bash {curr_path}/getValueAndTime_python.sh {file_path}")
elif file_path.split(".")[-1] == "c":
os.system(
f"/bin/bash {curr_path}/getValueAndTime_c.sh {file_path}")
elif file_path.split(".")[-1] == "cpp":
os.system(
f"/bin/bash {curr_path}/getValueAndTime_cpp.sh {file_path}")
else:
print("지원되지 않는 파일 형식입니다.")
f = open(f"{curr_path}/values.txt", "r")
values = f.read()
return_dict["answer"] = values
Expand Down
2 changes: 1 addition & 1 deletion resources/images/student-ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN apt-get dist-upgrade


RUN echo "deb http://archive.ubuntu.com/ubuntu vivid main restricted universe" >> /etc/apt/sources.list # libffi-dev
RUN apt-get install -y ssh openssh-server sudo curl vim git openssh-client telnet net-tools nginx python3.8 python3-pip libc-dev libffi-dev gcc tzdata tree shc
RUN apt-get install -y ssh openssh-server sudo curl vim git openssh-client telnet net-tools nginx python3.8 python3-pip libc-dev libffi-dev gcc g++ tzdata tree shc

## TZ
ENV TZ=Asia/Seoul
Expand Down
Loading