示例#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)
示例#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")
示例#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)
示例#4
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)
示例#5
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)
示例#6
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'))