summaryrefslogtreecommitdiffstats
path: root/test/test_rtnetlink.cpp
Commit message (Collapse)AuthorAgeFilesLines
* test: rtnetlink: use manager interface queryPatrick Venture2019-03-121-9/+2
| | | | | | | | Use the new interface query method provided by manager to know if the interface was added instead of inspecting the manager itself. Change-Id: I94600199fd60a014d6b376155555449f7af617f5 Signed-off-by: Patrick Venture <venture@google.com>
* Re-enable unit testRatan Gupta2018-11-301-5/+5
| | | | | | | | | | | | Unit test were broken after sd bus calls started throwing exception, In this repo we start the systemd-networkd with the use of sd bus calls, which throws exception and it was not handled in the test case. This commit fixes the problem by mocking the network manager which mock the functionality of function which makes the sdbus call. Change-Id: I5b60a2117a661cffa36200415ca611b85dd2fda1 Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
* Migrate to a common timer classWilliam A. Kennington III2018-09-271-4/+5
| | | | | | | | | | | | This change pulls in sdeventplus and uses the timer implementation as a drop in for the currently included timer. Tested: Unit tests still build but are not currently running. Manually tested this change on a zaius machine and made sure timers went off. Change-Id: I2808196581fc766843931403b83fead16926b0ae Signed-off-by: William A. Kennington III <wak@google.com>
* clang-format: Update to match docs repoGunnar Mills2018-09-151-64/+52
| | | | | | | | | Update the .clang-format file and run clang-format-6.0. This .clang-format matches the example one in https://github.com/openbmc/docs/blob/master/cpp-style-and-conventions.md#clang-formatting Change-Id: Ia331c9a5b040e1a3c45a0ebf1b8d776d93b05ae5 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* test: Change tmp file names to fix racesAndrew Jeffery2018-03-151-1/+2
| | | | | | | | | | | | | | With MAKEFLAGS=-jN for N > 1 we hit race conditions in the test suite. Multiple independent tests use the same absolute path under /tmp for test case IO. This leads to corruption across the tests manifesting as intermittent failures. Make the file-names semi-unique. This solution is poor in that it makes no attempt at ensuring the file names are absolutely unique, but they are at least unique wither respect to the other test file names, which is an improvement. Change-Id: I6b312093a2d9cd52261d02821566b69e874e7770 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test_rtnetlink: Increase interations in WithSingleInterfaceAndrew Jeffery2018-03-151-1/+1
| | | | | | | | | | | | | We were hitting test failures caused by EXPECT_EQ(true, isInterfaceAdded("igb5")); at the end of the WithSingleInterface case. There appears to be a race condition between the netlink handling and the timer expiry, so increment the number of retries for test stability. Change-Id: I6cd2e4e95ee4d183466c73fa8a36a5580f566227 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test_rtnetlink: Improve exception handling by not handling themAndrew Jeffery2018-03-151-36/+27
| | | | | | | | | All the test was doing was verifying that an exception hadn't occurred. The test would fail if one had, so we're better off just not doing the dance. Change-Id: Iff7d9e4947e86b24f4cf99ddbac3e9c42e63f1d3 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test_rtnetlink: Force bus object to outlive TestRtNetlink lifetimeAndrew Jeffery2018-03-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were hitting a SEGFAULT by nullptr dereference in the WithSingleInterface test when calling sd_bus_ref() via the timer callback with code generated at -O2 from Ubuntu Artful's gcc-7.2.0: Running main() from gtest_main.cc Note: Google Test filter = TestRtNetlink.WithSingleInterface [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from TestRtNetlink [ RUN ] TestRtNetlink.WithSingleInterface ASAN:DEADLYSIGNAL ================================================================= ==19427==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f8a944922ca bp 0x0fffd7e37fc2 sp 0x7ffebf1bfda8 T0) ==19427==The signal is caused by a READ memory access. ==19427==Hint: address points to the zero page. #0 0x7f8a944922c9 in sd_bus_ref (/lib/x86_64-linux-gnu/libsystemd.so.0+0x2e2c9) #1 0x7f8a93a5c616 in sdbusplus::bus::bus::bus(sd_bus*) /usr/local/include/sdbusplus/bus.hpp:340 #2 0x7f8a93a5c616 in sdbusplus::server::interface::interface::interface(sdbusplus::bus::bus&, char const*, char const*, sd_bus_vtable const*, void*) /usr/local/include/sdbusplus/server/interface.hpp:61 ... #16 0x559d611755e7 in phosphor::network::Manager::createInterfaces() ../network_manager.cpp:151 #17 0x559d61178e12 in phosphor::network::Manager::createChildObjects() ../network_manager.cpp:166 #18 0x559d611ed59b in std::function<void ()>::operator()() const /usr/include/c++/7/bits/std_function.h:706 #19 0x559d611ed59b in phosphor::network::Timer::timeoutHandler(sd_event_source*, unsigned long, void*) ../timer.cpp:72 #20 0x7f8a9448e80d (/lib/x86_64-linux-gnu/libsystemd.so.0+0x2a80d) #21 0x7f8a944903e9 in sd_event_dispatch (/lib/x86_64-linux-gnu/libsystemd.so.0+0x2c3e9) #22 0x7f8a94490566 in sd_event_run (/lib/x86_64-linux-gnu/libsystemd.so.0+0x2c566) #23 0x559d610e122e in phosphor::network::TestRtNetlink_WithSingleInterface_Test::TestBody() /tmp/openbmc-build-scripts.wUcrvx/phosphor-networkd/test/test_rtnetlink.cpp:135 ... AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libsystemd.so.0+0x2e2c9) in sd_bus_ref ==19427==ABORTING Move the bus storage to namespace scope alongside the Manager to avoid it getting cleaned up before the callback fires. Change-Id: I3126d0b7b92fb6e66d82f9e32b43a52e44356884 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* Added new unit testcasesNagaraju Goruganti2018-01-301-0/+148
1. Added testcases to validate IP/PrefixLengnth/MACAddress. 2. Added test to rtnetlink. Resolves openbmc/openbmc#2546 Change-Id: I61efbf69682a50f7479b68e32d9714e9c81a32d7 Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
OpenPOWER on IntegriCloud