def test_interleaved_output(self): self.assertTrue(is_interleaved_output( 'aaabbbcccddd', 'abcd', 3)) self.assertTrue(is_interleaved_output( 'aabcbacdbcdd', 'abcd', 3)) self.assertFalse(is_interleaved_output( 'abcdabcdabcd', 'abcd', 3)[0])
def check_lock() -> List[Check]: return check_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)) + \ check_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)) + \ check_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) + \ check_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)
def check_lock() -> List[Check]: return check_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)) + \ check_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)) + \ check_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) + \ check_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) + \ check_execution('./selfie -c <assignment>release-after-exit.c -m 128', 'Lock is granted to a process after a terminated process did not release its lock', success_criteria='Hello child! Hello parent! ', timeout=5)