Lines Matching full:child

76 def expect(child, data):
77 child.expect(data)
80 # Eats all of the child's data.
81 # @param child The child whose data should be eaten.
82 def eat(child):
83 while child.buffer is not None and len(child.buffer) > 0:
84 expect(child, ".+")
87 # Send data to a child. This makes sure the buffers are empty first.
88 # @param child The child to send data to.
90 def send(child, data):
91 eat(child)
92 child.send(data)
95 def wait(child):
96 if child.isalive():
97 child.sendeof()
99 if child.isalive():
100 child.kill(signal.SIGTERM)
102 if child.isalive():
103 child.kill(signal.SIGKILL)
104 child.wait()
107 # Check that the child output the expected line. If history is false, then
109 def check_line(child, expected, prompt=">>> ", history=True):
110 send(child, "\n")
112 expect(child, prefix + expected + "\r\n" + prompt)
117 def write_str(child, s):
119 send(child, c)
121 expect(child, "\\{}".format(c))
123 expect(child, c)
127 # @param child The child process.
128 def bc_banner(child):
133 expect(child, bc_banner1)
134 expect(child, bc_banner2)
135 expect(child, bc_banner3)
136 expect(child, bc_banner4)
137 expect(child, prompt)
151 child = pexpect.spawn(exe, args=args, env=env, encoding='utf-8', codec_errors='ignore')
156 send(child, utf8_stress_strs[idx])
157 send(child, "\n")
160 send(child, "quit")
162 send(child, "q")
164 send(child, "\n")
166 wait(child)
171 print(str(child))
175 print(str(child))
176 print(str(child.buffer))
177 print(str(child.before))
180 return child
191 child = pexpect.spawn(exe, args=args, env=env, encoding='utf-8', codec_errors='ignore')
196 write_str(child, "ﴪáá̵̗?ã")
197 send(child, "\x1b[D\x1b[D\x1b[D\x1b\x1b[Aℐ")
198 send(child, "\n")
201 send(child, "quit")
203 send(child, "q")
205 send(child, "\n")
206 eat(child)
208 wait(child)
213 print(str(child))
217 print(str(child))
218 print(str(child.buffer))
219 print(str(child.before))
222 return child
250 child = pexpect.spawn(exe, args=args, env=env)
253 send(child, "\t")
254 expect(child, "\t")
255 send(child, "\x03")
256 # send(child, "\x1c")
257 wait(child)
261 print(str(child))
265 print(str(child))
266 print(str(child.buffer))
267 print(str(child.before))
270 return child
282 child = pexpect.spawn(exe, args=args, env=env)
285 send(child, "123")
286 expect(child, "123")
287 send(child, "\x01")
288 send(child, "\x04")
289 send(child, "\x04")
290 send(child, "\x04")
291 wait(child)
295 print(str(child))
299 print(str(child))
300 print(str(child.buffer))
301 print(str(child.before))
304 return child
319 child = pexpect.spawn(exe, args=args, env=env)
322 send(child, "\t")
323 expect(child, "\t")
324 send(child, "\x03")
325 wait(child)
329 print(str(child))
333 print(str(child))
334 print(str(child.buffer))
335 print(str(child.before))
338 return child
354 child = pexpect.spawn(exe, args=args, env=env)
357 send(child, "\t")
358 expect(child, "\t")
359 send(child, "\x13")
361 if not child.isalive():
362 print("child exited early")
363 print(str(child))
364 print(str(child.buffer))
366 child.kill(signal.SIGCONT)
367 send(child, "quit")
368 send(child, "\n")
369 wait(child)
373 print(str(child))
377 print(str(child))
378 print(str(child.buffer))
379 print(str(child.before))
382 return child
394 child = pexpect.spawn(exe, args=args, env=env)
397 send(child, "\t")
398 expect(child, "\t")
399 send(child, "\x14")
401 if not child.isalive():
402 print("child exited early")
403 print(str(child))
404 print(str(child.buffer))
406 send(child, "\x13")
408 if not child.isalive():
409 print("child exited early")
410 print(str(child))
411 print(str(child.buffer))
413 child.kill(signal.SIGCONT)
414 send(child, "quit")
415 send(child, "\n")
416 wait(child)
420 print(str(child))
424 print(str(child))
425 print(str(child.buffer))
426 print(str(child.before))
429 return child
458 child = pexpect.spawn(exe, args=args, env=env)
461 bc_banner(child)
462 write_str(child, "1")
463 check_line(child, "1")
464 write_str(child, "1")
465 check_line(child, "1")
466 send(child, "quit")
467 send(child, "\n")
468 wait(child)
472 print(str(child))
476 print(str(child))
477 print(str(child.buffer))
478 print(str(child.before))
481 return child
492 child = pexpect.spawn(exe, args=args, env=env)
495 bc_banner(child)
496 child.sendline("1")
497 check_line(child, "1", history=False)
499 child.sendintr()
500 child.sendline("quit")
501 wait(child)
505 print(str(child))
509 print(str(child))
510 print(str(child.buffer))
511 print(str(child.before))
514 return child
523 child = pexpect.spawn(exe, args=args, env=env)
526 bc_banner(child)
527 send(child, "\x1b[D\x1b[D\x1b[C\x1b[C")
528 send(child, "\n")
529 expect(child, prompt)
530 send(child, "12\x1b[D3\x1b[C4\x1bOD5\x1bOC6")
531 send(child, "\n")
532 check_line(child, "132546")
533 send(child, "12\x023\x064")
534 send(child, "\n")
535 check_line(child, "1324")
536 send(child, "12\x1b[H3\x1bOH\x01\x1b[H45\x1bOF6\x05\x1b[F7\x1bOH8")
537 send(child, "\n")
538 check_line(child, "84531267")
539 send(child, "quit")
540 send(child, "\n")
541 wait(child)
545 print(str(child))
549 print(str(child))
550 print(str(child.buffer))
551 print(str(child.before))
554 return child
563 child = pexpect.spawn(exe, args=args, env=env)
566 bc_banner(child)
567 send(child, "\x1b[A\x1bOA\x1b[B\x1bOB")
568 send(child, "\n")
569 expect(child, prompt)
570 write_str(child, "15")
571 check_line(child, "15")
572 write_str(child, "2^16")
573 check_line(child, "65536")
574 send(child, "\x1b[A\x1bOA")
575 send(child, "\n")
576 check_line(child, "15")
577 send(child, "\x1b[A\x1bOA\x1b[A\x1b[B")
578 check_line(child, "65536")
579 send(child, "\x1b[A\x1bOA\x0e\x1b[A\x1b[A\x1b[A\x1b[B\x10\x1b[B\x1b[B\x1bOB\x1b[B\x1bOA")
580 send(child, "\n")
581 check_line(child, "65536")
582 send(child, "quit")
583 send(child, "\n")
584 wait(child)
588 print(str(child))
592 print(str(child))
593 print(str(child.buffer))
594 print(str(child.before))
597 return child
606 child = pexpect.spawn(exe, args=args, env=env)
609 bc_banner(child)
610 send(child, "\x0c")
611 send(child, "quit")
612 send(child, "\n")
613 wait(child)
617 print(str(child))
621 print(str(child))
622 print(str(child.buffer))
623 print(str(child.before))
626 return child
635 child = pexpect.spawn(exe, args=args, env=env)
638 bc_banner(child)
639 send(child, "print \"Enter number: \"")
640 send(child, "\n")
641 expect(child, "Enter number: ")
642 send(child, "4\x1b[A\x1b[A")
643 send(child, "\n")
644 send(child, "quit")
645 send(child, "\n")
646 wait(child)
650 print(str(child))
654 print(str(child))
655 print(str(child.buffer))
656 print(str(child.before))
659 return child
668 child = pexpect.spawn(exe, args=args, env=env)
671 bc_banner(child)
672 send(child, "\x1bb\x1bb\x1bf\x1bf")
673 send(child, "\n")
674 expect(child, prompt)
675 send(child, "\x1b[0~\x1b[3a")
676 send(child, "\n")
677 expect(child, prompt)
678 send(child, "\x1b[0;4\x1b[0A")
679 send(child, "\n")
680 expect(child, prompt)
681 send(child, "\t")
682 send(child, "\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb")
683 send(child, "\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf")
684 send(child, "\n")
685 expect(child, prompt)
686 write_str(child, "12 + 34 + 56 + 78 + 90")
687 check_line(child, "270")
688 send(child, "\x1b[A")
689 send(child, "\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb")
690 send(child, "\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf")
691 check_line(child, "270")
692 send(child, "\x1b[A")
693 send(child, "\x1bh\x1bh\x1bf + 14 ")
694 send(child, "\n")
695 check_line(child, "284")
696 send(child, "quit")
697 send(child, "\n")
698 wait(child)
702 print(str(child))
706 print(str(child))
707 print(str(child.buffer))
708 print(str(child.before))
711 return child
720 child = pexpect.spawn(exe, args=args, env=env)
723 bc_banner(child)
724 send(child, "12\x1b[D3\x1b[C4\x08\x7f")
725 send(child, "\n")
726 check_line(child, "13")
727 send(child, "quit")
728 send(child, "\n")
729 wait(child)
733 print(str(child))
737 print(str(child))
738 print(str(child.buffer))
739 print(str(child.before))
742 return child
751 child = pexpect.spawn(exe, args=args, env=env)
754 bc_banner(child)
755 send(child, "\x1b[0;5D\x1b[0;5D\x1b[0;5D\x1b[0;5C\x1b[0;5D\x1bd\x1b[3~\x1b[d\x1b[d\x1b[d\x1b[d\x7f\x7f\x7f")
756 send(child, "\n")
757 expect(child, prompt)
758 write_str(child, "12 + 34 + 56 + 78 + 90")
759 check_line(child, "270")
760 send(child, "\x1b[A")
761 send(child, "\x1b[0;5D\x1b[0;5D\x1b[0;5D\x1b[0;5C\x1b[0;5D\x1bd\x1b[3~\x1b[d\x1b[d\x1b[d\x1b[d\x7f\x7f\x7f")
762 send(child, "\n")
763 check_line(child, "102")
764 send(child, "\x1b[A")
765 send(child, "\x17\x17")
766 send(child, "\n")
767 check_line(child, "46")
768 send(child, "\x17\x17")
769 send(child, "\n")
770 expect(child, prompt)
771 send(child, "quit")
772 send(child, "\n")
773 wait(child)
777 print(str(child))
781 print(str(child))
782 print(str(child.buffer))
783 print(str(child.before))
786 return child
795 child = pexpect.spawn(exe, args=args, env=env)
798 bc_banner(child)
799 send(child, "\x1b[3~\x1b[3~")
800 send(child, "\n")
801 expect(child, prompt)
802 send(child, " \x1b[3~\x1b[3~")
803 send(child, "\n")
804 expect(child, prompt)
805 write_str(child, "12 + 34 + 56 + 78 + 90")
806 check_line(child, "270")
807 send(child, "\x1b[A\x1b[A\x1b[A\x1b[B\x1b[B\x1b[B\x1b[A")
808 send(child, "\n")
809 check_line(child, "270")
810 send(child, "\x1b[A\x1b[0;5D\x1b[0;5D\x0b")
811 send(child, "\n")
812 check_line(child, "180")
813 send(child, "\x1b[A\x1521")
814 check_line(child, "21")
815 send(child, "quit")
816 send(child, "\n")
817 wait(child)
821 print(str(child))
825 print(str(child))
826 print(str(child.buffer))
827 print(str(child.before))
830 return child
839 child = pexpect.spawn(exe, args=args, env=env)
842 bc_banner(child)
843 send(child, "\x1b[A\x02\x14")
844 send(child, "\n")
845 expect(child, prompt)
846 write_str(child, "12 + 34 + 56 + 78")
847 check_line(child, "180")
848 send(child, "\x1b[A\x02\x14")
849 check_line(child, "189")
850 send(child, "quit")
851 send(child, "\n")
852 wait(child)
856 print(str(child))
860 print(str(child))
861 print(str(child.buffer))
862 print(str(child.before))
865 return child
874 child = pexpect.spawn(exe, args=args, env=env)
877 bc_banner(child)
878 send(child, "12 +")
879 send(child, "\n")
881 if not child.isalive():
882 print("child exited early")
883 print(str(child))
884 print(str(child.buffer))
886 send(child, "quit")
887 send(child, "\n")
888 wait(child)
892 print(str(child))
896 print(str(child))
897 print(str(child.buffer))
898 print(str(child.before))
901 return child
930 child = pexpect.spawn(exe, args=args, env=env)
933 write_str(child, "1pR")
934 check_line(child, "1")
935 write_str(child, "1pR")
936 check_line(child, "1")
937 write_str(child, "q")
938 send(child, "\n")
939 wait(child)
943 print(str(child))
947 print(str(child))
948 print(str(child.buffer))
949 print(str(child.before))
952 return child
963 child = pexpect.spawn(exe, args=args, env=env)
966 child.sendline("1pR")
967 check_line(child, "1", history=False)
969 child.sendintr()
970 child.sendline("q")
971 wait(child)
975 print(str(child))
979 print(str(child))
980 print(str(child.buffer))
981 print(str(child.before))
984 return child
993 child = pexpect.spawn(exe, args=args, env=env)
996 write_str(child, "[1 15+pR]x")
997 check_line(child, "16")
998 write_str(child, "1pR")
999 check_line(child, "1")
1000 write_str(child, "q")
1001 send(child, "\n")
1002 wait(child)
1006 print(str(child))
1010 print(str(child))
1011 print(str(child.buffer))
1012 print(str(child.before))
1015 return child
1148 child = test_array[test_idx](exe[0], exe[1:], env)
1150 child.close()
1152 exit = child.exitstatus
1155 print("child failed; expected exit code 0, got {}".format(exit))
1156 print(str(child))