[Linux-kernel-mentees] [PATCH 27/27] tests: Add test case to check struct endattr allminus

Jaskaran Singh jaskaransingh7654321 at gmail.com
Sun May 31 15:26:21 UTC 2020


Struct end attributes are added to the SmPL and C ASTs. Add a test case
to check allminus for struct end attributes.

Signed-off-by: Jaskaran Singh <jaskaransingh7654321 at gmail.com>
---
 tests/remove_struct_endattr_allminus.c     | 13 +++++++++++++
 tests/remove_struct_endattr_allminus.cocci |  6 ++++++
 tests/remove_struct_endattr_allminus.res   |  1 +
 3 files changed, 20 insertions(+)
 create mode 100644 tests/remove_struct_endattr_allminus.c
 create mode 100644 tests/remove_struct_endattr_allminus.cocci
 create mode 100644 tests/remove_struct_endattr_allminus.res

diff --git a/tests/remove_struct_endattr_allminus.c b/tests/remove_struct_endattr_allminus.c
new file mode 100644
index 00000000..a99a7e9f
--- /dev/null
+++ b/tests/remove_struct_endattr_allminus.c
@@ -0,0 +1,13 @@
+#define __struct_endattr MACROANNOTATION
+
+struct abcd {
+	int a;
+	int b;
+	int c;
+} __struct_endattr;
+
+struct defg {
+	int a;
+	int b;
+	int c;
+};
diff --git a/tests/remove_struct_endattr_allminus.cocci b/tests/remove_struct_endattr_allminus.cocci
new file mode 100644
index 00000000..f63ab7cd
--- /dev/null
+++ b/tests/remove_struct_endattr_allminus.cocci
@@ -0,0 +1,6 @@
+@@
+identifier id;
+attribute name __struct_endattr;
+@@
+
+- struct id {...};
diff --git a/tests/remove_struct_endattr_allminus.res b/tests/remove_struct_endattr_allminus.res
new file mode 100644
index 00000000..e2f74e8f
--- /dev/null
+++ b/tests/remove_struct_endattr_allminus.res
@@ -0,0 +1 @@
+#define __struct_endattr MACROANNOTATION
-- 
2.21.1



More information about the Linux-kernel-mentees mailing list