def test_mode_and_flags(self): self.assertEquals(mode_and_flags(34816), "O_RDONLY|O_NONBLOCK|O_LARGEFILE") self.assertEquals(mode_and_flags(33281), "O_WRONLY|O_TRUNC|O_LARGEFILE") self.assertEquals(mode_and_flags(576), "O_RDONLY|O_CREAT|O_TRUNC")
def parse_call(line): tokens = line.split() op = tokens[4] timestamp = map(long, tokens[5].split("-")) args = tokens[6:-1] return_value = tokens[-1] if op == "mkdir": args[-1] = str(oct(int(args[-1]))) elif op == "open":#FIXME TEST ME #we are assuming strace always prints access_mode before c_flags args is a 3 token str list e.g [/var/spool/cron/crontabs', '34816', '0'] we want the second token flags_number = int(args[1]) args[1] = mode_and_flags(flags_number) return (timestamp, op, args, return_value)