TWiki
>
ISG Web
>
ISGScripts
>
Testing
>
BitterSuite
>
BitterSuiteExternalTesting
>
BitterSuiteValidatingStudentFiles
(2010-08-18,
TerryVaskor
)
(raw view)
E
dit
A
ttach
---+ Validating Files Submitted by Students <div style="font-size: Large; font-weight: bold">Note: Performing filtering in this fashion is no longer recommended. The BitterSuiteFilter language should be used instead. This page will just remain as an illustration of how to write an external-command script, nothing more.</div> This is the kind of check normally done better by a submission filter; however, systems like [[Marmoset]] and MarkUs currently have no such filtering option. So, the following script targetting Scheme files with non-textual elements can try to give meaningful error messages early in the test output that can try to explain more mystifying failures later. The following code can be used in a =test.exe= file in =(language external)=. The arguments passed to it via =(args ...)= should be all of the files being expected for the current assignment with the extension (=.ss= or =.scm=) *omitted*. For example, =(args temp quadratic area grades mpg)=. <pre>#!/usr/bin/env bash # Since we won't make use of standard output for diff testing, # start the script by re-executing self with standard input # directed to fd4. This way, we don't have to write to it below # explicitly. if [ -z "$SOMEREALLYUNUSUALENVVAR" ]; then export SOMEREALLYUNUSUALENVVAR=boogedy exec "$0" "$@" 1>&4 fi if [[ $# -eq 0 ]]; then echo "$(basename $0) requires at least one command-line argument" >&2 exit 1 fi notexistcounter=0 wxmecounter=0 # Find out what expected files have been submitted; out of those, # check if any appear to be in WXME format. for filenamebase in "$@"; do if [ -e "$submitdir/$filenamebase.ss" ]; then filename="$submitdir/$filenamebase.ss" elif [ -e "$submitdir/$filenamebase.scm" ]; then filename="$submitdir/$filenamebase.scm" else notexist[$notexistcounter]="$filenamebase.ss" (( notexistcounter++ )) continue fi if head -n 1 "$filename" | grep WXME >/dev/null 2>&1; then wxme[$wxmecounter]=$(basename "$filename") (( wxmecounter++ )) fi done # Now output status information about any problem files. noerrors=true if [[ $notexistcounter -gt 0 ]]; then noerrors=false echo -n 'The following files were not submitted:' i=0 while [[ $i -lt $notexistcounter ]]; do echo -n " ${notexist[$i]}" (( i++ )) done echo -n '. ' fi if [[ $wxmecounter -gt 0 ]]; then noerrors=false echo -n 'The following files appear to be in a special PLT Scheme format' echo -n ' which contains representations of non-textual elements:' i=0 while [[ $i -lt $wxmecounter ]]; do echo -n " ${wxme[$i]}" (( i++ )) done echo -n '. Common causes include (but are not limited to): ' echo -n '* copying from the interactions window to the definitions window ' echo -n '* commenting out sections of code with boxes ' echo -n '* adding elements using the Insert menu. ' echo -n 'Please fix and submit again. Contact a tutor if you need assistance. ' fi if $noerrors; then echo -n 'All files appear to be submitted in a valid format.' fi # Give a newline to be nice. echo echo "$(( ($# - notexistcounter - wxmecounter) * 100 ))/$#" >&3</pre>
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r2
<
r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r2 - 2010-08-18
-
TerryVaskor
ISG
ISG Web
ISG Web Home
Changes
Index
Search
Webs
AIMAS
CERAS
CF
CrySP
External
Faqtest
HCI
Himrod
ISG
Main
Multicore
Sandbox
TWiki
TestNewSandbox
TestWebS
UW
My links
People
CERAS
WatForm
Tetherless lab
Ubuntu Main.HowTo
eDocs
RGG NE notes
RGG
CS infrastructure
Grad images
Edit
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback