mirror of
https://github.com/ntop/n2n.git
synced 2024-09-20 00:51:10 +02:00
b735ad6b9e
* 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
57 lines
1.5 KiB
C
57 lines
1.5 KiB
C
/*
|
|
* (C) 2007-21 - ntop.org and contributors
|
|
*
|
|
* 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 3 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; if not, see <http://www.gnu.org/licenses/>
|
|
*
|
|
*/
|
|
|
|
#include "n2n.h"
|
|
#include "hexdump.h"
|
|
|
|
void test_curve25519(unsigned char *pkt_input, unsigned char *key) {
|
|
char *test_name = "curve25519";
|
|
unsigned char pkt_output[32];
|
|
|
|
curve25519(pkt_output, key, pkt_input);
|
|
|
|
printf("%s: output\n", test_name);
|
|
fhexdump(0, pkt_output, sizeof(pkt_output), stdout);
|
|
|
|
fprintf(stderr, "%s: tested\n", test_name);
|
|
printf("\n");
|
|
}
|
|
|
|
int main(int argc, char * argv[]) {
|
|
char *test_name = "environment";
|
|
|
|
unsigned char key[32];
|
|
unsigned char pkt_input[32];
|
|
|
|
memset(pkt_input, 0, 31);
|
|
pkt_input[31] = 9;
|
|
|
|
memset(key, 0x55, 32);
|
|
|
|
printf("%s: input\n", test_name);
|
|
fhexdump(0, pkt_input, sizeof(pkt_input), stdout);
|
|
printf("%s: key\n", test_name);
|
|
fhexdump(0, key, sizeof(key), stdout);
|
|
printf("\n");
|
|
|
|
test_curve25519(pkt_input, key);
|
|
|
|
return 0;
|
|
}
|
|
|