示例#1
0
def validate(job):
    student_files = ['broken.c']
    assert_raises(job.run_build, inputs=student_files, output='helloworld')
    assert_raises(job.run_compiler, inputs=student_files, output='helloworld')
    assert_dont_raises(job.run_make, mandatory=False)
    assert_raises(job.run_make, mandatory=True)
    assert_dont_raises(job.run_configure, mandatory=False)
    assert_raises(job.run_configure, mandatory=True)
示例#2
0
def validate(job):
    student_files = ['lib.c', 'lib.h', 'main.c']
    assert_dont_raises(job.run_build,
                       compiler=compiler.GPP,
                       inputs=student_files,
                       output='add')
    assert_dont_raises(job.run_compiler,
                       compiler=compiler.GPP,
                       inputs=student_files,
                       output='add')
    assert_dont_raises(job.run_make, mandatory=False)
    assert_dont_raises(job.run_make, mandatory=True)
    assert_dont_raises(job.run_configure, mandatory=False)
    assert_raises(job.run_configure, mandatory=True)
示例#3
0
def validate(job):
    student_files = ['sum.cpp']
    assert_dont_raises(job.run_build,
                       compiler=compiler.GPP,
                       inputs=student_files,
                       output='sum1')
    assert_dont_raises(job.run_compiler,
                       compiler=compiler.GPP,
                       inputs=student_files,
                       output='sum2')
    assert_dont_raises(job.run_make, mandatory=False)
    assert_dont_raises(job.run_make, mandatory=True)
    assert_dont_raises(job.run_configure, mandatory=False)
    assert_raises(job.run_configure, mandatory=True)
示例#4
0
def validate(job):
    student_files = ['python.pdf']
    assert_raises(job.run_build, inputs=student_files, output='helloworld')
    assert_raises(job.run_compiler, inputs=student_files, output='helloworld')
    assert_dont_raises(job.run_make, mandatory=False)
    assert_raises(job.run_make, mandatory=True)
    assert_dont_raises(job.run_configure, mandatory=False)
    assert_raises(job.run_configure, mandatory=True)

    # Add some explicit checks about the working directory.
    # Mainly intended to test if file download keeps
    # the original file names appropriately (see #194)
    import os
    assert (os.path.isfile(job.working_dir + os.sep + 'validator.py'))
    assert (os.path.isfile(job.working_dir + os.sep + 'python.pdf'))
示例#5
0
def validate(job):
    student_files = ['helloworld.c']
    assert_dont_raises(job.run_build,
                       inputs=student_files,
                       output='helloworld')
示例#6
0
def validate(job):
    student_files = ['helloworld.c']
    assert_dont_raises(job.run_build,
                       inputs=student_files,
                       output='helloworld')
    running = assert_dont_raises(job.spawn_program, './helloworld')
    assert_dont_raises(running.expect, 'Please provide your input: ')
    assert_dont_raises(running.sendline, 'The quick brown fox')
    assert_dont_raises(running.expect, 'Your input was: The quick brown fox')
    assert_dont_raises(running.expect_end)
    assert (job.grep('int argc') == ['helloworld.c'])
    assert (job.grep('int argv') == [])
    job.send_pass_result("We saw the following console interaction:\n\n " +
                         running.get_output())