Skip to content

Commit 731c538

Browse files
committed
including gzoltar support and other changes
1 parent a54451f commit 731c538

13 files changed

+204
-15
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ webcat-support-*.*
44
src/fikin/*.jar
55
src/jacoco/*.jar
66
src/defaultJars/*.jar
7+
src/JavaTddPluginSupport.jar
8+
src/junit-4.8.2.jar

Properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#This file is automatically rewritten by ANT. Hand-edits may be lost.
2-
#Fri Nov 17 08:35:39 EST 2017
3-
version.minor=0
2+
#Sun Feb 25 22:29:07 GMT-05:00 2018
3+
version.minor=1
44
timeoutMultiplier=2
55
license.url="http\://www.gnu.org/licenses/agpl.html"
66
author="Stephen Edwards (edwards@cs.vt.edu)"
@@ -11,10 +11,10 @@ interpreter.prefix="${PerlForPlugins.perl.exe}"
1111
languages=( { name \= Java; version \= 1.4
1212
autoPublish=true
1313
version.major=4
14-
version.date=20171117
14+
version.date=20180225
1515
timeoutInternalPadding=400
1616
provider="Virginia Tech Computer Science"
1717
authorUid=edwards
1818
provider.url="http\://web-cat.cs.vt.edu/updates"
19-
version.revision=8
19+
version.revision=0
2020
name="JavaTddPlugin"

src/.cvsignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/JavaTddPluginSupport.jar

8.17 KB
Binary file not shown.

src/build.xml

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
value="${pluginHome}/checkstyle.xml"/>
1313
<property name="jacoco.db" value="${resultDir}/jacoco.db"/>
1414
<property name="defaultJars" value="${pluginHome}/defaultJars"/>
15+
<property name="zoltarJars" value="${pluginHome}/gzoltar"/>
1516
<property name="enableAssertions" value="-ea"/>
1617
<property name="enscriptStyle" value="msvc"/>
1718
<property name="instr.results.dir" value="${resultDir}/instr.results"/>
@@ -115,6 +116,13 @@
115116
<pathelement location="${studentBuild}.raw"/>
116117
</path>
117118

119+
<path id="zoltar.classpath">
120+
<path refid="student.classpath"/>
121+
<fileset dir="${zoltarJars}">
122+
<include name="**/*.jar"/>
123+
</fileset>
124+
</path>
125+
118126
<path id="checkstyle.classpath">
119127
<pathelement location="${checkstyle.jar}"/>
120128
<path refid="student.classpath"/>
@@ -233,8 +241,10 @@ staticAnalysisSrcExclusionPattern = ${staticAnalysisSrcExclusionPattern}
233241
<classpath refid="instructor.classpath"/>
234242
<src path="${testCasePath}"/>
235243
<include name="${testCasePattern}"/>
244+
<!--
236245
<src path="${visibleTestCasePath}"/>
237246
<include name="${visibleTestCasePattern}"/>
247+
-->
238248
</javac>
239249
</target>
240250

@@ -431,6 +441,58 @@ staticAnalysisSrcExclusionPattern = ${staticAnalysisSrcExclusionPattern}
431441
</target>
432442

433443

444+
<target name="zoltar" if="generateHeatmaps">
445+
<!--
446+
<fileset
447+
dir="${studentBuild}.raw"
448+
casesensitive="false"
449+
includes="${studentTestClassPattern}"
450+
excludes="${studentTestClassExclusionPattern}"
451+
id="student.test.files"/>
452+
<pathconvert
453+
pathsep=","
454+
property="student.test.files.list"
455+
refid="student.test.files"/>
456+
-->
457+
458+
<java fork="true" classname="org.webcat.plugins.javatddplugin.ZoltarTest">
459+
<assertions enablesystemassertions="true"/>
460+
<classpath refid="zoltar.classpath"/>
461+
<jvmarg value="-Xms128m"/>
462+
<jvmarg value="-Xmx512m"/>
463+
464+
<sysproperty key="student.testingsupport.junit4.AdaptiveTimeout.ceiling"
465+
value="${student.testingsupport.junit4.AdaptiveTimeout.ceiling}"/>
466+
<sysproperty key="student.testingsupport.junit4.AdaptiveTimeout.maximum"
467+
value="${student.testingsupport.junit4.AdaptiveTimeout.maximum}"/>
468+
<sysproperty key="student.testingsupport.junit4.AdaptiveTimeout.minimum"
469+
value="${student.testingsupport.junit4.AdaptiveTimeout.minimum}"/>
470+
<sysproperty key="student.testingsupport.junit4.AdaptiveTimeout.threshold"
471+
value="${student.testingsupport.junit4.AdaptiveTimeout.threshold}"/>
472+
<sysproperty key="student.testingsupport.junit4.AdaptiveTimeout.rampup"
473+
value="${student.testingsupport.junit4.AdaptiveTimeout.rampup}"/>
474+
<sysproperty key="student.testingsupport.junit4.AdaptiveTimeout.rampdown"
475+
value="${student.testingsupport.junit4.AdaptiveTimeout.rampdown}"/>
476+
477+
<sysproperty key="gzoltar.xml.output" value="${resultDir}/gzoltar.xml"/>
478+
<sysproperty key="gzoltar.csv.output" value="${resultDir}/gzoltar.csv"/>
479+
<sysproperty key="gzoltar.student.pid"
480+
value="${userInstitution},${semester},${course},${CRN},${assignment},${userName},${submissionNo}"/>
481+
<sysproperty key="gzoltar.student.bin" value="${studentBuild}.raw"/>
482+
<sysproperty key="gzoltar.tests.dir" value="${instructorBuild}"/>
483+
<sysproperty key="gzoltar.libs" value="${toString:student.classpath}"/>
484+
</java>
485+
486+
<java classname="org.webcat.plugins.javatddplugin.ZoltarHeatmap">
487+
<assertions enablesystemassertions="true"/>
488+
<classpath refid="zoltar.classpath"/>
489+
<sysproperty key="gzoltar.xml.input" value="${resultDir}/gzoltar.xml"/>
490+
<sysproperty key="gzoltar.html.output" value="${resultDir}/gzoltar.html"/>
491+
<sysproperty key="gzoltar.source.dir" value="${basedir}"/>
492+
</java>
493+
</target>
494+
495+
434496
<target name="checkstyle"
435497
unless="disableCheckstyle">
436498
<taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
@@ -532,6 +594,30 @@ staticAnalysisSrcExclusionPattern = ${staticAnalysisSrcExclusionPattern}
532594
</target>
533595

534596

597+
<target name="remote.post" if="remote.post.url">
598+
<pathconvert property="post.file.list" pathsep="${line.separator}">
599+
<fileset dir="${resultDir}/.." includes="*.*"/>
600+
</pathconvert>
601+
<loadresource property="post.file.name">
602+
<string value="${post.file.list}"/>
603+
<filterchain><headfilter lines="1"/></filterchain>
604+
</loadresource>
605+
<echo message="post file: ${post.file.name}"/>
606+
<httpmpost url="${remote.post.url}"
607+
logFile="${resultDir}/remote.post.html"
608+
logLevel="content"
609+
shutdown="true"
610+
failOnError="false"
611+
retryAttempts="2"
612+
sslAcceptUntrusted="true"
613+
>
614+
<userCredentials username="admin0" password="0admin" domain="" host="courses.cs.vt.edu"/>
615+
<postString name="user" value="${userName}"/>
616+
<postFile name="uploadedfile" file="${post.file.name}"/>
617+
</httpmpost>
618+
</target>
619+
620+
535621
<target name="generate.pdf"
536622
description="generates a pdf printout of student's source code"
537623
if="generatePDF">
@@ -615,9 +701,9 @@ staticAnalysisSrcExclusionPattern = ${staticAnalysisSrcExclusionPattern}
615701
The main target
616702
============================================================ -->
617703

618-
<target name="test.bundle" depends="instructor.test, jacoco.report"/>
704+
<target name="test.bundle" depends="instructor.test, jacoco.report, zoltar"/>
619705
<target name="checkstyle.bundle"
620-
depends="checkstyle, run.comtor, generate.pdf, generate.diagrams"/>
706+
depends="checkstyle, run.comtor, remote.post, generate.pdf, generate.diagrams"/>
621707

622708
<target name="sequential.middle" depends="compile" if="run.sequential">
623709
<echo message="Running steps sequentially ..."/>

src/checkstyle.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,10 @@
408408
<!-- <module name="FinalClass"/> -->
409409
<!-- <module name="HideUtilityClassConstructor"/> -->
410410
<!-- <module name="InterfaceIsType"/> -->
411-
<!--
412411
<module name="VisibilityModifier">
413412
<message key="variable.notPrivate"
414413
value="The field ''{0}'' should be declared private. Only constants (static final fields) are allowed to be public. If this field is intended to represent a constant value, declare it to be static and final."/>
415414
</module>
416-
-->
417415

418416

419417
<!-- Miscellaneous other checks. -->

src/config.plist

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
name = "JavaTddPlugin";
33
version.major = 4;
4-
version.minor = 0;
5-
version.revision = 8;
6-
version.date = 20160906;
4+
version.minor = 1;
5+
version.revision = 0;
6+
version.date = 20180225;
77
autoPublish = true;
88
requires = ( ANTForPlugins, PerlForPlugins,
99
PMDForPlugins, CheckstyleForPlugins );
@@ -12,7 +12,7 @@
1212
license = "GNU Affero General Public License v.3";
1313
license.url = "http://www.gnu.org/licenses/agpl.html";
1414
copyright =
15-
"(c) 2006-2016 Virginia Tech Department of Computer Science";
15+
"(c) 2006-2018 Virginia Tech Department of Computer Science";
1616
info.url = "http://wiki.web-cat.org/WCWiki/JavaTddPlugin";
1717
history.url =
1818
"http://wiki.web-cat.org/WCWiki/JavaTddPlugin/ChangeHistory";
@@ -165,6 +165,20 @@
165165
run-time. Leave unset to use the built-in default, which plugs most
166166
security holes and prevents any file system access outside the subtree
167167
rooted at the program's working directory.";
168+
},
169+
{
170+
property = remote.post.url;
171+
advanced = true;
172+
type = shortText;
173+
size = 40;
174+
name = "Remotely Post Submissions";
175+
category = "Advanced Settings";
176+
description =
177+
"A URL to which submissions will be posted as they are processed, to
178+
allow for external tools to receive student submissions. If a URL is
179+
specified an HTML POST request will be sent to the given URL, with the
180+
student's user name provided in the parameter 'user', and the student's
181+
submission file provided in the parameter 'uploadedfile'.";
168182
},
169183
{
170184
property = "grader.partnerExcludePatterns";
@@ -651,6 +665,17 @@
651665
files are deleted when a given submission has been completely processed.
652666
This setting is provided for debugging purposes, when one wishes to
653667
inspect the intermediate test driver source code or other derived files.";
668+
},
669+
{
670+
property = generateHeatmaps;
671+
type = antBoolean;
672+
advanced = true;
673+
name = "Generate Bug Heatmaps";
674+
category = "Developer Settings";
675+
description =
676+
"Set to true to generate GZoltar-based defect heatmaps. This option is
677+
<b>experimental</b> and for research use only. Using it will slow down
678+
generation of student feedback.";
654679
}
655680
);
656681
globalOptions = (

src/execute.pl

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3122,6 +3122,22 @@ sub extractExemptLines
31223122
}
31233123
elsif ($status{'instrTestResults'}->allTestsFail)
31243124
{
3125+
my $hints = $status{'instrTestResults'}->formatHints(
3126+
1, $hintsLimit);
3127+
print "hints = $hints\n";
3128+
if (defined $hints && $hints ne "" && $hints =~ /honor code viol/i)
3129+
{
3130+
$hints =~ s/<p>Failure during test case setup[^<]*<\/p>//g;
3131+
$hints =~ s/symptom: [^\s]*:\s*//g;
3132+
$hints =~ s/\s*expected: \S*false\S* but was: \S*true\S*//g;
3133+
$hints =~ s/<pre>/<p>/g;
3134+
$hints =~ s/<\/pre>/<\/p>/g;
3135+
$status{'feedback'}->print(<<EOF);
3136+
<p><b class="warn">$hints</b></p>
3137+
EOF
3138+
}
3139+
else
3140+
{
31253141
$status{'feedback'}->print(<<EOF);
31263142
<p><b class="warn">Your problem setup does not appear to be
31273143
consistent with the assignment.</b></p>
@@ -3152,6 +3168,7 @@ sub extractExemptLines
31523168
<p>Double check that you have carefully followed all initial conditions
31533169
requested in the assignment in setting up your solution.</p>
31543170
EOF
3171+
}
31553172
}
31563173
elsif ($status{'instrTestResults'}->allTestsPass)
31573174
{
@@ -3365,6 +3382,7 @@ sub extractExemptLines
33653382

33663383
# First, the static analysis, tool-based score
33673384
my $staticScore = $maxToolScore - $status{'toolDeductions'};
3385+
my $show_gzoltar = ($instructorCasesPercent < 10) ? 0 : 1;
33683386

33693387
# Second, the coverage/testing/correctness component
33703388
my $runtimeScore = $runtimeScoreWithoutCoverage;
@@ -3374,6 +3392,11 @@ sub extractExemptLines
33743392
{
33753393
my $multiplier = $gradedElementsCovered * 1.0 / $gradedElements
33763394
/ $coverageGoal;
3395+
if ($multiplier * 100.0 < $minCoverageLevel)
3396+
{
3397+
# print "multiplier = $multiplier\n";
3398+
$show_gzoltar = 0;
3399+
}
33773400
if ($multiplier < 1.0)
33783401
{
33793402
$runtimeScore *= $multiplier;
@@ -3394,6 +3417,41 @@ sub extractExemptLines
33943417
# : 0;
33953418
33963419
3420+
#=============================================================================
3421+
# Include zoltar info, if present.
3422+
#=============================================================================
3423+
3424+
my $gzoltar_file = "${resultDir}/gzoltar.html";
3425+
# print "instructor cases = $instructorCasesPercent, show = $show_gzoltar\n";
3426+
if ($show_gzoltar && -f $gzoltar_file && ! -z $gzoltar_file)
3427+
{
3428+
# print "starting feedback section\n";
3429+
$status{'feedback'}->startFeedbackSection(
3430+
"Heatmap of Suspicious Code",
3431+
++$expSectionId);
3432+
$status{'feedback'}->print(<<EOF);
3433+
<p>
3434+
This color-coded view of your source code shows the <b>most suspicious</b>
3435+
areas in your program--the lines that are most strongly associated with
3436+
failing reference tests provided by your instructor.</p>
3437+
<p>
3438+
The lines highlighted in color are hints for place(s) you can look for
3439+
bugs, with lines that are darker or more red being more suspicious. Only
3440+
classes containing suspicious lines are shown.</p>
3441+
<p>
3442+
Hover your mouse over colored lines to see line numbers.</p>
3443+
EOF
3444+
open(GZOLTAR, $gzoltar_file);
3445+
my $line;
3446+
while ($line = <GZOLTAR>)
3447+
{
3448+
$status{'feedback'}->print($line);
3449+
}
3450+
close(GZOLTAR);
3451+
$status{'feedback'}->endFeedbackSection;
3452+
}
3453+
3454+
33973455
#=============================================================================
33983456
# generate score explanation for student
33993457
#=============================================================================

src/gzoltar/gzoltar-0.0.10.jar

2.53 MB
Binary file not shown.

src/gzoltar/javaparser-core-2.2.1.jar

313 KB
Binary file not shown.

0 commit comments

Comments
 (0)