You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1001 B

added test framework and code coverage reporting (#797) * Add a simple test framework * Add a code coverage report example oneliner * Move the coverage report into a separate directory * Add a github action to run tests and publish a branch with the coverage report * Fix: Missing job separator * Fix: remember to actually run configure * Fix: Gotta autogen before I configure * Dont try to upload coverage report unless this is a push * Clearly show the git ref tested in the coverage report * Add a test for the various transforms * Add tests for the elliptic curve and pearson hash * Ensure we ignore new generated output * Remove unneeded boilerplate from the compression tests * Add an example of a test of the encoded wire packets * Ensure that correctly testable data is output even when zstd is not compiled * Factor test runner out into its own script and attempt to add it to the cmake file * Tell cmake about a new object file * Stop trying to make Cmake work... * Stop trying to make cmake work, round 2 * In the middle of a thousand lines of cmake output was one important one - windows could not find assert() - try again * Try again to plumb the tests into cmake * Add missing library to our superset install line * Fix build error when libcap-dev is installed * Switch to using artifact uploads instead of pages to store/show the coverage report * Fix artifact upload yaml * Upload coverage report to codecov * Fix codecov - clearly it doesnt do a recursive search for coverage files * Fix codecov - my hopeful use of a list of directories didnt work * Fix codecov - unfortunately, it doesnt just consume the coverage data and needs us to generate the gcov output * Fix codecov - nope, it still doesnt recursively search * Fix codecov - it really helps if I run the gcov data generator * Add a simple matrix build * Fix older ubuntu versions of gcovr that do not support the '--html-title' option * Ensure we use gcover options that are identical on older ubuntu * Improve coverage generation and required build packages
3 years ago
#include <stdio.h>
#include "n2n.h"
#include "hexdump.h"
void fhexdump(unsigned int display_addr, void *in, int size, FILE *stream) {
uint8_t *p = in;
while(size>0) {
fprintf(stream, "%03x: ", display_addr);
for (int i = 0; i < 16; i++) {
if (i < size) {
fprintf(stream, "%02x", p[i]);
} else {
fprintf(stream, " ");
}
if (i==7) {
fprintf(stream, " ");
} else {
fprintf(stream, " ");
}
}
fprintf(stream, " |");
for (int i = 0; i < 16; i++) {
if (i < size) {
char ch = p[i];
if (ch>=0x20 && ch<=0x7e) {
fprintf(stream, "%c", ch);
} else {
fprintf(stream, " ");
}
}
}
fprintf(stream, "|\n");
size -= 16;
display_addr += 16;
p += 16;
}
}