Commit 552b7d13 authored by Steen Hegelund's avatar Steen Hegelund Committed by David S. Miller

net: microchip: sparx5: Add VCAP debugfs KUNIT test

This tests the functionality of the debugFS support:

- finding valid keyset on an address
- raw VCAP output
- full rule VCAP output
Signed-off-by: default avatarSteen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 71c9de99
...@@ -40,6 +40,7 @@ config VCAP_KUNIT_TEST ...@@ -40,6 +40,7 @@ config VCAP_KUNIT_TEST
bool "KUnit test for VCAP library" if !KUNIT_ALL_TESTS bool "KUnit test for VCAP library" if !KUNIT_ALL_TESTS
depends on KUNIT depends on KUNIT
depends on KUNIT=y && VCAP=y && y depends on KUNIT=y && VCAP=y && y
select DEBUG_FS
default KUNIT_ALL_TESTS default KUNIT_ALL_TESTS
help help
This builds unit tests for the VCAP library. This builds unit tests for the VCAP library.
......
...@@ -776,3 +776,7 @@ struct dentry *vcap_debugfs(struct device *dev, struct dentry *parent, ...@@ -776,3 +776,7 @@ struct dentry *vcap_debugfs(struct device *dev, struct dentry *parent,
return dir; return dir;
} }
EXPORT_SYMBOL_GPL(vcap_debugfs); EXPORT_SYMBOL_GPL(vcap_debugfs);
#ifdef CONFIG_VCAP_KUNIT_TEST
#include "vcap_api_debugfs_kunit.c"
#endif
This diff is collapsed.
...@@ -1691,7 +1691,7 @@ static void vcap_api_rule_remove_at_end_test(struct kunit *test) ...@@ -1691,7 +1691,7 @@ static void vcap_api_rule_remove_at_end_test(struct kunit *test)
KUNIT_EXPECT_EQ(test, 0, test_move_count); KUNIT_EXPECT_EQ(test, 0, test_move_count);
KUNIT_EXPECT_EQ(test, 780, test_init_start); KUNIT_EXPECT_EQ(test, 780, test_init_start);
KUNIT_EXPECT_EQ(test, 12, test_init_count); KUNIT_EXPECT_EQ(test, 12, test_init_count);
KUNIT_EXPECT_EQ(test, 3071, admin.last_used_addr); KUNIT_EXPECT_EQ(test, 3072, admin.last_used_addr);
} }
static void vcap_api_rule_remove_in_middle_test(struct kunit *test) static void vcap_api_rule_remove_in_middle_test(struct kunit *test)
...@@ -1766,7 +1766,7 @@ static void vcap_api_rule_remove_in_middle_test(struct kunit *test) ...@@ -1766,7 +1766,7 @@ static void vcap_api_rule_remove_in_middle_test(struct kunit *test)
KUNIT_EXPECT_EQ(test, 0, test_move_count); KUNIT_EXPECT_EQ(test, 0, test_move_count);
KUNIT_EXPECT_EQ(test, 798, test_init_start); KUNIT_EXPECT_EQ(test, 798, test_init_start);
KUNIT_EXPECT_EQ(test, 2, test_init_count); KUNIT_EXPECT_EQ(test, 2, test_init_count);
KUNIT_EXPECT_EQ(test, 799, admin.last_used_addr); KUNIT_EXPECT_EQ(test, 800, admin.last_used_addr);
} }
static void vcap_api_rule_remove_in_front_test(struct kunit *test) static void vcap_api_rule_remove_in_front_test(struct kunit *test)
...@@ -1805,7 +1805,7 @@ static void vcap_api_rule_remove_in_front_test(struct kunit *test) ...@@ -1805,7 +1805,7 @@ static void vcap_api_rule_remove_in_front_test(struct kunit *test)
KUNIT_EXPECT_EQ(test, 0, test_move_count); KUNIT_EXPECT_EQ(test, 0, test_move_count);
KUNIT_EXPECT_EQ(test, 780, test_init_start); KUNIT_EXPECT_EQ(test, 780, test_init_start);
KUNIT_EXPECT_EQ(test, 12, test_init_count); KUNIT_EXPECT_EQ(test, 12, test_init_count);
KUNIT_EXPECT_EQ(test, 799, admin.last_used_addr); KUNIT_EXPECT_EQ(test, 800, admin.last_used_addr);
test_vcap_xn_rule_creator(test, 10000, VCAP_USER_QOS, 20, 400, 6, 792); test_vcap_xn_rule_creator(test, 10000, VCAP_USER_QOS, 20, 400, 6, 792);
test_vcap_xn_rule_creator(test, 10000, VCAP_USER_QOS, 30, 300, 3, 789); test_vcap_xn_rule_creator(test, 10000, VCAP_USER_QOS, 30, 300, 3, 789);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment