|
1 | 1 | from util import * |
2 | 2 | import re |
3 | 3 |
|
| 4 | +send_custom_command('when-end') |
| 5 | +expect_debugger(re.compile(r'Event at end of recording: (\d+)')) |
| 6 | +first_when_end_result = int(last_match().group(1)) |
| 7 | +# Check this value after running the program for a bit. |
| 8 | + |
4 | 9 | send_custom_command('when') |
5 | 10 | expect_debugger(re.compile(r'Completed event: (\d+)')) |
6 | 11 | t = int(last_match().group(1)) |
|
43 | 48 | if tid2 != tid: |
44 | 49 | failed('ERROR ... tid changed') |
45 | 50 |
|
| 51 | +send_custom_command('when-end') |
| 52 | +expect_debugger(re.compile(r'Event at end of recording: (\d+)')) |
| 53 | +second_when_end_result = int(last_match().group(1)) |
| 54 | + |
46 | 55 | # Ensure 'when' terminates a diversion |
47 | 56 | expect_expression('(int)strlen("abcd")', 4) |
48 | 57 | send_custom_command('when') |
|
65 | 74 | if tid3 != tid2: |
66 | 75 | failed('ERROR ... diversion changed tid') |
67 | 76 |
|
| 77 | +send_custom_command("c") |
| 78 | +send_custom_command('when-end') |
| 79 | +expect_debugger(re.compile(r'Event at end of recording: (\d+)')) |
| 80 | +final_when_end_result = int(last_match().group(1)) |
| 81 | + |
| 82 | +if first_when_end_result != second_when_end_result: |
| 83 | + failed("ERROR ... first when-end result differs from second when-end result") |
| 84 | +if second_when_end_result != final_when_end_result: |
| 85 | + failed("ERROR ... second when-end result differs from final when-end result") |
| 86 | + |
| 87 | +if t >= first_when_end_result: |
| 88 | + failed("ERROR ... First when result was after when-end") |
| 89 | +if t3 >= first_when_end_result: |
| 90 | + failed("ERROR ... Second when result was after when-end") |
| 91 | +if t3 >= first_when_end_result: |
| 92 | + failed("ERROR ... Third when result was after when-end") |
| 93 | + |
68 | 94 | ok() |
0 commit comments