Method, device and system for automatic testing of DDK interface based on automatic testing tool and lightweight operating system
Through automated testing tools, the automated testing of DDK interfaces is performed in a lightweight operating system, and the problems of limited test scope and fixed test content are solved, achieving full coverage of all DDK interfaces and functions to meet development needs.
Patent Information
- Application Number
- CN202411077900.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-07
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-08-07
AI Technical Summary
The existing DDK interface testing methods have limited testing scope and fixed test content, so they cannot be fully tested before the lightweight operating system is started, resulting in some interfaces being unable to be tested and can only test the registered functions.
Using automated testing tools, by obtaining the DDK interface test list, generating the test list header file, and setting reference instructions in the board-level driver file, compiling and providing them to the lightweight operating system to perform automated testing, covering all DDK interfaces and functions.
It realizes comprehensive testing of all DDK interfaces and functions provided by lightweight operating systems, solves the problems of insufficient test scope and fixed test content, and can modify the test content as needed to adapt to development needs.
Smart Images

Figure CN119025420A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of driver development and testing technology, and in particular to a method for realizing automated testing of a driver development kit (DDK) interface of a lightweight operating system (LOS) by using an automated testing tool, and an automated testing method, device, and system for a DDK interface based on a lightweight operating system. Background Art
[0002] A lightweight operating system is an operating system with a simple design, low resource consumption, and relatively limited functions. It is usually used in scenarios with specific hardware limitations or specific application requirements, such as embedded systems, IoT devices, microcontrollers, etc. The goal of a lightweight operating system is to provide the most basic operating system functions while maintaining low resource consumption and high operating efficiency.
[0003] In order to simplify the system structure, reduce resource consumption and improve efficiency, in lightweight operating systems, the kernel and driver are generally integrated more closely. However, in actual use, manufacturers have the need to select components independently, and lightweight operating systems with the kernel and driver integrated together cannot meet this demand. It may also cause system crashes due to driver errors, thereby causing security risks. Therefore, a lightweight operating system with a separated kernel and driver can avoid the above problems well.
[0004] However, in a lightweight operating system in which the kernel and driver are separated, in addition to providing a software development kit (SDK), a DDK is also required; therefore, before the release of a lightweight operating system in which the kernel and driver are separated, in addition to testing the kernel and SDK, the DDK also needs to be fully verified and tested; and compared with the SDK, the DDK is more closely connected to the lightweight operating system and has more stringent testing requirements.
[0005] There are two main deficiencies in the existing DDK interface testing method: limited test scope and fixed test content. That is, the existing testing method can only test the DDK interface after the lightweight operating system is started, using the SDK-based DDK test APP, resulting in some DDK interfaces being unable to be tested, and only the preset functions registered by the driver during the operating system startup phase can be tested. Summary of the invention
[0006] In order to solve the problems in the related art, the embodiments of the present disclosure provide a method for implementing automated testing of the DDK interface of a lightweight operating system using an automated testing tool, and an automated testing method, device, and system based on the DDK interface of a lightweight operating system.
[0007] In a first aspect, an embodiment of the present disclosure provides a method for implementing automated testing of a DDK interface of a lightweight operating system using an automated testing tool, wherein the automated testing tool runs on a computer, and the DDK interface is provided by the DDK for the lightweight operating system. The method includes using the automated testing tool to perform the following steps:
[0008] Acquire a DDK interface test list according to user input, wherein the DDK interface test list corresponds to a plurality of DDK unit test files, and the DDK unit test files are used to test corresponding test points among a plurality of test points set for the DDK interface;
[0009] Generate a DDK interface test list header file based on the DDK interface test list, and save the DDK interface test list header file in the DDK, wherein the DDK interface test list header file is used to implement references to the multiple DDK unit test files;
[0010] Setting a reference instruction in a board-level driver file, and saving the set board-level driver file in the DDK, wherein the reference instruction is used to reference the DDK interface test list header file in the set board-level driver file, so that the set board-level driver file can load the multiple DDK unit test files when executed;
[0011] Obtaining a set DDK, wherein the set DDK includes the DDK interface test list header file and the set board-level driver file;
[0012] Compile the set DDK to obtain a first compiled DDK file;
[0013] The first compiled DDK file is provided to the lightweight operating system, so that the lightweight operating system can use the first compiled DDK file to perform automated testing of the DDK interface.
[0014] According to an embodiment of the present disclosure, the method further includes: obtaining an interface test result from a startup log of the lightweight operating system, wherein the interface test result is a result obtained by the lightweight operating system executing an automated test of the DDK interface.
[0015] According to an embodiment of the present disclosure, it also includes:
[0016] After obtaining the interface test result, deleting the DDK interface test list header file and the set board-level driver file in the set DDK, and restoring the set DDK to the DDK;
[0017] Compile the DDK to obtain a second compiled DDK file;
[0018] The second compiled DDK file is provided to the lightweight operating system, so that the lightweight operating system can implement system recovery by using the second compiled DDK file.
[0019] According to an embodiment of the present disclosure, the DDK interface includes a plurality of application programming API interfaces;
[0020] The multiple test points set for the DDK interface include: one or more test points set for the API interface, or one or more test points set for some of the multiple API interfaces.
[0021] According to an embodiment of the present disclosure, the DDK interface includes an API interface of a necessary driver and an API interface of a non-essential driver provided by the DDK to the lightweight operating system.
[0022] In a second aspect, an embodiment of the present disclosure provides an automated testing method for a DDK interface provided by a DDK based on a lightweight operating system, wherein the lightweight operating system is applied to a chip, a kernel of the lightweight operating system is separated from a driver, and a plurality of test points are set for the DDK interface, wherein the method comprises:
[0023] The lightweight operating system is automatically restarted by executing a first compiled DDK file using an upgrade driver command, wherein the first compiled DDK file is obtained by compiling a set DDK, the set DDK includes a set board-level driver file and a DDK test list header file, the DDK test list header file includes a DDK test unit list, the DDK test unit list corresponds to a plurality of DDK unit test files, the DDK unit test file is used to test the test point, the set board-level driver file includes a reference instruction, the reference instruction is used to reference the DDK test list header file in the set board-level driver file, and the automatic restart includes:
[0024] Powering on the chip;
[0025] The lightweight operating system enters a booting phase, and an interrupt vector table is constructed in the booting phase;
[0026] After the interrupt vector table is constructed, the lightweight operating system enters the kernel startup phase;
[0027] During the kernel startup phase, the driver is loaded, the set board-level driver file is executed, the DDK test list header file is referenced by the reference instruction in the set board-level driver file, and the multiple DDK unit test files are loaded; the hardware initialization function is called to execute the multiple DDK unit test files, and the multiple test points set for the DDK interface are tested to obtain the interface test results of the DDK interface, and the interface test results are saved in the startup log of the lightweight operating system.
[0028] According to an embodiment of the present disclosure, after obtaining the interface test result of the DDK interface, an upgrade driver command is used on the lightweight operating system to execute a second compiled DDK file, so that the lightweight operating system is restarted again to achieve system recovery, wherein the second compiled DDK file is a file obtained by compiling after deleting the set board-level driver file and the DDK test list header file included in the set DDK.
[0029] According to an embodiment of the present disclosure, the DDK interface includes a plurality of API interfaces;
[0030] The multiple test points are set for the DDK interface, including: setting one or more test points for the API interface, or setting one or more test points for some of the multiple API interfaces.
[0031] According to an embodiment of the present disclosure, the test point is a test range set for a registered function and / or a non-registered function in the API interface.
[0032] According to an embodiment of the present disclosure, the registration function is a function registered in a driver loaded in the kernel startup phase;
[0033] The unregistered function is a function that is not registered in the driver loaded during the kernel startup phase.
[0034] According to an embodiment of the present disclosure, the loaded driver is a necessary driver, or the loaded driver is a necessary driver and a non-necessary driver.
[0035] In a third aspect, an automated testing tool is provided, wherein the automated testing tool is used to implement automated testing of a DDK interface of a lightweight operating system, wherein the automated testing tool runs on a computer, wherein the DDK interface is provided by the DDK for the lightweight operating system, and wherein the automated testing tool comprises:
[0036] A first acquisition module is configured to acquire a DDK interface test list according to a user input, wherein the DDK interface test list corresponds to a plurality of DDK unit test files, and the DDK unit test files are used to test corresponding test points among a plurality of test points set for the DDK interface;
[0037] A generating module, configured to generate a DDK interface test list header file based on the DDK interface test list, and save the DDK interface test list header file in the DDK, wherein the DDK interface test list header file is used to implement references to the multiple DDK unit test files;
[0038] A setting module is configured to set a reference instruction in a board-level driver file, and save the set board-level driver file in the DDK, wherein the reference instruction is used to reference the DDK interface test list header file in the set board-level driver file, so that the set board-level driver file can load the multiple DDK unit test files when executed;
[0039] A second acquisition module is configured to acquire a set DDK, wherein the set DDK includes the DDK interface test list header file and the set board-level driver file;
[0040] A first compiling module is configured to compile the set DDK to obtain a first compiled DDK file;
[0041] A providing module is configured to provide the first compiled DDK file to the lightweight operating system, so that the lightweight operating system can perform automated testing of the DDK interface using the first compiled DDK file.
[0042] According to an embodiment of the present disclosure, it also includes: a third acquisition module, configured to obtain an interface test result from the startup log of the lightweight operating system, wherein the interface test result is a result obtained by the lightweight operating system executing an automated test of the DDK interface.
[0043] According to an embodiment of the present disclosure, the method further includes: a second compilation module configured to:
[0044] After obtaining the interface test result, deleting the DDK interface test list header file and the set board-level driver file in the set DDK, and restoring the set DDK to the DDK;
[0045] Compile the DDK to obtain a second compiled DDK file;
[0046] The second compiled DDK file is provided to the lightweight operating system, so that the lightweight operating system can implement system recovery by using the second compiled DDK file.
[0047] In a fourth aspect, an embodiment of the present disclosure provides an automated testing device for a DDK interface provided by a DDK based on a lightweight operating system, wherein the automated testing device is applied to a lightweight operating system in which a kernel and a driver are separated, the lightweight operating system is applied to a chip, and a plurality of test points are set for the DDK interface, wherein the device comprises:
[0048] an automatic restart module, configured to execute a first compiled DDK file using an upgrade driver command on the lightweight operating system, so that the lightweight operating system automatically restarts, wherein the first compiled DDK file is obtained by compiling a set DDK, the set DDK includes a set board-level driver file and a DDK test list header file, the DDK test list header file includes a DDK test unit list, the DDK test unit list corresponds to a plurality of DDK unit test files, the DDK unit test file is used to test the test point, and the set board-level driver file includes a reference instruction, the reference instruction is used to reference the DDK test list header file in the set board-level driver file;
[0049] The automatic restart module comprises:
[0050] A power-on module, configured to power on the chip;
[0051] A boot module, configured to enable the lightweight operating system to enter a boot phase and to construct an interrupt vector table in the boot phase;
[0052] The kernel startup module is configured to, after the interrupt vector table is constructed, the lightweight operating system enters the kernel startup phase; in the kernel startup phase, load the driver, execute the set board-level driver file, reference the DDK test list header file through the reference instruction in the set board-level driver file, and load the multiple DDK unit test files; call the hardware initialization function to execute the multiple DDK unit test files, test the multiple test points set for the DDK interface, and obtain the interface test results of the DDK interface, and the interface test results are saved in the startup log of the lightweight operating system.
[0053] According to an embodiment of the present disclosure, it further includes: a system recovery module configured to:
[0054] After obtaining the interface test result of the DDK interface, an upgrade driver command is used on the lightweight operating system to execute a second compiled DDK file, so that the lightweight operating system is restarted again to achieve system recovery, wherein the second compiled DDK file is a file obtained by compiling after deleting the set board-level driver file and the DDK test list header file included in the set DDK.
[0055] According to an embodiment of the present disclosure, the DDK interface includes a plurality of API interfaces; and the first compiled DDK file is a binary file.
[0056] In a fifth aspect, an embodiment of the present disclosure provides an automated testing system for a DDK interface provided by DDK for a lightweight operating system, comprising: an automated testing tool as described in any one of the claims of the third aspect and an apparatus as described in any one of the claims of the fourth aspect.
[0057] In a sixth aspect, a computer-readable storage medium is provided in an embodiment of the present disclosure, on which computer instructions are stored. When the computer instructions are executed by a processor, a method as described in any one of the first aspect or the second aspect is implemented.
[0058] In a seventh aspect, a computer program product is provided in an embodiment of the present disclosure, comprising computer instructions, which, when executed by a processor, implement a method as described in any one of the first aspect or the second aspect.
[0059] According to the technical solution provided by the embodiment of the present disclosure, by using the reference instruction to reference the DDK interface test list header file in the set board-level driver file, the reference to multiple DDK unit test files is realized, and the set board-level driver file and the DDK interface test list header file are saved in the DDK and then compiled, thereby providing the first compiled DDK file to the lightweight operating system, so that the lightweight operating system can use the first compiled DDK file to perform automated testing of the DDK interface. Without relying on additional tools, the present disclosure can verify all DDK interfaces provided for the lightweight operating system and all functions of the DDK interface, solves the problem that some DDK interfaces cannot be tested because they can only be tested after the kernel is started, and only the functions registered in the DDK interface can be tested, and the test content of the DDK interface can be modified as needed to flexibly adapt to the testing needs of developers.
[0060] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Other features, objectives and advantages of the present disclosure will become more apparent through the following detailed description of non-limiting embodiments in conjunction with the accompanying drawings. In the accompanying drawings:
[0062] Figure 1 A flow chart showing a method for testing a DDK interface in the prior art;
[0063] Figure 2 A logic block diagram showing a method for implementing DDK interface automated testing of a lightweight operating system using an automated testing tool according to an embodiment of the present disclosure;
[0064] Figure 3 A schematic diagram showing the relationship between the set board-level driver file, the DDK interface test list header file and the DDK interface test list;
[0065] Figure 4 A logic block diagram showing an automated testing method for a DDK interface provided by DDK based on a lightweight operating system according to an embodiment of the present disclosure is shown;
[0066] Figure 5 Show Figure 4 A flowchart of the automatic restart of the lightweight operating system in the automated testing method of the illustrated example;
[0067] Figure 6 A structural block diagram of an automated testing tool according to an embodiment of the present disclosure is shown;
[0068] Figure 7 A structural block diagram of an automated testing device for a DDK interface provided by DDK based on a lightweight operating system according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0069] Hereinafter, exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings so that those skilled in the art can easily implement them. In addition, for the sake of clarity, parts not related to the description of the exemplary embodiments are omitted in the accompanying drawings.
[0070] In the present disclosure, it should be understood that terms such as "include" or "have" are intended to indicate the presence of features, numbers, steps, behaviors, components, parts, or a combination thereof disclosed in the present specification, and are not intended to exclude the possibility that one or more other features, numbers, steps, behaviors, components, parts, or a combination thereof exist or are added.
[0071] It should also be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0072] In the present disclosure, if it involves operations of obtaining user information or user data or displaying user information or user data to others, the operations are all authorized and confirmed by the user, or actively selected by the user.
[0073] As mentioned above, in a lightweight operating system, when the driver is coupled with the kernel, it cannot meet the manufacturer's independent component selection requirements, and may also cause system crashes due to driver errors. In order to avoid the above problems, it is necessary to provide a lightweight operating system that separates the driver from the kernel.
[0074] In a lightweight operating system where the driver is separated from the kernel, the DDK needs to be fully verified and tested during the testing process before the system is released. Compared with user-mode SDK development, DDK is more closely connected to the system and has stricter requirements for developers and testers.
[0075] like Figure 1 As shown in the figure, in the existing DDK interface test method, the lightweight operating system needs to be started first. During the startup process: after the system is powered on, it will first enter the boot stage (the boot stage of the operating system), complete the construction of the interrupt vector table in the boot stage, and then jump to the kernel. The first step in the kernel startup stage is to load the necessary drivers, and the system kernel will not be started until the loading is complete. Among them, when the necessary driver is loaded, the first function executed is the hardware initialization function in the board-level driver file, in which the necessary hardware initialization is completed, such as: vector table setting, clock configuration, heap space initialization, etc. For some non-essential drivers, you can wait until the system kernel is started and then register and load them through the automatic initialization mechanism. Finally, after the lightweight operating system is started, use the SDK-based DDK test APP to test the DDK interface.
[0076] After in-depth research, the inventors found that the existing DDK interface testing method has the following deficiencies:
[0077] 1. Limited test scope: Since a cross-compiled test APP is used, the test APP can only be downloaded to the system to test the interface after the lightweight operating system is started. Therefore, only the corresponding interface in the SDK can be called, and the time to call the interface in the DDK to implement driver testing has passed. As a result, some interfaces that are only called in the board-level driver file during the system startup process cannot be tested, such as thread communication API interface, inter-process communication API interface, waiting queue API interface, timer API interface, file access API interface, memory management API interface and C library API interface, etc.
[0078] 2. The test content is fixed, and only the preset functions registered by the driver during the operating system startup phase can be tested: After the operating system is started, the driver has been registered and cannot be modified, so only the preset functions during registration can be tested. However, the preset functions during registration are not perfect, and some functions will be closed or restricted. At the same time, it is also impossible to create a driver for a new device after the operating system is started.
[0079] In order to solve the above technical problems, the present disclosure provides a method for implementing automated testing of a DDK interface of a lightweight operating system using an automated testing tool, wherein the automated testing tool runs on a computer, and the DDK interface is provided by the DDK for the lightweight operating system. The method comprises using the automated testing tool to perform the following steps:
[0080] According to user input, a DDK interface test list is obtained, wherein the DDK interface test list corresponds to a plurality of DDK unit test files, and the DDK unit test files are used to test corresponding test points among a plurality of test points set for the DDK interface; a DDK interface test list header file is generated based on the DDK interface test list, and the DDK interface test list header file is saved in the DDK, wherein the DDK interface test list header file is used to implement reference to the plurality of DDK unit test files; a reference instruction is set in a board-level driver file, and the set board-level driver file is saved in the DDK, wherein the reference instruction is used to reference the DDK interface test list header file in the set board-level driver file, so that the set board-level driver file can load the plurality of DDK unit test files when executed; a set DDK is obtained, wherein the set DDK includes the DDK interface test list header file and the set board-level driver file; the set DDK is compiled to obtain a first compiled DDK file; and the first compiled DDK file is provided to the lightweight operating system, so that the lightweight operating system can use the first compiled DDK file to perform automated testing of the DDK interface.
[0081] The present disclosure can verify all DDK interfaces and all functions of the DDK interfaces provided by the lightweight operating system without using additional tools. The test scope is comprehensive, and the test content for the DDK interface can be modified as needed to flexibly adapt to the testing needs of developers.
[0082] Figure 2 The following is a logic block diagram of a method for implementing DDK interface automated testing of a lightweight operating system using an automated testing tool according to an embodiment of the present disclosure. Figure 2 As shown, the method includes using the automated testing tool to perform the following steps S201 to S206.
[0083] According to an embodiment of the present disclosure, the automated testing tool runs on a computer, for example, it may be an intelligent testing platform, intelligent testing software, and the like.
[0084] In step S201, a DDK interface test list is obtained according to user input, wherein the DDK interface test list corresponds to a plurality of DDK unit test files, and the DDK unit test files are used to test corresponding test points among a plurality of test points set for the DDK interface.
[0085] The DDK interface is an interface provided by the DDK for the lightweight operating system, that is, an interface provided by the DDK for the driver requirements of the lightweight operating system, and the driver requirements are requirements that can meet the developer's development or testing of the driver interface of the lightweight operating system.
[0086] Specifically, the DDK interface includes multiple API interfaces, such as thread communication API interface, inter-process communication API interface, waiting queue API interface, timer API interface, file access API interface, memory management API interface and C library API interface, etc.
[0087] According to an embodiment of the present disclosure, one or more test points are set for the API interface, or one or more test points are set for some of the multiple API interfaces.
[0088] In the present disclosure, test points are a series of test contents to ensure that the functions, performance, security, etc. of the interface meet expectations, for example, interface response time test, resource occupancy test, security test, stability test, boundary value test, error handling test, etc.
[0089] One or more test points can be set for an API interface, and one or more test points can also be set for some of the API interfaces in multiple API interfaces. For example, assuming that all the test contents for the first API interface are: test content 1, test content 2, test content 3, and all the test contents for the second API interface are: test content 4, test content 5, test content 6; then for the test of the first API interface, test content 1 and test content 2 can be set as one test point, test content 3 can be set as another test point, or test content 1, test content 2, and test content 3 can be set as one test point. For the test of the first API interface and the second API interface, test content 1 and test content 4 can be set as one test point, test content 2 and test content 5 can be set as one test point, test content 3 and test content 6 can be set as one test point, and test contents 1-6 can also be set as one test point together. Those skilled in the art should understand that the number and setting method of the test points are determined according to user needs and are not used as a technical means to limit the scope of protection of the present disclosure.
[0090] According to an embodiment of the present disclosure, the DDK interface includes an API interface of a necessary driver and an API interface of a non-essential driver provided by the DDK to the lightweight operating system.
[0091] As mentioned above, during the kernel startup process of the lightweight operating system, the necessary drivers (e.g., storage device drivers, display device drivers, basic input / output (I / O) device drivers) are first loaded, then the kernel is jumped to start the kernel, and finally the non-essential drivers (e.g., network device drivers, audio device drivers, drivers of peripherals such as printers) are loaded. The present disclosure can set test points for the API interfaces of necessary drivers and non-essential drivers for testing, so that not only the API interfaces of non-essential drivers after the kernel is started can be tested, but also the API interfaces of necessary drivers before the kernel is started can be tested, and the test scope is more comprehensive.
[0092] In step S202, a DDK interface test list header file is generated based on the DDK interface test list, and the DDK interface test list header file is saved in the DDK, wherein the DDK interface test list header file is used to implement references to the multiple DDK unit test files.
[0093] It is known that header files are usually files with .h or .hpp extensions. These files contain function declarations, macro definitions, etc., but do not contain specific function files. The form of header files enables it to provide specific function files to other source files without saving the specific function files in the source files, thereby saving the storage space of the source files, reducing the coupling between the source files and the specific implementation function files, and promoting the reuse of function files.
[0094] like Figure 3 As shown, the DDK interface test list is set in the form of a header file, and the DDK interface test list header file is used to implement the reference to multiple DDK unit test files included in the DDK interface test list, so that when the DDK interface test list header file is provided to other files, the multiple DDK unit test files can be referenced.
[0095] In step S203, a reference instruction is set in the board-level driver file, and the set board-level driver file is saved in the DDK. The reference instruction is used to reference the DDK interface test list header file in the set board-level driver file, so that the set board-level driver file can load the multiple DDK unit test files when executed.
[0096] In a specific implementation, a reference instruction is set at the beginning of the board-level driver file, so that when the set board-level driver file is executed, the DDK interface test list header file is referenced through the reference instruction, thereby enabling multiple DDK unit test files to be referenced, such as Figure 3 shown.
[0097] In step S204, the configured DDK is obtained, wherein the configured DDK includes the DDK interface test list header file and the configured board-level driver file.
[0098] In step S205, the set DDK is compiled to obtain a first compiled DDK file.
[0099] Specifically, the DDK storing the DDK interface test list header file and the set board-level driver file is compiled to obtain a first compiled DDK file in binary form, so that when the first compiled DDK file is subsequently provided, the first compiled DDK file can be recognized by the lightweight operating system.
[0100] In step S206, the first compiled DDK file is provided to the lightweight operating system, so that the lightweight operating system can use the first compiled DDK file to perform automated testing of the DDK interface.
[0101] The present disclosure can not only realize automated testing and greatly improve test efficiency, but also verify all DDK interfaces and all functions in the DDK interfaces provided by the lightweight operating system. The test scope is comprehensive, and the test content for the DDK interface can be modified as needed, flexibly adapting to the testing needs of developers.
[0102] According to an embodiment of the present disclosure, an interface test result is obtained from a startup log of the lightweight operating system, and the interface test result is a result obtained by the lightweight operating system executing an automated test of the DDK interface.
[0103] The boot log of the operating system is generated during the system boot process, and it records various events and status information from the system boot to the complete boot process. Since the lightweight operating system performs the automated test of the DDK interface during the kernel boot process, the interface test result will be recorded in the system boot log, and the automated test tool can directly obtain the interface test result of the DDK interface from the boot log.
[0104] According to an embodiment of the present disclosure, after obtaining the interface test result, the DDK interface test list header file and the set board-level driver file in the set DDK are deleted, and the set DDK is restored to the DDK; the DDK is compiled to obtain a second compiled DDK file; and the second compiled DDK file is provided to the lightweight operating system, so that the lightweight operating system can use the second compiled DDK file to achieve system recovery.
[0105] Specifically, in order to avoid affecting the subsequent use of the tested lightweight operating system, it is necessary to perform a system recovery on the lightweight operating system. At this time, the automated testing tool needs to delete the DDK interface test list header file and the set board-level driver file in the set DDK, obtain the DDK, and then compile the DDK to obtain a second compiled DDK file, and provide the second compiled DDK file to the lightweight operating system to achieve system recovery.
[0106] Figure 4 A logic block diagram of an automated testing method for a DDK interface provided by a DDK based on a lightweight operating system according to an embodiment of the present disclosure is shown. The method comprises steps S401 to S405:
[0107] According to an embodiment of the present disclosure, the lightweight operating system is applied to a chip, a kernel of the lightweight operating system is separated from a driver, and a plurality of test points are provided for the DDK interface.
[0108] According to an embodiment of the present disclosure, the DDK interface includes multiple API interfaces.
[0109] According to an embodiment of the present disclosure, one or more test points are set for the API interface, or one or more test points are set for some of the multiple API interfaces.
[0110] According to an embodiment of the present disclosure, the test point is a test range set for a registered function and / or a non-registered function in the API interface.
[0111] The registered function is a function registered in the driver loaded in the kernel startup phase; the unregistered function is a function not registered in the driver loaded in the kernel startup phase.
[0112] Given that the loaded driver has incomplete functions during the registration phase, some functions may be closed or restricted. To this end, the test mechanism disclosed in the present invention can not only effectively test the functions that have been successfully registered in the driver, but also test the closed or restricted functions. This makes the test process more complete, thereby ensuring the overall stability and reliability of the lightweight operating system.
[0113] According to an embodiment of the present disclosure, the loaded driver is a necessary driver, or the loaded driver is a necessary driver and a non-necessary driver.
[0114] In a specific embodiment, the chip may include a microcontroller unit (MCU) in a smart meter, a control chip in an energy controller, a microprocessor in a concentrator, and the like.
[0115] In step S401, an upgrade driver command is used to execute a first compiled DDK file on the lightweight operating system, so that the lightweight operating system is automatically restarted.
[0116] Among them, the first compiled DDK file is obtained by compiling the set DDK, the set DDK includes a set board-level driver file and a DDK test list header file, the DDK test list header file includes a DDK test unit list, the DDK test unit list corresponds to multiple DDK unit test files, the DDK unit test file is used to test the test point, the set board-level driver file includes a reference instruction, and the reference instruction is used to reference the DDK test list header file in the set board-level driver file.
[0117] Figure 5 Show Figure 4 The flowchart of the automatic restart of the lightweight operating system in the automated testing method of the example shown is as follows: Figure 5 As shown, the automatic restart includes steps S402 to S405.
[0118] In step S402, the chip is powered on.
[0119] In step S403, the lightweight operating system enters a booting phase, and an interrupt vector table is constructed in the booting phase.
[0120] It is known that the interrupt vector table is a list of addresses used by the operating system to respond to interrupt requests, each address points to the corresponding interrupt service routine (ISR). Therefore, the interrupt vector table is an indispensable part of the operating system, which allows the system to effectively respond to and handle interrupts.
[0121] In step S404, after the interrupt vector table is constructed, the lightweight operating system enters the kernel startup phase.
[0122] In step S405, during the kernel startup phase, the driver is loaded, the set board-level driver file is executed, the DDK test list header file is referenced by the reference instruction in the set board-level driver file, and the multiple DDK unit test files are loaded; the hardware initialization function is called to execute the multiple DDK unit test files, and the multiple test points set for the DDK interface are tested to obtain the interface test results of the DDK interface, and the interface test results are saved in the startup log of the lightweight operating system.
[0123] In detail, during the kernel startup phase, the driver is loaded, the set board-level driver file is executed, and the DDK test list header file is referenced through the reference instructions therein to load multiple DDK unit test files in the set board-level driver file, so that when the hardware initialization function is called, the loaded multiple DDK unit test files can be executed to implement testing of multiple test points.
[0124] The present disclosure executes the compiled DDK file including the set board-level driver file in the lightweight operating system, so that the lightweight operating system can also perform automated testing of the DDK interface during the restart process, in the kernel startup phase, and until the end of the non-essential driver loading process, with a wide test range, high test efficiency, and more flexible test content. At the same time, batch testing of a wide variety of test points can also be achieved, further improving the test efficiency.
[0125] Figure 6 A structural block diagram of an automated testing tool according to an embodiment of the present disclosure is shown, wherein the automated testing tool is used to implement automated testing of a DDK interface of a lightweight operating system, wherein the automated testing tool runs on a computer, and the DDK interface is provided by the DDK for the lightweight operating system.
[0126] like Figure 6 As shown, the automated testing tool 600 includes: a first acquisition module 610 , a generation module 620 , a setting module 630 , a second acquisition module 640 , a first compilation module 650 and a providing module 660 .
[0127] The first acquisition module 610 is configured to acquire a DDK interface test list according to a user input, wherein the DDK interface test list corresponds to a plurality of DDK unit test files, and the DDK unit test files are used to test corresponding test points among a plurality of test points set for the DDK interface;
[0128] The generating module 620 is configured to generate a DDK interface test list header file based on the DDK interface test list, and save the DDK interface test list header file in the DDK, wherein the DDK interface test list header file is used to implement references to the multiple DDK unit test files;
[0129] The setting module 630 is configured to set a reference instruction in the board-level driver file, and save the set board-level driver file in the DDK, wherein the reference instruction is used to reference the DDK interface test list header file in the set board-level driver file, so that the set board-level driver file can load the multiple DDK unit test files when executed;
[0130] The second acquisition module 640 is configured to acquire the set DDK, wherein the set DDK includes the DDK interface test list header file and the set board-level driver file;
[0131] The first compiling module 650 is configured to compile the set DDK to obtain a first compiled DDK file;
[0132] The providing module 660 is configured to provide the first compiled DDK file to the lightweight operating system, so that the lightweight operating system can use the first compiled DDK file to perform automated testing of the DDK interface.
[0133] According to an embodiment of the present disclosure, it also includes: a third acquisition module, configured to obtain an interface test result from the startup log of the lightweight operating system, wherein the interface test result is a result obtained by the lightweight operating system executing an automated test of the DDK interface.
[0134] According to an embodiment of the present disclosure, the method further includes: a second compilation module configured to:
[0135] After obtaining the interface test result, the DDK interface test list header file and the set board-level driver file in the set DDK are deleted, and the set DDK is restored to the DDK; the DDK is compiled to obtain a second compiled DDK file; and the second compiled DDK file is provided to the lightweight operating system, so that the lightweight operating system can use the second compiled DDK file to achieve system recovery.
[0136] Figure 7 A structural block diagram of an automated testing device for a DDK interface provided by DDK based on a lightweight operating system according to an embodiment of the present disclosure is shown, wherein the automated testing device is applied to a lightweight operating system in which a kernel and a driver are separated, the lightweight operating system is applied to a chip, and a plurality of test points are provided for the DDK interface. The device 700 includes an automatic restart module 710, and the automatic restart module 710 includes a power-on module 720, a boot module 730, a kernel startup module 740, and a system recovery module 750.
[0137] The automatic restart module 710 is configured to: use the upgrade driver command on the lightweight operating system to execute the first compiled DDK file, so that the lightweight operating system automatically restarts, wherein the first compiled DDK file is obtained by compiling the set DDK, the set DDK includes a set board-level driver file and a DDK test list header file, the DDK test list header file includes a DDK test unit list, the DDK test unit list corresponds to multiple DDK unit test files, the DDK unit test file is used to test the test point, and the set board-level driver file includes a reference instruction, and the reference instruction is used to reference the DDK test list header file in the set board-level driver file.
[0138] In the automatic restart module 710:
[0139] The power-on module 720 is configured to power on the chip;
[0140] The boot module 730 is configured to enter the boot phase of the lightweight operating system and to construct an interrupt vector table in the boot phase;
[0141] The kernel startup module 740 is configured to, after the interrupt vector table is constructed, the lightweight operating system enters the kernel startup phase; in the kernel startup phase, load the driver, execute the set board-level driver file, reference the DDK test list header file through the reference instruction in the set board-level driver file, and load the multiple DDK unit test files; call the hardware initialization function to execute the multiple DDK unit test files, test the multiple test points set for the DDK interface, and obtain the interface test results of the DDK interface, and the interface test results are saved in the startup log of the lightweight operating system.
[0142] The system recovery module 750 is configured to: after obtaining the interface test result of the DDK interface, use the upgrade driver command on the lightweight operating system to execute a second compiled DDK file, so that the lightweight operating system restarts again to achieve system recovery, wherein the second compiled DDK file is a file obtained by compiling after deleting the set board-level driver file and the DDK test list header file included in the set DDK.
[0143] According to an embodiment of the present disclosure, the DDK interface includes multiple API interfaces.
[0144] According to an embodiment of the present disclosure, the first compiled DDK file and the second compiled DDK file are binary files.
[0145] The present disclosure also provides an automated testing system for the DDK interface provided by the DDK for a lightweight operating system, characterized by comprising: the automated testing tool as described above and the automated testing device based on the lightweight operating system for the DDK interface provided by the DDK as described above.
[0146] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0147] The units or modules involved in the embodiments described in the present disclosure may be implemented by software or programmable hardware. The units or modules described may also be set in a processor, and the names of these units or modules do not constitute limitations on the units or modules themselves in some cases.
[0148] As another aspect, the present disclosure further provides a computer-readable storage medium, which may be a computer-readable storage medium included in the electronic device or computer system in the above embodiment; or a computer-readable storage medium that exists independently and is not assembled into a device. The computer-readable storage medium stores one or more programs, and the programs are used by one or more processors to execute the method described in the present disclosure.
[0149] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present disclosure is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other.
Claims
1. A method for realizing automatic testing of driver development kit DDK interface of lightweight operating system by using automatic testing tool, It is characterized in that The automated testing tool runs on a computer, the DDK interface is provided by the DDK for a lightweight operating system, and the method includes using the automated testing tool to perform the following steps: Acquire a DDK interface test list according to user input, wherein the DDK interface test list corresponds to a plurality of DDK unit test files, and the DDK unit test files are used to test corresponding test points among a plurality of test points set for the DDK interface; Generate a DDK interface test list header file based on the DDK interface test list, and save the DDK interface test list header file in the DDK, wherein the DDK interface test list header file is used to implement references to the multiple DDK unit test files; Setting a reference instruction in a board-level driver file, and saving the set board-level driver file in the DDK, wherein the reference instruction is used to reference the DDK interface test list header file in the set board-level driver file, so that the set board-level driver file can load the multiple DDK unit test files when executed; Obtaining a set DDK, wherein the set DDK includes the DDK interface test list header file and the set board-level driver file; Compile the set DDK to obtain a first compiled DDK file; The first compiled DDK file is provided to the lightweight operating system, so that the lightweight operating system can use the first compiled DDK file to perform automated testing of the DDK interface.
2. The method according to claim 1, It is characterized in that Also includes: An interface test result is obtained from the startup log of the lightweight operating system, where the interface test result is a result obtained by the lightweight operating system executing an automated test of the DDK interface.
3. The method according to claim 2, It is characterized in that Also includes: After obtaining the interface test result, deleting the DDK interface test list header file and the set board-level driver file in the set DDK, and restoring the set DDK to the DDK; Compile the DDK to obtain a second compiled DDK file; The second compiled DDK file is provided to the lightweight operating system, so that the lightweight operating system can implement system recovery by using the second compiled DDK file.
4. The method according to claim 1, Features: The DDK interface includes a plurality of application programming API interfaces; The multiple test points set for the DDK interface include: one or more test points set for the API interface, or one or more test points set for some of the multiple API interfaces.
5. The method according to claim 4, It is characterized in that The DDK interface includes an API interface of a necessary driver and an API interface of a non-essential driver provided by the DDK to the lightweight operating system.
6. An automated testing method for the DDK interface provided by DDK based on a lightweight operating system. It is characterized in that The lightweight operating system is applied to a chip, the kernel of the lightweight operating system is separated from the driver, a plurality of test points are set for the DDK interface, and the method includes: The lightweight operating system is automatically restarted by executing a first compiled DDK file using an upgrade driver command, wherein the first compiled DDK file is obtained by compiling a set DDK, the set DDK includes a set board-level driver file and a DDK test list header file, the DDK test list header file includes a DDK test unit list, the DDK test unit list corresponds to a plurality of DDK unit test files, the DDK unit test file is used to test the test point, the set board-level driver file includes a reference instruction, the reference instruction is used to reference the DDK test list header file in the set board-level driver file, and the automatic restart includes: Powering on the chip; The lightweight operating system enters a booting phase, and an interrupt vector table is constructed in the booting phase; After the interrupt vector table is constructed, the lightweight operating system enters the kernel startup phase; During the kernel startup phase, the driver is loaded, the set board-level driver file is executed, the DDK test list header file is referenced by the reference instruction in the set board-level driver file, and the multiple DDK unit test files are loaded; the hardware initialization function is called to execute the multiple DDK unit test files, and the multiple test points set for the DDK interface are tested to obtain the interface test results of the DDK interface, and the interface test results are saved in the startup log of the lightweight operating system.
7. The method according to claim 6, It is characterized in that After obtaining the interface test result of the DDK interface, an upgrade driver command is used on the lightweight operating system to execute a second compiled DDK file, so that the lightweight operating system is restarted again to achieve system recovery, wherein the second compiled DDK file is a file obtained by compiling after deleting the set board-level driver file and the DDK test list header file included in the set DDK.
8. The method according to claim 6, Features: The DDK interface includes multiple API interfaces; The multiple test points are set for the DDK interface, including: setting one or more test points for the API interface, or setting one or more test points for some of the multiple API interfaces.
9. The method according to claim 8, It is characterized in that The test point is a test range set for the registration function and / or non-registration function in the API interface.
10. The method according to claim 9, Features: The registration function is a function registered in the driver loaded during the kernel startup phase; The unregistered function is a function that is not registered in the driver loaded during the kernel startup phase.
11. The method according to claim 10, It is characterized in that The loaded driver is a necessary driver, or the loaded driver is a necessary driver and a non-necessary driver.
12. An automated testing tool, the automated testing tool is used to implement automated testing of the DDK interface of a lightweight operating system, It is characterized in that The automated testing tool runs on a computer, the DDK interface is provided by the DDK for a lightweight operating system, and the automated testing tool includes: A first acquisition module is configured to acquire a DDK interface test list according to a user input, wherein the DDK interface test list corresponds to a plurality of DDK unit test files, and the DDK unit test files are used to test corresponding test points among a plurality of test points set for the DDK interface; A generating module, configured to generate a DDK interface test list header file based on the DDK interface test list, and save the DDK interface test list header file in the DDK, wherein the DDK interface test list header file is used to implement references to the multiple DDK unit test files; A setting module is configured to set a reference instruction in a board-level driver file, and save the set board-level driver file in the DDK, wherein the reference instruction is used to reference the DDK interface test list header file in the set board-level driver file, so that the set board-level driver file can load the multiple DDK unit test files when executed; A second acquisition module is configured to acquire a set DDK, wherein the set DDK includes the DDK interface test list header file and the set board-level driver file; A first compiling module is configured to compile the set DDK to obtain a first compiled DDK file; A providing module is configured to provide the first compiled DDK file to the lightweight operating system, so that the lightweight operating system can perform automated testing of the DDK interface using the first compiled DDK file.
13. The automated testing tool according to claim 12, It is characterized in that Also includes: The third acquisition module is configured to acquire an interface test result from the startup log of the lightweight operating system, where the interface test result is a result obtained by the lightweight operating system executing an automated test of the DDK interface.
14. The automated testing tool according to claim 12, It is characterized in that Also includes: The second compilation module is configured as follows: After obtaining the interface test result, deleting the DDK interface test list header file and the set board-level driver file in the set DDK, and restoring the set DDK to the DDK; Compile the DDK to obtain a second compiled DDK file; The second compiled DDK file is provided to the lightweight operating system, so that the lightweight operating system can implement system recovery by using the second compiled DDK file.
15. An automated testing device for the DDK interface provided by DDK based on a lightweight operating system, It is characterized in that The automated testing device is applied to a lightweight operating system in which a kernel and a driver are separated, the lightweight operating system is applied to a chip, and a plurality of test points are set for the DDK interface. The device comprises: an automatic restart module, configured to execute a first compiled DDK file using an upgrade driver command on the lightweight operating system, so that the lightweight operating system automatically restarts, wherein the first compiled DDK file is obtained by compiling a set DDK, the set DDK includes a set board-level driver file and a DDK test list header file, the DDK test list header file includes a DDK test unit list, the DDK test unit list corresponds to a plurality of DDK unit test files, the DDK unit test file is used to test the test point, and the set board-level driver file includes a reference instruction, the reference instruction is used to reference the DDK test list header file in the set board-level driver file; The automatic restart module comprises: A power-on module, configured to power on the chip; A boot module, configured to enable the lightweight operating system to enter a boot phase and to construct an interrupt vector table in the boot phase; The kernel startup module is configured to, after the interrupt vector table is constructed, the lightweight operating system enters the kernel startup phase; in the kernel startup phase, load the driver, execute the set board-level driver file, reference the DDK test list header file through the reference instruction in the set board-level driver file, and load the multiple DDK unit test files; call the hardware initialization function to execute the multiple DDK unit test files, test the multiple test points set for the DDK interface, and obtain the interface test results of the DDK interface, and the interface test results are saved in the startup log of the lightweight operating system.
16. The device according to claim 15, It is characterized in that Also includes: The system recovery module is configured as follows: After obtaining the interface test result of the DDK interface, an upgrade driver command is used on the lightweight operating system to execute a second compiled DDK file, so that the lightweight operating system is restarted again to achieve system recovery, wherein the second compiled DDK file is a file obtained by compiling after deleting the set board-level driver file and the DDK test list header file included in the set DDK.
17. The device according to claim 15, Features: The DDK interface includes multiple API interfaces; The first compiled DDK file is a binary file.
18. An automated testing system for the DDK interface provided by DDK for lightweight operating systems. It is characterized in that include: The automated testing tool as claimed in any one of claims 12 to 14 and the device as claimed in any one of claims 15 to 17.
19. A computer-readable storage medium having computer instructions stored thereon, It is characterized in that When the computer instructions are executed by a processor, the method according to any one of claims 1 to 11 is implemented.
20. A computer program product, comprising computer instructions, which implement the method according to any one of claims 1 to 11 when executed by a processor.
Citation Information
Patent Citations
Automatic compilation testing method and automatic compilation testing platform for realizing same
CN103530225A
Automatic testing system and method both applicable to compiler in logical configuration software
CN104516818A
Testing software integration frame and method for processing testing data
CN105138462A
A lightweight device control method
CN109582376A
Automated generation of a test class pre-header from an interactive graphical user interface
US20140324378A1
