forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow output of logging when running unit tests (qmk#13556)
* Initial pass at enabling logging for unit tests * Add to docs * Bind debug for more test types * Force everything * Tidy up slightly
- Loading branch information
Showing
5 changed files
with
59 additions
and
6 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "gtest/gtest.h" | ||
|
||
extern "C" { | ||
#include "stdio.h" | ||
#include "debug.h" | ||
|
||
int8_t sendchar(uint8_t c) { | ||
fprintf(stderr, "%c", c); | ||
return 0; | ||
} | ||
|
||
__attribute__((weak)) debug_config_t debug_config = {0}; | ||
|
||
void init_logging(void) { | ||
print_set_sendchar(sendchar); | ||
|
||
// Customise these values to desired behaviour | ||
// debug_enable = true; | ||
// debug_matrix = true; | ||
// debug_keyboard = true; | ||
// debug_mouse = true; | ||
debug_config.raw = 0xFF; | ||
} | ||
} | ||
|
||
int main(int argc, char **argv) { | ||
::testing::InitGoogleTest(&argc, argv); | ||
|
||
init_logging(); | ||
|
||
return RUN_ALL_TESTS(); | ||
} |
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