Software APIs
status_report_overflow_test.c
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #include <stdbool.h>
6 
7 #include "sw/device/lib/base/status_report_unittest_c.h"
8 #include "sw/device/lib/testing/test_framework/check.h"
10 
11 OTTF_DEFINE_TEST_CONFIG();
13 
14 bool test_main(void) {
15  // Manually push items on the stack to overflow the list.
16  for (size_t i = 0; i < 100; i++)
17  status_report(UNKNOWN());
18  status_report(DEADLINE_EXCEEDED());
19  status_report(CANCELLED());
20  status_report(UNAVAILABLE());
21  status_report(ABORTED());
22  // Make the test fails so it prints the status.
23  return false;
24 }