* struct unit_test_state - Entire state of test system
*
* @fail_count: Number of tests that failed
+ * @skip_count: Number of tests that were skipped
* @start: Store the starting mallinfo when doing leak test
* @of_live: true to use livetree if available, false to use flattree
* @of_root: Record of the livetree root node (used for setting up tests)
*/
struct unit_test_state {
int fail_count;
+ int skip_count;
struct mallinfo start;
struct device_node *of_root;
bool of_live;
return 0;
}
+/**
+ * skip_test() - Handle skipping a test
+ *
+ * @uts: Test state to update
+ * @return -EAGAIN (always)
+ */
+static int skip_test(struct unit_test_state *uts)
+{
+ uts->skip_count++;
+
+ return -EAGAIN;
+}
+
/**
* ut_run_test() - Run a single test
*
ret = test_pre_run(uts, test);
if (ret == -EAGAIN)
- return -EAGAIN;
+ return skip_test(uts);
if (ret)
return ret;
- test->func(uts);
+ ret = test->func(uts);
+ if (ret == -EAGAIN)
+ skip_test(uts);
ret = test_post_run(uts, test);
if (ret)
int runs;
if ((test->flags & UT_TESTF_OTHER_FDT) && !IS_ENABLED(CONFIG_SANDBOX))
- return -EAGAIN;
+ return skip_test(uts);
/* Run with the live tree if possible */
runs = 0;
os_free(uts.other_fdt);
}
+ if (uts.skip_count)
+ printf("Skipped: %d, ", uts.skip_count);
if (ret == -ENOENT)
printf("Test '%s' not found\n", select_name);
else