8 from collections
import defaultdict
10 NSEC_PER_SEC
= 1000000000
13 from babeltrace
import TraceCollection
15 # quick fix for debian-based distros
16 sys
.path
.append("/usr/local/lib/python%d.%d/site-packages" %
17 (sys
.version_info
.major
, sys
.version_info
.minor
))
18 from babeltrace
import TraceCollection
22 def __init__(self
, trace
, pid
):
26 # This dictionnary holds the results of each testcases of a test.
27 # Its layout is the following:
29 # 'event_name_1': {'check_1': 0, 'check_2: 1},
30 # 'event_name_2': {'check_1': 1}
32 # Each test classes checks the payload of different events. Each of
33 # those checks are stored in a event_name specific dictionnary in this
35 self
.expect
= defaultdict(lambda : defaultdict(int))
37 # This dictionnary holds the value recorded in the trace that are
38 # tested. Its content is use to print the values that caused a test to
40 self
.recorded_values
= {}
42 def ns_to_hour_nsec(self
, ns
):
43 d
= time
.localtime(ns
/NSEC_PER_SEC
)
44 return "%02d:%02d:%02d.%09d" % (d
.tm_hour
, d
.tm_min
, d
.tm_sec
,
48 # iterate over all the events
49 for event
in self
.trace
.events
:
50 if self
.pid
is not None and event
["pid"] != self
.pid
:
53 method_name
= "handle_%s" % event
.name
.replace(":", "_").replace(
55 # call the function to handle each event individually
56 if hasattr(TraceParser
, method_name
):
57 func
= getattr(TraceParser
, method_name
)
61 # For each event of the test case, check all entries for failed
62 for event_name
, event_results
in self
.expect
.items():
63 for val
in event_results
.keys():
64 if self
.expect
[event_name
][val
] == 0:
65 print("%s not validated" % val
)
66 print("Values of the local variables of this test:")
67 # using pprint for pretty printing the dictionnary
68 pprint
.pprint(self
.recorded_values
[event_name
])
74 def handle_compat_syscall_entry_epoll_ctl(self
, event
):
75 self
.epoll_ctl_entry(event
)
77 def handle_compat_syscall_exit_epoll_ctl(self
, event
):
78 self
.epoll_ctl_exit(event
)
80 def handle_syscall_entry_epoll_ctl(self
, event
):
81 self
.epoll_ctl_entry(event
)
83 def handle_syscall_exit_epoll_ctl(self
, event
):
84 self
.epoll_ctl_exit(event
)
86 def epoll_ctl_entry(self
, event
):
89 def epoll_ctl_exit(self
, event
):
92 # epoll_wait + epoll_pwait
93 def handle_compat_syscall_entry_epoll_wait(self
, event
):
94 self
.epoll_wait_entry(event
)
96 def handle_compat_syscall_exit_epoll_wait(self
, event
):
97 self
.epoll_wait_exit(event
)
99 def handle_syscall_entry_epoll_wait(self
, event
):
100 self
.epoll_wait_entry(event
)
102 def handle_syscall_exit_epoll_wait(self
, event
):
103 self
.epoll_wait_exit(event
)
105 def handle_compat_syscall_entry_epoll_pwait(self
, event
):
106 self
.epoll_wait_entry(event
)
108 def handle_compat_syscall_exit_epoll_pwait(self
, event
):
109 self
.epoll_wait_exit(event
)
111 def handle_syscall_entry_epoll_pwait(self
, event
):
112 self
.epoll_wait_entry(event
)
114 def handle_syscall_exit_epoll_pwait(self
, event
):
115 self
.epoll_wait_exit(event
)
117 def epoll_wait_entry(self
, event
):
120 def epoll_wait_exit(self
, event
):
124 def handle_compat_syscall_entry_poll(self
, event
):
125 self
.poll_entry(event
)
127 def handle_compat_syscall_exit_poll(self
, event
):
128 self
.poll_exit(event
)
130 def handle_syscall_entry_poll(self
, event
):
131 self
.poll_entry(event
)
133 def handle_syscall_exit_poll(self
, event
):
134 self
.poll_exit(event
)
136 def handle_compat_syscall_entry_ppoll(self
, event
):
137 self
.poll_entry(event
)
139 def handle_compat_syscall_exit_ppoll(self
, event
):
140 self
.poll_exit(event
)
142 def handle_syscall_entry_ppoll(self
, event
):
143 self
.poll_entry(event
)
145 def handle_syscall_exit_ppoll(self
, event
):
146 self
.poll_exit(event
)
148 def poll_entry(self
, event
):
151 def poll_exit(self
, event
):
155 def handle_compat_syscall_entry_epoll_create1(self
, event
):
156 self
.epoll_create_entry(event
)
158 def handle_compat_syscall_exit_epoll_create1(self
, event
):
159 self
.epoll_create_exit(event
)
161 def handle_compat_syscall_entry_epoll_create(self
, event
):
162 self
.epoll_create_entry(event
)
164 def handle_compat_syscall_exit_epoll_create(self
, event
):
165 self
.epoll_create_exit(event
)
167 def handle_syscall_entry_epoll_create1(self
, event
):
168 self
.epoll_create_entry(event
)
170 def handle_syscall_exit_epoll_create1(self
, event
):
171 self
.epoll_create_exit(event
)
173 def handle_syscall_entry_epoll_create(self
, event
):
174 self
.epoll_create_entry(event
)
176 def handle_syscall_exit_epoll_create(self
, event
):
177 self
.epoll_create_exit(event
)
179 def epoll_create_entry(self
, event
):
182 def epoll_create_exit(self
, event
):
186 def handle_syscall_entry_pselect6(self
, event
):
187 self
.select_entry(event
)
189 def handle_syscall_exit_pselect6(self
, event
):
190 self
.select_exit(event
)
192 def handle_compat_syscall_entry_pselect6(self
, event
):
193 self
.select_entry(event
)
195 def handle_compat_syscall_exit_pselect6(self
, event
):
196 self
.select_exit(event
)
198 def handle_syscall_entry_select(self
, event
):
199 self
.select_entry(event
)
201 def handle_syscall_exit_select(self
, event
):
202 self
.select_exit(event
)
204 def handle_compat_syscall_entry_select(self
, event
):
205 self
.select_entry(event
)
207 def handle_compat_syscall_exit_select(self
, event
):
208 self
.select_exit(event
)
210 def select_entry(self
, event
):
213 def select_exit(self
, event
):
217 class Test1(TraceParser
):
218 def __init__(self
, trace
, pid
):
219 super().__init
__(trace
, pid
)
220 self
.expect
["select_entry"]["select_in_fd0"] = 0
221 self
.expect
["select_entry"]["select_in_fd1023"] = 0
222 self
.expect
["select_exit"]["select_out_fd0"] = 0
223 self
.expect
["select_exit"]["select_out_fd1023"] = 0
224 self
.expect
["poll_entry"]["poll_in_nfds1"] = 0
225 self
.expect
["poll_exit"]["poll_out_nfds1"] = 0
226 self
.expect
["epoll_ctl_entry"]["epoll_ctl_in_add"] = 0
227 self
.expect
["epoll_ctl_exit"]["epoll_ctl_out_ok"] = 0
228 self
.expect
["epoll_wait_entry"]["epoll_wait_in_ok"] = 0
229 self
.expect
["epoll_wait_exit"]["epoll_wait_out_fd0"] = 0
231 def select_entry(self
, event
):
233 overflow
= event
["overflow"]
234 readfd_0
= event
["readfds"][0]
236 # check that the FD 0 is actually set in the readfds
237 if n
== 1 and readfd_0
== 1:
238 self
.expect
["select_entry"]["select_in_fd0"] = 1
240 readfd_127
= event
["readfds"][127]
241 writefd_127
= event
["writefds"][127]
242 exceptfd_127
= event
["exceptfds"][127]
244 # check that the FD 1023 is actually set in the readfds
245 if readfd_127
== 0x40 and writefd_127
== 0 and \
246 exceptfd_127
== 0 and overflow
== 0:
247 self
.expect
["select_entry"]["select_in_fd1023"] = 1
249 # Save values of local variables to print in case of test failure
250 self
.recorded_values
["select_entry"] = locals()
252 def select_exit(self
, event
):
255 overflow
= event
["overflow"]
256 _readfds_length
= event
["_readfds_length"]
259 # check that the FD 0 is actually set in the readfds
260 readfd_0
= event
["readfds"][0]
263 self
.expect
["select_exit"]["select_out_fd0"] = 1
264 # check that the FD 1023 is actually set in the readfds
265 if _readfds_length
== 128:
266 readfd_127
= event
["readfds"][127]
267 writefd_127
= event
["writefds"][127]
268 exceptfd_127
= event
["exceptfds"][127]
269 if readfd_127
== 0x40 and writefd_127
== 0 and \
270 exceptfd_127
== 0 and tvp
== 0:
271 self
.expect
["select_exit"]["select_out_fd1023"] = 1
273 # Save values of local variables to print in case of test failure
274 self
.recorded_values
["select_exit"] = locals()
276 def poll_entry(self
, event
):
278 fds_length
= event
["fds_length"]
279 overflow
= event
["overflow"]
281 # check that only one FD is set, that it has the POLLIN flag and that
282 # the raw value matches the events bit field.
283 if nfds
== 1 and fds_length
== 1:
284 fd_0
= event
["fds"][0]
285 if fd_0
["raw_events"] == 0x3 and fd_0
["events"]["POLLIN"] == 1 and \
286 fd_0
["events"]["padding"] == 0:
287 self
.expect
["poll_entry"]["poll_in_nfds1"] = 1
289 # Save values of local variables to print in case of test failure
290 self
.recorded_values
["poll_entry"] = locals()
292 def poll_exit(self
, event
):
294 fds_length
= event
["fds_length"]
296 # check that only one FD is set, that it has the POLLIN flag and that
297 # the raw value matches the events bit field.
298 if ret
== 1 and fds_length
== 1:
299 fd_0
= event
["fds"][0]
300 if fd_0
["raw_events"] == 0x1 and fd_0
["events"]["POLLIN"] == 1 and \
301 fd_0
["events"]["padding"] == 0:
302 self
.expect
["poll_exit"]["poll_out_nfds1"] = 1
304 # Save values of local variables to print in case of test failure
305 self
.recorded_values
["poll_exit"] = locals()
307 def epoll_ctl_entry(self
, event
):
309 op_enum
= event
["op_enum"]
311 _event
= event
["event"]
313 # check that we have FD 0 waiting for EPOLLIN|EPOLLPRI and that
315 if epfd
== 3 and op_enum
== "EPOLL_CTL_ADD" and fd
== 0 and \
316 _event
["data_union"]["fd"] == 0 and \
317 _event
["events"]["EPOLLIN"] == 1 and \
318 _event
["events"]["EPOLLPRI"] == 1:
319 self
.expect
["epoll_ctl_entry"]["epoll_ctl_in_add"] = 1
321 # Save values of local variables to print in case of test failure
322 self
.recorded_values
["epoll_ctl_entry"] = locals()
324 def epoll_ctl_exit(self
, event
):
328 self
.expect
["epoll_ctl_exit"]["epoll_ctl_out_ok"] = 1
330 # Save values of local variables to print in case of test failure
331 self
.recorded_values
["epoll_ctl_exit"] = locals()
333 def epoll_wait_entry(self
, event
):
335 maxevents
= event
["maxevents"]
336 timeout
= event
["timeout"]
338 if epfd
== 3 and maxevents
== 1 and timeout
== -1:
339 self
.expect
["epoll_wait_entry"]["epoll_wait_in_ok"] = 1
341 # Save values of local variables to print in case of test failure
342 self
.recorded_values
["epoll_wait_entry"] = locals()
344 def epoll_wait_exit(self
, event
):
346 fds_length
= event
["fds_length"]
347 overflow
= event
["overflow"]
349 # check that FD 0 returned with EPOLLIN and the right data.fd
350 if ret
== 1 and fds_length
== 1:
351 fd_0
= event
["fds"][0]
352 if overflow
== 0 and fd_0
["data_union"]["fd"] == 0 and \
353 fd_0
["events"]["EPOLLIN"] == 1:
354 self
.expect
["epoll_wait_exit"]["epoll_wait_out_fd0"] = 1
356 # Save values of local variables to print in case of test failure
357 self
.recorded_values
["epoll_wait_exit"] = locals()
360 class Test2(TraceParser
):
361 def __init__(self
, trace
, pid
):
362 super().__init
__(trace
, pid
)
363 self
.expect
["select_entry"]["select_timeout_in_fd0"] = 0
364 self
.expect
["select_entry"]["select_timeout_in_fd1023"] = 0
365 self
.expect
["select_exit"]["select_timeout_out"] = 0
366 self
.expect
["poll_entry"]["poll_timeout_in"] = 0
367 self
.expect
["poll_exit"]["poll_timeout_out"] = 0
368 self
.expect
["epoll_ctl_entry"]["epoll_ctl_timeout_in_add"] = 0
369 self
.expect
["epoll_ctl_exit"]["epoll_ctl_timeout_out_ok"] = 0
370 self
.expect
["epoll_wait_entry"]["epoll_wait_timeout_in"] = 0
371 self
.expect
["epoll_wait_exit"]["epoll_wait_timeout_out"] = 0
373 def select_entry(self
, event
):
377 if n
== 1 and tvp
!= 0:
378 self
.expect
["select_entry"]["select_timeout_in_fd0"] = 1
380 readfd_127
= event
["readfds"][127]
381 writefd_127
= event
["writefds"][127]
382 exceptfd_127
= event
["exceptfds"][127]
384 if readfd_127
== 0x40 and writefd_127
== 0 and \
385 exceptfd_127
== 0 and tvp
!= 0:
386 self
.expect
["select_entry"]["select_timeout_in_fd1023"] = 1
388 # Save values of local variables to print in case of test failure
389 self
.recorded_values
["select_entry"] = locals()
391 def select_exit(self
, event
):
395 if ret
== 0 and tvp
!= 0:
396 self
.expect
["select_exit"]["select_timeout_out"] = 1
398 # Save values of local variables to print in case of test failure
399 self
.recorded_values
["select_exit"] = locals()
401 def poll_entry(self
, event
):
403 fds_length
= event
["fds_length"]
405 # check that we wait on FD 0 for POLLIN and that the raw_events
406 # field matches the value of POLLIN
407 if nfds
== 1 and fds_length
== 1:
408 fd_0
= event
["fds"][0]
409 if fd_0
["raw_events"] == 0x3 and \
410 fd_0
["events"]["POLLIN"] == 1 and \
411 fd_0
["events"]["padding"] == 0:
412 self
.expect
["poll_entry"]["poll_timeout_in"] = 1
414 # Save values of local variables to print in case of test failure
415 self
.recorded_values
["poll_entry"] = locals()
417 def poll_exit(self
, event
):
420 fds_length
= event
["fds_length"]
422 if ret
== 0 and nfds
== 1 and fds_length
== 0:
423 self
.expect
["poll_exit"]["poll_timeout_out"] = 1
425 # Save values of local variables to print in case of test failure
426 self
.recorded_values
["poll_exit"] = locals()
428 def epoll_ctl_entry(self
, event
):
429 op_enum
= event
["op_enum"]
430 _event
= event
["event"]
432 # make sure we see a EPOLLIN|EPOLLPRI
433 if op_enum
== "EPOLL_CTL_ADD" and \
434 _event
["events"]["EPOLLIN"] == 1 and \
435 _event
["events"]["EPOLLPRI"] == 1:
436 self
.expect
["epoll_ctl_entry"]["epoll_ctl_timeout_in_add"] = 1
438 # Save values of local variables to print in case of test failure
439 self
.recorded_values
["epoll_ctl_entry"] = locals()
441 def epoll_ctl_exit(self
, event
):
445 self
.expect
["epoll_ctl_exit"]["epoll_ctl_timeout_out_ok"] = 1
447 # Save values of local variables to print in case of test failure
448 self
.recorded_values
["epoll_ctl_exit"] = locals()
450 def epoll_wait_entry(self
, event
):
451 maxevents
= event
["maxevents"]
452 timeout
= event
["timeout"]
454 if maxevents
== 1 and timeout
== 1:
455 self
.expect
["epoll_wait_entry"]["epoll_wait_timeout_in"] = 1
457 # Save values of local variables to print in case of test failure
458 self
.recorded_values
["epoll_wait_entry"] = locals()
460 def epoll_wait_exit(self
, event
):
462 fds_length
= event
["fds_length"]
463 overflow
= event
["overflow"]
465 if ret
== 0 and fds_length
== 0 and overflow
== 0:
466 self
.expect
["epoll_wait_exit"]["epoll_wait_timeout_out"] = 1
468 # Save values of local variables to print in case of test failure
469 self
.recorded_values
["epoll_wait_exit"] = locals()
472 class Test3(TraceParser
):
473 def __init__(self
, trace
, pid
):
474 super().__init
__(trace
, pid
)
475 self
.expect
["select_entry"]["select_invalid_fd_in"] = 0
476 self
.expect
["select_exit"]["select_invalid_fd_out"] = 0
478 def select_entry(self
, event
):
480 overflow
= event
["overflow"]
482 if n
> 0 and overflow
== 0:
483 self
.expect
["select_entry"]["select_invalid_fd_in"] = 1
485 # Save values of local variables to print in case of test failure
486 self
.recorded_values
["select_entry"] = locals()
488 def select_exit(self
, event
):
490 overflow
= event
["overflow"]
491 _readfds_length
= event
["_readfds_length"]
493 # make sure the event has a ret field equal to -EBADF
494 if ret
== -9 and overflow
== 0 and _readfds_length
== 0:
495 self
.expect
["select_exit"]["select_invalid_fd_out"] = 1
497 # Save values of local variables to print in case of test failure
498 self
.recorded_values
["select_exit"] = locals()
501 class Test4(TraceParser
):
502 def __init__(self
, trace
, pid
):
503 super().__init
__(trace
, pid
)
504 self
.expect
["poll_entry"]["big_poll_in"] = 0
505 self
.expect
["poll_exit"]["big_poll_out"] = 0
507 def poll_entry(self
, event
):
509 fds_length
= event
["fds_length"]
510 overflow
= event
["overflow"]
512 # test of big list of FDs and the behaviour of the overflow
513 if nfds
== 2047 and fds_length
== 512 and overflow
== 1:
514 fd_0
= event
["fds"][0]
515 fd_511
= event
["fds"][511]
516 if fd_0
["raw_events"] == 0x3 and fd_0
["events"]["POLLIN"] == 1 and \
517 fd_0
["events"]["padding"] == 0 and \
518 fd_511
["events"]["POLLIN"] == 1 and \
519 fd_511
["events"]["POLLPRI"] == 1:
520 self
.expect
["poll_entry"]["big_poll_in"] = 1
522 # Save values of local variables to print in case of test failure
523 self
.recorded_values
["poll_entry"] = locals()
525 def poll_exit(self
, event
):
528 fds_length
= event
["fds_length"]
529 overflow
= event
["overflow"]
531 # test of big list of FDs and the behaviour of the overflow
532 if ret
== 2047 and nfds
== 2047 and fds_length
== 512 and overflow
== 1:
533 fd_0
= event
["fds"][0]
534 fd_511
= event
["fds"][511]
535 if fd_0
["events"]["POLLIN"] == 1 and fd_511
["events"]["POLLIN"] == 1:
536 self
.expect
["poll_exit"]["big_poll_out"] = 1
538 # Save values of local variables to print in case of test failure
539 self
.recorded_values
["poll_exit"] = locals()
541 class Test5(TraceParser
):
542 def __init__(self
, trace
, pid
):
543 super().__init
__(trace
, pid
)
544 self
.expect
["poll_entry"]["poll_overflow_in"] = 0
545 self
.expect
["poll_exit"]["poll_overflow_out"] = 0
547 def poll_entry(self
, event
):
549 fds_length
= event
["fds_length"]
550 overflow
= event
["overflow"]
552 # test that event in valid even though the target buffer is too small
553 # and the program segfaults
554 if nfds
== 100 and fds_length
== 100 and overflow
== 0:
555 fd_0
= event
["fds"][0]
556 if fd_0
["events"]["POLLIN"] == 1:
557 self
.expect
["poll_entry"]["poll_overflow_in"] = 1
559 # Save values of local variables to print in case of test failure
560 self
.recorded_values
["poll_entry"] = locals()
562 def poll_exit(self
, event
):
564 overflow
= event
["overflow"]
566 # test that event in valid even though the target buffer is too small
567 # and the program segfaults
568 if nfds
== 100 and overflow
== 0:
569 self
.expect
["poll_exit"]["poll_overflow_out"] = 1
571 # Save values of local variables to print in case of test failure
572 self
.recorded_values
["poll_exit"] = locals()
575 class Test6(TraceParser
):
576 def __init__(self
, trace
, pid
):
577 super().__init
__(trace
, pid
)
578 self
.expect
["select_entry"]["pselect_invalid_in"] = 0
579 self
.expect
["select_exit"]["pselect_invalid_out"] = 0
581 def select_entry(self
, event
):
583 overflow
= event
["overflow"]
584 _readfds_length
= event
["_readfds_length"]
586 # test that event in valid even though the target buffer pointer is
587 # invalid and the program segfaults
588 if n
== 1 and overflow
== 0 and _readfds_length
== 0:
589 self
.expect
["select_entry"]["pselect_invalid_in"] = 1
591 # Save values of local variables to print in case of test failure
592 self
.recorded_values
["select_entry"] = locals()
594 def select_exit(self
, event
):
596 overflow
= event
["overflow"]
597 _readfds_length
= event
["_readfds_length"]
599 # test that event in valid even though the target buffer pointer is
600 # invalid and the program segfaults
601 if ret
== -14 and overflow
== 0 and _readfds_length
== 0:
602 self
.expect
["select_exit"]["pselect_invalid_out"] = 1
604 # Save values of local variables to print in case of test failure
605 self
.recorded_values
["select_exit"] = locals()
608 class Test7(TraceParser
):
609 def __init__(self
, trace
, pid
):
610 super().__init
__(trace
, pid
)
611 self
.expect
["poll_entry"]["poll_max_in"] = 0
612 self
.expect
["poll_exit"]["poll_max_out"] = 0
614 def poll_entry(self
, event
):
616 overflow
= event
["overflow"]
618 # check the proper working of INT_MAX maxevent value
619 if nfds
== 4294967295 and overflow
== 1:
620 self
.expect
["poll_entry"]["poll_max_in"] = 1
622 # Save values of local variables to print in case of test failure
623 self
.recorded_values
["poll_entry"] = locals()
626 def poll_exit(self
, event
):
629 overflow
= event
["overflow"]
631 # check the proper working of UINT_MAX maxevent value
632 if ret
== -22 and nfds
== 4294967295 and overflow
== 0:
633 self
.expect
["poll_exit"]["poll_max_out"] = 1
635 # Save values of local variables to print in case of test failure
636 self
.recorded_values
["poll_exit"] = locals()
639 class Test8(TraceParser
):
640 def __init__(self
, trace
, pid
):
641 super().__init
__(trace
, pid
)
642 self
.expect
["epoll_wait_entry"]["epoll_wait_invalid_in"] = 0
643 self
.expect
["epoll_wait_exit"]["epoll_wait_invalid_out"] = 0
645 def epoll_wait_entry(self
, event
):
647 maxevents
= event
["maxevents"]
648 timeout
= event
["timeout"]
650 # test that event in valid even though the target buffer pointer is
651 # invalid and the program segfaults
652 if epfd
== 3 and maxevents
== 1 and timeout
== -1:
653 self
.expect
["epoll_wait_entry"]["epoll_wait_invalid_in"] = 1
655 # Save values of local variables to print in case of test failure
656 self
.recorded_values
["epoll_wait_entry"] = locals()
658 def epoll_wait_exit(self
, event
):
660 fds_length
= event
["fds_length"]
661 overflow
= event
["overflow"]
663 # test that event in valid even though the target buffer pointer is
664 # invalid and the program segfaults
665 if ret
== -14 and fds_length
== 0 and overflow
== 0:
666 self
.expect
["epoll_wait_exit"]["epoll_wait_invalid_out"] = 1
668 # Save values of local variables to print in case of test failure
669 self
.recorded_values
["epoll_wait_exit"] = locals()
672 class Test9(TraceParser
):
673 def __init__(self
, trace
, pid
):
674 super().__init
__(trace
, pid
)
675 self
.expect
["epoll_wait_entry"]["epoll_wait_max_in"] = 0
676 self
.expect
["epoll_wait_exit"]["epoll_wait_max_out"] = 0
678 def epoll_wait_entry(self
, event
):
680 maxevents
= event
["maxevents"]
681 timeout
= event
["timeout"]
683 # check the proper working of INT_MAX maxevent value
684 if epfd
== 3 and maxevents
== 2147483647 and timeout
== -1:
685 self
.expect
["epoll_wait_entry"]["epoll_wait_max_in"] = 1
687 # Save values of local variables to print in case of test failure
688 self
.recorded_values
["epoll_wait_entry"] = locals()
690 def epoll_wait_exit(self
, event
):
692 fds_length
= event
["fds_length"]
693 overflow
= event
["overflow"]
695 # check the proper working of INT_MAX maxevent value
696 if ret
== -22 and fds_length
== 0 and overflow
== 0:
697 self
.expect
["epoll_wait_exit"]["epoll_wait_max_out"] = 1
699 # Save values of local variables to print in case of test failure
700 self
.recorded_values
["epoll_wait_exit"] = locals()
703 if __name__
== "__main__":
704 parser
= argparse
.ArgumentParser(description
='Trace parser')
705 parser
.add_argument('path', metavar
="<path/to/trace>", help='Trace path')
706 parser
.add_argument('-t', '--test', type=int, help='Test to validate')
707 parser
.add_argument('-p', '--pid', type=int, help='PID of the app')
708 args
= parser
.parse_args()
711 print("Need to pass a test to validate (-t)")
715 print("Need to pass the PID to check (-p)")
718 traces
= TraceCollection()
719 handle
= traces
.add_traces_recursive(args
.path
, "ctf")
726 t
= Test1(traces
, args
.pid
)
728 t
= Test2(traces
, args
.pid
)
730 t
= Test3(traces
, args
.pid
)
732 t
= Test4(traces
, args
.pid
)
734 t
= Test5(traces
, args
.pid
)
736 t
= Test6(traces
, args
.pid
)
738 t
= Test7(traces
, args
.pid
)
740 t
= Test8(traces
, args
.pid
)
742 t
= Test9(traces
, args
.pid
)
743 elif args
.test
== 10:
744 # stress test, nothing reliable to check
746 elif args
.test
== 11:
747 # stress test, nothing reliable to check
750 print("Invalid test case")
756 for h
in handle
.values():
757 traces
.remove_trace(h
)
This page took 0.046049 seconds and 4 git commands to generate.