-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zebra: giant zapi cleanup #1828
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2cf63c3
lib: fixup zlog_hexdump
qlyoung 3fc174e
tests: add unit test for zlog
qlyoung 8068a64
zebra: dont return a status code in zapi handlers
qlyoung 9bcbcae
zebra: add struct zmsghdr
qlyoung 89f4e50
zebra: standardize ZAPI message handler args
qlyoung 1002497
zebra: reorganize zserv, batch i/o
qlyoung 124ead2
lib, zebra: use existing zapi header struct
qlyoung 5530922
lib: zclient.h style fixes
qlyoung 107afcd
lib, zebra: clean up zapi nits
qlyoung 41903a4
lib, zebra: slight cleanup after rebase
qlyoung File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Zlog tests. | ||
* Copyright (C) 2018 Cumulus Networks, Inc. | ||
* Quentin Young | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the Free | ||
* Software Foundation; either version 2 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; see the file COPYING; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
*/ | ||
#include <zebra.h> | ||
#include <memory.h> | ||
#include "log.h" | ||
|
||
/* maximum amount of data to hexdump */ | ||
#define MAXDATA 16384 | ||
|
||
/* | ||
* Test hexdump functionality. | ||
* | ||
* At the moment, not crashing is considered success. | ||
*/ | ||
static bool test_zlog_hexdump(void) | ||
{ | ||
unsigned int nl = 1; | ||
|
||
do { | ||
long d[nl]; | ||
|
||
for (unsigned int i = 0; i < nl; i++) | ||
d[i] = random(); | ||
zlog_hexdump(d, nl * sizeof(long)); | ||
} while (++nl * sizeof(long) <= MAXDATA); | ||
|
||
return true; | ||
} | ||
|
||
bool (*tests[])(void) = { | ||
test_zlog_hexdump, | ||
}; | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
openzlog("testzlog", "NONE", 0, LOG_CONS | LOG_NDELAY | LOG_PID, | ||
LOG_ERR); | ||
zlog_set_file("test_zlog.log", LOG_DEBUG); | ||
|
||
for (unsigned int i = 0; i < array_size(tests); i++) | ||
if (!tests[i]()) | ||
return 1; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import frrtest | ||
|
||
class TestZlog(frrtest.TestMultiOut): | ||
program = './test_zlog' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this change intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was at a previous version of this PR, not anymore. As I read it there's no difference either way. I can back it out if you like.