From 52c0e83053a4a7326da6436f9ef29b7dcc64db41 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Tue, 4 Dec 2018 11:30:57 +0100 Subject: Déplacement des entêtes de test/debug hors de src/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/debug.h | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 test/debug.h (limited to 'test/debug.h') diff --git a/test/debug.h b/test/debug.h new file mode 100644 index 0000000..24b7787 --- /dev/null +++ b/test/debug.h @@ -0,0 +1,71 @@ +#ifndef DEBUG_H +#define DEBUG_H + +#include +#include + + +extern FILE *DUMP; /* Define this variable somewhere (eg with DUMP = stderr). */ + + +static inline void debug_dump_lanes(const char *header, size_t len, const uint8_t buf[len], int indent) +{ + fprintf(DUMP, "%s\n", header); + + for (size_t line=0; line %zu]", line, b, byte_index); */ + fprintf(DUMP, "%02x ", buf[byte_index]); + } + fprintf(DUMP, "\n"); + } + + fprintf(DUMP, "\n"); +} + +static inline void debug_open_dump(const char *folder, const char *suite, const char *vector_name) +{ + size_t namelen = snprintf( + NULL, 0, "%s/traces-%s-%s.txt", folder, suite, vector_name + ); + char name[namelen+1]; + snprintf(name, sizeof(name), "%s/traces-%s-%s.txt", folder, suite, vector_name); + DUMP = fopen(name, "w"); +} + + +#endif /* DEBUG_H */ -- cgit v1.2.3