kunit: Add speed attribute
[linux-2.6-microblaze.git] / include / kunit / test.h
index 1fc9155..ed5f500 100644 (file)
@@ -63,8 +63,27 @@ enum kunit_status {
        KUNIT_SKIPPED,
 };
 
+/* Attribute struct/enum definitions */
+
+/*
+ * Speed Attribute is stored as an enum and separated into categories of
+ * speed: very_slowm, slow, and normal. These speeds are relative to
+ * other KUnit tests.
+ *
+ * Note: unset speed attribute acts as default of KUNIT_SPEED_NORMAL.
+ */
+enum kunit_speed {
+       KUNIT_SPEED_UNSET,
+       KUNIT_SPEED_VERY_SLOW,
+       KUNIT_SPEED_SLOW,
+       KUNIT_SPEED_NORMAL,
+       KUNIT_SPEED_MAX = KUNIT_SPEED_NORMAL,
+};
+
 /* Holds attributes for each test case and suite */
-struct kunit_attributes {};
+struct kunit_attributes {
+       enum kunit_speed speed;
+};
 
 /**
  * struct kunit_case - represents an individual test case.
@@ -150,6 +169,17 @@ static inline char *kunit_status_to_ok_not_ok(enum kunit_status status)
                { .run_case = test_name, .name = #test_name,    \
                  .attr = attributes }
 
+/**
+ * KUNIT_CASE_SLOW - A helper for creating a &struct kunit_case
+ * with the slow attribute
+ *
+ * @test_name: a reference to a test case function.
+ */
+
+#define KUNIT_CASE_SLOW(test_name)                     \
+               { .run_case = test_name, .name = #test_name,    \
+                 .attr.speed = KUNIT_SPEED_SLOW }
+
 /**
  * KUNIT_CASE_PARAM - A helper for creation a parameterized &struct kunit_case
  *