diff --git a/mariadb-test/.gitignore b/mariadb-test/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..d9510fe19708424a629f7a5bc0ebb36c49131d88 --- /dev/null +++ b/mariadb-test/.gitignore @@ -0,0 +1,15 @@ +.idea/ +logs/ +__pycache__/ +*.o +*.a +*.d +*.cmd +*.test +*.ko +*.mod +*.mod.c +Module.symvers +modules.order +compile_commands.json + diff --git a/mariadb-test/LICENSE b/mariadb-test/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d06cc9f83a6dcc6be19943abc87f9dccccc17230 --- /dev/null +++ b/mariadb-test/LICENSE @@ -0,0 +1,824 @@ +Tencent is pleased to support the open source community by making OpenCloudOS Kernel Stream available. + +Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. The below software in this distribution may have been modified by THL A29 Limited ("Tencent Modifications"). All Tencent Modifications are Copyright (C) THL A29 Limited. + +OpenCloudOS Kernel Stream is licensed under the the Mulan Permissive Software License 2.0 except for the third-party components listed below. + + +Terms of the Mulan Permissive Software License 2.0: +-------------------------------------------------------------------- + 木兰宽松许可证, 第2版 + +2020年1月 http://license.coscl.org.cn/MulanPSL2 + +您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束: + +0. 定义 + +“软件”是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。 + +“贡献”是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。 + +“贡献者”是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。 + +“法人实体”是指提交贡献的机构及其“关联实体”。 + +“关联实体”是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。 + +1. 授予版权许可 + +每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。 + +2. 授予专利许可 + +每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。 + +3. 无商标许可 + +“本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。 + +4. 分发限制 + +您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。 + +5. 免责声明与责任限制 + +“软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。 + +6. 语言 + +“本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。 + +条款结束 + +如何将木兰宽松许可证,第2版,应用到您的软件 + +如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步: + +1,请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字; + +2,请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中; + +3,请将如下声明文本放入每个源文件的头部注释中。 + +Copyright (c) [Year] [name of copyright holder] [Software Name] is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for more details. + +January 2020 http://license.coscl.org.cn/MulanPSL2 + +Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions: + +0. Definition + +Software means the program and related documents which are licensed under this License and comprise all Contribution(s). + +Contribution means the copyrightable work licensed by a particular Contributor under this License. + +Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License. + +Legal Entity means the entity making a Contribution and all its Affiliates. + +Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity. + +1. Grant of Copyright License + +Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not. + +2. Grant of Patent License + +Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken. + +3. No Trademark License + +No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in Section 4. + +4. Distribution Restriction + +You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software. + +5. Disclaimer of Warranty and Limitation of Liability + +THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +6. Language + +THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL. + +END OF THE TERMS AND CONDITIONS + + + +Other dependencies and licenses: + + +Open Source Software Licensed under the GPL v2.0 with Linux-syscall-note, and Other Licenses of the Third-Party Components therein: +The below software in this distribution may have been modified by THL A29 Limited ("Tencent Modifications"). All Tencent Modifications are Copyright (C) 2021 THL A29 Limited. +-------------------------------------------------------------------- +1. kernel +Copyright © kernel original author and authors + + +The Linux Kernel is provided under: + + SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +Being under the terms of the GNU General Public License version 2 only, +according with: + + LICENSES/preferred/GPL-2.0 + +With an explicit syscall exception, as stated at: + + LICENSES/exceptions/Linux-syscall-note + +In addition, other licenses may also apply. Please see: + + Documentation/process/license-rules.rst + +for more details. + +All contributions to the Linux Kernel are subject to this COPYING file. + +Valid-License-Identifier: GPL-2.0 +Valid-License-Identifier: GPL-2.0-only +Valid-License-Identifier: GPL-2.0+ +Valid-License-Identifier: GPL-2.0-or-later +SPDX-URL: https://spdx.org/licenses/GPL-2.0.html +Usage-Guide: + To use this license in source code, put one of the following SPDX + tag/value pairs into a comment according to the placement + guidelines in the licensing rules documentation. + For 'GNU General Public License (GPL) version 2 only' use: + SPDX-License-Identifier: GPL-2.0 + or + SPDX-License-Identifier: GPL-2.0-only + For 'GNU General Public License (GPL) version 2 or any later version' use: + SPDX-License-Identifier: GPL-2.0+ + or + SPDX-License-Identifier: GPL-2.0-or-later +License-Text: + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + +SPDX-Exception-Identifier: Linux-syscall-note +SPDX-URL: https://spdx.org/licenses/Linux-syscall-note.html +SPDX-Licenses: GPL-2.0, GPL-2.0+, GPL-1.0+, LGPL-2.0, LGPL-2.0+, LGPL-2.1, LGPL-2.1+, GPL-2.0-only, GPL-2.0-or-later +Usage-Guide: + This exception is used together with one of the above SPDX-Licenses + to mark user space API (uapi) header files so they can be included + into non GPL compliant user space application code. + To use this exception add it with the keyword WITH to one of the + identifiers in the SPDX-Licenses tag: + SPDX-License-Identifier: WITH Linux-syscall-note +License-Text: + + NOTE! This copyright does *not* cover user programs that use kernel + services by normal system calls - this is merely considered normal use + of the kernel, and does *not* fall under the heading of "derived work". + Also note that the GPL below is copyrighted by the Free Software + Foundation, but the instance of code that it refers to (the Linux + kernel) is copyrighted by me and others who actually wrote it. + + Also note that the only valid version of the GPL as far as the kernel + is concerned is _this_ particular version of the license (ie v2, not + v2.2 or v3.x or whatever), unless explicitly otherwise stated. + + Linus Torvalds + +For the licenses of other third parties, please refer to the following URL: +https://github.com/torvalds/linux/tree/v5.18-rc5/LICENSES + +Linux kernel licensing rules +The Linux Kernel is provided under the terms of the GNU General Public License version 2 only (GPL-2.0), as provided in LICENSES/preferred/GPL-2.0, with an explicit syscall exception described in LICENSES/exceptions/Linux-syscall-note, as described in the COPYING file. + +This documentation file provides a description of how each source file should be annotated to make its license clear and unambiguous. It doesn't replace the Kernel's license. + +The license described in the COPYING file applies to the kernel source as a whole, though individual source files can have a different license which is required to be compatible with the GPL-2.0: + +GPL-1.0+ : GNU General Public License v1.0 or later +GPL-2.0+ : GNU General Public License v2.0 or later +LGPL-2.0 : GNU Library General Public License v2 only +LGPL-2.0+ : GNU Library General Public License v2 or later +LGPL-2.1 : GNU Lesser General Public License v2.1 only +LGPL-2.1+ : GNU Lesser General Public License v2.1 or later +Aside from that, individual files can be provided under a dual license, e.g. one of the compatible GPL variants and alternatively under a permissive license like BSD, MIT etc. + +The User-space API (UAPI) header files, which describe the interface of user-space programs to the kernel are a special case. According to the note in the kernel COPYING file, the syscall interface is a clear boundary, which does not extend the GPL requirements to any software which uses it to communicate with the kernel. Because the UAPI headers must be includable into any source files which create an executable running on the Linux kernel, the exception must be documented by a special license expression. + +The common way of expressing the license of a source file is to add the matching boilerplate text into the top comment of the file. Due to formatting, typos etc. these "boilerplates" are hard to validate for tools which are used in the context of license compliance. + +An alternative to boilerplate text is the use of Software Package Data Exchange (SPDX) license identifiers in each source file. SPDX license identifiers are machine parsable and precise shorthands for the license under which the content of the file is contributed. SPDX license identifiers are managed by the SPDX Workgroup at the Linux Foundation and have been agreed on by partners throughout the industry, tool vendors, and legal teams. For further information see https://spdx.org/ + +The Linux kernel requires the precise SPDX identifier in all source files. The valid identifiers used in the kernel are explained in the section License identifiers and have been retrieved from the official SPDX license list at https://spdx.org/licenses/ along with the license texts. + +License identifier syntax +Placement: + +The SPDX license identifier in kernel files shall be added at the first possible line in a file which can contain a comment. For the majority of files this is the first line, except for scripts which require the '#!PATH_TO_INTERPRETER' in the first line. For those scripts the SPDX identifier goes into the second line. + + +Style: + +The SPDX license identifier is added in form of a comment. The comment style depends on the file type: + +C source: // SPDX-License-Identifier: +C header: /* SPDX-License-Identifier: */ +ASM: /* SPDX-License-Identifier: */ +scripts: # SPDX-License-Identifier: +.rst: .. SPDX-License-Identifier: +.dts{i}: // SPDX-License-Identifier: +If a specific tool cannot handle the standard comment style, then the appropriate comment mechanism which the tool accepts shall be used. This is the reason for having the "/* */" style comment in C header files. There was build breakage observed with generated .lds files where 'ld' failed to parse the C++ comment. This has been fixed by now, but there are still older assembler tools which cannot handle C++ style comments. + + +Syntax: + +A is either an SPDX short form license identifier found on the SPDX License List, or the combination of two SPDX short form license identifiers separated by "WITH" when a license exception applies. When multiple licenses apply, an expression consists of keywords "AND", "OR" separating sub-expressions and surrounded by "(", ")" . + +License identifiers for licenses like [L]GPL with the 'or later' option are constructed by using a "+" for indicating the 'or later' option.: + +// SPDX-License-Identifier: GPL-2.0+ +// SPDX-License-Identifier: LGPL-2.1+ +WITH should be used when there is a modifier to a license needed. For example, the linux kernel UAPI files use the expression: + +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note +// SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note +Other examples using WITH exceptions found in the kernel are: + +// SPDX-License-Identifier: GPL-2.0 WITH mif-exception +// SPDX-License-Identifier: GPL-2.0+ WITH GCC-exception-2.0 +Exceptions can only be used with particular License identifiers. The valid License identifiers are listed in the tags of the exception text file. For details see the point Exceptions in the chapter License identifiers. + +OR should be used if the file is dual licensed and only one license is to be selected. For example, some dtsi files are available under dual licenses: + +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause +Examples from the kernel for license expressions in dual licensed files: + +// SPDX-License-Identifier: GPL-2.0 OR MIT +// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause +// SPDX-License-Identifier: GPL-2.0 OR Apache-2.0 +// SPDX-License-Identifier: GPL-2.0 OR MPL-1.1 +// SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT +// SPDX-License-Identifier: GPL-1.0+ OR BSD-3-Clause OR OpenSSL +AND should be used if the file has multiple licenses whose terms all apply to use the file. For example, if code is inherited from another project and permission has been given to put it in the kernel, but the original license terms need to remain in effect: + +// SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) AND MIT +Another other example where both sets of license terms need to be adhered to is: + +// SPDX-License-Identifier: GPL-1.0+ AND LGPL-2.1+ +License identifiers +The licenses currently used, as well as the licenses for code added to the kernel, can be broken down into: + +Preferred licenses: + +Whenever possible these licenses should be used as they are known to be fully compatible and widely used. These licenses are available from the directory: + +LICENSES/preferred/ +in the kernel source tree. + +The files in this directory contain the full license text and Metatags. The file names are identical to the SPDX license identifier which shall be used for the license in source files. + +Examples: + +LICENSES/preferred/GPL-2.0 +Contains the GPL version 2 license text and the required metatags: + +LICENSES/preferred/MIT +Contains the MIT license text and the required metatags + +Metatags: + +The following meta tags must be available in a license file: + +Valid-License-Identifier: + +One or more lines which declare which License Identifiers are valid inside the project to reference this particular license text. Usually this is a single valid identifier, but e.g. for licenses with the 'or later' options two identifiers are valid. + +SPDX-URL: + +The URL of the SPDX page which contains additional information related to the license. + +Usage-Guidance: + +Freeform text for usage advice. The text must include correct examples for the SPDX license identifiers as they should be put into source files according to the License identifier syntax guidelines. + +License-Text: + +All text after this tag is treated as the original license text + +File format examples: + +Valid-License-Identifier: GPL-2.0 +Valid-License-Identifier: GPL-2.0+ +SPDX-URL: https://spdx.org/licenses/GPL-2.0.html +Usage-Guide: + To use this license in source code, put one of the following SPDX + tag/value pairs into a comment according to the placement + guidelines in the licensing rules documentation. + For 'GNU General Public License (GPL) version 2 only' use: + SPDX-License-Identifier: GPL-2.0 + For 'GNU General Public License (GPL) version 2 or any later version' use: + SPDX-License-Identifier: GPL-2.0+ +License-Text: + Full license text +SPDX-License-Identifier: MIT +SPDX-URL: https://spdx.org/licenses/MIT.html +Usage-Guide: + To use this license in source code, put the following SPDX + tag/value pair into a comment according to the placement + guidelines in the licensing rules documentation. + SPDX-License-Identifier: MIT +License-Text: + Full license text + +Deprecated licenses: + +These licenses should only be used for existing code or for importing code from a different project. These licenses are available from the directory: + +LICENSES/deprecated/ +in the kernel source tree. + +The files in this directory contain the full license text and Metatags. The file names are identical to the SPDX license identifier which shall be used for the license in source files. + +Examples: + +LICENSES/deprecated/ISC +Contains the Internet Systems Consortium license text and the required metatags: + +LICENSES/deprecated/GPL-1.0 +Contains the GPL version 1 license text and the required metatags. + +Metatags: + +The metatag requirements for 'other' licenses are identical to the requirements of the Preferred licenses. + +File format example: + +Valid-License-Identifier: ISC +SPDX-URL: https://spdx.org/licenses/ISC.html +Usage-Guide: + Usage of this license in the kernel for new code is discouraged + and it should solely be used for importing code from an already + existing project. + To use this license in source code, put the following SPDX + tag/value pair into a comment according to the placement + guidelines in the licensing rules documentation. + SPDX-License-Identifier: ISC +License-Text: + Full license text + +Dual Licensing Only + +These licenses should only be used to dual license code with another license in addition to a preferred license. These licenses are available from the directory: + +LICENSES/dual/ +in the kernel source tree. + +The files in this directory contain the full license text and Metatags. The file names are identical to the SPDX license identifier which shall be used for the license in source files. + +Examples: + +LICENSES/dual/MPL-1.1 +Contains the Mozilla Public License version 1.1 license text and the required metatags: + +LICENSES/dual/Apache-2.0 +Contains the Apache License version 2.0 license text and the required metatags. + +Metatags: + +The metatag requirements for 'other' licenses are identical to the requirements of the Preferred licenses. + +File format example: + +Valid-License-Identifier: MPL-1.1 +SPDX-URL: https://spdx.org/licenses/MPL-1.1.html +Usage-Guide: + Do NOT use. The MPL-1.1 is not GPL2 compatible. It may only be used for + dual-licensed files where the other license is GPL2 compatible. + If you end up using this it MUST be used together with a GPL2 compatible + license using "OR". + To use the Mozilla Public License version 1.1 put the following SPDX + tag/value pair into a comment according to the placement guidelines in + the licensing rules documentation: +SPDX-License-Identifier: MPL-1.1 +License-Text: + Full license text + +Exceptions: + +Some licenses can be amended with exceptions which grant certain rights which the original license does not. These exceptions are available from the directory: + +LICENSES/exceptions/ +in the kernel source tree. The files in this directory contain the full exception text and the required Exception Metatags. + +Examples: + +LICENSES/exceptions/Linux-syscall-note +Contains the Linux syscall exception as documented in the COPYING file of the Linux kernel, which is used for UAPI header files. e.g. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */: + +LICENSES/exceptions/GCC-exception-2.0 +Contains the GCC 'linking exception' which allows to link any binary independent of its license against the compiled version of a file marked with this exception. This is required for creating runnable executables from source code which is not compatible with the GPL. + +Exception Metatags: + +The following meta tags must be available in an exception file: + +SPDX-Exception-Identifier: + +One exception identifier which can be used with SPDX license identifiers. + +SPDX-URL: + +The URL of the SPDX page which contains additional information related to the exception. + +SPDX-Licenses: + +A comma separated list of SPDX license identifiers for which the exception can be used. + +Usage-Guidance: + +Freeform text for usage advice. The text must be followed by correct examples for the SPDX license identifiers as they should be put into source files according to the License identifier syntax guidelines. + +Exception-Text: + +All text after this tag is treated as the original exception text + +File format examples: + +SPDX-Exception-Identifier: Linux-syscall-note +SPDX-URL: https://spdx.org/licenses/Linux-syscall-note.html +SPDX-Licenses: GPL-2.0, GPL-2.0+, GPL-1.0+, LGPL-2.0, LGPL-2.0+, LGPL-2.1, LGPL-2.1+ +Usage-Guidance: + This exception is used together with one of the above SPDX-Licenses + to mark user-space API (uapi) header files so they can be included + into non GPL compliant user-space application code. + To use this exception add it with the keyword WITH to one of the + identifiers in the SPDX-Licenses tag: + SPDX-License-Identifier: WITH Linux-syscall-note +Exception-Text: + Full exception text +SPDX-Exception-Identifier: GCC-exception-2.0 +SPDX-URL: https://spdx.org/licenses/GCC-exception-2.0.html +SPDX-Licenses: GPL-2.0, GPL-2.0+ +Usage-Guidance: + The "GCC Runtime Library exception 2.0" is used together with one + of the above SPDX-Licenses for code imported from the GCC runtime + library. + To use this exception add it with the keyword WITH to one of the + identifiers in the SPDX-Licenses tag: + SPDX-License-Identifier: WITH GCC-exception-2.0 +Exception-Text: + Full exception text +All SPDX license identifiers and exceptions must have a corresponding file in the LICENSES subdirectories. This is required to allow tool verification (e.g. checkpatch.pl) and to have the licenses ready to read and extract right from the source, which is recommended by various FOSS organizations, e.g. the FSFE REUSE initiative. + +MODULE_LICENSE +Loadable kernel modules also require a MODULE_LICENSE() tag. This tag is neither a replacement for proper source code license information (SPDX-License-Identifier) nor in any way relevant for expressing or determining the exact license under which the source code of the module is provided. + +The sole purpose of this tag is to provide sufficient information whether the module is free software or proprietary for the kernel module loader and for user space tools. + +The valid license strings for MODULE_LICENSE() are: + +"GPL" Module is licensed under GPL version 2. This does not express any distinction between GPL-2.0-only or GPL-2.0-or-later. The exact license information can only be determined via the license information in the corresponding source files. +"GPL v2" Same as "GPL". It exists for historic reasons. +"GPL and additional rights" Historical variant of expressing that the module source is dual licensed under a GPL v2 variant and MIT license. Please do not use in new code. +"Dual MIT/GPL" The correct way of expressing that the module is dual licensed under a GPL v2 variant or MIT license choice. +"Dual BSD/GPL" The module is dual licensed under a GPL v2 variant or BSD license choice. The exact variant of the BSD license can only be determined via the license information in the corresponding source files. +"Dual MPL/GPL" The module is dual licensed under a GPL v2 variant or Mozilla Public License (MPL) choice. The exact variant of the MPL license can only be determined via the license information in the corresponding source files. +"Proprietary" The module is under a proprietary license. This string is solely for proprietary third party modules and cannot be used for modules which have their source code in the kernel tree. Modules tagged that way are tainting the kernel with the 'P' flag when loaded and the kernel module loader refuses to link such modules against symbols which are exported with EXPORT_SYMBOL_GPL(). \ No newline at end of file diff --git a/mariadb-test/Makefile b/mariadb-test/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..0ae2951157e1405b05f44cf2a1f8d12eab8b3826 --- /dev/null +++ b/mariadb-test/Makefile @@ -0,0 +1,27 @@ +export TST_TS_TOPDIR := $(shell pwd) +DIRS := cmd testcase kmod +LIBS := tst_common tst_lib + +all: libs + @for d in $(DIRS); do \ + echo try make $$d; \ + make -C $$d all; \ + done + +libs: + @for d in $(LIBS); do \ + echo try make $$d; \ + make -C $$d all; \ + done + +clean: + @for d in $(DIRS) $(LIBS); do \ + echo try clean $$d; \ + make -C $$d clean; \ + done + +cleanall: + @for d in $(DIRS) $(LIBS); do \ + echo try cleanall $$d; \ + make -C $$d cleanall; \ + done diff --git a/mariadb-test/Makefile.common b/mariadb-test/Makefile.common new file mode 100644 index 0000000000000000000000000000000000000000..1d9d2dade3b256721cdccc66b3eb80483ae403be --- /dev/null +++ b/mariadb-test/Makefile.common @@ -0,0 +1,3 @@ +CFLAGS += -Wall -g -I$(TST_TS_TOPDIR)/tst_common/lib -I$(TST_TS_TOPDIR)/tst_lib +LDFLAGS += -L$(TST_TS_TOPDIR)/tst_common/lib -L$(TST_TS_TOPDIR)/tst_lib +LDFLAGS += -lm -lrt -lpthread -Wl,--whole-archive -lcommon -ltscommon -Wl,--no-whole-archive diff --git a/mariadb-test/cmd/Makefile b/mariadb-test/cmd/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..133158c83eceb271077f1178bb0994fa35f817e5 --- /dev/null +++ b/mariadb-test/cmd/Makefile @@ -0,0 +1,20 @@ +export TST_TS_TOPDIR ?= $(shell pwd)/.. +include $(TST_TS_TOPDIR)/Makefile.common +ALL_SRC := $(wildcard *.c) +ALL_OBJ := $(patsubst %.c,%.o,$(ALL_SRC)) +ALL_BIN := $(patsubst %.o,%.cmd,$(ALL_OBJ)) +CFLAGS += +LDFLAGS += + +all: $(ALL_BIN) + +$(ALL_BIN):%.cmd:%.o + $(CC) $^ -o $@ $(LDFLAGS) + +$(ALL_OBJ):%.o:%.c + $(CC) $(CFLAGS) -c $^ -o $@ + +clean: + rm -rfv $(ALL_OBJ) $(ALL_BIN) + +cleanall: clean diff --git a/mariadb-test/cmd/hello.c b/mariadb-test/cmd/hello.c new file mode 100644 index 0000000000000000000000000000000000000000..c70b44218abc7ea8528c9516dc3ae9116c3d8de2 --- /dev/null +++ b/mariadb-test/cmd/hello.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("hello world\n"); + return 0; +} diff --git a/mariadb-test/kmod/Makefile b/mariadb-test/kmod/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..01632efcce85312d752f75db4c9da8922ece5c41 --- /dev/null +++ b/mariadb-test/kmod/Makefile @@ -0,0 +1,28 @@ +# General Purpose Makefile for Linux Kernel module +# 以下编译适合于在内核代码树之外编译内核模块。 +# 整个过程会导致本Makefile文件被加载执行两遍。 +# 第一遍执行时,由于`KERNELRELEASE`没有被定义,所以先执行`else`下的逻辑。 +# `-C $(KERNEL_DIR)`指明跳转到内核源码目录下读取那里的Makefile; +# `M=$(CURDIR)`表明然后返回到当前目录继续读入当前的Makefile并执行之。此为第二遍执行。 +# 第二遍执行时,此时从内核源码目录返回时,KERNELRELEASE已被被定义, +# kbuild也被启动去解析kbuild语法的语句,make将继续读取else之前的内容。 +# else之前的内容为kbuild语法的语句, 指明模块源码中各文件的依赖关系,以及要生成的目标模块名。 + +CURDIR ?= $(shell pwd) +KERNEL_VER := $(shell uname -r) +KERNEL_DIR ?= /lib/modules/$(KERNEL_VER)/build +export ALL_SRC ?= $(filter-out %.mod.c, $(wildcard *.c)) +export ALL_OBJ ?= $(patsubst %.c,%.o,$(ALL_SRC)) +export ALL_MOD ?= $(patsubst %.o,%.ko,$(ALL_OBJ)) + +ifneq ($(KERNELRELEASE),) + obj-m += $(ALL_OBJ) +else +all: + $(MAKE) -C $(KERNEL_DIR) M=$(CURDIR) modules +endif + +clean: + $(MAKE) -C $(KERNEL_DIR) M=$(CURDIR) clean + +cleanall: clean diff --git a/mariadb-test/kmod/ts_kcommon.c b/mariadb-test/kmod/ts_kcommon.c new file mode 100644 index 0000000000000000000000000000000000000000..41a779a0caa17f4cc2c3c60ec40a6842d312fd7a --- /dev/null +++ b/mariadb-test/kmod/ts_kcommon.c @@ -0,0 +1,14 @@ +#include + +static int __init kmod_common_init(void) { + printk("Hello, World!\n"); + return 0; +} +static void __exit kmod_common_exit(void) { + printk("Goodbye, World!\n"); +} + +module_init(kmod_common_init); +module_exit(kmod_common_exit); + +MODULE_LICENSE("GPL"); diff --git a/mariadb-test/testcase/Makefile b/mariadb-test/testcase/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..1b4db5bcbf65a82a67d32917028e601b2dd629ba --- /dev/null +++ b/mariadb-test/testcase/Makefile @@ -0,0 +1,21 @@ +export TST_TS_TOPDIR ?= $(shell pwd)/.. +include $(TST_TS_TOPDIR)/Makefile.common +ALL_SRC := $(filter-out %.mod.c, $(wildcard *.c)) +ALL_OBJ := $(patsubst %.c,%.o,$(ALL_SRC)) +ALL_BIN := $(patsubst %.o,%.test,$(ALL_OBJ)) +CFLAGS += +LDFLAGS += +LDFLAGS += + +all: $(ALL_BIN) + +$(ALL_BIN):%.test:%.o + $(CC) $^ -o $@ $(LDFLAGS) + +$(ALL_OBJ):%.o:%.c + $(CC) $(CFLAGS) -c $^ -o $@ + +clean: + rm -rfv $(ALL_OBJ) $(ALL_BIN) + +cleanall: clean diff --git a/mariadb-test/testcase/test-mariadb.sh b/mariadb-test/testcase/test-mariadb.sh new file mode 100644 index 0000000000000000000000000000000000000000..723c5bf21ac5941be48f9230bcc4bf467ee09d88 --- /dev/null +++ b/mariadb-test/testcase/test-mariadb.sh @@ -0,0 +1,83 @@ +#!/bin/bash +############################################################################### +# @用例ID: 20230524-163554-963002542 +# @用例名称: test-mariadb +# @用例级别: 3 +# @用例标签: +# @用例类型: 功能 +############################################################################### +[ -z "$TST_TS_TOPDIR" ] && { + TST_TS_TOPDIR="$(realpath "$(dirname "$0")/..")" + export TST_TS_TOPDIR +} +source "${TST_TS_TOPDIR}/tst_common/lib/common.sh" || exit 1 +############################################################################### + +g_tmpdir="$(mktemp -d)" + +# 检查 mariadb 版本以及启动 mariadb Server +tc_setup() { + msg "this is tc_setup" + # 检查 mariadb 是否已成功安装并获取 mariadb 版本号 + mariadb_installed=$(mysql --version) + if [ $? -ne 0 ]; then + echo "MariaDB is not installed!" + return 1 + fi + mariadb_version=$(echo $mariadb_installed | awk '{print $5}') + + # 启动 mariadb Server + systemctl start mysql + if [ $? -ne 0 ]; then + echo "MariaDB server failed to start!" + return 1 + fi + + # 检查 mariadb 是否启动成功 + if ! mysqladmin ping > /dev/null 2>&1; then + echo "MariaDB server failed to start!" + return 1 + fi + + # 输出启动成功的提示信息 + echo "MariaDB server version ${mariadb_version} started successfully!" + return 0 +} + +# 运行 mariadb 官方测试用例,并检查是否成功 +do_test() { + msg "this is do_test" + # 找到系统中的 mariadb 的安装位置并找到里面自带的官方测试脚本,然后运行 mariadb 官方测试用例 + mariadb_install_path=$(which mysql) + mariadb_install_dir=$(dirname $mariadb_install_path) + test_dir="${mariadb_install_dir}/../mysql-test" + if [ -d "$test_dir" ]; then + cd "$test_dir" + #./mysql-test-run.pl --force --max-test-fail=0 + sudo ./mariadb-test-run.pl --force --max-test-fail=0 + else + echo "MariaDB test directory not found." + return 1 + fi + # 检查测试是否成功 + if [ $? -ne 0 ]; then + echo "Tests failed!" + return 1 + fi + + # 输出所有测试都通过的提示信息 + echo "All tests passed!" + return 0 +} + +# 停止 mariadb Server,并删除临时目录 +tc_teardown() { + msg "this is tc_teardown" + systemctl stop mysql + rm -rfv "$g_tmpdir" || return 1 + return 0 +} + +############################################################################### +tst_main "$@" +############################################################################### diff --git a/mariadb-test/tst_lib/Makefile b/mariadb-test/tst_lib/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..171b10b3fca6452dc7565ebc7b613ae163de0e86 --- /dev/null +++ b/mariadb-test/tst_lib/Makefile @@ -0,0 +1,20 @@ +export TST_TS_TOPDIR ?= $(shell pwd)/.. +include $(TST_TS_TOPDIR)/Makefile.common +ALL_SRC := $(wildcard *.c) +ALL_OBJ := $(patsubst %.c,%.o,$(ALL_SRC)) +LIB_STATIC := libtscommon.a +CFLAGS += + +all: $(LIB_STATIC) + +$(LIB_STATIC): $(ALL_OBJ) + ar -rc $(LIB_STATIC) $(ALL_OBJ) + +$(ALL_OBJ):%.o:%.c + $(CC) $(CFLAGS) -c $^ -o $@ + +clean: + rm -rfv $(LIB_STATIC) $(ALL_OBJ) + +cleanall: clean + rm -rfv __pycache__ diff --git a/mariadb-test/tst_lib/other_common.sh b/mariadb-test/tst_lib/other_common.sh new file mode 100644 index 0000000000000000000000000000000000000000..e63ac90298d63de876c5ba45157d045ff2e15ed2 --- /dev/null +++ b/mariadb-test/tst_lib/other_common.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +my_func() { + return 0 +} diff --git a/mariadb-test/tst_lib/ts_common.c b/mariadb-test/tst_lib/ts_common.c new file mode 100644 index 0000000000000000000000000000000000000000..b65caf6f1c17ff37deebd1c16cdc2fe9c362faad --- /dev/null +++ b/mariadb-test/tst_lib/ts_common.c @@ -0,0 +1,23 @@ +// 测试套自定义公共函数库 +#include "common.h" +#include "ts_common.h" + +int ts_setup(void) { + msg("this is ts_setup"); + return 0; +} + +int tc_setup_common(int argc, char **argv) { + msg("this is tc_setup_common"); + return 0; +} + +int tc_teardown_common(int argc, char **argv) { + msg("this is tc_teardown_common"); + return 0; +} + +int ts_teardown(void) { + msg("this is ts_teardown"); + return 0; +} diff --git a/mariadb-test/tst_lib/ts_common.h b/mariadb-test/tst_lib/ts_common.h new file mode 100644 index 0000000000000000000000000000000000000000..9ed2c5f83c433140bd772eb8c673132df2760066 --- /dev/null +++ b/mariadb-test/tst_lib/ts_common.h @@ -0,0 +1,6 @@ +#ifndef __TS_COMMON_H__ +#define __TS_COMMON_H__ + +// 测试套自定义头文件内容 + +#endif // __TS_COMMON_H__ diff --git a/mariadb-test/tst_lib/ts_common.py b/mariadb-test/tst_lib/ts_common.py new file mode 100644 index 0000000000000000000000000000000000000000..5b60299e25b059fdb5dc6707cc9fa380c8763ab3 --- /dev/null +++ b/mariadb-test/tst_lib/ts_common.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +# coding: utf-8 +# Desc: 测试套公共模块 +import abc +import os.path +import sys + +sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +from tst_common.lib.common import TestCase + + +class MyTestCase(TestCase): + """ + 本测试套内的Python用例需要继承此类 + """ + + def tc_setup_common(self, *args): + """ + 所有Python用例执行tc_setup函数前会先执行本函数 + :param args: + :return: + """ + self.msg("this is tc_setup_common") + + @abc.abstractmethod + def do_test(self, *args): + pass + + def tc_teardown_common(self, *args): + """ + 所有Python用例执行tc_teardown函数后会执行本函数 + :param args: + :return: + """ + self.msg("this is tc_teardown_common") diff --git a/mariadb-test/tst_lib/ts_common.sh b/mariadb-test/tst_lib/ts_common.sh new file mode 100644 index 0000000000000000000000000000000000000000..0516a9e4e1884c6ed38383e2b0088878df572513 --- /dev/null +++ b/mariadb-test/tst_lib/ts_common.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# 测试套公共函数 +# 约定: +# 1、以下划线"_"开头的函数和变量用例不能直接调用 +# 2、环境变量全大写,全局变量加上"g_"前置,局部变量统一加"local"修饰 + +# source自己定义的其他公共函数 +source "${TST_TS_TOPDIR}/tst_lib/other_common.sh" || exit 1 + +ts_setup() { + msg "this is ts_setup" + return 0 +} + +tc_setup_common() { + msg "this is tc_setup_common" + return 0 +} + +tc_teardown_common() { + msg "this is tc_teardown_common" + return 0 +} + +ts_teardown() { + msg "this is ts_teardown" + return 0 +} diff --git a/mariadb-test/tst_lib/ts_setup b/mariadb-test/tst_lib/ts_setup new file mode 100755 index 0000000000000000000000000000000000000000..2f7aaaf2ac6439e24ea61cc85b48eb95a56541d9 --- /dev/null +++ b/mariadb-test/tst_lib/ts_setup @@ -0,0 +1,13 @@ +#!/bin/bash +# Time: 2022-04-19 22:44:25 +# Desc: ts_setup +[ -z "$TST_TS_TOPDIR" ] && export TST_TS_TOPDIR="$(realpath "$(dirname "$0")/..")" +source "${TST_TS_TOPDIR}/tst_common/lib/common.sh" + +ts_setup() { + # 测试套setup脚本,在这里增加setup操作 + msg "this is ts_setup" + return 0 +} + +ts_setup diff --git a/mariadb-test/tst_lib/ts_teardown b/mariadb-test/tst_lib/ts_teardown new file mode 100755 index 0000000000000000000000000000000000000000..324080fe7b09842c383f9ba3d8585741a3b75d64 --- /dev/null +++ b/mariadb-test/tst_lib/ts_teardown @@ -0,0 +1,13 @@ +#!/bin/bash +# Time: 2022-04-19 22:44:25 +# Desc: ts_teardown +[ -z "$TST_TS_TOPDIR" ] && export TST_TS_TOPDIR="$(realpath "$(dirname "$0")/..")" +source "${TST_TS_TOPDIR}/tst_common/lib/common.sh" + +ts_teardown() { + # 测试套teardown脚本,在这里增加teardown操作 + msg "this is ts_teardown" + return 0 +} + +ts_teardown diff --git a/mariadb-test/tsuite b/mariadb-test/tsuite new file mode 120000 index 0000000000000000000000000000000000000000..d7009e55a826436c7a6549fb48cc1d33e7abd1eb --- /dev/null +++ b/mariadb-test/tsuite @@ -0,0 +1 @@ +tst_common/tsuite \ No newline at end of file