n2n/tools/tests-hashing.c

123 lines
4.3 KiB
C
Raw Normal View History

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
2021-09-27 11:41:06 +02:00
/*
2022-03-12 10:22:42 +01:00
* (C) 2007-22 - ntop.org and contributors
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
2021-09-27 11:41:06 +02:00
*
* 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/>
*
*/
added mingw test platform (#829) * Provide a minimal reimplementation of our autoconf, to try windows builds * Try building with windows * Fix thinko in spelling * Ensure shell script runs inside a shell * Add a hack to aid include discovery * Just keep adding tech debt... * Assume that we will have slashes in some of the replacement strings and avoid that char with sed * Restore one slash * Hack around the tools makefile interdependancy bug * A correct cflags include hack for each compile dir * Ensure we link against winsock (note, even though this says 32bit, it should link the 64bit library ... I think) * Bad link ordering if we dont use LDLIBS * Remove unused make variable * Remove makefile duplication using inheritance (this does mean you can no longer cd tools; make, but must do make tools) * Add missing library for win32 * Show OS variable * Make hack autoconf more robust for tests on non gitlab runners * Remove no longer used substitutions from hack autoconf * Add missing include path to tools under win32 * Build the win32 subdir when the compiler is Msys * The different subdirs have different dependancies * Ensure we can find the include files * Fix library link ordering * Ensure the tools dir can find the special win32 lib * Deal with the differing basic type sizes on both linux/64bit and windows/64bit * Document the steps to mimic the github windows/mingw build locally - to allow for simpler debugging * Ensure branch name in instructions matches my test branch name * Clarify the shell needed to build with mingw * Since the makefile depends on knowing the OS, raise a fatal error if we cannot determine this * Handling different compile environments is hard. - Linux: sane and reasonable results for both uname -s (=Linux) and uname -o (=GNU/Linux) - Windows/Mingw: insane results for uname -s (=MSYS_NT-$MAJOR.$MINOR-$BUILDNR) but sane results for uname -o (Msys) - Macos: sane results for uname -s (=Darwin) but does not support uname -o at all * Revamp the way that Mingw is detected * Avoid attempting to generate gcovr report when running under windows * Whoops, isolate the right step * Fix spelling mistake * win32/Makefile: Remove unused setting and add comment * ensure that all win32 includes use the same expected path * Allow simpler cross compilation by letting configure pass the CC and AR environment through * Avoid multiple '_CRT_SECURE_NO_WARNINGS redefined' warnings * Convert to a consolidated CONFIG_TARGET variable to select any different compile options * Use the more generic printf defines to avoid warnings on mingw * Update mingw build docs * English better for reader happy make * Address a number of mingw compiler warnings * Fix Visual C compile * Be sure to document some of the hacky nature of the mingw build
2021-10-05 21:07:15 +02:00
2023-06-18 12:34:28 +02:00
#include <inttypes.h> // for PRIx64, PRIx16, PRIx32
#include <stdint.h> // for uint8_t, uint16_t, uint32_t, uint64_t
#include <stdio.h> // for printf, fprintf, stderr, stdout
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
2021-09-27 11:41:06 +02:00
#include "n2n.h"
2023-06-14 21:02:54 +02:00
#include "hexdump.h" // for fhexdump
#include "pearson.h" // for pearson_hash_128, pearson_hash_16, pearson_has...
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
2021-09-27 11:41:06 +02:00
uint8_t PKT_CONTENT[]={
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
Basic C Code lint checker and shell checker (#859) * Factor build packages out into a more maintainable list * Create a location for scripts to live * Provide a make target to return the source dir as close as reasonable to the original distributed state * Add a code lint step, checking the coding style * Change test harness as recommended by shellcheck * Ensure we actually have the linter tool installed * Use the correct directory for cmake to run the tests * Adjust for the older uncrustify in the current github ubuntu-latest * Make one file pass the linter * Integrate the lint with the existing test workflow * Add files with minimal changes needed to the linter * Add more files with minimal changes needed to the linter * Dont build binaries if we fail the lint test * Update the phony targets with the lint steps * Ensure the flake8 package is installed in the new lint workflow job * Use the makefile to drive the packages needed to install for linting * No need to add dependancies on lint, just rely on the workflow status to show failure * Update the scripts dir README to reflect current assumptions * Rename and briefly document the indent.sh script * Fix the ignore to ignore the right Makefile * Rename the test_harness script to make it clear it is a shell script * Provide a master lint make target and add a shell script lint tool * Elminate stray tabs * Drop include/auth.h from linter - there are inconsistant results with function definitions when using the current uncrustify rules
2021-10-23 21:36:18 +02:00
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
};
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
2021-09-27 11:41:06 +02:00
void test_pearson_16 (void *buf, unsigned int bufsize) {
char *test_name = "pearson_hash_16";
uint16_t hash = pearson_hash_16(buf, bufsize);
printf("%s: output = 0x%" PRIx16 "\n", test_name, hash);
fprintf(stderr, "%s: tested\n", test_name);
printf("\n");
}
void test_pearson_32 (void *buf, unsigned int bufsize) {
char *test_name = "pearson_hash_32";
uint32_t hash = pearson_hash_32(buf, bufsize);
printf("%s: output = 0x%" PRIx32 "\n", test_name, hash);
fprintf(stderr, "%s: tested\n", test_name);
printf("\n");
}
void test_pearson_64 (void *buf, unsigned int bufsize) {
char *test_name = "pearson_hash_64";
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
2021-09-27 11:41:06 +02:00
uint64_t hash = pearson_hash_64(buf, bufsize);
Basic C Code lint checker and shell checker (#859) * Factor build packages out into a more maintainable list * Create a location for scripts to live * Provide a make target to return the source dir as close as reasonable to the original distributed state * Add a code lint step, checking the coding style * Change test harness as recommended by shellcheck * Ensure we actually have the linter tool installed * Use the correct directory for cmake to run the tests * Adjust for the older uncrustify in the current github ubuntu-latest * Make one file pass the linter * Integrate the lint with the existing test workflow * Add files with minimal changes needed to the linter * Add more files with minimal changes needed to the linter * Dont build binaries if we fail the lint test * Update the phony targets with the lint steps * Ensure the flake8 package is installed in the new lint workflow job * Use the makefile to drive the packages needed to install for linting * No need to add dependancies on lint, just rely on the workflow status to show failure * Update the scripts dir README to reflect current assumptions * Rename and briefly document the indent.sh script * Fix the ignore to ignore the right Makefile * Rename the test_harness script to make it clear it is a shell script * Provide a master lint make target and add a shell script lint tool * Elminate stray tabs * Drop include/auth.h from linter - there are inconsistant results with function definitions when using the current uncrustify rules
2021-10-23 21:36:18 +02:00
printf("%s: output = 0x%" PRIx64 "\n", test_name, hash);
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
2021-09-27 11:41:06 +02:00
fprintf(stderr, "%s: tested\n", test_name);
printf("\n");
}
void test_pearson_128 (void *buf, unsigned int bufsize) {
char *test_name = "pearson_hash_128";
uint8_t hash[16];
pearson_hash_128(hash, buf, bufsize);
printf("%s: output:\n", test_name);
fhexdump(0, hash, sizeof(hash), stdout);
fprintf(stderr, "%s: tested\n", test_name);
printf("\n");
}
void test_pearson_256 (void *buf, unsigned int bufsize) {
char *test_name = "pearson_hash_256";
uint8_t hash[32];
pearson_hash_256(hash, buf, bufsize);
printf("%s: output:\n", test_name);
fhexdump(0, hash, sizeof(hash), stdout);
fprintf(stderr, "%s: tested\n", test_name);
printf("\n");
}
Basic C Code lint checker and shell checker (#859) * Factor build packages out into a more maintainable list * Create a location for scripts to live * Provide a make target to return the source dir as close as reasonable to the original distributed state * Add a code lint step, checking the coding style * Change test harness as recommended by shellcheck * Ensure we actually have the linter tool installed * Use the correct directory for cmake to run the tests * Adjust for the older uncrustify in the current github ubuntu-latest * Make one file pass the linter * Integrate the lint with the existing test workflow * Add files with minimal changes needed to the linter * Add more files with minimal changes needed to the linter * Dont build binaries if we fail the lint test * Update the phony targets with the lint steps * Ensure the flake8 package is installed in the new lint workflow job * Use the makefile to drive the packages needed to install for linting * No need to add dependancies on lint, just rely on the workflow status to show failure * Update the scripts dir README to reflect current assumptions * Rename and briefly document the indent.sh script * Fix the ignore to ignore the right Makefile * Rename the test_harness script to make it clear it is a shell script * Provide a master lint make target and add a shell script lint tool * Elminate stray tabs * Drop include/auth.h from linter - there are inconsistant results with function definitions when using the current uncrustify rules
2021-10-23 21:36:18 +02:00
int main (int argc, char * argv[]) {
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
2021-09-27 11:41:06 +02:00
pearson_hash_init();
char *test_name = "environment";
Basic C Code lint checker and shell checker (#859) * Factor build packages out into a more maintainable list * Create a location for scripts to live * Provide a make target to return the source dir as close as reasonable to the original distributed state * Add a code lint step, checking the coding style * Change test harness as recommended by shellcheck * Ensure we actually have the linter tool installed * Use the correct directory for cmake to run the tests * Adjust for the older uncrustify in the current github ubuntu-latest * Make one file pass the linter * Integrate the lint with the existing test workflow * Add files with minimal changes needed to the linter * Add more files with minimal changes needed to the linter * Dont build binaries if we fail the lint test * Update the phony targets with the lint steps * Ensure the flake8 package is installed in the new lint workflow job * Use the makefile to drive the packages needed to install for linting * No need to add dependancies on lint, just rely on the workflow status to show failure * Update the scripts dir README to reflect current assumptions * Rename and briefly document the indent.sh script * Fix the ignore to ignore the right Makefile * Rename the test_harness script to make it clear it is a shell script * Provide a master lint make target and add a shell script lint tool * Elminate stray tabs * Drop include/auth.h from linter - there are inconsistant results with function definitions when using the current uncrustify rules
2021-10-23 21:36:18 +02:00
printf("%s: input size = 0x%" PRIx64 "\n", test_name, sizeof(PKT_CONTENT));
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
2021-09-27 11:41:06 +02:00
fhexdump(0, PKT_CONTENT, sizeof(PKT_CONTENT), stdout);
printf("\n");
test_pearson_256(PKT_CONTENT, sizeof(PKT_CONTENT));
test_pearson_128(PKT_CONTENT, sizeof(PKT_CONTENT));
test_pearson_64(PKT_CONTENT, sizeof(PKT_CONTENT));
test_pearson_32(PKT_CONTENT, sizeof(PKT_CONTENT));
test_pearson_16(PKT_CONTENT, sizeof(PKT_CONTENT));
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
2021-09-27 11:41:06 +02:00
return 0;
}