mirror of https://github.com/ARMmbed/mbed-os.git
Allow starting a specification at a different case.
This can be used to skip failing test cases with external support from a test runner like greentea. It would reset the device and execute the specification again, but start at the next test case.
parent
c2343b223b
commit
4e5996ceea
|
@ -52,9 +52,18 @@ static void die() {
|
|||
}
|
||||
|
||||
void Harness::run(const Specification specification)
|
||||
{
|
||||
run(specification, 0);
|
||||
}
|
||||
|
||||
void Harness::run(const Specification specification, std::size_t start_case)
|
||||
{
|
||||
mbed::util::CriticalSectionLock lock;
|
||||
|
||||
// ignore any invalid start index
|
||||
if (start_case >= specification.length)
|
||||
return;
|
||||
|
||||
test_cases = specification.cases;
|
||||
test_length = specification.length;
|
||||
defaults = specification.defaults;
|
||||
|
@ -68,7 +77,7 @@ void Harness::run(const Specification specification)
|
|||
case_passed = 0;
|
||||
case_failed = 0;
|
||||
case_failed_before = 0;
|
||||
case_current = test_cases;
|
||||
case_current = &test_cases[start_case];
|
||||
|
||||
if (handlers.test_setup && (handlers.test_setup(test_length) != STATUS_CONTINUE)) {
|
||||
if (handlers.test_teardown) handlers.test_teardown(0, 0, FAILURE_SETUP);
|
||||
|
|
|
@ -43,9 +43,13 @@ namespace v1 {
|
|||
class Harness
|
||||
{
|
||||
public:
|
||||
/// Starts running a test specification
|
||||
/// Runs a test specification
|
||||
static void run(const Specification specification);
|
||||
|
||||
/// Runs a test specification starting at the specified case index
|
||||
/// @warning if the start index is out of bounds, the call has no effect!
|
||||
static void run(const Specification specification, size_t start_case);
|
||||
|
||||
/// @returns `true` if a test specification is being executed, `false` otherwise
|
||||
static bool is_busy();
|
||||
|
||||
|
|
Loading…
Reference in New Issue