Add extra options to verifier.

This commit is contained in:
Rob 2016-06-21 11:48:28 -07:00
parent 6eef19e488
commit bdfa6d435a
4 changed files with 24 additions and 7 deletions
app
styles/editor/verifier
templates/editor/verifier
views/editor/verifier

View file

@ -19,3 +19,6 @@
.test-failed
color: red
.lineUnder
border-bottom: 1px solid #ccc

View file

@ -16,9 +16,18 @@ block content
p.alert.alert-info
| To Run: #{view.testCount - view.passed - view.problem - view.failed}
.form.form-inline
.row.lineUnder
.form-group.campaign-mix
input(id="careAboutFrames", type="checkbox", checked=!!view.careAboutFrames, disabled=!!view.tests)
label(for="careAboutFrames") Check frame counts
.form-group.campaign-mix
label(for="cores") Threads:
input(id="cores", type="number", min="1", max="16", value=view.cores, disabled=!!view.tests)
if view.levelsByCampaign
.form.form-inline
.row
.row.lineUnder
each campaignInfo, campaign in view.levelsByCampaign
.form-group.campaign-mix
- var campaignID = "campaign-" + campaign + "-checkbox";

View file

@ -7,7 +7,7 @@ LevelLoader = require 'lib/LevelLoader'
utils = require 'core/utils'
module.exports = class VerifierTest extends CocoClass
constructor: (@levelID, @updateCallback, @supermodel, @language) ->
constructor: (@levelID, @updateCallback, @supermodel, @language, @options) ->
super()
# TODO: turn this into a Subview
# TODO: listen to the progress report from Angel to show a simulation progress bar (maybe even out of the number of frames we actually know it'll take)
@ -91,7 +91,7 @@ module.exports = class VerifierTest extends CocoClass
isSuccessful: () ->
return false unless @solution?
return false unless @frames == @solution.frameCount
return false unless @frames == @solution.frameCount or @options.dontCareAboutFrames
if @goals and @solution.goals
for k of @goals
continue if not @solution.goals[k]

View file

@ -23,6 +23,10 @@ module.exports = class VerifierView extends RootView
@problem = 0
@testCount = 0
defaultCores = 2
@cores = Math.max(window.navigator.hardwareConcurrency, defaultCores)
@careAboutFrames = true
if @levelID
@levelIDs = [@levelID]
@testLanguages = ['python', 'javascript', 'java', 'lua', 'coffeescript']
@ -56,6 +60,8 @@ module.exports = class VerifierView extends RootView
onClickGoButton: (e) ->
@filterCampaigns()
@levelIDs = []
@careAboutFrames = @$("#careAboutFrames").is(':checked')
@cores = @$("#cores").val()|0
for campaign, campaignInfo of @levelsByCampaign
if @$("#campaign-#{campaign}-checkbox").is(':checked')
for level in campaignInfo.levels
@ -87,8 +93,6 @@ module.exports = class VerifierView extends RootView
@render()
onTestLevelsLoaded: ->
defaultCores = 2
cores = Math.max(window.navigator.hardwareConcurrency, defaultCores)
@linksQueryString = window.location.search
#supermodel = if @levelID then @supermodel else undefined
@ -102,7 +106,8 @@ module.exports = class VerifierView extends RootView
@tasksList.push level: levelID, language: codeLanguage
@testCount = @tasksList.length
chunks = _.groupBy @tasksList, (v,i) -> i%cores
console.log("Starting in", @cores, "cores...")
chunks = _.groupBy @tasksList, (v,i) => i%@cores
supermodels = [@supermodel]
_.forEach chunks, (chunk, i) =>
@ -128,7 +133,7 @@ module.exports = class VerifierView extends RootView
++@problem
next()
, chunkSupermodel, task.language
, chunkSupermodel, task.language, {dontCareAboutFrames: not @careAboutFrames}
@tests.unshift test
@render()
, => @render()