예제 #1
0
def test_treiber_stack():
    test_riscv_instruction(LR_INSTRUCTION, 'load-reserved.c')
    test_riscv_instruction(SC_INSTRUCTION, 'store-conditional.c')
    test_execution('./selfie -c treiber-stack.c <assignment>stack-push.c -m 128',
                   'all pushed elements are actually in the treiber-stack',
                   success_criteria=lambda code, out: is_permutation_of(out, [0, 1, 2, 3, 4, 5, 6, 7]))
    test_execution('./selfie -c treiber-stack.c <assignment>stack-pop.c -m 128',
                   'all treiber-stack elements can be popped ',
                   success_criteria=lambda code, out: is_permutation_of(out, [0, 1, 2, 3, 4, 5, 6, 7]))
예제 #2
0
def test_thread():
    test_execution('./selfie -c <assignment>syscalls.c -m 128',
                   'creates a thread, where the parent can join the thread with MIPSTER', success_criteria=70)
    test_execution('./selfie -c selfie.c -m 128 -c <assignment>syscalls.c -y 64',
                   'creates a thread, where the parent can join the thread with HYPSTER', success_criteria=70)
    test_mipster_execution('shared-data.c', 42,
                           'data section is shared for threads on MIPSTER')
    test_hypster_execution('shared-data.c', 42,
                           'data section is shared for threads on HYPSTER')
    test_mipster_execution('shared-heap.c', 42,
                           'heap data is shared for threads on MIPSTER')
    test_hypster_execution('shared-heap.c', 42,
                           'heap data is shared for threads on HYPSTER')
예제 #3
0
def test_assembler_parser():
    test_execution('./selfie -c selfie.c -s selfie.s -a selfie.s',
                   'selfie can parse its own implementation in assembly')
    test_execution('./selfie -a <assignment>missing-address.s',
                   'assembly file with a missing address is not parseable', success_criteria=False)
    test_execution('./selfie -a <assignment>missing-instruction.s',
                   'assembly file with a missing instruction is not parseable', success_criteria=False)
    test_execution('./selfie -a <assignment>missing-literal.s',
                   'assembly file with a missing literal is not parseable', success_criteria=False)
예제 #4
0
def test_lock():
    test_execution('./selfie -c <assignment>print-without-lock.c -m 128',
                   '16 processes are running concurrently on MIPSTER',
                   success_criteria=lambda code, out: is_interleaved_output(out, 'Hello World!    ', 8))
    test_execution('./selfie -c selfie.c -m 128 -c <assignment>print-without-lock.c -y 10',
                   '16 processes are running concurrently on HYPSTER',
                   success_criteria=lambda code, out: is_interleaved_output(out, 'Hello World!    ', 8))
    test_execution('./selfie -c <assignment>print-with-lock.c -m 128',
                   '16 processes are printing in sequential order with the use of locks on MIPSTER',
                   success_criteria='Hello World!    ' * 8)
    test_execution('./selfie -c selfie.c -m 128 -c <assignment>print-with-lock.c -y 10',
                   '16 processes are printing in sequential order with the use of locks on HYPSTER',
                   success_criteria='Hello World!    ' * 8)
예제 #5
0
def test_print_name():
    test_execution('./selfie -c selfie.c -m 128',
                   'selfie prints first and second name',
                   success_criteria=lambda code, out: contains_name(out))
예제 #6
0
def test_self_compilation(mandatory=False):
    test_execution('make clean selfie',
                   'cc compiles selfie.c', mandatory=mandatory)
    test_compile_warnings(
        'selfie.c', 'self-compilation does not lead to warnings or syntax errors', mandatory=mandatory)
예제 #7
0
def test_self_assemblation():
    test_execution('./selfie -c selfie.c -s selfie1.s -a selfie1.s -m 128 -a selfie1.s -s selfie2.s ',
                   'selfie can assemble its own binary file')
    test_execution('diff -q selfie1.s selfie2.s',
                   'both assembly files are exactly the same')
예제 #8
0
파일: self.py 프로젝트: TheNyanta/selfie
def test_fork_and_wait():
    test_execution('./selfie -c grader/syscalls.c -m 128',
                   'fork creates a child process, where the parent can wait for the child process with MIPSTER', success_criteria=70)
    test_execution('./selfie -c selfie.c -m 128 -c grader/syscalls.c -y 64',
                   'fork creates a child process, where the parent can wait for the child process with HYPSTER', success_criteria=70)