summaryrefslogtreecommitdiff
path: root/tests/lib
AgeCommit message (Collapse)Author
2020-02-03*: don't null after XFREE; XFREE does this itselfQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-12-18tests: fix endian bug in test_typelistMark Stapp
Fix a byte-swapping bug that appeared on big-endian arch but wasn't visible on little-endian runs. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-06lib: add frr_version_cmp()David Lamparter
This just compares 2 version strings. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-06lib: rename memory_vty.c to lib_vty.cDavid Lamparter
And memory_init() to lib_cmd_init(). Signed-off-by: David Lamparter <equinox@diac24.net>
2019-11-30*: make frr_yang_module_info constDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-09-30*: strip trailing whitespaceQuentin Young
Some of it has snuck by CI Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-09-03*: frr_elevate_privs -> frr_with_privsDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-08-08Merge pull request #4497 from opensourcerouting/rcuDonald Sharp
RCU support
2019-08-07Merge pull request #4763 from opensourcerouting/ds-workDonald Sharp
lib: get rid of pqueue_*, use DECLARE_HEAP in thread.c
2019-08-06Merge pull request #4790 from opensourcerouting/ctype-castQuentin Young
*: fix ctype casts
2019-08-06*: fix ctype (isalpha & co.) castsDavid Lamparter
The correct cast for these is (unsigned char), because "char" could be signed and thus have some negative value. isalpha & co. expect an int arg that is positive, i.e. 0-255. So we need to cast to (unsigned char) when calling any of these. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-08-02all: remove logical-router functionalityIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2019-08-01lib: remove pqueue_* (again)David Lamparter
All users of the pqueue_* implementations have been migrated to use some new data structure (TYPEDSKIP for ospf, HEAP for thread.c). Remove. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-07-31tests: Add asserts to check return on list *_delStephen Worley
Add some asserts where `list_del()` is called to verify they object was found when it was deleted. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-07-31lib/seqlock: avoid syscalls in no-waiter casesDavid Lamparter
When we have no contention on the seqlock, we shouldn't incur the cost of syscalls. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-07-15tests: remove strlen assert in inet_ntop testsQuentin Young
Some platform libc's like to render some v6 addresses as v4 mapped where others render the same addresses as v6 with leading zeroes. Binary equivalence checks pass but strlen checks sometimes fail here. Remove assert causing the failure. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-06-17Merge pull request #4514 from opensourcerouting/warnings-20190612Donald Sharp
*: kill more warnings
2019-06-14eliminate snprintf from AF_INET/AF_INET6 prefix2str, add prefix2str test (#4521)David Lamparter
eliminate snprintf from AF_INET/AF_INET6 prefix2str, add prefix2str test
2019-06-13tests: add prefix2str testQuentin Young
Only tests IPv4 and IPv6 right now. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-06-13Merge pull request #4509 from opensourcerouting/spanish-intquisitionQuentin Young
lib: make printfrr int64_t usable
2019-06-13*: config.h or zebra.h is the first #includeDavid Lamparter
This is mostly relevant for Solaris, where config.h sets up some #define that affect overall header behaviour, so it needs to be before anything else. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-06-12lib: make "%Ld" work for int64_tDavid Lamparter
... without compiler plugins. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-06-11lib: const-unaware container_of for C++David Lamparter
This version of container_of() should work on C++, by ditching the unavailable builtins (at the cost of no longer checking for "const" violations.) Signed-off-by: David Lamparter <equinox@diac24.net>
2019-06-06tests: exercise frr_inet_ntop()David Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-06-03tests: exercise printfrr()David Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-05-31lib: Add '--command-log-always` to all daemons startupDonald Sharp
Add 'no log commands' cli and at the same time add a --command-log-always to the daemon startup cli. If --command-log-always is specified then all commands are auto-logged and the 'no log commands' form of the command is now ignored. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-21tests: update list of headers in the cxx compat testRenato Westphal
Now, whenever a new header is added to libfrr, this test needs to be updated manually (unless we automate this somehow in the future). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-05-21*: rename new ForEach macros from the typesafe APIRenato Westphal
This is necessary to avoid a name collision with std::for_each from C++. Fixes the compilation of the gRPC northbound module. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-05-21tests: more datastructure testsDavid Lamparter
A little something for everybody in here. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-05-21tests: extend DECLARE_* testsDavid Lamparter
The unsorted datastructures (LIST, DLIST) had no test before this. Also add a hash check (mostly to make testing the unsorted lists easier.) Signed-off-by: David Lamparter <equinox@diac24.net>
2019-05-21tests: test DECLARE_HASH with good and bad hashfnDavid Lamparter
The hash table test was previously (intentionally) using a bad hash function to test the code in the face of hash collisions. Add a test with a good hash function to see some performance numbers. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-05-14lib: hashing functions should take const argumentsQuentin Young
It doesn't make much sense for a hash function to modify its argument, so const the hash input. BGP does it in a couple places, those cast away the const. Not great but not any worse than it was. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-04-29Revert "lib: remove pqueue_*"David Lamparter
This reverts commit 798ac49d06b6619adb4c5ac765b092397bc50a6c.
2019-04-27lib: remove fifo implementationDavid Lamparter
2019-04-27lib: remove pqueue_*David Lamparter
All users of the pqueue_* implementations have been migrated to use TYPEDSKIP_* skiplists. Remove. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-04-27tests: exercise the typesafe list wrappersDavid Lamparter
Since all of these list implementations provide almost the same API, we can run and validate them against the same test code. 9 tests for the price of one! Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-04-27lib: atomlist & atomsortDavid Lamparter
These two are lock-free linked list implementations, the plain one is primarily intended for queues while the sorted one is for general data storage. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-04-18lib: add "seqlock" wait/broadcast primitiveDavid Lamparter
Manually tested rather extensively in addition to included unit tests, should work as intended. NB: The OpenBSD futex() code is "future"; it's not actually in OpenBSD (yet?) and thus untested. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-04-03lib: remove event_counter.[ch]Quentin Young
goodbye spooky code Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25*: use array_size instead of raw divisionQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25*: return bool from boolean functionsQuentin Young
Not 1 or 0. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25*: Rename backet to bucketTim Bray
Presume typo from original author Signed-off-by: Tim Bray <tim@kooky.org>
2019-02-11tests: add C++ header compatibility smoke testDavid Lamparter
Compiling an empty C file with most headers included and -Wc++-compat gives us a build error if we introduce some stupid C++-incompatible change. While this won't catch everything, it's a good start. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-01-24Treewide: use ANSI function definitionsRuben Kerkhof
Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
2018-12-09lib, tests: add support for keyless YANG listsRenato Westphal
YANG allows lists without keys for operational data, in which case the list elements are uniquely identified using a positional index (starting from one). This commit does the following: * Remove the need to implement the 'get_keys' and 'lookup_entry' callbacks for keyless lists. * Extend nb_oper_data_iter_list() so that it special-cases keyless lists appropriately. Since both the CLI and the sysrepo plugin use nb_oper_data_iterate() to fetch operational data, both these northbound clients automatically gain the ability to understand keyless lists without additional changes. * Extend the confd plugin to special-case keyless lists as well. This was a bit painful to implement given ConfD's clumsy API, but keyless lists should work ok now. * Update the "test_oper_data" unit test to test keyless YANG lists in addition to regular lists. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-12-09Merge pull request #3452 from opensourcerouting/reprobuild-masterDonald Sharp
[master] build reproducibility
2018-12-07tests: fix domainname dependencyDavid Lamparter
These are causing random test failures when the host's domainname is actually set to something (as opposed to empty/unset, which it is 99% of times.) Signed-off-by: David Lamparter <equinox@diac24.net>
2018-12-07lib: add support for confirmed commitsRenato Westphal
Confirmed commits allow the user to request an automatic rollback to the previous configuration if the commit operation is not confirmed within a number of minutes. This is particularly useful when the user is accessing the CLI through the network (e.g. using SSH) and any configuration change might cause an unexpected loss of connectivity between the user and the managed device (e.g. misconfiguration of a routing protocol). By using a confirmed commit, the user can rest assured the connectivity will be restored after the given timeout expires, avoiding the need to access the router physically to fix the problem. When "commit confirmed TIMEOUT" is used, a new "commit" command is expected to confirm the previous commit before the given timeout expires. If "commit confirmed TIMEOUT" is used while there's already a confirmed-commit in progress, the confirmed-commit timeout is reset to the new value. In the current implementation, if other users perform commits while there's a confirmed-commit in progress, all commits are rolled back when the confirmed-commit timeout expires. It's recommended to use the "configure exclusive" configuration mode to prevent unexpected outcomes when using confirmed commits. When an user exits from the configuration mode while there's a confirmed-commit in progress, the commit is automatically rolled back and the user is notified about it. In the future we might want to prompt the user if he or she really wants to exit from the configuration mode when there's a pending confirmed commit. Needless to say, confirmed commit only work for configuration commands converted to the new northbound model. vtysh support will be implemented at a later time. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-11-26lib, tests: major rework in the operational-data callbacksRenato Westphal
The northbound infrastructure for operational data was subpar compared to the infrastructure for configuration data. This commit addresses most of the existing problems, making it possible to write operational-data callbacks for more complex YANG models. Summary of the changes: * Add support for nested YANG lists. * Add support for leaf-lists. * Add support for leafs of type "empty". * Introduce the "show yang operational-data XPATH" command, and write an unit test for it. The main purpose of this command is to make it easier to test the operational-data northbound callbacks. * Introduce the nb_oper_data_iterate() function, that can be used to iterate over operational data. Make the CLI and sysrepo use this function. * Since ConfD has a very peculiar API, it can't reuse the nb_oper_data_iterate() like the other northbound clients. In this case, adapt the existing ConfD callbacks to support the new features (and make some performance improvements in the process). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-11-26tests: fix warning related to change in the hash APIRenato Westphal
The hash_cmp functions need to return bool since commit 74df8d6d9d6. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>