Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Test GPG signing
  • Loading branch information
ShawnHymel committed Aug 6, 2022
commit 8226903e999f1b6e5bfe6cb1230a90cc67db12a9
8 changes: 2 additions & 6 deletions custom-graders/DemoCGrader/autograder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,16 @@ RUN \

# Make directories for the submissions and grader/test programs
RUN mkdir -p /grader/tests
RUN mkdir -p /shared/submission

# Copy the grader script into the Docker image
COPY grader.py /grader/grader.py

# Copy the C source code for the tests into the Docker image
COPY tests/* /grader/tests/
COPY tests/ /grader/tests/

# Set grader directory to have read/write/execute permissions so we can copy in
# submissions, compile them, and run them
RUN chmod a+rwx -R /grader/

# Setup the command that will be invoked when your docker image is run.
ENTRYPOINT ["grader/grader.py"]

# For debugging (interactive terminal): comment out above and use empty entrypoint
#ENTRYPOINT []
ENTRYPOINT ["grader/grader.py"]
11 changes: 7 additions & 4 deletions custom-graders/DemoCGrader/autograder/grader.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
COMPILER_TIMEOUT = 2.0 # How long to wait for the compiler to finish (seconds)
RUN_TIMEOUT = 2.0 # How long to wait for the test program to run (seconds)

# Define the test cases and each associated project directory and file
# Define the test cases and each associated project directory and file. Note
# that the script will look for any file with *.c in the /shared/submission
# folder, copy it to "project_dir," and rename it to "submission_file."
TEST_CASES = {
"power": {
"partId": "sN0bw",
Expand Down Expand Up @@ -62,12 +64,13 @@ def main(partId):
return

# Check to make sure that the student submitted a .c file
submitted_file = None
for file in os.listdir(SUBMISSION_SRC):
if file.endswith(".c"):
submitted_file = file
else:
send_feedback(0.0, "Your file must end with a .c extension.")
return
if submitted_file == None:
send_feedback(0.0, "Your file must end with a .c extension.")
return
submitted_file_path = os.path.join(SUBMISSION_SRC, submitted_file)

# Copy the submitted file to the project folder (has executable permissions)
Expand Down