Concurrent lock testing methods, related devices and computer program products

By setting instruction interception breakpoints on the instruction receiving channel of the concurrent lock, the connection path is opened at a preset number of times, which solves the data consistency problem when multiple users access the lock concurrently and achieves more refined concurrent lock testing results.

CN113360330BActive Publication Date: 2025-11-14BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110697331.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-23
Publication Date
2025-11-14
Estimated Expiration
2041-06-23

AI Technical Summary

Technical Problem

When multiple users access the site concurrently, existing technologies struggle to accurately perform concurrent lock tests, leading to data inconsistencies and access conflicts.

Method used

By setting instruction interception breakpoints on the instruction receiving channel of the concurrent lock, and opening the connection path when the number of intercepted instructions reaches a preset number, the concurrent lock can receive the processing results of the instructions, thus achieving more accurate concurrent lock testing.

Benefits of technology

It enables more accurate and finer-grained concurrent lock testing, improving test quality and saving test resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113360330B_ABST
    Figure CN113360330B_ABST
Patent Text Reader

Abstract

This disclosure provides a method, apparatus, electronic device, computer-readable storage medium, and computer program product for testing concurrent locks, relating to artificial intelligence technologies such as data processing, process testing, and network technology. One specific implementation of the method includes: determining the target concurrent lock to be tested based on lock test instructions; setting an instruction interception breakpoint on the instruction receiving channel of the target concurrent lock; then controlling the instruction interception breakpoint to only connect the instruction receiving channel to the target concurrent lock when the number of intercepted instructions exceeds a preset number; and finally, receiving the processing results of the target concurrent lock for the instructions exceeding the preset number. The concurrent lock testing method provided by this disclosure enables more accurate and finer-grained concurrent lock testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, specifically to artificial intelligence technologies such as data processing, process testing, and network technology, and particularly to concurrent lock testing methods, apparatus, electronic devices, computer-readable storage media, and computer program products. Background Technology

[0002] As society enters the information age, users are increasingly using the internet for business interactions, information queries, and other purposes. However, with the increase in users, access conflicts may occur when accessing, retrieving, or updating the same function. For example, when different users simultaneously receive access requests for the same function at the same or similar times, in order to ensure that multiple requests can be executed correctly and that the data is accurate, corresponding concurrency locks are added to the business logic of this function to ensure that the currently executing instruction is not interfered with by other access instructions. Summary of the Invention

[0003] This disclosure provides a concurrent lock testing method, apparatus, electronic device, computer-readable storage medium, and computer program product.

[0004] In a first aspect, embodiments of this disclosure propose a concurrent lock testing method, comprising: determining a target concurrent lock to be tested according to a lock testing instruction; setting an instruction interception breakpoint on the instruction receiving channel of the target concurrent lock; controlling the instruction interception breakpoint to only connect the instruction receiving channel and the target concurrent lock when the number of intercepted instructions exceeds a preset number; and receiving the processing result of the target concurrent lock for instructions exceeding the preset number.

[0005] Secondly, embodiments of this disclosure provide a concurrent lock testing device, comprising: a concurrent lock determination unit configured to determine a target concurrent lock to be tested according to a lock testing instruction; an instruction interception breakpoint generation unit configured to set an instruction interception breakpoint on the instruction receiving channel of the target concurrent lock; an instruction interception breakpoint control unit configured to control the instruction interception breakpoint to only connect the instruction receiving channel to the target concurrent lock when the number of intercepted instructions exceeds a preset number; and a processing result receiving unit configured to receive the processing result of the target concurrent lock for instructions exceeding the preset number.

[0006] Thirdly, embodiments of this disclosure provide an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to implement the concurrent lock testing method as described in any implementation of the first aspect.

[0007] Fourthly, embodiments of this disclosure provide a non-transitory computer-readable storage medium storing computer instructions that enable a computer to implement the concurrent lock testing method as described in any implementation of the first aspect.

[0008] Fifthly, embodiments of this disclosure provide a computer program product including a computer program that, when executed by a processor, can implement the concurrent lock testing method as described in any implementation of the first aspect.

[0009] The concurrent lock testing method, apparatus, electronic device, computer-readable storage medium, and computer program product provided in this disclosure determine the target concurrent lock to be tested according to lock test instructions, set an instruction interception breakpoint on the instruction receiving channel of the target concurrent lock, and then control the instruction interception breakpoint to only connect the instruction receiving channel and the target concurrent lock when the number of intercepted instructions exceeds a preset number. Finally, the processing results of the target concurrent lock for the instructions exceeding the preset number are received. This disclosure enables more accurate and finer-grained concurrent lock testing.

[0010] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0011] Other features, objects, and advantages of this disclosure will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:

[0012] Figure 1 This is an exemplary system architecture to which this disclosure can be applied;

[0013] Figure 2 A flowchart of a concurrent lock testing method provided in an embodiment of this disclosure;

[0014] Figure 3 A flowchart of another concurrent lock testing method provided in this disclosure embodiment;

[0015] Figure 4 A flowchart illustrating a concurrent lock testing method in an application scenario provided by an embodiment of this disclosure;

[0016] Figure 5 A structural block diagram of a concurrent lock testing device provided in an embodiment of this disclosure;

[0017] Figure 6 This is a schematic diagram of the structure of an electronic device suitable for performing a concurrent lock testing method, provided as an embodiment of the present disclosure. Detailed Implementation

[0018] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding; these should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description. It should be noted that, unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other.

[0019] Furthermore, the acquisition, storage, and application of user personal information involved in the technical solutions disclosed herein comply with relevant laws and regulations and do not violate public order and good morals.

[0020] Figure 1 An exemplary system architecture 100 is shown, in which embodiments of the concurrent lock testing methods, apparatus, electronic devices, and computer-readable storage media of this disclosure can be applied.

[0021] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0022] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various applications for communication between the terminal devices 101, 102, and 103 and server 105 can be installed. Server 105 can typically be configured with corresponding concurrency locks for each application to ensure correct response to commands received from the same application. Furthermore, server 105 can also be configured with concurrency lock testing applications to test the configured concurrency locks.

[0023] The concurrent lock test application can also be set up on terminal devices 101, 102, and 103 at the same time, so that the corresponding concurrent lock test requests can be sent to the server through terminal devices 101, 102, and 103 to test the concurrent locks corresponding to the relevant applications.

[0024] Terminal devices 101, 102, and 103 and server 105 can be either hardware or software. When terminal devices 101, 102, and 103 are hardware, they can be various electronic devices with displays, including but not limited to smartphones, tablets, laptops, and desktop computers. When terminal devices 101, 102, and 103 are software, they can be installed in the aforementioned electronic devices, and can be implemented as multiple software programs or software modules, or as a single software program or software module; no specific limitation is made here. When server 105 is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or as a single server. When server 105 is software, it can be implemented as multiple software programs or software modules, or as a single software program or software module; no specific limitation is made here.

[0025] Taking a concurrent lock testing application set up in server 105 as an example, when server 105 runs this concurrent lock testing application, it can achieve the following effects: First, it obtains lock test instructions from terminal devices 101, 102, and 103 via network 104; then, server 105 determines the target concurrent lock to be tested based on the lock test instructions; next, server 105 sets an instruction interception breakpoint on the instruction receiving channel of the target concurrent lock; further, server 105 controls the instruction interception breakpoint to only connect the instruction receiving channel to the target concurrent lock when the number of intercepted instructions exceeds a preset number; finally, server 105 receives the processing results of the target concurrent lock for instructions exceeding the preset number.

[0026] It should be noted that, in addition to being obtained from terminal devices 101, 102, and 103 via network 104, lock test commands can also be pre-stored locally on server 105 through various means. Therefore, when server 105 detects that lock test commands have been stored locally (e.g., when preset time period test conditions are met), it can choose to directly issue or obtain lock test commands from locally. In this case, the exemplary system architecture 100 may not include terminal devices 101, 102, and 103 and network 104.

[0027] To facilitate responses to commands from different users, the concurrent lock testing methods provided in the subsequent embodiments of this disclosure are generally executed by a server 105 with strong computing power and abundant computing resources. Correspondingly, the concurrent lock testing device is also generally located in the server 105. However, it should also be noted that when terminal devices 101, 102, and 103 also possess sufficient computing power and resources, they can also complete the aforementioned calculations performed by the server 105 through concurrent lock testing applications installed on them, thereby outputting the same results as the server 105. Especially when multiple terminal devices with different computing capabilities exist simultaneously, but the concurrent lock testing application determines that the terminal device has strong computing power and abundant remaining computing resources, or does not require command response from the server 105, the terminal device can perform the aforementioned calculations. Accordingly, the concurrent lock testing device can also be located in terminal devices 101, 102, and 103. In this case, the exemplary system architecture 100 may also exclude the server 105 and the network 104.

[0028] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0029] Please refer to Figure 2 , Figure 2 A flowchart of a concurrent lock testing method provided in this disclosure embodiment, wherein process 200 includes the following steps:

[0030] Step 201: Determine the target concurrent lock to be tested according to the lock test instruction.

[0031] This step is intended for the execution body of the concurrent lock testing method (e.g., Figure 1 After receiving the lock test instruction, the server 105 shown determines the target concurrent lock to be tested corresponding to the lock test instruction.

[0032] The target concurrency lock can be a lock function, code segment, etc., used to implement the locking function. Typically, when the subject executing the instruction performs the operation corresponding to the instruction, the target concurrency lock is triggered to implement the locking function. When the target concurrency lock is executed, it can lock the instructions received in the path it is in, preventing the subject executing the instruction from receiving multiple different instructions at the same time and causing execution errors.

[0033] It should be noted that the lock test command can be issued directly by the aforementioned execution entity, or it can be obtained from a non-local terminal device and issued to the aforementioned execution entity by the non-local terminal device (e.g., Figure 1The terminal devices 101, 102, and 103 shown are examples. The local storage device can be a data storage module located within the execution entity, such as a server hard drive. In this case, corresponding triggering timing rules can be set according to preset time periods and other triggering conditions. When these timing rules are met, the execution entity quickly reads the lock test command from the local storage. The non-local storage device can also be any other electronic device configured to store data, such as user terminals. In this case, the user can send the lock test command to the execution entity through the electronic device.

[0034] Step 202: Set an instruction interception breakpoint on the instruction receiving channel of the target concurrent lock.

[0035] In this embodiment, after determining the target concurrent lock to be tested based on the above step 201, an instruction interception breakpoint is set in the instruction receiving channel used to transmit instructions to the target concurrent lock. The instruction interception breakpoint is used to intercept the instructions passing through the instruction receiving channel at the instruction interception breakpoint.

[0036] For example, after determining the location where the instruction interception breakpoint is generated, the instruction interception breakpoint can be set based on the breakpoint creation function (createBreakpointRequest).

[0037] Step 203: The control command interception breakpoint will only connect the command receiving channel and the target concurrent lock when the number of intercepted commands exceeds a preset number.

[0038] In this embodiment, the execution entity controls the instruction interception breakpoint to perform an open operation when the number of intercepted instructions meets a preset number, so that the continuously accumulated instructions can be sent to the execution entity that subsequently executes the accumulated instructions through the target concurrency lock, thereby simulating the instruction concurrency scenario.

[0039] In the process of intercepting instructions at the instruction interception breakpoint, the obtained instructions can be filtered by matching the valid instruction set and querying instruction keywords. This is to filter the instructions intercepted by the instruction interception breakpoint, so as to avoid invalid instructions being included in the statistical count, which could lead to incorrect connection between the instruction receiving channel and the target concurrent lock and affect the quality of concurrent lock testing.

[0040] Furthermore, time filtering conditions can be set accordingly. If the time for which an instruction is intercepted by an instruction interception breakpoint exceeds the time filtering condition, the instruction will be rejected to improve the quality of instructions used to test the target concurrent lock.

[0041] Step 204: Receive the processing results of the target concurrent lock for more than a preset number of instructions.

[0042] In this embodiment, after the connection between the instruction receiving channel and the target concurrent lock is established in step 203, the processing results of the target concurrent lock for more than a preset number of instructions are received. These processing results can directly reflect the locking status of each instruction among the more than preset number of incoming instructions.

[0043] The processing result can be the number of instructions passed through the target concurrent lock, which can be used directly to indicate the locking performance of the target concurrent lock, or the specific instructions passed through the target concurrent lock, so as to determine which instructions the target concurrent lock lacks locking functionality for based on the specific instructions.

[0044] The concurrent lock testing method provided in this disclosure collects test information by using instruction interception breakpoints in the original test process, so as to more realistically reproduce multi-instruction concurrent scenarios. It does not require building an additional test process, saving test resources and improving the test quality of concurrent lock testing, thus achieving more accurate and finer-grained concurrent lock testing.

[0045] In some optional implementations of this embodiment, the method further includes: optimizing the target concurrent lock using the instruction set in response to the processing result being an instruction set including at least one of the instructions.

[0046] Specifically, when the processing result is a set of instructions including at least one instruction, the instructions included in the instruction set are obtained, and the target concurrent lock is optimized according to the form and content of the instruction to help the target concurrent lock successfully lock the instruction, thereby improving the locking capability of the target concurrent lock.

[0047] When the instruction set includes multiple instructions, features extraction and similar content extraction can be performed on the multiple instructions to extract the common features of the multiple instructions. The locking capability of the target concurrent lock can then be optimized based on these common features to improve the optimization efficiency and quality of the target concurrent lock.

[0048] In some optional implementations of this embodiment, determining the target concurrent lock to be tested according to the lock test instruction includes: in response to the test process entering the unit test phase, determining the target concurrent lock to be tested according to the lock test instruction.

[0049] Specifically, when executing a test process for a complete program architecture to achieve the testing objective, a concurrent lock test operation can be performed when the test process enters the unit test phase. This involves obtaining lock test instructions, determining the target concurrent lock to be tested based on the lock test instructions, and thus testing the target concurrent lock. This moves the lock test phase to the unit test phase, allowing for timely resolution of issues related to the target concurrent lock and improving overall efficiency.

[0050] Please refer to Figure 3 , Figure 3 A flowchart of another concurrent lock testing method provided in this disclosure embodiment, wherein process 300 includes the following steps:

[0051] Step 301: Obtain the virtual machine object through the virtual interface and generate an event request manager based on the virtual machine object.

[0052] In this embodiment, the Java Virtual Machine (JVM) object is first obtained through the Java Virtual Interface (JVM Tool Interface, or JVMTI), and the event request manager is obtained using the JVM.

[0053] JVMTI is a set of interfaces exposed by the JVM for users to extend. JVMTI is event-driven. The JVM will call some event callback interfaces (if any) every time it executes certain logic. These interfaces can be used by developers to extend their own logic.

[0054] JVMTI is a program interface used for developing and monitoring the JVM. It can probe the internal state of the JVM and control the execution of JVM applications. Functions it can perform include, but are not limited to, debugging, monitoring, thread analysis, and coverage analysis tools.

[0055] JVMTI is a two-way interface. A JVMTI client, or agent, can listen for events of interest. JVMTI provides many functions for querying or controlling applications. The JVMTI agent runs in the same process as the target JVM and communicates through JVMTI to maximize control and minimize communication costs. In typical scenarios, the JVMTI agent is implemented very compactly, and other processes communicate with the JVMTI agent to achieve the goal of controlling the JVM application.

[0056] Step 302: Use the Event Request Manager to clear the historical command interception breakpoints.

[0057] In this embodiment, the information of instruction interception breakpoints stored in the event request manager is cleared by deleting the event request method (deleteEventRequest), so as to clear the historically set instruction interception breakpoints and make sure that there are no instruction interception breakpoints in the current test process.

[0058] Step 303: Determine the target concurrent lock to be tested according to the lock test instruction.

[0059] Step 304: Set an instruction interception breakpoint on the instruction receiving channel of the target concurrent lock.

[0060] Step 305: Control the instruction interception breakpoint to only open the connection path between the instruction receiving channel and the target concurrent lock when the number of intercepted instructions exceeds a preset number.

[0061] In this embodiment, since an event request manager has been generated in step 301 above, the event request manager can be used to clear the instruction interception breakpoint by deleteEventRequest when the number of instructions intercepted by the instruction interception breakpoint exceeds the preset number, so as to achieve the purpose of connecting the instruction receiving channel and the target concurrent lock.

[0062] Step 306: Receive the processing results of the target concurrent lock for instructions exceeding the preset number.

[0063] Steps 303-306 above are respectively related to... Figure 2 Steps 201-204 shown are the same; for the same parts, please refer to the corresponding parts of the previous embodiment, which will not be repeated here. The concurrent lock testing method provided in this embodiment is based on the above... Figure 2 Based on the corresponding embodiment, further, an event request manager can be generated using a virtual machine object, and then the event request manager can be used to clear historically set instruction interception breakpoints in the current test process. This enables targeted testing of the target concurrent lock, avoids other instruction interception breakpoints set in the current test process from affecting the concurrent lock test, and improves the quality of the concurrent lock test.

[0064] In some optional implementations of this embodiment, the concurrency lock testing method further includes: monitoring the number of instructions intercepted at the instruction interception breakpoint through the virtual machine programming interface.

[0065] Specifically, since the JVM has been obtained through JVMTI in this embodiment, the number of access objects held at the instruction interception breakpoint can also be used through JVMTI to determine the number of instructions intercepted at the instruction interception breakpoint. No additional settings are required to directly monitor the number of instructions intercepted at the instruction interception breakpoint, simplifying the processing structure of the concurrency lock test method and reducing the required resources.

[0066] Based on any of the above embodiments, the concurrent lock testing method further includes: in response to the processing result being an empty set, generating feedback information indicating that the target concurrent lock meets the locking requirements.

[0067] Specifically, when the target concurrency lock processes more than the preset number of instructions and the result is an empty set, it can be determined that the target concurrency lock can lock all instructions intercepted by the instruction interception breakpoint. That is, the simulated concurrent instructions intercepted and accumulated by the instruction interception breakpoint cannot pass through the target concurrency lock. The locking function of the target concurrency lock can meet the locking requirements and generate corresponding feedback information to provide feedback, so as to understand the results of the concurrency lock test.

[0068] Furthermore, to improve the accuracy of concurrent lock testing and avoid false alarms caused by abnormal instructions failing the target concurrent lock, in response to an empty set of processing results, feedback information indicating that the target concurrent lock meets the locking requirements is generated. This includes: in response to an empty set of processing results, obtaining the preset number of instructions intercepted by the instruction interception point this time, and generating a corresponding test instruction set; controlling the pause locking function of the target concurrent lock; issuing the test instruction set to the target concurrent lock after the pause locking function is activated; and generating feedback information indicating that the target concurrent lock meets the locking requirements in response to all test instructions in the test instruction set passing the target concurrent lock after the pause locking function is activated.

[0069] Specifically, when the target concurrent lock's processing result for more than the preset number of instructions is an empty set, it acquires all the preset number of instructions intercepted by the instruction interception point this time and generates a corresponding test instruction set. Then, it controls the target concurrent lock to temporarily disable its locking function, allowing any instruction to pass through the target concurrent lock. After pausing the locking function, the target concurrent lock issues the test instruction set. If all test instructions in the test instruction set can pass through the target concurrent lock after pausing the locking function, it can be determined that the target concurrent lock has effectively locked all the preset number of instructions intercepted by the instruction interception point this time. Corresponding feedback information is generated to avoid false alarms caused by instructions failing to pass through the target concurrent lock due to abnormalities, thereby improving the accuracy of the target concurrent lock test.

[0070] To enhance understanding, this disclosure also provides a specific implementation scheme based on a particular application scenario. Please refer to the example below. Figure 4 The process shown is 400.

[0071] Step 401: Obtain the event request manager.

[0072] Specifically, in an agent, the virtual machine JVM object is first obtained through JVMTI, and the event request manager is obtained through the JVM.

[0073] Step 402: Clear historical breakpoints.

[0074] Specifically, historical instruction interception breakpoints in the current test process are cleared by deleting event requests in the event request manager.

[0075] Step 403: Determine the target concurrent lock to be tested according to the lock test instruction.

[0076] Step 404: Set an instruction interception breakpoint on the instruction receiving channel of the target concurrent lock.

[0077] Specifically, determine the location to set the instruction interception breakpoint on the instruction receive channel of the target concurrent lock, and use the createBreakpointRequest function to generate an instruction interception breakpoint before that location.

[0078] Step 405: The control command interception breakpoint will only connect the command receiving channel and the target concurrent lock when the number of intercepted commands exceeds a preset number.

[0079] Step 406: Receive the processing results of the target concurrent lock for more than a preset number of instructions.

[0080] Specifically, the processing result includes a set of instructions A and B, where instruction A is "add annotation information abcd to the first parameter" and instruction B is "add annotation information cdef to the first parameter".

[0081] Step 407: In response to the processing result being an instruction set including at least one instruction, optimize the target concurrent lock using the instruction set.

[0082] Specifically, based on the instruction set determined in step 406 that contains instruction A and instruction B, and the common feature of both is "adding ..." to the first parameter, the locking capability of the target concurrent lock for the "adding ..." instruction is optimized.

[0083] Further reference Figure 5 As an implementation of the methods shown in the above figures, this disclosure provides an embodiment of a concurrent lock testing device, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.

[0084] like Figure 5As shown, the concurrent lock testing device 500 of this embodiment may include: a concurrent lock determination unit 501, an instruction interception breakpoint generation unit 502, an instruction interception breakpoint control unit 503, and a processing result receiving unit 504. The concurrent lock determination unit 501 is configured to determine the target concurrent lock to be tested based on a lock testing instruction; the instruction interception breakpoint generation unit 502 is configured to set an instruction interception breakpoint on the instruction receiving channel of the target concurrent lock; the instruction interception breakpoint control unit 503 is configured to control the instruction interception breakpoint to only connect the instruction receiving channel to the target concurrent lock when the number of intercepted instructions exceeds a preset number; and the processing result receiving unit 504 is configured to receive the processing results of the target concurrent lock for instructions exceeding the preset number.

[0085] In this embodiment, the specific processing and technical effects of the concurrent lock determination unit 501, instruction interception breakpoint generation unit 502, instruction interception breakpoint control unit 503, and processing result receiving unit 504 in the concurrent lock testing device 500 can be referred to respectively. Figure 2 The relevant descriptions of steps 201-204 in the corresponding embodiments will not be repeated here.

[0086] In some optional implementations of this embodiment, the concurrent lock testing device 500 further includes a concurrent lock optimization unit, configured to optimize the target concurrent lock using the instruction set in response to the processing result being an instruction set including at least one of the instructions.

[0087] In some optional implementations of this embodiment, the concurrent lock determination unit 501 is further configured to determine the target concurrent lock to be tested according to the lock test instruction in response to the test process entering the unit test phase.

[0088] In some optional implementations of this embodiment, the concurrent lock testing device 500 further includes: a manager generation unit, configured to obtain a virtual machine object through a virtual interface and generate an event request manager based on the virtual machine object; and a historical instruction interception breakpoint clearing unit, configured to clear historically set instruction interception breakpoints using the event request manager.

[0089] In some optional implementations of this embodiment, the concurrent lock testing device 500 further includes an instruction count monitoring unit, configured to monitor the number of instructions intercepted at the instruction interception breakpoint through the virtual machine programming interface.

[0090] In some optional implementations of this embodiment, the concurrent lock testing device 500 further includes: a feedback information generation unit, configured to generate feedback information indicating that the target concurrent lock meets the locking requirements in response to the processing result being an empty set.

[0091] In some optional implementations of this embodiment, the feedback information generation unit 504 includes: a test instruction set generation subunit, configured to, in response to the processing result being an empty set, obtain the preset number of instructions intercepted by the instruction interception point this time, and generate a corresponding test instruction set; a locking function control subunit, configured to control the target concurrent lock to pause the locking function; a test instruction issuing subunit, configured to issue the test instruction set to the target concurrent lock after pausing the locking function; and a feedback information generation subunit, configured to, in response to the test instructions in the test instruction set all being able to pass the target concurrent lock after pausing the locking function, generate feedback information indicating that the target concurrent lock meets the locking requirements.

[0092] This embodiment exists as a device embodiment corresponding to the above method embodiment. The concurrent lock testing device provided in this embodiment collects test information by using instruction interception breakpoints under the original test process, so as to realistically restore the multi-instruction concurrent scenario. There is no need to build an additional test process, saving test resources, while also improving the test quality of concurrent lock testing, and realizing more accurate and finer-grained concurrent lock testing.

[0093] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0094] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0095] like Figure 6 As shown, device 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 602 or a computer program loaded from storage unit 608 into random access memory (RAM) 603. RAM 603 may also store various programs and data required for the operation of device 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.

[0096] Multiple components in device 600 are connected to I / O interface 605, including: input unit 606, such as keyboard, mouse, etc.; output unit 607, such as various types of monitors, speakers, etc.; storage unit 608, such as disk, optical disk, etc.; and communication unit 609, such as network card, modem, wireless transceiver, etc. Communication unit 609 allows device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0097] The computing unit 601 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as the concurrency lock testing method. For example, in some embodiments, the concurrency lock testing method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the concurrency lock testing method described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the concurrency lock testing method by any other suitable means (e.g., by means of firmware).

[0098] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0099] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0100] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0101] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0102] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0103] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is established by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, also known as cloud computing servers or cloud hosts, which are hosting products within the cloud computing service ecosystem to address the management difficulties and weak business scalability inherent in traditional physical hosts and Virtual Private Servers (VPS) services. Servers can also be categorized as distributed system servers or servers incorporating blockchain technology.

[0104] According to the technical solution of this disclosure, test information is collected by using instruction interception breakpoints in the original test process, so as to more realistically reproduce the multi-instruction concurrent scenario. There is no need to build an additional test process, which saves test resources and can also improve the test quality of concurrent lock testing, achieving more accurate and finer-grained concurrent lock testing.

[0105] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution provided in this disclosure can be achieved, and this is not limited herein.

[0106] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A concurrent lock testing method, comprising: The target concurrent lock to be tested is determined according to the lock test instructions; Set an instruction interception breakpoint on the instruction receiving channel of the target concurrent lock; The control point for intercepting instructions is activated only when the number of intercepted instructions exceeds a preset number, thus enabling the connection between the instruction receiving channel and the target concurrent lock. Receive the processing results of the target concurrent lock for more than the preset number of instructions; In response to the processing result being an instruction set including at least one of the instructions, the target concurrent lock is optimized using the instruction set, including: optimizing the target concurrent lock based on the form and content of the instructions in the processing result, so as to help the target concurrent lock successfully lock the instructions in the processing result.

2. The method according to claim 1, wherein, The step of determining the target concurrent lock to be tested according to the lock test instruction includes: In response to the test process entering the unit test phase, the target concurrent lock to be tested is determined according to the lock test instruction.

3. The method according to claim 1, further comprising: The virtual machine object is obtained through the virtual interface, and an event request manager is generated based on the virtual machine object; Use the event request manager to clear historical command interception breakpoints.

4. The method according to claim 3, further comprising: The number of instructions intercepted at the instruction interception breakpoint is monitored through the virtual machine programming interface.

5. The method according to any one of claims 1-4, further comprising: In response to the processing result being an empty set, feedback information is generated indicating that the target concurrent lock meets the locking requirements.

6. The method according to claim 5, wherein, The response to the processing result being an empty set generates feedback information indicating that the target concurrent lock meets the locking requirements, including: In response to the processing result being an empty set, the preset number of instructions intercepted by the instruction interception point in this instance are obtained, and a corresponding test instruction set is generated; After controlling the pause and locking function of the target concurrent lock; The test instruction set is issued to the target concurrent lock after the locking function is paused; In response to all test instructions in the test instruction set, feedback information is generated indicating that the target concurrent lock meets the locking requirements after the locking function is paused.

7. A concurrent lock testing device, comprising: The concurrent lock determination unit is configured to determine the target concurrent lock to be tested based on the lock test instruction; The instruction interception breakpoint generation unit is configured to set an instruction interception breakpoint on the instruction receiving channel of the target concurrent lock; The instruction interception breakpoint control unit is configured to control the instruction interception breakpoint to only open the connection path between the instruction receiving channel and the target concurrency lock when the number of intercepted instructions exceeds a preset number; The processing result receiving unit is configured to receive the processing results of the target concurrent lock pair exceeding the preset number of instructions; The concurrent lock optimization unit is configured to optimize the target concurrent lock in response to the processing result being an instruction set including at least one of the instructions, including: optimizing the target concurrent lock based on the form and content of the instructions in the processing result, so as to help the target concurrent lock successfully lock the instructions in the processing result.

8. The apparatus according to claim 7, wherein, The concurrent lock determination unit is further configured to determine the target concurrent lock to be tested according to the lock test instruction in response to the test process entering the unit test phase.

9. The apparatus according to claim 7, further comprising: The manager generation unit is configured to obtain virtual machine objects through a virtual interface and generate an event request manager based on the virtual machine objects; The historical instruction interception breakpoint clearing unit is configured to clear historical instruction interception breakpoints using the event request manager.

10. The apparatus according to claim 9, further comprising: The instruction count monitoring unit is configured to monitor the number of instructions intercepted at the instruction interception breakpoint through the virtual machine programming interface.

11. The apparatus according to any one of claims 7-10, further comprising: The feedback information generation unit is configured to generate feedback information that the target concurrent lock meets the locking requirements in response to the processing result being an empty set.

12. The apparatus according to claim 11, wherein, The feedback information generation unit includes: The test instruction set generation subunit is configured to, in response to the processing result being an empty set, obtain the preset number of instructions intercepted by the instruction interception point this time, and generate the corresponding test instruction set; The locking function control subunit is configured to control the target concurrent lock to pause the locking function; The test instruction issuing subunit is configured to issue the set of test instructions to the target concurrent lock after the pause and locking function is activated; The feedback information generation subunit is configured to generate feedback information indicating that the target concurrent lock meets the locking requirements in response to all test instructions in the test instruction set passing the target concurrent lock after the pause locking function.

13. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the concurrent lock testing method according to any one of claims 1-6.

14. A non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the concurrent lock testing method according to any one of claims 1-6.

15. A computer program product comprising a computer program that, when executed by a processor, implements the concurrent lock testing method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Concurrent simulation test method and apparatus

    CN105045711A