Exemple #1
0
def validate(job):
    assert_dont_raises(job.prepare_student_files)
    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_raises(job.run_make, mandatory=True)
    assert_dont_raises(job.run_configure, mandatory=False)
    assert_raises(job.run_configure, mandatory=True)
Exemple #2
0
def validate(job):
    assert_dont_raises(job.prepare_student_files)
    job.run_compiler(inputs=['bsp.c'], output='bsp')
    running = job.spawn_program('./bsp')
    for std_input, expected_output in test_cases:
        running.sendline(std_input)
        # Program input contains "1", but output is "0",
        # so a TerminationException should be raised
        assert_raises(running.expect, expected_output, timeout=1)
        job.send_fail_result("timeout", "timeout")
Exemple #3
0
def validate(job):
    assert_dont_raises(job.prepare_student_files, remove_directories=True)
    student_files = ['helloworld.c']
    assert_dont_raises(job.run_build,
                       inputs=student_files,
                       output='helloworld')
    assert_dont_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)
Exemple #4
0
def validate(job):
    assert_dont_raises(job.prepare_student_files)
    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)
Exemple #5
0
def validate(job):
    student_files = ['python.pdf']
    assert_dont_raises(job.prepare_student_files)
    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'))
Exemple #6
0
def validate(job):
    assert_dont_raises(job.prepare_student_files)
    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)
Exemple #7
0
def validate(job):
    assert_dont_raises(job.prepare_student_files)
    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())
Exemple #8
0
def validate(job):
    assert_dont_raises(job.prepare_student_files)
    student_files = ['helloworld.c']
    assert_dont_raises(job.run_build,
                       inputs=student_files,
                       output='helloworld')