Merge tag 'f2fs-for-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeu...
[linux-2.6-microblaze.git] / lib / kunit / kunit-example-test.c
index be1164e..51099b0 100644 (file)
@@ -40,6 +40,35 @@ static int example_test_init(struct kunit *test)
        return 0;
 }
 
+/*
+ * This test should always be skipped.
+ */
+static void example_skip_test(struct kunit *test)
+{
+       /* This line should run */
+       kunit_info(test, "You should not see a line below.");
+
+       /* Skip (and abort) the test */
+       kunit_skip(test, "this test should be skipped");
+
+       /* This line should not execute */
+       KUNIT_FAIL(test, "You should not see this line.");
+}
+
+/*
+ * This test should always be marked skipped.
+ */
+static void example_mark_skipped_test(struct kunit *test)
+{
+       /* This line should run */
+       kunit_info(test, "You should see a line below.");
+
+       /* Skip (but do not abort) the test */
+       kunit_mark_skipped(test, "this test should be skipped");
+
+       /* This line should run */
+       kunit_info(test, "You should see this line.");
+}
 /*
  * Here we make a list of all the test cases we want to add to the test suite
  * below.
@@ -52,6 +81,8 @@ static struct kunit_case example_test_cases[] = {
         * test suite.
         */
        KUNIT_CASE(example_simple_test),
+       KUNIT_CASE(example_skip_test),
+       KUNIT_CASE(example_mark_skipped_test),
        {}
 };