Skip to content
Permalink
Browse files

tests: fp_sharing: properly dump coverage data

This was dumping coverage before the test code even ran.
Ideally, this gets re-written to use ztest, but meanwhile
place a dummy main thread which sleeps forever, and dump
coverage once the test succeeds.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  • Loading branch information...
andrewboie committed Jul 2, 2019
1 parent 89430b3 commit 3c8fa37a1071c7672baf215e8250bf538b79bda7
Showing with 15 additions and 0 deletions.
  1. +15 −0 tests/kernel/fp_sharing/src/main.c
@@ -69,6 +69,7 @@
#include "float_context.h"
#include <stddef.h>
#include <string.h>
#include <debug/gcov.h>

#define MAX_TESTS 500
#define STACKSIZE 2048
@@ -340,6 +341,9 @@ void load_store_high(void)
if (load_store_high_count == MAX_TESTS) {
TC_END_RESULT(TC_PASS);
TC_END_REPORT(TC_PASS);
#ifdef CONFIG_COVERAGE_GCOV
gcov_coverage_dump();
#endif
return;
}
}
@@ -362,3 +366,14 @@ K_THREAD_DEFINE(pi_low, STACKSIZE, calculate_pi_low, NULL, NULL, NULL,

K_THREAD_DEFINE(pi_high, STACKSIZE, calculate_pi_high, NULL, NULL, NULL,
HI_PRI, THREAD_FP_FLAGS, K_NO_WAIT);

void main(void *p1, void *p2, void *p3)
{
/* This very old test didn't have a main() function, and would
* dump gcov data immediately. Sleep forever, we'll invoke
* gcov manually later when the test completes.
*/
while (true) {
k_sleep(1000);
}
}

0 comments on commit 3c8fa37

Please sign in to comment.
You can’t perform that action at this time.