Test method and device, electronic equipment and storage medium
By using the collaborative work of the task management module and the test module in the 5G physical layer software module test to control the sleep state of the test thread to start the next test phase, the inefficiency problem caused by the fixed time of the test phase is solved and more efficient is achieved testing process.
Patent Information
- Application Number
- CN202310325469.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-29
- Publication Date
- 2024-10-01
AI Technical Summary
In the 5G physical layer software module testing, the time length of the test phase in the existing technology is fixed, resulting in too little time to complete the task or excessive idle time after completion, resulting in low test efficiency.
Determine the test tasks of the current test phase through the task management module, control multiple test threads to be in the working state, when the test thread switches from the working state to the dormant state, send instruction information to the task management module, and start the next test stage based on this information Test tasks to avoid waiting too long.
It shortens the test time, improves the test efficiency, and avoids waste caused by being too late to complete the task within a fixed time period or waiting for too long.
Smart Images

Figure CN118733422A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and in particular to a testing method, device, electronic equipment and storage medium. Background Art
[0002] At present, the physical layer software module test of the fifth generation mobile communication technology (5th Generation Mobile Communication Technology, 5G) is a pure software method to verify the correctness of the physical layer software. It does not rely on specific hardware and only requires a Linux server with an ordinary compiler to compile and execute. This test method is convenient and fast. However, during the test process, the time length T of each test phase is a fixed empirical value. If T is too small, the task will not be completed in time. If T is too large, too much idle time will be generated after the task is completed, wasting time and resulting in low test efficiency. Summary of the invention
[0003] Embodiments of the present application provide a testing method, device, electronic device, and storage medium.
[0004] The technical solution of this application is implemented as follows:
[0005] The present application provides a testing method, including:
[0006] Determine the test task of the current test phase through the task management module; the test task includes multiple test threads;
[0007] Control the multiple test threads to be in working state and process the test tasks through the test module;
[0008] In the case where the multiple test threads are switched from the working state to the sleeping state, the test module sends instruction information to the task management module; the instruction information is used to instruct the multiple test threads to switch from the working state to the sleeping state;
[0009] Through the task management module, based on the indication information, the test task of the next test phase is started; the end time of the current test phase is the moment when the multiple test threads switch from the working state to the sleeping state, and the test duration of the current test phase is greater than or equal to or less than the preset duration, and the preset duration is the duration of each configured test phase.
[0010] The present application provides a testing device, including:
[0011] A task management module, configured to determine a test task for a current test phase; the test task includes a plurality of test threads;
[0012] A test module, configured to control the multiple test threads to be in a working state and process the test task;
[0013] The test module is further configured to send indication information to the task management module when the multiple test threads are switched from the working state to the sleeping state; the indication information is used to instruct the multiple test threads to switch from the working state to the sleeping state;
[0014] The task management module is also configured to start the test task of the next test phase based on the indication information; the end time of the current test phase is the moment when the multiple test threads switch from the working state to the sleeping state, and the test duration of the current test phase is greater than or equal to or less than equal to the preset duration, and the preset duration is the duration of each configured test phase.
[0015] An embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor to execute the test method provided above.
[0016] An embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and the computer program enables a computer to execute the test method provided above.
[0017] In the technical solution provided in some embodiments of the present application, when multiple test threads are switched from a working state to a dormant state, an indication message is sent to a task management module through a test module, and the test task of the next test phase is started through the task management module based on the indication message. In this way, after knowing that all threads have entered a dormant state, the test task of the current test phase is ended through the task management module, and the test task of the next test phase is directly started, so as to avoid not being able to complete the test task of the current test phase in time within a fixed time T, or waiting for too long after completing the test task of the current test phase, thereby shortening the test time and further improving the test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 A physical layer test structure diagram provided for an embodiment of the present application;
[0019] Figure 2 A test method provided in the embodiment of the present application is shown in FIG. Figure 1 ;
[0020] Figure 3 A test method process provided for the embodiment of the present application Figure 1 ;
[0021] Figure 4 A test method provided in the embodiment of the present application is shown in FIG. Figure 2 ;
[0022] Figure 5 A test method process provided for the embodiment of the present application Figure 2 ;
[0023] Fig. 6A A time engine implementation method 1 provided in an embodiment of the present application;
[0024] Figure 6B A second time engine implementation method provided in an embodiment of the present application;
[0025] Figure 7 A test method process provided for the embodiment of the present application Figure 3 ;
[0026] Figure 8 A schematic diagram of the structure of a testing device provided in an embodiment of the present application;
[0027] Fig. 9 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] The following will describe the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0029] To facilitate understanding of the technical solutions of the embodiments of the present application, the relevant technologies of the embodiments of the present application are described below. The following related technologies can be arbitrarily combined with the technical solutions of the embodiments of the present application as optional solutions, and they all belong to the protection scope of the embodiments of the present application.
[0030] In addition, in the embodiments of the present application, "first", "second", etc. are used to distinguish similar objects and are not necessarily used for a specific order or sequence.
[0031] At present, the 5G New Radio (NR) physical layer host test is a pure software method to verify the correctness of the physical layer software. The advantage of this method is that it does not rely on specific hardware or third-party testing tools. It only requires an ordinary multi-core Linux server with an ordinary compiler to compile and execute. The test is convenient and fast. Developers can execute commands to see the effect of protocol implementation in the gap between writing code.
[0032] The physical layer software is usually stored in the final product as "firmware", accepts the command of the upper-layer software Radio Resource Control (RRC), provides physical layer services for the upper-layer software, converts the upper-layer request into the underlying control command, and sends messages to control the underlying data processing unit of the chip to perform data diversion, encoding and decoding, control signaling response, transparent transmission, protocol status maintenance and other functions. The peripheral module promotes the work of the physical layer software by sending messages and triggering interrupts.
[0033] In the Host test test architecture, the test architecture needs to simulate the upper-layer RRC software and the underlying data processing unit for stubbing simulation. During the test, the test architecture analyzes the plot designed in the test case, feeds messages to the physical layer on time and in quantity, and checks whether the response message of the physical layer meets expectations.
[0034] The CPU used by Host Test is X86, which is not the type in the final product. Therefore, Host Test focuses on the correctness of business logic implementation and cannot accurately check performance issues. Host Test uses flexible and changeable scenario design to list as many encounters as possible when the physical layer works to solve the problem of whether the physical layer code logic is correctly implemented.
[0035] refer to Figure 1 As shown, Figure 1 This is a physical layer test structure diagram, in which the physical layer test is carried out through the message interaction between the test architecture and the physical layer software (test object). The test object can read the value of the system chip (STC) counter through the underlying software interface. STC is a 64-bit counter. In actual products, the chip hardware will continue to increase the STC value at a certain frequency and at a uniform rate. In the Long Time Evolution (LTE) system and the New Radio (NR) system, STC will be used as the basis for time calculation. The concepts of symbol, slot, and frame are all converted based on STC. In the Host test system, the task management module thread will repeat the following operations over and over again: "Increase the STC value, call the time (timer) callback function, and then sleep for a time T. It is estimated that within the time T, the threads of the test architecture and the threads of the test object can complete the work that needs to be completed and enter the sleep state. After that, the task management module thread wakes up again and increases the STC value..."
[0036] Figure 1The task management module can use STC to schedule Timer events. When a scheduled event occurs, a corresponding Timer interrupt will be generated, and the interrupt notification will be used to interrupt the test architecture of the test module and the status of the test thread in the physical layer software.
[0037] refer to Figure 2 As shown, Figure 2 It is a schematic diagram of the physical layer test of the prior art. When performing the physical layer test in the prior art, the threads are distributed in different time grids, such as Figure 2 There are three time grids in it, namely 0-1, 1-2, and 2-3. Each time grid is a fixed time length T. The thread that completes the test task needs to complete the work within the time length T. When T is too small, the current task will not be completed, and the next task will come one after another. The object under test and the test architecture will not have time to respond, resulting in unexpected execution effects, thus affecting the execution effect; when T is too large, there will be too many idle time periods after the thread completes the work, such as Figure 2 After the threads 0, 1, and 2 are completed, there is still some system idle time left, which wastes time and leads to low test efficiency.
[0038] Based on the problems existing in the prior art, an embodiment of the present application provides a testing method, in which, when multiple test threads in the current test phase switch from a working state to a sleeping state, an indication message is sent to a task management module through a test module, and the task management module ends the test task of the current test phase based on the indication message, and starts the test task of the next test phase. In this way, after knowing that all threads have entered the sleeping state, the test task of the next test phase is immediately started through the task management module, avoiding waiting for a period of time after the test task of the current test phase is completed before starting the test task of the next test phase, thereby shortening the test time and further improving the test efficiency.
[0039] The test method provided in the embodiment of the present application can be applied to the physical layer development and testing process of the 5G chip modem (Modem), and can also be used in LTE-related development. Among them, time jumping may be performed in the module testing of the 5G chip Modem physical layer. If the CPU utilization in the test architecture is always very high, the virtual time growth is not uniform, and the virtual time jumps on demand, it means that the 5G chip Modem physical layer uses time jumping technology for module testing.
[0040] The electronic device provided in the embodiments of the present application can be applied to any intelligent electronic device such as laptop computers, tablet computers, desktop computers, mobile devices (for example, mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), intelligent robots, smart home appliances, and smart vehicle-mounted devices, and the embodiments of the present application do not make specific limitations.
[0041] Figure 3 A flow chart of a test method provided in the embodiment of the present application, refer to Figure 3 As shown, the test methods include:
[0042] Step S110: determining the test task of the current test phase through the task management module; the test task includes multiple test threads.
[0043] In the embodiment of the present application, the task management module manages the test tasks of the current test phase in the system. The test tasks of the current test phase are determined through the task management module. It can be understood that the test tasks that need to be performed in the current test phase can be determined through the task management module.
[0044] In computer programs or software, testing is a technique for accessing software program functionality, wherein testing may be performed during the development process to find and fix defects, or may not be started until the development process is completed, and the embodiments of the present application do not specifically limit this.
[0045] Test threads are used to determine whether an application can run a specific task or thread. Test threads are implemented in a program. Test tasks can be test threads in the test architecture or test threads in the object under test. Test threads can be various scenarios simulated by the test architecture or the response of the physical layer software to simulated scenarios.
[0046] In order to test the physical layer more comprehensively, the test architecture will simulate many scenarios of the physical layer software at work and send them to the physical layer software (the object under test) to check whether the response of the physical layer software meets expectations. When the physical layer software responds to the scenarios simulated by the test architecture, message interaction is required between the test architecture and the physical layer software. Multiple test threads may appear in the same test phase. After determining the test tasks of the current test phase, multiple test threads can be included in the current test task.
[0047] In the embodiment of the present application, after the test tasks of the current test phase are determined through the task management module, multiple test threads of the current test phase are obtained.
[0048] Step S120: Control the multiple test threads to be in a working state and process the test task through the test module.
[0049] The working status of the test thread refers to the status that needs to occupy the CPU, such as creation, ready, running, blocking and other states that need to occupy the CPU. When the test thread is in any state of creation, ready, running, or blocking, it can be determined that the test thread is in a working state and is occupying the CPU. The embodiment of the present application does not specifically limit the form of the working status.
[0050] In an embodiment of the present application, after determining multiple test threads of the current test phase through the task management module, the test module controls the multiple test threads to enter the working state, so that the test tasks of the current test phase are processed through message interaction between the test architecture and the physical layer software.
[0051] In an embodiment of the present application, after determining multiple test threads in the current test phase through the task management module, when the test module controls the test threads to be in a working state, the test threads can be executed sequentially or multiple test threads can be executed in parallel at the same time. This application does not specifically limit the way in which the test module handles the test threads.
[0052] In the embodiment of the present application, the physical layer test only needs to focus on whether the response message of the physical layer meets expectations, and there is no need to check performance issues. The embodiment of the present application does not make specific limitations on this.
[0053] Step S130: When the multiple test threads are switched from the working state to the sleeping state, an indication message is sent to the task management module through the test module; the indication message is used to instruct the multiple test threads to switch from the working state to the sleeping state.
[0054] In the embodiment of the present application, the test thread is in a dormant state, which means that the test thread does not occupy the CPU. When the test thread is not in the creation, ready, running, blocked and other states, it does not perform any operation and does not need to occupy the CPU. When the test thread is in a dormant state, the test thread will stop executing for a corresponding time, but its monitor will not stop monitoring. After a period of time, the test thread will resume running. That is to say, the test thread will be in a dormant state after the current test phase is completed, and the test thread may resume running in the next test phase.
[0055] In the embodiment of the present application, different test threads may complete their work at different times, and each test thread may enter a dormant state at different times. Optionally, the present application may execute multiple test threads in parallel, so that the times at which the multiple test threads enter a dormant state may be different, or may execute multiple test threads in sequence, so that the times at which the multiple test threads enter a dormant state are the same, which is not specifically limited in the embodiment of the present application.
[0056] In an embodiment of the present application, the test module controls multiple test threads to be in a working state and processes test tasks. When the test thread completes the work in the current test phase, the test thread will enter a sleep state and stop working. When all test threads among multiple test threads switch from a working state to a sleep state, the test module sends an indication message to the task management module to notify the task management module to switch multiple test threads from a working state to a sleep state.
[0057] Step S140: Through the task management module, based on the indication information, start the test task of the next test phase; the end time of the current test phase is the moment when the multiple test threads switch from the working state to the sleeping state, and the test duration of the current test phase is greater than or equal to or less than the preset duration, and the preset duration is the duration of each configured test phase.
[0058] In an embodiment of the present application, after the task management module receives the indication information sent by the test module indicating that multiple test threads have entered a dormant state, it indicates that the test task of the current test phase is completed, and the task management module starts the test task of the next test phase.
[0059] Among them, the end time of the current test phase is the moment when multiple test threads switch from the working state to the sleeping state. If the test duration of the current test phase is greater than or equal to the preset duration, it means that the time required to complete the work of the test thread of the current test phase is greater than or equal to the preset duration. When the test duration of the current test phase reaches or exceeds the preset duration, the test thread of the current test phase will continue to execute until multiple test threads complete their work, then the current test phase will be ended and the test task of the next test phase will be started; if the test duration of the current test phase is less than the preset duration, it means that the time required to complete the work of the test thread of the current test phase is less than or equal to the preset duration. After multiple test threads complete their work in the current test phase, if the preset duration has not been reached, the remaining preset duration will be skipped and the test task of the next test phase will be directly started.
[0060] In the embodiment of the present application, the preset duration can be set in advance by the object under test before leaving the factory, or it can be obtained by averaging the time required for the test personnel to obtain the test results for multiple tests during the test process. The embodiment of the present application does not specifically limit the value of the preset duration.
[0061] In an embodiment of the present application, the test task of the current test phase is determined through the task management module, and multiple test threads are obtained. The test module controls the multiple test threads to enter the working state and process the test tasks. When multiple test threads switch from the working state to the sleeping state, the test module sends an indication message to the task management module to notify the task management module that the multiple test threads enter the sleeping state. The test task of the current test phase is completed, and the task management module starts the test task of the next test phase. When all test threads switch from the working state to the sleeping state, the test module sends an indication message to the task management module, and the task management module starts the test task of the next test phase based on the indication message.
[0062] Exemplarily, the test method in the embodiment of the present application is a cyclically repeated process, and it is necessary to test the test tasks of n test phases, where n is an integer greater than 1. For example, after determining the test tasks of the i-th test phase through the task management module, multiple test threads of the i-th test phase are obtained, and the test module is used to control the multiple test threads to be in a working state and process the test tasks. When the multiple test threads of the i-th test phase are switched from the working state to the sleeping state, the test module sends an indication message to the task manager, indicating that the test threads of the i-th test phase are switched from the working state to the sleeping state. After receiving the indication message, the task manager starts The test task of the i+1th test phase; after continuing to determine the test task of the i+1th test phase through the task management module, multiple test threads of the i+1th test phase are obtained, and the multiple test threads are controlled to be in a working state through the test module to process the test tasks. When the multiple test threads of the i+1th test phase are switched from the working state to the sleeping state, the test module sends an indication message to the task manager to instruct the test thread of the i+1th test phase to switch from the working state to the sleeping state. After receiving the indication message, the task manager starts the test task of the i+2th test phase; repeat the above operation until the preset test phase n is reached. i is a positive integer less than n.
[0063] In this way, after knowing that all threads have entered the dormant state, the test tasks of the next test phase are started through the task management module to avoid not being able to complete the test tasks of the current test phase within the fixed time T or waiting for too long, thereby shortening the test time and further improving the test efficiency.
[0064] Exemplary, reference Figure 4, when all test threads in multiple test threads switch from working state to sleeping state, the system starts to be silent. When the system starts to be silent, the test module sends an indication message to the task management module to notify the task management module that the system starts to be silent. The task management module directly jumps the remaining time according to the system silent start time and starts the next time grid. By knowing the system silent start time, the task management module directly ends the test task of the current time grid and starts the next time grid, which greatly shortens the time, thereby improving the test efficiency and further improving the production efficiency.
[0065] In the embodiment of the present application, step S110, determining the test task of the current test phase through the task management module, can be implemented in the following manner:
[0066] The task management module determines the test task of the current test phase based on the mapping relationship; the mapping relationship is used to indicate the corresponding relationship between the current test phase and the test task.
[0067] In the embodiment of the present application, the task management module includes a time engine (Time Engine) thread, and the Time Engine thread uses the STC counter for timing. The task management module determines the test tasks of the current test phase based on the correspondence between the STC and the test tasks. For example, when the STC is 100, the current test phase is 100. According to the mapping relationship, the STC is 100, and the test tasks are determined to be thread 0, thread 1, and thread 2; when the STC is 200, the current test phase is 200. According to the mapping relationship, the STC is 200, and the test tasks are determined to be thread 3, thread 4, and thread 5.
[0068] In an embodiment of the present application, the mapping relationship can be set in advance by the tester in the task management module. The tester can randomly set the mapping relationship according to the length of the test thread and the content of the test thread. The embodiment of the present application does not specifically limit the mapping relationship.
[0069] In an embodiment of the present application, a mapping relationship between the current test phase and the test task is pre-set in the task management module, and the test task of the current test phase is determined based on the mapping relationship. Through the mapping relationship set in advance, many test threads are divided into different phases to avoid system crashes due to too many test threads during the test process and inability to process test tasks.
[0070] In the embodiment of the present application, in step S120, the test module is used to control the multiple test threads to be in a working state and process the test task. The method further includes:
[0071] Sending a notification message to the test module through the task management module; the notification message is used to indicate the multiple test threads;
[0072] Through the test module, the multiple test threads are controlled to be in a working state to process the test task.
[0073] In an embodiment of the present application, after determining multiple test threads of the current test phase based on the mapping relationship through the task management module, the task management module sends a notification message to the test module, indicating the multiple test threads that the test module needs to execute.
[0074] In an embodiment of the present application, the notification message sent by the task management module may include the identifiers of multiple determined test threads, or may be an interrupt notification including multiple test threads, wherein the interrupt notification is used to wake up the multiple determined test threads. The embodiment of the present application does not specifically limit the form of the notification message.
[0075] In an embodiment of the present application, the test module receives a notification message sent by the task management module, controls multiple test threads to be in a working state, and processes the test tasks.
[0076] In an embodiment of the present application, after the task management module determines multiple test threads, it sends a notification message to the test module, instructing the test module to control the determined multiple test threads to enter a working state and process the test task. In this way, a notification message is sent to the test module through the task management module to control the test thread to enter a working state, thereby avoiding the tester from manually triggering the test thread and improving the test efficiency.
[0077] In the embodiment of the present application, the notification message can be sent by the task management module calling a timer callback function at a certain time.
[0078] The callback function is defined and implemented by the tester in a certain form. The address of a function written by the tester is passed as a parameter to another function. When a certain event occurs, the callback function is called by the system or another function. For example, in the embodiment of the present application, the callback function can be a function pre-defined by the tester to wake up the test thread, or a function that performs other operations on the test thread. The certain event in the embodiment of the present application can be that the STC reaches a certain time point (i.e., another function), and the address of the function written by the tester to wake up the test thread is passed as a parameter to another function.
[0079] It can be understood that the timer callback function when the time comes means that when the STC reaches a certain time point (satisfies the time function), the callback function needs to be called to wake up the test thread or perform other operations on the test thread.
[0080] The callback function can be used for notification mechanism. For example, a timer is set in the time engine thread. When a certain time comes, the program will get the corresponding notification, but the implementer of the notification mechanism knows nothing about the program. At this time, a function pointer with a specific prototype is needed to perform callback to notify the program that the event has occurred.
[0081] In another embodiment of the present application, the tester sets the time function and the callback function in the time engine thread in advance. The time function includes the correspondence between the STC and the callback function. The callback function includes a function for waking up the test thread or a function for performing other operations on the test thread. The address of the callback function is passed to the time function as a parameter.
[0082] In an embodiment of the present application, when STC satisfies the time function, a callback function for waking up the test thread will be called, and the callback function will send an interrupt notification. After the test module receives the interrupt notification, it will interrupt the sleep state of multiple test threads, control the multiple test threads to be in a working state, and process the test tasks of the current test phase.
[0083] By using the timer callback function to send an interrupt notification, wake up the test thread or perform other operations on the test thread, it is more convenient and faster during the test process, and the operation of the test thread can be changed by directly modifying the callback function.
[0084] In the embodiments of this application, reference Figure 5 As shown, step S130, when the multiple test threads are switched from the working state to the sleeping state, sending indication information to the task management module through the test module includes:
[0085] Step S131: when any one of the multiple test threads is switched from a working state to a sleeping state, determining whether the remaining test threads of the multiple test threads are in a working state.
[0086] Step S132: If the remaining test threads among the multiple test threads are in a working state, continue to process the test tasks of the current test phase; if the remaining test threads among the multiple test threads are not in a working state, send indication information to the task management module.
[0087] In an embodiment of the present application, when any one of the multiple test threads switches from a working state to a sleeping state, it is determined whether the remaining test threads among the multiple test threads are in a working state. If the remaining test threads are in a working state, the test tasks of the current test phase continue to be processed; if the remaining test threads are all in a sleeping state, an indication message is sent to the task manager module to instruct the multiple test threads to enter a sleeping state.
[0088] In an embodiment of the present application, the test module may include a thread scheduler. The thread scheduler is a program resident in the memory that continuously scans the thread queue and uses specific algorithms, such as time slice rotation, priority scheduling, multi-level feedback queue scheduling, etc. to find a thread that has more CPU usage rights than the thread currently occupying the CPU, and reclaims the processor from the previous thread, and then allows the thread to be run to occupy the processor.
[0089] When multiple test threads are switched from the working state to the sleeping state, the thread scheduler in the test module sends an indication message to the task management module to notify the task management module that the multiple test threads are all in the sleeping state.
[0090] The thread scheduler in the embodiment of the present application sends indication information in the form of a semaphore S, an electromagnetic wave, or other indication signals indicating that multiple test threads have entered a sleep state. For example, the number 1 indicates that multiple test threads have entered a sleep state. The present application does not specifically limit the form of the signal.
[0091] Exemplarily, in an embodiment of the present application, when multiple test threads switch from a working state to a dormant state, it is called a "system silent start indication" (SSSI). In the system silent state, there are no threads being executed on all CPUs, and there are no threads in a "ready" state. The method for checking SSSI is that the thread scheduler in the test module performs an additional check on each thread when it is about to enter dormancy, scans the thread queue, and checks whether there are no threads being executed and / or ready to be executed on all cores, that is, checks whether there are threads on all cores that are occupying the CPU, or are ready to occupy the CPU. If there are no threads being executed and / or ready to be executed, an SSSI signal is sent to the task management module. If there are threads being executed and / or ready to be executed, the threads continue to be executed, and the test tasks of the current test phase continue to be processed.
[0092] By detecting whether the remaining test threads are in a working state when each test thread enters a dormant state, when it is detected that multiple threads are in a dormant state, the current test phase is ended and the next test phase is started. In this way, when multiple test threads enter a dormant state, the current test phase can be ended immediately and the test task of the next test phase can be started, thereby shortening the test time, improving the test efficiency, and further improving the production efficiency.
[0093] In the embodiment of the present application, the test task of the current test phase is determined by the task management module, and the method further includes:
[0094] Adjust the counter STC;
[0095] The test task of the current test phase is determined based on the value of the counter STC and the mapping relationship, and the mapping relationship is used to indicate the corresponding relationship between the value of the counter STC and the test task.
[0096] In an embodiment of the present application, the test module sends an indication message of "system starts silent event" to the task management module. After receiving the indication message, the task management module ends the test task of the current test phase and starts the test task of the next test phase.
[0097] The task management module adjusts the counter STC, and determines the test task of the current test phase based on the value and mapping relationship of the adjusted counter.
[0098] In an embodiment of the present application, the test task for starting the next test phase may be the test task for the current test phase of the present application, and the method for starting the test task for the current test phase may be to adjust the counter STC, and the task management module determines the test task for the current test phase based on the value and mapping relationship of the adjusted counter.
[0099] In the embodiment of the present application, the counter STC can be adjusted in an increasing manner or in a decreasing manner. STC increases or decreases at a uniform rate. The embodiment of the present application does not specifically limit the method of adjusting STC.
[0100] Exemplarily, referring to FIG6 , in the embodiment of the present application, the task management module may be a time engine (TimeEngine) thread, Fig. 6A It is the implementation of the Time Engine thread in the prior art. The STC timer is used in the Time Engine thread for timing. The Time Engine thread pre-sets the time function and the callback function. Before the Time Engine thread starts the test task, the STC is increased; it is determined whether the STC satisfies the preset mapping relationship. If it does, the Timer callback function of the time is triggered. It can be understood that the time function calls the callback function according to the pointer address of the callback function, calling multiple test threads or performing other operations on multiple test threads; when multiple test threads are in working state, the time engine sleeps for a preset time length T, then increases the STC, and repeats the above operation in a cycle.
[0101] Figure 6BIt is the implementation of the Time Engine thread in the embodiment of the present application. The STC timer is used in the Time Engine thread for timing. The Time Engine thread pre-sets the time function and the callback function. Before the Time Engine thread starts the test task, the STC is increased; it is determined whether the STC satisfies the preset mapping relationship. If it does, the Timer callback function of the time is triggered. It can be understood that the time function calls the callback function according to the pointer address of the callback function, wakes up multiple test threads or performs other operations on multiple test threads; when multiple test threads are in working state, the time engine waits for the "system silent event"; when the time engine waits for the "system silent event", the STC is increased and the above operation is repeated.
[0102] It can be understood that the old Time Engine thread loops and sleeps for a period of time T, and is changed to loop and wait for the "system silent time".
[0103] In the embodiment of this application, Fig. 6A Sleep T time and Figure 6B The timing of waiting for the "system silence event" can be performed by calling the underlying Linux operation function, which is not specifically limited in the embodiments of the present application.
[0104] By adjusting the counter STC, based on the value and mapping relationship of the adjusted counter STC, the test tasks of the current test phase are determined, and the test is divided into different phases to avoid system crashes caused by too many test threads during the test process and inability to process test tasks.
[0105] The following describes in detail the test method provided in the embodiment of the present application in combination with specific application scenarios. Figure 7 shown.
[0106] Step 1: Increase STC through the time engine.
[0107] It should be understood that the time engine in the application scenario is the task management module in the embodiment of the present application. When the test task of the current test phase is started, the STC is increased through the time engine.
[0108] Step 2: Through the time engine, based on the STC and the mapping relationship, determine the test tasks of the current test phase and obtain multiple test threads.
[0109] It should be understood that STC is the value of the increased STC, and the mapping relationship is the corresponding relationship between the value of STC and the test task.
[0110] Through the time engine, based on the value and mapping relationship of the increased STC, the test task of the current test phase is determined to obtain multiple test threads.
[0111] In an embodiment of the present application, a correspondence between a time function and a callback function is pre-set in the time engine. An STC timer is used in the time function for timing. When the STC meets the conditions of the time function, the time function calls the callback function according to the pointer of the callback function. Calling the callback function once is equivalent to sending an interrupt notification.
[0112] Step 3: Through the test module, control multiple test threads to be in working state and process test tasks.
[0113] In this application scenario, the test module includes a test architecture and physical layer software (test object). After receiving the interrupt notification message, the test module controls the test architecture and multiple test threads determined in the physical layer software to be in working state and process the test tasks.
[0114] Step 4: Determine whether there is a thread in the working state. If so, continue to step 3; if not, go to step 5.
[0115] In the process of processing the test task, after each thread switches from the working state to the dormant state, the thread scheduler in the test module will detect whether there are other threads in the working state in the current test phase. If there are other threads in the working state in the current test phase, the test task will continue to be processed through the test module; if there are no other threads in the working state in the current test phase, step 5 will be executed.
[0116] Step 5: Send the SSSI signal to the time engine through the test module.
[0117] If no other threads are in working state in the current test phase, it means that multiple test threads in the current test phase are in dormant state. At this time, the SSSI signal is sent to the time engine through the test module.
[0118] Step 6: Use the time engine to start a test task for the test phase.
[0119] After the time engine receives the SSSI signal, it starts the test task of the next test phase, and repeats the above steps 1 to 6 in a loop until it reaches the preset n test phases and stops.
[0120] In the embodiment of the present application, the test method of the present application is used to greatly shorten the test case execution time. For example, the execution time of the test case that previously took nearly 5 minutes to execute is reduced to 1 second (the case that previously took 15 minutes is shortened to less than 5 seconds, which is basically negligible). It effectively improves the development efficiency and improves the developer experience. Moreover, in the later stage, only the internal code of the test architecture needs to be modified, which will not affect the writing of existing test cases, and only a small number of test cases will be affected.
[0121] The preferred embodiments of the present application are described in detail above in conjunction with the accompanying drawings. However, the present application is not limited to the specific details in the above embodiments. Within the technical concept of the present application, the technical solution of the present application can be subjected to a variety of simple modifications, and these simple modifications all belong to the protection scope of the present application. For example, the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present application will not further explain various possible combinations. For another example, the various different embodiments of the present application can also be arbitrarily combined, as long as they do not violate the idea of the present application, they should also be regarded as the contents disclosed in the present application. For another example, under the premise of no conflict, the various embodiments and / or the technical features in the various embodiments described in the present application can be arbitrarily combined with the prior art, and the technical solution obtained after the combination should also fall within the protection scope of the present application.
[0122] The present application also provides a testing device, referring to Figure 8 As shown, the test device may include:
[0123] The task management module 801 is configured to determine the test task of the current test phase; the test task includes multiple test threads;
[0124] The test module 802 is configured to control the multiple test threads to be in a working state and process the test task;
[0125] The test module 802 is further configured to send indication information to the task management module when the multiple test threads are switched from the working state to the sleeping state; the indication information is used to instruct the multiple test threads to switch from the working state to the sleeping state;
[0126] The task management module 801 is also configured to start the test task of the next test phase based on the indication information; the end time of the current test phase is the moment when the multiple test threads switch from the working state to the sleeping state, and the test duration of the current test phase is greater than or equal to or less than equal to the preset duration, and the preset duration is the duration of each configured test phase.
[0127] In some embodiments, the task management module is further configured to determine the test task of the current test phase based on a mapping relationship; the mapping relationship is used to indicate the corresponding relationship between the current test phase and the test task.
[0128] In some embodiments, the test module is further configured to receive a notification message sent by the task management module; the notification message is used to indicate the multiple test threads; and control the multiple test threads to be in a working state to process the test task.
[0129] In some embodiments, the notification message may be sent by the task management module calling a timer callback function at a certain time.
[0130] In some embodiments, the test module is also used to determine whether the remaining test threads among the multiple test threads are in a working state when any one of the multiple test threads switches from a working state to a sleeping state; if the remaining test threads among the multiple test threads are in a working state, continue to process the test tasks of the current test phase; if the remaining test threads among the multiple test threads are not in a working state, send a signal to the task management module.
[0131] In some embodiments, the task management module is also configured to adjust the counter STC; wherein the test task of the current test phase is determined based on the value of the counter STC and the mapping relationship, and the mapping relationship is used to indicate the correspondence between the value of the counter STC and the test task.
[0132] In an embodiment of the present application, the task management module is configured to determine the test task of the current test phase and obtain multiple test threads; the test module is configured to send a signal to the task management module when multiple test threads are switched from a working state to a sleeping state, notifying the task management module that multiple test threads enter a sleeping state, and the test task of the current test phase is completed; the task management module is configured to start the test task of the next test phase. When all test threads are switched from a working state to a sleeping state, the test module sends a signal to the task management module, and the task management module starts the test task of the next test phase based on the indication information. In this way, after knowing that all threads have entered a sleeping state, the test task of the next test phase is started through the task management module, thereby shortening the test time and further improving the test efficiency.
[0133] Of course, in practical applications, Fig. 9 As shown, the various components in the electronic device are coupled together via a bus system 902. It is understood that the bus system 902 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 902 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Fig. 9 The various buses are collectively labeled bus system 902 .
[0134] It can be understood that the memory in this embodiment can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), SyncLink Dynamic Random Access Memory (SLDRAM), and Direct Rambus Random Access Memory (DRRAM).The memories described in the embodiments of the present application are intended to include, but are not limited to, these and any other suitable types of memories.
[0135] The method disclosed in the above embodiment of the present application can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor may be a general-purpose processor, a DSP, or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0136] The present application also provides a computer storage medium, specifically a computer-readable storage medium, on which computer instructions are stored. As a first implementation, when the computer storage medium is located in an electronic device, the computer instructions are executed by a processor to implement any step of the above-mentioned test method in the present application.
[0137] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0138] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0139] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be separately configured as a unit, or at least two units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0140] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium, which, when executed, executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, disks or optical disks.
[0141] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0142] It should be noted that the technical solutions described in the embodiments of the present application can be combined arbitrarily without conflict.
[0143] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A testing method, characterized in that: include: Determine the test tasks of the current test phase through the task management module; The test task includes multiple test threads; Control the multiple test threads to be in working state and process the test tasks through the test module; When the plurality of test threads are switched from a working state to a dormant state, sending indication information to the task management module through the test module; The indication information is used to instruct the multiple test threads to switch from a working state to a sleeping state; Through the task management module, based on the indication information, the test task of the next test phase is started; the end time of the current test phase is the moment when the multiple test threads switch from the working state to the sleeping state, and the test duration of the current test phase is greater than or equal to or less than the preset duration, and the preset duration is the duration of each configured test phase.
2. The method according to claim 1, characterized in that The task management module is used to determine the test tasks of the current test phase, including: The task management module determines the test task of the current test phase based on the mapping relationship; the mapping relationship is used to indicate the corresponding relationship between the current test phase and the test task.
3. The method according to claim 1 or 2, characterized in that: The test module controls the multiple test threads to be in a working state and processes the test task, and the method further includes: Sending a notification message to the test module through the task management module; the notification message is used to indicate the multiple test threads; Through the test module, the multiple test threads are controlled to be in a working state to process the test task.
4. The method according to claim 3, characterized in that: The notification message can be sent by the task management module calling a timer callback function at a certain time.
5. The method according to claim 1 or 2, characterized in that: When the plurality of test threads are switched from a working state to a sleeping state, sending indication information to the task management module through the test module includes: When any one of the multiple test threads switches from a working state to a sleeping state, determining whether the remaining test threads of the multiple test threads are in a working state; If the remaining test threads among the multiple test threads are in a working state, then the test tasks of the current test phase continue to be processed; if the remaining test threads among the multiple test threads are not in a working state, then an indication message is sent to the task management module.
6. The method according to claim 2, characterized in that The method further comprises: determining the test tasks of the current test phase through the task management module; Adjust the counter STC; The test task of the current test phase is determined based on the value of the counter STC and the mapping relationship, and the mapping relationship is used to indicate the corresponding relationship between the value of the counter STC and the test task.
7. A testing device, characterized in that: The device comprises: A task management module, configured to determine a test task for a current test phase; the test task includes a plurality of test threads; A test module, configured to control the multiple test threads to be in a working state and process the test task; The test module is further configured to send indication information to the task management module when the multiple test threads are switched from the working state to the sleeping state; the indication information is used to instruct the multiple test threads to switch from the working state to the sleeping state; The task management module is also configured to start the test task of the next test phase based on the indication information; the end time of the current test phase is the moment when the multiple test threads switch from the working state to the sleeping state, and the test duration of the current test phase is greater than or equal to or less than equal to the preset duration, and the preset duration is the duration of each configured test phase.
8. The device according to claim 7, characterized in that The task management module is further configured as follows: Based on the mapping relationship, the test task of the current test phase is determined; the mapping relationship is used to indicate the corresponding relationship between the current test phase and the test task.
9. The device according to claim 7 or 8, characterized in that The test module is further configured as: Receiving a notification message sent by the task management module; the notification message is used to indicate the multiple test threads; Control the multiple test threads to be in a working state and process the test tasks.
10. The device according to claim 7 or 8, characterized in that The test module is further configured as: When any one of the multiple test threads switches from a working state to a sleeping state, determining whether the remaining test threads of the multiple test threads are in a working state; If the remaining test threads among the multiple test threads are in a working state, then the test tasks of the current test phase continue to be processed; if the remaining test threads among the multiple test threads are not in a working state, then an indication message is sent to the task management module.
11. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor implements the test method according to any one of claims 1 to 6 when executing the program.
12. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the testing method according to any one of claims 1 to 6 is implemented.
