Skip to content

Commit

Permalink
memblock tests: add verbose output to memblock tests
Browse files Browse the repository at this point in the history
Add and use functions and macros for printing verbose testing output.

If the Memblock simulator was compiled with VERBOSE=1:
- prefix_push(): appends the given string to a prefix string that will be
  printed in test_fail() and test_pass*().

- prefix_pop(): removes the last prefix from the prefix string.

- prefix_reset(): clears the prefix string.

- test_fail(): prints a message after a test fails containing the test
  number of the failing test and the prefix.

- test_pass(): prints a message after a test passes containing its test
  number and the prefix.

- test_print(): prints the given formatted output string.

- test_pass_pop(): runs test_pass() followed by prefix_pop().

- PREFIX_PUSH(): runs prefix_push(__func__).

If the Memblock simulator was not compiled with VERBOSE=1, these
functions/macros do nothing.

Add the assert wrapper macros ASSERT_EQ(), ASSERT_NE(), and ASSERT_LT().
If the assert condition fails, these macros call test_fail() before
executing assert().

Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Shaoqin Huang <shaoqin.huang@intel.com>
Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Link: https://lore.kernel.org/r/f234d443fe154d5ae8d8aa07284aff69edfb6f61.1656907314.git.remckee0@gmail.com
  • Loading branch information
Rebecca Mckeever authored and Mike Rapoport committed Jul 4, 2022
1 parent 946dccb commit 76586c0
Show file tree
Hide file tree
Showing 6 changed files with 817 additions and 344 deletions.
Loading

0 comments on commit 76586c0

Please sign in to comment.