Test method and device of microkernel system, computer device and storage medium
By generating a target symbol table to update the test script, the problem of static objects in microkernel systems being unable to be directly manipulated is solved, enabling a testing method that does not require modification of the source code and reducing the impact of testing on the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA AUTOMOTIVE INNOVATION CORP
- Filing Date
- 2023-02-21
- Publication Date
- 2026-06-02
AI Technical Summary
In microkernel systems, static objects cannot be directly manipulated externally and have no file system. Traditional methods require modifying the source code, which affects the system and makes effective testing impossible.
By obtaining the source code of the microkernel system, compiling it to generate a target symbol table, updating the test script to include static object attribute information, and directly calling the static object from the test script, there is no need to modify the microkernel source code.
It enables the calling of static objects in the microkernel system, reduces the impact of the testing process on the system, and avoids the risk of modifying the source code.
Smart Images

Figure CN116166551B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of microkernel technology, and in particular to a testing method, apparatus, computer device, and storage medium for a microkernel system. Background Technology
[0002] When performing integration testing on a software system, it is inevitable to verify the call flow or data flow of certain static objects (including static functions or static variables).
[0003] Static objects cannot be directly manipulated externally if they do not provide an external interface. Traditional solutions involve adding an interface or modifying the system to not use static objects. Both methods require modifying the source code of the object under test (i.e., the software system), which may impact the system. In typical software system testing, to minimize the impact of source code modifications, static object information is usually written in a configuration file. During testing, methods in this configuration file are read to invoke the static objects.
[0004] However, microkernels lack file systems and have limited system resources, making file read and write operations impossible, thus requiring improvement. Summary of the Invention
[0005] Therefore, it is necessary to provide a testing method, apparatus, computer device, and storage medium for a microkernel system that enables the invocation of corresponding static objects in the microkernel system without modifying the microkernel system source code, in response to the above-mentioned technical problems.
[0006] Firstly, this application provides a testing method for a microkernel system, the method comprising:
[0007] Obtain the source code of the microkernel system;
[0008] The source code is compiled to obtain the target symbol table, which includes the attribute information of each static object in the source code, including the symbol name, symbol type and symbol address;
[0009] Obtain the test script for the microkernel system;
[0010] The test script is updated based on the target symbol table to obtain the updated test script;
[0011] The microkernel system was tested based on the updated test scripts and source code.
[0012] In one embodiment, the attribute information includes symbol type; compiling the source code to obtain a target symbol table includes: compiling the source code to obtain an initial symbol table; extracting attribute information of each static object from the initial symbol table according to the symbol type of the static object; and generating the target symbol table according to the attribute information of each static object.
[0013] In one embodiment, updating the test script according to the target symbol table to obtain the updated test script includes: parsing the target symbol table to obtain a symbol table array; performing deduplication on the symbol table array to obtain a deduplicated symbol table array; and adding the deduplicated symbol table array to the test script to obtain the updated test script.
[0014] In one embodiment, the symbol table array is deduplicated to obtain a deduplicated symbol table array, including: determining the number of each static object in the symbol table array; filtering the attribute information of static objects whose number is greater than a threshold to obtain a deduplicated symbol table array.
[0015] In one embodiment, the deduplicated symbol table array is added to the test script to obtain an updated test script, including: determining the language type of the test script; compiling the symbol table array into an updated file according to the language type; and adding the updated file to the test script to obtain the updated test script.
[0016] In one embodiment, testing the microkernel system based on the updated test script and source code includes: generating an executable file based on the updated test script and source code; and testing the microkernel system based on the executable file.
[0017] Secondly, this application also provides a test apparatus for a microkernel system, the apparatus comprising:
[0018] The first acquisition module is used to acquire the source code of the microkernel system;
[0019] The compilation module is used to compile the source code to obtain the target symbol table, which includes the attribute information of each static object in the source code.
[0020] The second acquisition module is used to acquire the test scripts of the microkernel system;
[0021] The modification module is used to update the test script based on the target symbol table to obtain the updated test script;
[0022] The testing module is used to test the microkernel system based on the updated test scripts and source code.
[0023] Thirdly, this application also provides a computer device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0024] Obtain the source code of the microkernel system;
[0025] The source code is compiled to obtain the target symbol table, which includes the attribute information of each static object in the source code.
[0026] Obtain the test script for the microkernel system;
[0027] The test script is updated based on the target symbol table to obtain the updated test script;
[0028] The microkernel system was tested based on the updated test scripts and source code.
[0029] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0030] Obtain the source code of the microkernel system;
[0031] The source code is compiled to obtain the target symbol table, which includes the attribute information of each static object in the source code.
[0032] Obtain the test script for the microkernel system;
[0033] The test script is updated based on the target symbol table to obtain the updated test script;
[0034] The microkernel system was tested based on the updated test scripts and source code.
[0035] Fifthly, this application also provides a computer program product comprising a computer program that, when executed by a processor, performs the following steps:
[0036] Obtain the source code of the microkernel system;
[0037] The source code is compiled to obtain the target symbol table, which includes the attribute information of each static object in the source code.
[0038] Obtain the test script for the microkernel system;
[0039] The test script is updated based on the target symbol table to obtain the updated test script;
[0040] The microkernel system was tested based on the updated test scripts and source code.
[0041] The aforementioned testing method, apparatus, computer equipment, and storage medium for the microkernel system obtain updated test scripts based on the attribute information (i.e., target symbol table) of each static object in the source code. During the execution of the test script and source code, if the test script needs to call a corresponding static object, it can directly read the attribute information (e.g., address) of the static object from the target symbol table within the test script. Based on this attribute information, the operation of calling the corresponding static object can be realized. That is, the modified test script can call the corresponding static objects in the microkernel system without involving modifications to the microkernel source code (adding interfaces for external operations) during the call. By only modifying the test script, the impact of the microkernel system on the testing process is reduced. Attached Figure Description
[0042] Figure 1 This is a diagram illustrating the application environment of a test method for a microkernel system in one embodiment.
[0043] Figure 2 This is a flowchart illustrating a testing method for a microkernel system in one embodiment;
[0044] Figure 3 This is a flowchart illustrating the process of generating an updated test script in one embodiment;
[0045] Figure 4 This is a flowchart illustrating the testing process of a microkernel system in one embodiment;
[0046] Figure 5 This is a flowchart illustrating a testing method for a microkernel system in another embodiment;
[0047] Figure 6 This is a structural block diagram of a test device for a microkernel system in one embodiment;
[0048] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0050] The microkernel system testing method provided in this application embodiment can be applied to, for example... Figure 1In the application environment shown, the test platform 102 communicates with the computer device 104 via a network. The computer device 104 can compile the microkernel source code and test scripts to obtain a test package; the computer device 104 sends the test package to the test platform 102, which then executes the test on the test package, thus achieving the testing of the microkernel system. The computer device 104 can be a terminal, server, etc., and the test platform 102 can be a cloud platform.
[0051] In one embodiment, such as Figure 2 As shown, a testing method for a microkernel system is provided, consisting of... Figure 1 The computer device 104 performs the following steps:
[0052] S201, obtain the source code of the microkernel system.
[0053] In this context, source code refers to the code written in a programming language that describes the source programs and resources of the microkernel system, and serves as the object of this test.
[0054] S202, compile the source code to obtain the target symbol table.
[0055] A symbol table is a data structure used in language translators (such as compilers and interpreters). In a symbol table, each syntactic element in the source code (function name, variable name, module name, etc.) is bound to its declaration or attribute information. The attribute information includes, for example, data type, symbol size, scope, and symbol address. This attribute information is generally stored in tabular form, forming, for example, constant tables, variable name tables, array name tables, procedure name tables, label tables, etc., all of which can be collectively referred to as symbol tables.
[0056] For example, three types of symbol elements are given, with symbol names of function fun1, function fun2, and variable var1, and the symbol address, symbol size, symbol type, and segment name of these symbol elements are obtained respectively; where the symbol address can be a relative address (offset address), that is, the offset of the symbol relative to the starting address of the source code, or the relative address of the symbol in the segment in the source code. Specific examples are as follows: (1) Function fun1, the relative address of the symbol in the segment is: 0x1000, the symbol size is: 0x300, the symbol type is: global function, and the segment name is: text. (2) Function fun2, the relative address of the symbol in the segment is: 0x5000, the symbol size is: 0x600, the symbol type is: local function, and the segment name is: text_application_app. (3) Variable var1, the relative address of the symbol in the segment is: 0x6000, the symbol size is: 0x4, the symbol type is: variable, and the segment name is: data.
[0057] It is understandable that the symbol table stores the attribute information of symbols through a structure as shown below:
[0058] Typepf struct VerSymbolEntry;
[0059] {
[0060] Char*name; / * Symbol name * /
[0061] void *addr; / * A variable containing the relative address of the segment containing the symbol plus the starting address of the segment * /
[0062] int size; / * Sign size * /
[0063] int type; / * Symbolic type * /
[0064] char segment; / *segment name* /
[0065] }VerSymbolEntry;
[0066] In this embodiment, the computer device 104 is equipped with a compiler, which has two main functions: analysis and synthesis. The analysis function analyzes the language structure of the source program, collects symbol information, uses it for semantic analysis, and represents it in some intermediate form, such as the symbol table mentioned above. The synthesis function takes the intermediate representation generated by the analysis part and processes it through the synthesis task performed by the optimizer and code generator to produce a machine-dependent target language program. After compilation by the compiler, the target symbol table in this embodiment contains the attribute information of each static object in the source code. This attribute information may include symbol name, symbol type, and symbol address.
[0067] S203, obtain the test script for the microkernel system.
[0068] The test script is interpreted or compiled only when it is invoked. The scripting language of the test script can be Python, VBScript, JavaScript, InstallShield Script, ActionScript, etc. The scripting language does not need to be compiled into an executable file beforehand; it is interpreted by the corresponding scripting language interpreter during execution. Optionally, a scripting language interpreter is loaded into the computer device 104. The scripting language interpreter can directly execute instructions written in the scripting language, thus forming test cases. These test cases are computer programs used to test whether the source code can achieve the expected function. The microkernel system in this embodiment mainly includes a task management component, a task scheduling component, and an inter-task communication component; therefore, the test cases are mainly used to test the task management component, the task scheduling component, and the inter-task communication component.
[0069] Specifically, test cases mainly include three parts: input, function calls (including variable calls), and output comparison with expected values. During the execution of test cases, corresponding functions in the source code are called and corresponding variables in the source code are obtained to perform test operations, thereby simulating the operation of the microkernel system in actual use. Then, the output results are used to verify whether the source code of the microkernel system can achieve the expected function, that is, whether it can pass the test.
[0070] S204, Update the test script according to the target symbol table to obtain the updated test script.
[0071] The updated test script includes attribute information for each static object in the target symbol table.
[0072] Optionally, when updating the test script based on the target symbol table, in one possible implementation (Method 1), the initial test script may define a symbol table with an initial value of empty. In this case, replacing the initial symbol table with the target symbol table yields the updated test script. In another possible implementation (Method 2), the target symbol table is compiled into a file within the test script to obtain the final test script.
[0073] S205 tests the microkernel system based on the updated test scripts and source code.
[0074] Specifically, after obtaining the microkernel source code and the updated test script, the computer device 104 compiles the source code and test script together using a compiler (i.e., the comprehensive analysis of the compiler mentioned above) to obtain the microkernel system image system and test cases. The computer device 104 then sends the microkernel system image system and the updated test cases to the test platform 102, which controls the test platform 102 to test the microkernel system image system based on the updated test script, thereby achieving the testing of the microkernel system. It can be understood that the image system and the updated test cases are the aforementioned test package.
[0075] Furthermore, during the testing process, if the updated test script needs to call the corresponding static object in the source code (i.e., the mirror system), the symbol address of the static object can be read directly from the target symbol table located in the test script based on the calling statement in the test case, and the static object can be found based on the symbol address.
[0076] In the aforementioned microkernel system testing method, the updated test script is obtained based on the attribute information (i.e., the target symbol table) of each static object in the source code. During the execution of the test script and the source code, if the test script needs to call the corresponding static object, it can directly read the attribute information (i.e., the address) of the static object from the target symbol table within the test script. Based on this attribute information (address), the operation of calling the corresponding static object can be realized. That is, the modified test script can call the corresponding static object in the microkernel system, and the call does not involve modifying the microkernel source code (adding an interface for external operation). By only modifying the test script, the impact of the microkernel system on the testing process is reduced.
[0077] This embodiment provides an optional method for compiling source code to obtain a target symbol table, that is, a method for refining S202. The specific implementation process may include: compiling the source code to obtain an initial symbol table; extracting attribute information of each static object from the initial symbol table according to the symbol type of the static object; and generating the target symbol table based on the attribute information of each static object.
[0078] Understandably, during the symbol table generation process, the compiler's syntax analysis module analyzes and collects information on various syntax elements (objects) in the source code. Therefore, the initial symbol table stores the attribute information of each syntax element and symbol obtained from the source code analysis. The types of each syntax element can include variables, defined constants, procedures, functions, tags, structures, etc. Furthermore, the attribute information of syntax elements can also include other dimensions. Since the calling object of the test script in this embodiment is a static object, the attribute information of each static object is extracted based on its symbol type, such as the symbol type of a static variable or a static function; and the target symbol table is generated based on the attribute information of each static object.
[0079] Understandably, after extracting the attribute information of static objects, the target symbol table contains various structures used to store the attribute information of static objects. To facilitate retrieval of each structure, the structures can be sorted, for example, by building a binary search tree or an array. Figure 3 As shown, this embodiment provides an optional method for updating the test script based on the target symbol table to obtain the updated test script, that is, a method for refining S204. The specific implementation process may include:
[0080] S301, parse the target symbol table to obtain the symbol table array.
[0081] This process involves converting the target symbol table into a corresponding array (i.e., a symbol table array). The symbol table array contains multiple structures as shown below, where each dimension stores the symbol name, symbol type, and symbol address of the static object. See the example below.
[0082]
[0083] Specifically, the symbol table array can take the form of:
[0084] char*name; int type unsigned long address Stu[0] static functions 0x1020 Stu[1] static variables 0x1030
[0085] Understandably, the symbol table array can be generated in an ordered or unordered manner. The purpose of organizing it into a symbol table array is to arrange the various static objects according to a unified dimension, making it easier to query the symbol names of each static object during the execution of subsequent test cases.
[0086] Furthermore, in addition to analyzing the source code, the test script (before the update) can be compiled to obtain the static objects that need to be called in the test script; the static objects corresponding to the test script (before the update) are compared with the target symbol table to obtain a symbol table array, so that each static object in the symbol table array corresponds one-to-one with the static object corresponding to the test script.
[0087] Optionally, if the same syntax element appears in the source code during definition and multiple declarations, it may be compiled by the compiler into two static objects with the same symbol name. Since no corresponding memory address is allocated for this syntax element during the declaration process, the attribute information corresponding to this symbol name is incomplete. In this case, it is necessary to remove duplicate symbol names, specifically including:
[0088] S302, perform deduplication on the symbol table array to obtain the deduplicated symbol table array.
[0089] The process involves determining the number of static objects of each type in the symbol table array; filtering the attribute information of static objects with a count exceeding a threshold to obtain a deduplicated symbol table array. The number of static objects in each type refers to the number of static objects with the same symbol name within each category. Optionally, the attribute information stored in the target symbol table may also include the symbol size, meaning that the symbol size in bytes may differ for each static object during the declaration process.
[0090] Specifically, when performing deduplication filtering on any type of static object, if the number of static objects in that type is greater than one, the attribute information of the static object with the largest symbol size among those with the same symbol name is retained, and the attribute information of other static objects is deleted, so that the symbol name of each static object is unique in the deduplicated symbol table array; if the number of static objects in that type is greater than one and all symbols have the same size, the attribute information of only one static object is retained; furthermore, if the number of static objects in that type is equal to one, then it is not necessary to perform deduplication filtering on the attribute information of that static object.
[0091] In this embodiment, using symbol size as a filtering condition for deduplication can reduce the probability of incorrect definition of syntax elements due to code writing errors, and deduplication filtering can avoid duplicate and redundant target symbol tables caused by multiple compilations.
[0092] S303 adds the deduplicated symbol table array to the test script to obtain the updated test script.
[0093] In this embodiment, the test script is a file package that includes multiple sub-files. If the test script before the update is the test script in Method 1 above, that is, the test script before the update includes a sub-file that stores a symbol table, and the content of the symbol table is empty, then in this case, updating the test script may include the following process: determining the language type of the test script; compiling the symbol table array into an update file according to the language type; adding the update file to the test script to obtain the updated test script.
[0094] Specifically, the deduplicated symbol table array and the language type based on the test script are compiled into an update file. The update file replaces the sub-files under the original test script, resulting in the updated test script.
[0095] like Figure 4 As shown, this embodiment provides an optional method for testing a microkernel system based on an updated test script and source code, that is, a method for refining S204. The specific implementation process may include:
[0096] S401 generates the executable file based on the updated test script and source code.
[0097] Specifically, computer device 104 can compile the microkernel source code and the updated test scripts to obtain an executable file, which includes the microkernel system image and the test cases corresponding to the test scripts.
[0098] S402 tests the microkernel system according to the executable file.
[0099] Specifically, computer device 104 sends the executable file and corresponding execution instructions to test platform 102. Test platform 102 deploys the image system in the pre-configured test environment and completes initialization according to the execution instructions, and then calls test cases to test the image system.
[0100] It is understandable that when the image system is deployed in the test environment, the test environment allocates a corresponding memory address to the image system, and the image system obtains the corresponding starting address. For any static object in the target symbol table, since its corresponding symbol address is known (the offset address compared to the starting address), the address of the symbol can be found by reading the target symbol table, thus enabling the call to the static object.
[0101] For example, based on the above embodiments, this embodiment provides an optional example of a testing method for a microkernel system. For instance... Figure 5 As shown, the specific implementation process includes:
[0102] S501, obtain the source code of the microkernel system.
[0103] S502 compiles the source code to obtain the initial symbol table.
[0104] S503, extract the attribute information of each static object based on the symbol type of the static object.
[0105] The static object attribute information includes symbol name, symbol type, and symbol address.
[0106] S504, Attribute information of each static object, generate target symbol table.
[0107] S505, obtain the test script for the microkernel system.
[0108] S506, parse the target symbol table to obtain the symbol table array.
[0109] S507 performs deduplication on the symbol table array to obtain the deduplicated symbol table array.
[0110] S508 adds the deduplicated symbol table array to the test script to obtain the updated test script.
[0111] The process involves determining the language type of the test script; compiling the symbol table array into an update file based on the language type; and adding the update file to the test script to obtain the updated test script.
[0112] S509 generates the executable file based on the updated test script and source code.
[0113] S510 tests the microkernel system according to the executable file.
[0114] The specific processes of S501-S510 described above can be found in the description of the above method embodiments. Their implementation principles and technical effects are similar, and will not be repeated here.
[0115] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0116] Based on the same inventive concept, this application also provides a microkernel system testing apparatus for implementing the aforementioned microkernel system testing method. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more microkernel system testing method apparatus embodiments provided below can be found in the limitations of the microkernel system testing method described above, and will not be repeated here.
[0117] In one embodiment, such as Figure 6As shown, a testing device 1 for a microkernel system is provided, comprising: a first acquisition module, a compilation processing module 12, a second acquisition module 13, a modification module 14, and a testing module 15, wherein:
[0118] The first acquisition module 11 is used to acquire the source code of the microkernel system;
[0119] The compilation processing module 12 is used to compile the source code to obtain the target symbol table, wherein the target symbol table includes the attribute information of each static object in the source code;
[0120] The second acquisition module 13 is used to acquire the test script of the microkernel system;
[0121] Modify module 14 to update the test script based on the target symbol table to obtain the updated test script;
[0122] Test module 15 is used to test the microkernel system based on the updated test scripts and source code.
[0123] In one embodiment, the attribute information includes the symbol type; the compilation processing module 12 includes:
[0124] The compilation submodule is used to compile the source code to obtain the initial symbol table;
[0125] The extraction submodule is used to extract the attribute information of each static object from the initial symbol table based on the symbol type of the static object;
[0126] The generation submodule is used to generate the target symbol table based on the attribute information of each static object.
[0127] In one embodiment, modifying module 14 includes:
[0128] The parsing submodule uses a parsing target symbol table to obtain a symbol table array;
[0129] The deduplication submodule is used to deduplicatize the symbol table array to obtain the deduplicated symbol table array;
[0130] Modify the submodule to add the deduplicated symbol table array to the test script, resulting in an updated test script.
[0131] In one embodiment, the attribute information includes symbol names; the deduplication submodule is also used to: determine the number of each static object in the symbol table array, wherein the number of any type of static object represents the number of static objects with the same symbol name;
[0132] The attribute information of static objects with a number greater than a threshold is filtered to obtain a deduplicated symbol table array.
[0133] In one embodiment, the modification submodule is also used to: determine the language type of the test script;
[0134] Based on the language type, the symbol table array is compiled into an updated file;
[0135] Add the updated file to the test script to obtain the updated test script.
[0136] In one embodiment, the test module 15 is further configured to: generate an executable file based on the updated test script and source code;
[0137] The microkernel system is tested according to the executable file.
[0138] Each module in the aforementioned microkernel system test device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0139] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores XX data. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements a test method for a microkernel system.
[0140] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0141] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0142] Obtain the source code of the microkernel system;
[0143] The source code is compiled to obtain the target symbol table, which includes the attribute information of each static object in the source code.
[0144] Obtain the test script for the microkernel system;
[0145] The test script is updated based on the target symbol table to obtain the updated test script;
[0146] The microkernel system was tested based on the updated test scripts and source code.
[0147] In one embodiment, the attribute information includes symbol type; when the processor executes a computer program to compile the source code and obtain the target symbol table, the following steps are specifically implemented: compiling the source code to obtain an initial symbol table; extracting the attribute information of each static object from the initial symbol table according to the symbol type of the static object; and generating the target symbol table according to the attribute information of each static object.
[0148] In one embodiment, when the processor executes a computer program to update the test script based on the target symbol table to obtain the updated test script, the following steps are specifically implemented: parsing the target symbol table to obtain a symbol table array; performing deduplication on the symbol table array to obtain a deduplicated symbol table array; and adding the deduplicated symbol table array to the test script to obtain the updated test script.
[0149] In one embodiment, the attribute information includes symbol names; when the processor executes a computer program to deduplicate the symbol table array and obtains the deduplicated symbol table array, the following steps are specifically implemented: determining the number of each static object in the symbol table array, wherein the number of any type of static object represents the number of static objects with the same symbol name; filtering the attribute information of static objects whose number is greater than a threshold to obtain the deduplicated symbol table array.
[0150] In one embodiment, when the processor executes a computer program to add the deduplicated symbol table array to the test script to obtain the updated test script, the following steps are specifically implemented: determine the language type of the test script; compile the symbol table array into an update file according to the language type; add the update file to the test script to obtain the updated test script.
[0151] In one embodiment, when the processor executes the computer program, it further performs the following steps: generating an executable file based on the updated test script and source code; and testing the microkernel system based on the executable file.
[0152] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0153] Obtain the source code of the microkernel system;
[0154] The source code is compiled to obtain the target symbol table, which includes the attribute information of each static object in the source code.
[0155] Obtain the test script for the microkernel system;
[0156] The test script is updated based on the target symbol table to obtain the updated test script;
[0157] The microkernel system was tested based on the updated test scripts and source code.
[0158] In one embodiment, the attribute information includes symbol type; when the logic of the computer program compiling the source code to obtain the target symbol table is executed by the processor, the following steps are specifically implemented: compiling the source code to obtain an initial symbol table; extracting the attribute information of each static object from the initial symbol table according to the symbol type of the static object; and generating the target symbol table according to the attribute information of each static object.
[0159] In one embodiment, when a computer program updates a test script based on a target symbol table and the logic of the updated test script is executed by a processor, the following steps are specifically implemented: parsing the target symbol table to obtain a symbol table array; performing deduplication on the symbol table array to obtain a deduplicated symbol table array; and adding the deduplicated symbol table array to the test script to obtain the updated test script.
[0160] In one embodiment, the attribute information includes symbol names; when the logic of the computer program performing deduplication on the symbol table array to obtain the deduplicated symbol table array is executed by the processor, the following steps are specifically implemented: determining the number of each static object in the symbol table array, wherein the number of any type of static object represents the number of static objects with the same symbol name; filtering the attribute information of static objects whose number is greater than a threshold to obtain the deduplicated symbol table array.
[0161] In one embodiment, when the computer program adds the deduplicated symbol table array to the test script and the logic of the updated test script is executed by the processor, the following steps are specifically implemented: determining the language type of the test script; compiling the symbol table array into an update file according to the language type; adding the update file to the test script to obtain the updated test script.
[0162] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: generating an executable file based on the updated test script and source code; and testing the microkernel system based on the executable file.
[0163] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0164] Obtain the source code of the microkernel system;
[0165] The source code is compiled to obtain the target symbol table, which includes the attribute information of each static object in the source code.
[0166] Obtain the test script for the microkernel system;
[0167] The test script is updated based on the target symbol table to obtain the updated test script;
[0168] The microkernel system was tested based on the updated test scripts and source code.
[0169] In one embodiment, the attribute information includes symbol type; when the logic of the computer program compiling the source code to obtain the target symbol table is executed by the processor, the following steps are specifically implemented: compiling the source code to obtain an initial symbol table; extracting the attribute information of each static object from the initial symbol table according to the symbol type of the static object; and generating the target symbol table according to the attribute information of each static object.
[0170] In one embodiment, when a computer program updates a test script based on a target symbol table and the logic of the updated test script is executed by a processor, the following steps are specifically implemented: parsing the target symbol table to obtain a symbol table array; performing deduplication on the symbol table array to obtain a deduplicated symbol table array; and adding the deduplicated symbol table array to the test script to obtain the updated test script.
[0171] In one embodiment, the attribute information includes symbol names; when the logic of the computer program performing deduplication on the symbol table array to obtain the deduplicated symbol table array is executed by the processor, the following steps are specifically implemented: determining the number of each static object in the symbol table array, wherein the number of any type of static object represents the number of static objects with the same symbol name; filtering the attribute information of static objects whose number is greater than a threshold to obtain the deduplicated symbol table array.
[0172] In one embodiment, when the computer program adds the deduplicated symbol table array to the test script and the logic of the updated test script is executed by the processor, the following steps are specifically implemented: determining the language type of the test script; compiling the symbol table array into an update file according to the language type; adding the update file to the test script to obtain the updated test script.
[0173] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: generating an executable file based on the updated test script and source code; and testing the microkernel system based on the executable file.
[0174] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0175] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0176] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0177] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A testing method for a microkernel system, characterized in that, The method includes: Obtain the source code of the microkernel system; The source code is compiled to obtain an initial symbol table; Based on the symbol type of each static object in the source code, the attribute information of each static object is extracted from the initial symbol table, and a target symbol table is generated based on the attribute information of each static object; wherein, the attribute information includes data type, symbol size, scope, and symbol address; Obtain the test script for the microkernel system; The target symbol table is used to replace the symbol table in the test script; or, the target symbol table is compiled into a file in the test script to obtain an updated test script; wherein, the updated test script contains the attribute information of each static object in the target symbol table, and the initial value of the symbol table is empty; The microkernel system was tested based on the updated test script and the source code. The step of replacing the symbol table in the test script with the target symbol table to obtain an updated test script includes: parsing the target symbol table to obtain a symbol table array; performing deduplication on the symbol table array to obtain a deduplicated symbol table array; and adding the deduplicated symbol table array to the test script to obtain an updated test script. The step of testing the microkernel system based on the updated test script and the source code includes: generating an executable file based on the updated test script and the source code; and testing the microkernel system based on the executable file.
2. The method according to claim 1, characterized in that, The attribute information includes symbol names; the process of deduplicating the symbol table array to obtain a deduplicated symbol table array includes: Determine the number of each type of static object in the symbol table array, wherein the number of any type of static object represents the number of static objects with the same symbol name; The attribute information of static objects with a number greater than a threshold is filtered to obtain a deduplicated symbol table array.
3. The method according to claim 1, characterized in that, The step of adding the deduplicated symbol table array to the test script to obtain the updated test script includes: Determine the language type of the test script; Based on the language type, the symbol table array is compiled into an update file; The updated file is added to the test script to obtain the updated test script.
4. The method according to claim 1, characterized in that, The executable file includes the image system of the microkernel system and the test cases corresponding to the test script; The step of testing the microkernel system according to the executable file includes: The executable file and corresponding execution instructions are sent to the test platform, so that the test platform can deploy the image system in the pre-configured test environment and complete the initialization according to the execution instructions, and call the test cases to test the image system.
5. A testing device for a microkernel system, characterized in that, The device includes: The first acquisition module is used to acquire the source code of the microkernel system; The compilation processing module is used to compile the source code to obtain an initial symbol table; extract the attribute information of each static object from the initial symbol table according to the symbol type of each static object in the source code, and generate a target symbol table according to the attribute information of each static object; wherein, the attribute information includes data type, symbol size, scope and symbol address; The second acquisition module is used to acquire the test script of the microkernel system; The modification module is used to replace the symbol table in the test script with the target symbol table; or, to compile the target symbol table into a file in the test script to obtain an updated test script; wherein, the updated test script contains the attribute information of each static object in the target symbol table, and the initial value of the symbol table is empty; The testing module is used to test the microkernel system based on the updated test script and the source code. Specifically, the modification module is used to parse the target symbol table to obtain a symbol table array; perform deduplication on the symbol table array to obtain a deduplicated symbol table array; and add the deduplicated symbol table array to the test script to obtain an updated test script. The testing module is specifically used to generate an executable file based on the updated test script and the source code; and to test the microkernel system based on the executable file.
6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.
8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.