Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[test][test_brb] Gate the test behind the new skipUnlessHasBinaries d…
…ecorator If we have the binaries on file, we should fail and report the failure. Currently, if the binaries are missing, the test fail and we just ignore it. If the binaries are there and we fail, we would have the same outcome, but really, we should report the failure as something wrong would have happened. Faking a missing binary: ``` $ docker run -ti \ --privileged \ --network=host \ --pid=host \ -v $(pwd):/bcc \ -v /sys/kernel/debug:/sys/kernel/debug:rw \ -v /lib/modules:/lib/modules:ro \ -v /usr/src:/usr/src:ro \ -e CTEST_OUTPUT_ON_FAILURE=1 \ u34 \ /bin/bash -c \ '/bcc/build/tests/wrapper.sh "py_test_percpu" "sudo" "/bcc/tests/python/test_brb.py" test_brb.c -v' test_brb (__main__.TestBPFSocket) ... skipped 'Missing binaries: iper, neterf. iperf and netperf packages must be installed.' ---------------------------------------------------------------------- Ran 1 test in 0.000s OK (skipped=1) ``` running against a container where both iperf and netperf were installed: ``` net.ipv4.ip_forward = 1 ARPING 100.1.1.254 42 bytes from b2:55:dc:a4:58:81 (100.1.1.254): index=0 time=8.384 usec --- 100.1.1.254 statistics --- 1 packets transmitted, 1 packets received, 0% unanswered (0 extra) rtt min/avg/max/std-dev = 0.008/0.008/0.008/0.000 ms ARPING 200.1.1.254 42 bytes from 9e:94:6c:ba:2a:3c (200.1.1.254): index=0 time=8.918 usec --- 200.1.1.254 statistics --- 1 packets transmitted, 1 packets received, 0% unanswered (0 extra) rtt min/avg/max/std-dev = 0.009/0.009/0.009/0.000 ms PING 200.1.1.1 (200.1.1.1) 56(84) bytes of data. 64 bytes from 200.1.1.1: icmp_seq=1 ttl=63 time=0.097 ms 64 bytes from 200.1.1.1: icmp_seq=2 ttl=63 time=0.079 ms --- 200.1.1.1 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1019ms rtt min/avg/max/mdev = 0.079/0.088/0.097/0.009 ms [ ID] Interval Transfer Bandwidth [ 3] 0.0- 1.0 sec 6.46 GBytes 55.5 Gbits/sec [ ID] Interval Transfer Bandwidth [ 4] 0.0- 1.0 sec 6.46 GBytes 55.0 Gbits/sec Starting netserver with host 'IN(6)ADDR_ANY' port '12865' and family AF_UNSPEC MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 200.1.1.1 () port 0 AF_INET : demo Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec 131072 16384 65160 1.00 49468.46 MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 200.1.1.1 () port 0 AF_INET : demo : first burst 0 Local /Remote Socket Size Request Resp. Elapsed Trans. Send Recv Size Size Time Rate bytes Bytes bytes bytes secs. per sec 16384 131072 1 1 1.00 63173.69 16384 131072 ok ---------------------------------------------------------------------- Ran 1 test in 9.331s OK ``` Forcing a failure when all binaries are on the system: ``` net.ipv4.ip_forward = 1 ARPING 100.1.1.254 42 bytes from 62:d8:ac:1e:d4:ee (100.1.1.254): index=0 time=5.247 usec --- 100.1.1.254 statistics --- 1 packets transmitted, 1 packets received, 0% unanswered (0 extra) rtt min/avg/max/std-dev = 0.005/0.005/0.005/0.000 ms ARPING 200.1.1.254 42 bytes from 42:07:f7:d5:d2:b9 (200.1.1.254): index=0 time=6.799 usec --- 200.1.1.254 statistics --- 1 packets transmitted, 1 packets received, 0% unanswered (0 extra) rtt min/avg/max/std-dev = 0.007/0.007/0.007/0.000 ms PING 200.1.1.1 (200.1.1.1) 56(84) bytes of data. 64 bytes from 200.1.1.1: icmp_seq=1 ttl=63 time=0.104 ms 64 bytes from 200.1.1.1: icmp_seq=2 ttl=63 time=0.084 ms --- 200.1.1.1 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1000ms rtt min/avg/max/mdev = 0.084/0.094/0.104/0.010 ms FAIL ====================================================================== FAIL: test_brb (__main__.TestBPFSocket) ---------------------------------------------------------------------- Traceback (most recent call last): File "/bcc/tests/python/utils.py", line 68, in wrapper func(self, *args, **kwargs) File "/bcc/tests/python/test_brb.py", line 201, in test_brb self.assertEqual(self.pem_stats[c_uint(0)].value, 9) AssertionError: 8 != 9 ---------------------------------------------------------------------- Ran 1 test in 4.294s FAILED (failures=1) ```
- Loading branch information