Difference between revisions of "Moodle VPL Tutorials"
(→Moodle Virtual-Programming-Lab (VPL)) |
|||
(18 intermediate revisions by the same user not shown) | |||
Line 11: | Line 11: | ||
</tanbox> | </tanbox> | ||
<br /> | <br /> | ||
+ | <br /> | ||
+ | ==Reference Material== | ||
+ | * A video I created to help explain how I use VPL for my courses. | ||
<br /> | <br /> | ||
<center><videoflash>GHGTw84XFdM</videoflash><br />([[Tutorial: Moodle VPL Demo -- Java Heap|Supporting Files for Video]] )</center> | <center><videoflash>GHGTw84XFdM</videoflash><br />([[Tutorial: Moodle VPL Demo -- Java Heap|Supporting Files for Video]] )</center> | ||
<br /> | <br /> | ||
+ | * Juan Carlos Rodríguez-del-Pino, Enrique Rubio-Royo, Zenón, and J. HernándezFigueroa, A Virtual Programming Lab for Moodle with automatic assessment and anti-plagiarism features, Proc. WorldComp12, July 2012, Las Vegas, USA. ([http://acceda.ulpgc.es/xmlui/bitstream/handle/10553/9773/EEE3753.pdf?sequence=5 pdf]) | ||
+ | * [[media:Thiebaut_automaticEvaluationOfComputerProgramsUsingMoodlesVirtualProgrammingLabModule2.pdf|Automatic Evaluation of Computer Programs using Moodle's Virtual Programming Lab (VPL) Module]], D. Thiebaut, accepted for presentation at CCSCNE 2015. | ||
+ | <br /> | ||
+ | * [https://www.youtube.com/watch?v=34dfL5jd4eY YouTube video 1]: setting up a simple VPL module Part 1 (for use at CCSCNE2015) | ||
+ | * [https://www.youtube.com/watch?v=pbnH1g195uQ YouTube video 2]: setting up a simple VPL module, Part 2 (for use at CCSCNE2015) | ||
+ | <br /> | ||
+ | ===Setting up a VPL module for Python=== | ||
+ | <br /> | ||
+ | <center><videoflash>QgcQMB4yYuU</videoflash></center> | ||
<br /> | <br /> | ||
==Moodle Virtual-Programming-Lab ([http://acceda.ulpgc.es/bitstream/10553/9773/5/EEE3753.pdf VPL])== | ==Moodle Virtual-Programming-Lab ([http://acceda.ulpgc.es/bitstream/10553/9773/5/EEE3753.pdf VPL])== | ||
− | + | <br /> | |
{| | {| | ||
! Tutorial | ! Tutorial | ||
Line 163: | Line 175: | ||
[[Tutorial: Moodle_VPL_--_Verifying Presence of Functions in Asm | Moodle VPL Example 17: Verifying that ASM Program Contains Key Functions.]] | [[Tutorial: Moodle_VPL_--_Verifying Presence of Functions in Asm | Moodle VPL Example 17: Verifying that ASM Program Contains Key Functions.]] | ||
| | | | ||
− | Assembly | + | Assembly<br />Nasm |
| | | | ||
This VPL module tests that an assembly program actually declares and calls 3 key functions. | This VPL module tests that an assembly program actually declares and calls 3 key functions. | ||
Line 172: | Line 184: | ||
[[Tutorial: Moodle_VPL_--_Test Function of Student Program Multiple Times | Moodle VPL Example 18: Test Function of Student Program Multiple Times.]] | [[Tutorial: Moodle_VPL_--_Test Function of Student Program Multiple Times | Moodle VPL Example 18: Test Function of Student Program Multiple Times.]] | ||
| | | | ||
− | Assembly | + | Assembly<br />Nasm |
| | | | ||
This VPL module tests a function in the student program and calls it several times to see if it performs correctly. The _start label of the student program is invalidated, and the student program is linked with a test program that calls the student function as an extern. | This VPL module tests a function in the student program and calls it several times to see if it performs correctly. The _start label of the student program is invalidated, and the student program is linked with a test program that calls the student function as an extern. | ||
Line 205: | Line 217: | ||
[[Tutorial: Moodle_VPL_-- Test Assembly Functions and checks that function is recursive | Moodle VPL Example 22: Test functions in the student programs, checks stack and register invariance, and verifies that solution provided is recursive.]] | [[Tutorial: Moodle_VPL_-- Test Assembly Functions and checks that function is recursive | Moodle VPL Example 22: Test functions in the student programs, checks stack and register invariance, and verifies that solution provided is recursive.]] | ||
| | | | ||
− | Assembly | + | Assembly<br />Nasm |
| | | | ||
This VPL module requires the student to submit a program that contains only global assembly language functions. The module uses a test program in assembly that calls the functions with a given set of parameters, and tests whether the returned values are correct or not. The test program also verifies that none of the Pentium registers are modified. The testing script also ensures that the student program uses recursion for his/her solution. | This VPL module requires the student to submit a program that contains only global assembly language functions. The module uses a test program in assembly that calls the functions with a given set of parameters, and tests whether the returned values are correct or not. The test program also verifies that none of the Pentium registers are modified. The testing script also ensures that the student program uses recursion for his/her solution. | ||
+ | |||
+ | |- style="background:#ffffff" valign="top" | ||
+ | | | ||
+ | [[Tutorial: Moodle_VPL_-- Testing Python Program that performs basic input/output| Moodle VPL Example 23: Test a Python program that performs basic input/output operations.]] | ||
+ | | | ||
+ | Python | ||
+ | | | ||
+ | This VPL module is written mostly in Python. vpl_evaluates simply calls a python program that tests the student's python code. The python test first attempts to run the student program as a subprocess to catch possible errors or crash. If this is successful, then the student code is ''imported'' and run, with its stdin and stdout redirected from and to files controlled by the test program. | ||
+ | |||
+ | |- style="background:#eeeeff" valign="top" | ||
+ | | | ||
+ | [[Tutorial:_Moodle_VPL_--_Testing_a_Bash_Script | Testing a Bash script]] | ||
+ | | | ||
+ | Bash | ||
+ | | | ||
+ | This setup tests a bash script submitted by students. The script acts as a teller machine, getting an integer on the command line and printing 4 integers out, corresponding to the number of $20-bills, number of $10-bills, number of $5-bills, and number of $1-bills. | ||
+ | |||
+ | |- style="background:#ffffff" valign="top" | ||
+ | | | ||
+ | [[Tutorial:_Moodle_VPL_--_Testing_with_Time-Out | Testing an Assembly Program with Time-Out]] | ||
+ | | | ||
+ | Assembly<br />Nasm | ||
+ | | | ||
+ | This setup tests a recursive program in assembly (binary search) that may time-out (possibly because of weird recursive coding.) The evaluate script will abort if the program takes longer than a specified amount of time. This uses a bash script for vpl_evaluate.sh and vpl_run.sh. | ||
+ | |||
+ | |- style="background:#eeeeff" valign="top" | ||
+ | | | ||
+ | [[Tutorial:_Moodle_VPL_--_Testing_a_C_Program | Testing a C Program]] | ||
+ | | | ||
+ | C | ||
+ | | | ||
+ | This setup tests a C program that is supposed to replicate some of the functionality of the Linux grep command. In particular, the C program should get its input from the command line and support the "-i" switch, for case-insensitive searching. | ||
|- style="background:#ffffff" valign="top" | |- style="background:#ffffff" valign="top" | ||
Line 217: | Line 261: | ||
| | | | ||
A collection of notes, recommendations, tips, tricks, and modifications. For example, we describe how to strip comments from java or assembly language comments. | A collection of notes, recommendations, tips, tricks, and modifications. For example, we describe how to strip comments from java or assembly language comments. | ||
+ | |||
+ | |- style="background:#eeeeff" valign="top" | ||
+ | | | ||
+ | [[Setting the Grade Depending on Number of Correct Output Lines| Testing a C Program and Setting the Grade Depending on Number of Correct Output Lines]] | ||
+ | | | ||
+ | C & Bash | ||
+ | | | ||
+ | A collection of notes, recommendations, tips, tricks, and modifications. For example, we describe how to strip comments from java or assembly language comments. | ||
+ | |||
+ | |- style="background:#ffffff" valign="top" | ||
+ | | | ||
+ | [[VPL Module for C-Sharp program| Testing a C-Sharp "Hello World" program]] | ||
+ | | | ||
+ | C#, Bash | ||
+ | | | ||
+ | This is just a rough tutorial assuming that you already know how to setup a VPL module. | ||
|} | |} |
Latest revision as of 09:00, 12 April 2018
--D. Thiebaut (talk) 11:51, 19 September 2014 (EDT)
The tutorials below are intended for instructors teaching programming languages, and interested in setting up Moodle VPL modules to automatically test student programs.
The modules are listed in chronological order, most recent at the end. Because VPL is a complex system to master, the
early tutorials may not be built using the best approach, but provide functionality. The later modules use more sophisticated features of VPL.
Feel freel to send me your own modules or discoveries, at dthiebaut@smith.edu, and I will be happy to include them here.
Reference Material
- A video I created to help explain how I use VPL for my courses.
(Supporting Files for Video )
- Juan Carlos Rodríguez-del-Pino, Enrique Rubio-Royo, Zenón, and J. HernándezFigueroa, A Virtual Programming Lab for Moodle with automatic assessment and anti-plagiarism features, Proc. WorldComp12, July 2012, Las Vegas, USA. (pdf)
- Automatic Evaluation of Computer Programs using Moodle's Virtual Programming Lab (VPL) Module, D. Thiebaut, accepted for presentation at CCSCNE 2015.
- YouTube video 1: setting up a simple VPL module Part 1 (for use at CCSCNE2015)
- YouTube video 2: setting up a simple VPL module, Part 2 (for use at CCSCNE2015)
Setting up a VPL module for Python
Moodle Virtual-Programming-Lab (VPL)
Tutorial | Language | Description |
---|---|---|
|
This tutorial provides rough directions for setting up two virtual servers that will host Moodle on one of them, and the VPL jail server on the other. This setup is used by the tutorials below on the use of VPL to test student programs. | |
Python |
This tutorial illustrates how to setup VPL to test a simple Python 3 program that prints the string "Hello World!" to the console. | |
Python |
This tutorial illustrates how to setup VPL to test a simple Python 3 program that receives 3 numbers from the console and prints the smallest of the 3. The program is tested 3 times, with 3 different sets of input numbers. | |
Python |
This tutorial shows the settings for a VPL activity that would test a Python program that plays the game of Rock-Paper-Scissors. The program tested is expected to get its input as pairs of letters (PP, RS, PS, etc), indicates the winner of each round, and stops when one player is 3 points above the other. | |
Python |
This tutorial illustrates how to setup a VPL activity that tests a student program that reads a text file, modifies it, and stores the new content back in the original file. This requires an additional python program that sets up the environment for the first one to run, provides it the information it needs, and captures its output. | |
Python |
This tutorial illustrates how to setup a VPL activity that tests a student program that asks the user for an integer and then prints a 2D chessboard (alternating black & white cells) with that dimension. The size of a cell is a 3x3 character on the screen. | |
Assembly |
This tutorial illustrates the setup of a VPL activity to test an assembly language program that displays a fixed string (rectangle of stars). | |
Moodle VPL Example 7: Assign a grade inversely proportional to the size of the executable |
Assembly |
This tutorial illustrates how to setup a VPL activity that will test the size of the executable version of an assembly language program. This can easily be adapted to other languages. |
Java |
This tutorial illustrates how to setup a VPL activity to test a simple Hello World program in Java. | |
Moodle VPL Example 9: A Multi-File Java Program with A Data File |
Java |
This tutorial illustrates the setting of a VPL activity that evaluates a 2-class Java project that gets its input from a data file. The project is tested with 4 different data files; one provided by the students, 3 provided by the instructor. |
Moodle VPL Example 10: Evaluation Using A Custom Python Program |
Python |
This tutorial illustrates how to evaluate student work using a custom Python program. Such evaluation allows for more complex testing than enabled by the VPL .cases file. |
Moodle VPL Example 11: Testing a Java Class Using another Class as Tester. |
Java |
This tutorial sets up an environment to test different methods of a Java class provided by the students, and uses a derived class provided by the instructor to activate the student classes. |
Moodle VPL Example 12: Using a Java Tester for testing Student Java Program. |
Java |
This tutorial shows how to setup a more sophisticated testing environment for evaluating and grading Java program. |
Java |
This VPL module tests two Java classes, one inherited from the other. The test checks that one class does not access directly a member array of the super class (look for presence of [ ] brackets in code). Different grades are given depending on various stages of success. | |
Moodle VPL Example 14: Testing Student List Class and Verifying Functionality. |
Java |
This VPL module tests a data structure provided by the student using a class provided by the instructor. The instructor class tests various methods. The grade is proportional to the number of correct output lines. |
Moodle VPL Example 15: Looping through Tests in vpl_evaluate.sh. Testing Exceptions. |
Java |
This VPL module tests how a program uses exceptions to parse a simple text file containing numbers. The vpl_evaluate.sh script generates 3 tests, and runs through all 3 of them. Vpl_evaluate.sh skips non digits and non minus characters when comparing the output of the submitted program to the expected output.
|
Moodle VPL Example 16: Catching Programs Stuck in Infinite Loops. |
Java |
This VPL module is an extension of the previous module (#15), and catches java programs that hang in infinite loops. |
Moodle VPL Example 17: Verifying that ASM Program Contains Key Functions. |
Assembly |
This VPL module tests that an assembly program actually declares and calls 3 key functions.
|
Moodle VPL Example 18: Test Function of Student Program Multiple Times. |
Assembly |
This VPL module tests a function in the student program and calls it several times to see if it performs correctly. The _start label of the student program is invalidated, and the student program is linked with a test program that calls the student function as an extern. |
Moodle VPL Example 19: Feed Different Tests on Command Line. |
Java |
This VPL module tests a Java program that outputs 0, 1, or several numbers depending on an input provided on the program's command line. |
Java |
This VPL module tests a Java program and verify that its execution is greater than some predefined amount of time. Otherwise the program may be short-circuiting the execution and outputting a preprocessed answer.
| |
Moodle VPL Example 21: A Java Test Program that Evaluates Student's Submitted Class and Methods |
Java |
This VPL module uses a Java test program that energizes the student's submitted class, activating various methods, and generates OK or FAIL strings for each test given. The vpl_evaluate.sh script simply counts the # of OK strings generated and gives grade proportional to it. |
Assembly |
This VPL module requires the student to submit a program that contains only global assembly language functions. The module uses a test program in assembly that calls the functions with a given set of parameters, and tests whether the returned values are correct or not. The test program also verifies that none of the Pentium registers are modified. The testing script also ensures that the student program uses recursion for his/her solution.
| |
Moodle VPL Example 23: Test a Python program that performs basic input/output operations. |
Python |
This VPL module is written mostly in Python. vpl_evaluates simply calls a python program that tests the student's python code. The python test first attempts to run the student program as a subprocess to catch possible errors or crash. If this is successful, then the student code is imported and run, with its stdin and stdout redirected from and to files controlled by the test program. |
Bash |
This setup tests a bash script submitted by students. The script acts as a teller machine, getting an integer on the command line and printing 4 integers out, corresponding to the number of $20-bills, number of $10-bills, number of $5-bills, and number of $1-bills. | |
Assembly |
This setup tests a recursive program in assembly (binary search) that may time-out (possibly because of weird recursive coding.) The evaluate script will abort if the program takes longer than a specified amount of time. This uses a bash script for vpl_evaluate.sh and vpl_run.sh. | |
C |
This setup tests a C program that is supposed to replicate some of the functionality of the Linux grep command. In particular, the C program should get its input from the command line and support the "-i" switch, for case-insensitive searching. | |
|
A collection of notes, recommendations, tips, tricks, and modifications. For example, we describe how to strip comments from java or assembly language comments. | |
Testing a C Program and Setting the Grade Depending on Number of Correct Output Lines |
C & Bash |
A collection of notes, recommendations, tips, tricks, and modifications. For example, we describe how to strip comments from java or assembly language comments. |
C#, Bash |
This is just a rough tutorial assuming that you already know how to setup a VPL module. |