CN113360330A - Concurrent lock testing method, related device and computer program product - Google Patents

Concurrent lock testing method, related device and computer program product Download PDF

Info

Publication number
CN113360330A
CN113360330A CN202110697331.5A CN202110697331A CN113360330A CN 113360330 A CN113360330 A CN 113360330A CN 202110697331 A CN202110697331 A CN 202110697331A CN 113360330 A CN113360330 A CN 113360330A
Authority
CN
China
Prior art keywords
instruction
lock
concurrent lock
test
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110697331.5A
Other languages
Chinese (zh)
Inventor
张�成
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202110697331.5A priority Critical patent/CN113360330A/en
Publication of CN113360330A publication Critical patent/CN113360330A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2273Test methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2289Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing by configuration test

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The disclosure provides a concurrent lock testing method, a concurrent lock testing device, an electronic device, a computer readable storage medium and a computer program product, and relates to the technical field of artificial intelligence such as data processing, process testing and network technology. One embodiment of the method comprises: determining a target concurrent lock to be tested according to a lock test instruction, setting an instruction interception breakpoint on an instruction receiving channel of the target concurrent lock, controlling the instruction interception breakpoint to conduct a connection channel between the instruction receiving channel and the target concurrent lock only when the number of intercepted instructions exceeds a preset number, and finally receiving a processing result of the target concurrent lock on the instructions exceeding the preset number. By the testing method for the concurrent lock, more accurate and finer-grained concurrent lock testing can be realized.

Description

Concurrent lock testing method, related device and computer program product
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to the field of artificial intelligence technologies such as data processing, process testing, and network technologies, and in particular, to a concurrent lock testing method, apparatus, electronic device, computer-readable storage medium, and computer program product.
Background
As society enters the information age, users increasingly utilize the internet to achieve the purposes of service interaction, information query and the like, but with the increase of users, when accessing, calling, updating and the like are performed aiming at the same function, there may be access conflict situations, for example, when access situations of different users aiming at the same function are received at the same time in the same or similar time, in order to ensure that a plurality of requests can be correctly executed and ensure the accuracy of data, when the service logic of the function is implemented, corresponding concurrent locks are added to ensure that the currently executed instruction is not interfered by other access instructions.
Disclosure of Invention
The embodiment of the disclosure provides a concurrent lock testing method, a concurrent lock testing device, electronic equipment, a computer-readable storage medium and a computer program product.
In a first aspect, an embodiment of the present disclosure provides a concurrent lock testing method, including: determining a target concurrent lock to be tested according to the lock test instruction; setting an instruction interception breakpoint on an instruction receiving channel of the target concurrent lock; controlling the instruction interception breakpoint to conduct a connection path of the instruction receiving channel and the target concurrent lock only when the number of intercepted instructions exceeds a preset number; and receiving the processing result of the target concurrent lock on the instructions exceeding the preset number.
In a second aspect, an embodiment of the present disclosure provides a concurrent lock testing apparatus, including: a concurrent lock determination unit configured to determine a target concurrent lock to be tested according to the lock test instruction; an instruction interception breakpoint generating unit configured to set an instruction interception breakpoint on an instruction receiving channel of the target concurrent lock; the instruction interception breakpoint control unit is configured to control the instruction interception breakpoint to conduct a connection path of the instruction receiving channel and the target concurrent lock only when the number of intercepted instructions exceeds a preset number; and the processing result receiving unit is configured to receive the processing result of the target concurrent lock on the instructions exceeding the preset number.
In a third aspect, an embodiment of the present disclosure provides an electronic device, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable 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 manner of the first aspect when executed.
In a fourth aspect, the disclosed embodiments provide a non-transitory computer-readable storage medium storing computer instructions for enabling a computer to implement the concurrent lock testing method as described in any implementation manner of the first aspect when executed.
In a fifth aspect, the disclosed embodiments provide a computer program product comprising a computer program, which when executed by a processor is capable of implementing the concurrent lock testing method as described in any implementation manner of the first aspect.
According to the concurrency lock testing method, the concurrency lock testing device, the electronic equipment, the computer readable storage medium and the computer program product, a target concurrency lock to be tested is determined according to a lock testing instruction, an instruction interception breakpoint is set on an instruction receiving channel of the target concurrency lock, then the instruction interception breakpoint is controlled to conduct a connecting channel between the instruction receiving channel and the target concurrency lock only when the number of intercepted instructions exceeds a preset number, and finally a processing result of the target concurrency lock on the instructions exceeding the preset number is received. The concurrent lock test method and the concurrent lock test device can realize more accurate and finer-grained concurrent lock test.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
Other features, objects and advantages of the disclosure will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture to which the present disclosure may be applied;
FIG. 2 is a flow chart of a concurrent lock testing method provided by an embodiment of the present disclosure;
FIG. 3 is a flow chart of another concurrent lock testing method provided by the embodiments of the present disclosure;
fig. 4 is a schematic flowchart of a concurrent lock testing method in an application scenario according to an embodiment of the present disclosure;
FIG. 5 is a block diagram of a concurrent lock testing apparatus according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of an electronic device suitable for executing a concurrent lock test method according to an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness. It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict.
In addition, in the technical scheme related to the disclosure, the acquisition, storage, application and the like of the personal information of the related user all conform to the regulations of related laws and regulations, and do not violate the good custom of the public order.
Fig. 1 illustrates an exemplary system architecture 100 to which embodiments of the concurrent lock testing method, apparatus, electronic device, and computer-readable storage medium of the present disclosure may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. Various applications for realizing information communication between the terminal devices 101, 102, 103 and the server 105 may be installed on the terminal devices 101, 102, 103 and the server 105, and in the server 105, corresponding concurrent locks may be generally set corresponding to the applications, so as to ensure that when an instruction for the same application is received, the instruction can be correctly responded, and further, a concurrent lock test application may be further set in the server 105, so as to test the set concurrent locks.
The concurrent lock test application may also be simultaneously set in the terminal devices 101, 102, and 103, so that the terminal devices 101, 102, and 103 may send corresponding concurrent lock test requests to the server to test the concurrent locks corresponding to the related applications.
The terminal apparatuses 101, 102, 103 and the server 105 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices with display screens, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like; when the terminal devices 101, 102, and 103 are software, they may be installed in the electronic devices listed above, and they may be implemented as multiple software or software modules, or may be implemented as a single software or software module, and are not limited in this respect. When the server 105 is hardware, it may be implemented as a distributed server cluster composed of multiple servers, or may be implemented as a single server; when the server is software, the server may be implemented as a plurality of software or software modules, or may be implemented as a single software or software module, which is not limited herein.
Taking a concurrent lock test application set in the server 105 and capable of providing a test for a concurrent lock as an example, the server 105 may implement the following effects when running the concurrent lock test application: firstly, acquiring a lock test instruction from terminal equipment 101, 102 and 103 through a network 104; then, the server 105 determines a target concurrent lock to be tested according to the lock test instruction; next, the server 105 sets an instruction interception breakpoint on the instruction receiving channel of the target concurrent lock; further, the server 105 controls the instruction interception breakpoint to conduct the connection path between the instruction receiving channel and the target concurrent lock only when the number of intercepted instructions exceeds a preset number; finally, the server 105 receives the result of the processing of the instructions exceeding the preset number by the target concurrent lock.
It should be noted that the lock test instruction may be acquired from the terminal devices 101, 102, and 103 through the network 104, or may be stored locally in the server 105 in advance in various ways. Thus, when the server 105 detects that the lock test instruction has been stored locally (e.g., when a preset time period test condition is met, etc.), the lock test instruction may be selected to be issued, retrieved directly from the local, in which case the exemplary system architecture 100 may also not include the terminal devices 101, 102, 103 and the network 104.
To facilitate responding to instructions from different users, the concurrent lock testing method provided in the following embodiments of the present disclosure is generally executed by the server 105 having stronger computing capability and more computing resources, and accordingly, the concurrent lock testing apparatus is also generally disposed in the server 105. However, it should be noted that when the terminal devices 101, 102, and 103 also have the computation capability and computation resource meeting the requirements, the terminal devices 101, 102, and 103 may also complete the above operations performed by the server 105 through the concurrent lock test application installed thereon, and then output the same result as the result of the server 105. Particularly, when there are a plurality of types of terminal devices having different computation capabilities at the same time, the concurrent lock test application may cause the terminal device to execute the computation when it determines that the terminal device has a strong computation capability and a large amount of computation resources are left or when it is not necessary to perform an instruction response by the server 105, and accordingly, the concurrent lock test apparatus may be provided in the terminal devices 101, 102, and 103. In such a case, the exemplary system architecture 100 may also not include the server 105 and the network 104.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring to fig. 2, fig. 2 is a flowchart of a concurrent lock testing method according to an embodiment of the present disclosure, in which the process 200 includes the following steps:
step 201, determining a target concurrent lock to be tested according to a lock test instruction.
This step is intended to determine, by an execution subject (e.g., the server 105 shown in fig. 1) of the concurrent lock testing method, after acquiring the lock testing instruction, a target concurrent lock to be tested corresponding to the lock testing instruction.
The target concurrent lock may be a lock function, a code segment, or the like for implementing a locking function, and is triggered to implement the locking function when a main body for executing an instruction executes an operation corresponding to the instruction, and the target concurrent lock may lock an instruction received in a path where the target concurrent lock is executed, so as to avoid that the main body for executing the instruction receives a plurality of different instructions at the same time and an execution error is generated.
It should be noted that the lock test instruction may be issued directly by the execution entity locally, or may be acquired from a non-local terminal device and issued to the execution entity by the non-local terminal device (for example, terminal devices 101, 102, 103 shown in fig. 1). The local storage device may be a data storage module arranged in the execution main body, for example, a server hard disk, in which case, a corresponding trigger timing rule may be set according to a preset time period and other trigger conditions, and when the timing rule is satisfied, the execution main body may quickly read a lock test instruction from the local; the non-local storage device may also be any other electronic device arranged to store data, such as some user terminal, etc., in which case a user may send a lock test instruction to the execution entity via the electronic device.
Step 202, setting an instruction interception breakpoint on an instruction receiving channel of the target concurrent lock.
In this embodiment, after determining the target concurrent lock to be tested based on step 201, an instruction interception breakpoint is set in an instruction receiving channel used for transmitting an instruction into the target concurrent lock, where the instruction interception breakpoint is used for intercepting the instruction passing through the instruction receiving channel at the instruction interception breakpoint.
For example, after the generation position of the instruction interception breakpoint is determined, the instruction interception breakpoint may be set based on a breakpoint creation function (createbeakpointrequest).
And step 203, controlling the instruction interception breakpoint to conduct the connection path between the instruction receiving channel and the target concurrent lock only when the number of the intercepted instructions exceeds the preset number.
In this embodiment, the execution main body controls the instruction interception breakpoint to execute an open operation on the instruction interception breakpoint when the number of intercepted instructions meets a preset number, so that the continuously accumulated instructions can be sent to a subsequent execution main body for executing the accumulated instructions through the target concurrency lock, so as to simulate an instruction concurrency scene.
In the process of intercepting the instruction by the instruction interception breakpoint, the obtained instruction can be screened by means of matching of an effective instruction set, query of instruction keywords and the like, so that each instruction intercepted by the instruction interception breakpoint is screened, and the influence on the quality of concurrent lock testing due to the fact that invalid instructions are counted into the statistical quantity and the connection path of the instruction receiving channel and the target concurrent lock is mistakenly conducted is avoided.
Furthermore, a time screening condition can be set correspondingly, and when the time for the instruction to be intercepted by the instruction interception breakpoint exceeds the time screening condition, the instruction is removed, so that the quality of the instruction for testing the target concurrent lock is improved.
And step 204, receiving the processing result of the target concurrent lock on the instructions with the number exceeding the preset number.
In this embodiment, after the connection path between the instruction receiving channel and the target concurrent lock is turned on in step 203, the processing result of the target concurrent lock on the instructions exceeding the preset number is received, and the processing result may directly reflect the locking condition of the target concurrent lock on each instruction in the transmitted instructions exceeding the preset number.
The processing result may be the number of instructions passing through the target concurrent lock, which is directly used to indicate the locking performance of the target concurrent lock, or a specific instruction passing through the target concurrent lock, so as to determine which instruction the target concurrent lock has a locking function deficiency for according to the specific instruction.
According to the concurrent lock testing method provided by the embodiment of the disclosure, the test information is collected by using the instruction interception point under the original test process, so that the multi-instruction concurrent scene is relatively truly restored, the test process does not need to be additionally constructed, the test resource is saved, the test quality of the concurrent lock test can be improved, and the more accurate and more fine-grained concurrent lock test is realized.
In some optional implementations of this embodiment, the method further includes: and in response to the processing result being an instruction set comprising at least one of the instructions, optimizing the target concurrent lock with the instruction set.
Specifically, when the obtained processing result is an instruction set including at least one instruction, the instruction included in the instruction set is obtained, and the target concurrent lock is optimized according to the form, content and the like of the instruction, so that the target concurrent lock can smoothly lock the instruction, and the locking capability of the target concurrent lock is improved.
When the instruction set comprises a plurality of instructions, the plurality of instructions can be subjected to operations such as feature extraction and similar content extraction, so that common features of the plurality of instructions are extracted, and the locking capability of the target concurrent lock is optimized according to the common features, so that the optimization efficiency and quality of the target concurrent lock are improved.
In some optional implementations of this embodiment, determining a target concurrent lock to be tested according to the lock test instruction includes: and responding to the test process to enter a unit test stage, and determining the target concurrent lock to be tested according to the lock test instruction.
Specifically, when a complete program framework executes a test process to achieve a test purpose, when the test process enters a unit test stage, a concurrent lock test operation can be executed, a lock test instruction is obtained, a target concurrent lock to be tested is determined according to the lock test instruction, so that the test of the target concurrent lock is achieved, the lock test stage is lifted to the unit test stage, the problem corresponding to the target concurrent lock is solved in time, and the overall efficiency is improved.
Referring to fig. 3, fig. 3 is a flowchart of another concurrent lock testing method according to an embodiment of the present disclosure, wherein the process 300 includes the following steps:
step 301, obtaining a virtual machine object through a virtual interface, and generating an event request manager according to the virtual machine object.
In this embodiment, a Java Virtual Machine object (JVM) is obtained through a Java Virtual Interface (JVM Tool Interface, JVM for short), and an event request manager (eventRequestManager) is obtained through the JVM.
The JVM is based on event driving, and calls callback interfaces (if any) of some events when the JVM executes certain logic, and the interfaces can be used for developers to extend own logic.
The JVM is a program interface used for developing and monitoring the JVM, and can detect the internal state of the JVM and control the execution of the JVM application. The functions that can be implemented include, but are not limited to: debugging, monitoring, thread analysis, coverage analysis tools, and the like.
JVMTI is a two-way interface. The client of the JVMTI, also called an agent (agent), can monitor interesting events, the JVMTI provides a plurality of functions so as to inquire or control an application program, the agent of the JVMTI and a target JVM run in the same process, and the JVMTI is communicated through the JVMTI, so that the control capability is maximized, and the communication cost is minimized. In a typical scenario, the agent for the JVM application will be implemented very compactly, and other processes will communicate with the JVM application agent to achieve the goal of controlling the JVM application.
Step 302, clearing the instruction interception breakpoint set by the history by using the event request manager.
In this embodiment, the information of the instruction interception breakpoint stored in the event request manager is cleared by a method of deleting an event request (deleteEventRequest), so as to achieve the purpose of clearing the instruction interception breakpoint historically set, so that no instruction interception breakpoint exists in the current test process.
Step 303, determining a target concurrent lock to be tested according to the lock test instruction.
And step 304, setting an instruction interception breakpoint on the instruction receiving channel of the target concurrent lock.
Step 305, controlling the instruction interception breakpoint to conduct the connection path of the instruction receiving channel and the target concurrent lock only when the number of the intercepted instructions exceeds the preset number.
In this embodiment, since the event request manager has been generated in step 301, when the number of instructions intercepted by the instruction interception breakpoint exceeds the preset number, the instruction interception breakpoint can be cleared by the event request manager through the deleteEventRequest, so as to achieve the purpose of turning on the connection path where the instruction receiving channel and the target are concurrently locked.
Step 306, receiving the processing result of the target concurrent lock on the instructions exceeding the preset number.
The above step 303-.
In some optional implementation manners of this embodiment, the concurrent lock testing method further includes: and monitoring the quantity of the intercepted instructions at the instruction interception breakpoint through the virtual machine programming interface.
Specifically, in this embodiment, because the JVM is already acquired through the JVM, the number of access objects held at the instruction interception breakpoint can be determined through the JVM, so that the number of instructions intercepted at the instruction interception breakpoint can be directly monitored without additional settings, the processing structure of the concurrent lock testing method is simplified, and the required resources are reduced.
On the basis of any one of the above embodiments, the concurrent lock testing method further includes: and responding to the processing result as an empty set, and generating feedback information that the target concurrent lock meets the locking requirement.
Specifically, when the target concurrent lock has an empty set of processing results of instructions exceeding the preset number, it may be determined that the target concurrent lock can implement a locking function on all instructions intercepted by the instruction interception breakpoint, that is, the simulation concurrent instructions intercepted and accumulated by the instruction interception breakpoint cannot pass through the target concurrent lock, and the locking function of the target concurrent lock can meet the locking requirement and generate corresponding feedback information for feedback, so as to know the result of the concurrent lock test.
Further, in order to improve the accuracy of the concurrent lock test and avoid the false test report caused by the fact that the target concurrent lock cannot pass due to the exception of the instruction, the feedback information that the target concurrent lock meets the locking requirement is generated in response to the processing result being an empty set, and the method includes: responding to the processing result as an empty set, acquiring the preset number of instructions intercepted by the instruction interception point this time, and generating a corresponding test instruction set; after the locking pause function of the target concurrent lock is controlled; sending the test instruction set to the target concurrent lock after the locking function is suspended; and responding to the test instructions in the test instruction set, wherein the test instructions can pass through the target concurrent lock after the locking function is suspended, and generating feedback information that the target concurrent lock meets the locking requirement.
Specifically, when the processing result of the target concurrent lock on the instructions exceeding the preset number is an empty set, all the instructions of the preset number intercepted by the instruction interception point at this time are acquired, and generates a corresponding test instruction set, then controls the target concurrent lock to temporarily close the locking function, that is, after any instruction is allowed to pass through the target concurrent lock, the target concurrent lock after the locking function is suspended issues the test instruction set, the test instructions in the test instruction set can pass through the target concurrent lock after the locking function is suspended, determining that the target concurrency lock effectively locks all the instructions of the preset number intercepted by the instruction fetching interception point this time, generating corresponding feedback information for feedback, the method and the device can avoid the false test report caused by the fact that the target concurrent lock cannot pass due to the abnormal instruction, and improve the test accuracy of the target concurrent lock.
For a deeper understanding, the present disclosure also provides a specific implementation scheme in conjunction with a specific application scenario, please refer to the flow 400 shown in fig. 4.
Step 401, obtain an event request manager.
Specifically, in one agent, a virtual machine JVM object is obtained through the JVM ti, and an event request manager is obtained by using the JVM.
Step 402, clearing historical breakpoints.
Specifically, historical instruction interception breakpoints in the test process are cleared in a mode of deleting event requests in an event request manager.
And 403, determining a target concurrent lock to be tested according to the lock test instruction.
And step 404, setting an instruction interception breakpoint on the instruction receiving channel of the target concurrent lock.
Specifically, the position of an instruction interception breakpoint set on an instruction receiving channel of the target concurrent lock is determined, and an instruction interception breakpoint is generated before the position by using a createbeakpointrequest function.
And 405, controlling the instruction interception breakpoint to conduct a connection path between the instruction receiving channel and the target concurrent lock only when the number of the intercepted instructions exceeds a preset number.
Step 406, receiving the processing result of the target concurrent lock on the instructions exceeding the preset number.
Specifically, the processing result includes an instruction set of an instruction a and an instruction B, where the instruction a is "add labeling information abcd for the first parameter", and the instruction B is "add labeling information cdef for the first parameter".
Step 407, in response to the processing result being an instruction set including at least one instruction, optimizing the target concurrent lock using the instruction set.
Specifically, based on the determination in step 406 that there is an instruction set of instruction A and instruction B in the instruction set, the common characteristic of both is determined to be "add … … to first argument", and thus the target concurrent lock is optimized for the locking capability of the "add … … to first argument" instruction.
With further reference to fig. 5, as an implementation of the methods shown in the above-mentioned figures, the present disclosure provides an embodiment of a concurrent lock testing apparatus, which corresponds to the method embodiment shown in fig. 2, and which may be specifically applied to various electronic devices.
As shown in fig. 5, the concurrent lock testing apparatus 500 of the present embodiment may include: a concurrency 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 a target concurrent lock to be tested according to a lock test instruction; when the instruction interception breakpoint generating unit 502 is configured to set an instruction interception breakpoint on the instruction receiving channel of the target concurrent lock; an instruction interception breakpoint control unit 503 configured to control the instruction interception breakpoint to conduct a connection path between the instruction receiving channel and the target concurrent lock only when the number of intercepted instructions exceeds a preset number; a processing result receiving unit 504 configured to receive a processing result of the target concurrent lock on instructions exceeding the preset number.
In the present embodiment, in the concurrent lock testing apparatus 500: the specific processing and the technical effects thereof of the concurrent lock determination unit 501, the instruction interception breakpoint generation unit 502, the instruction interception breakpoint control unit 503, and the processing result receiving unit 504 can refer to the related descriptions of step 201 and step 204 in the corresponding embodiment of fig. 2, and are not described herein again.
In some optional implementations of the present embodiment, the concurrent lock testing apparatus 500 further includes: and the concurrent lock optimization unit is configured to respond to the processing result that an instruction set comprising at least one instruction is used for optimizing the target concurrent lock by utilizing the instruction set.
In some optional implementations of this embodiment, the concurrent lock determination unit 501 is further configured to determine a target concurrent lock to be tested according to the lock test instruction in response to the test progress entering the unit test phase.
In some optional implementations of the present embodiment, the concurrent lock testing apparatus 500 further includes: the manager generating unit is configured to acquire a virtual machine object through a virtual interface and generate an event request manager according to the virtual machine object; and a historical instruction interception breakpoint clearing unit configured to clear the historically set instruction interception breakpoints using the event request manager.
In some optional implementations of the present embodiment, the concurrent lock testing apparatus 500 further includes: and the instruction quantity monitoring unit is configured to monitor the quantity of the intercepted instructions at the instruction interception breakpoint through the virtual machine programming interface.
In some optional implementations of the present embodiment, the concurrent lock testing apparatus 500 further includes: and the feedback information generating unit is configured to generate the feedback information that the target concurrent lock meets the locking requirement in response to the processing result being the empty set.
In some optional implementations of this embodiment, the feedback information generating unit 504 includes: the test instruction set generating subunit is configured to respond to that the processing result is an empty set, acquire 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 after suspending the locking function; the test instruction issuing subunit is configured to issue the test instruction set to the target concurrent lock after the locking function is suspended; and the feedback information generation subunit is configured to respond to that the test instructions in the test instruction set can pass through the target concurrent lock after the locking function is suspended, and generate feedback information that the target concurrent lock meets the locking requirement.
The embodiment exists as an embodiment of the device corresponding to the method embodiment, and the concurrent lock testing device provided by the embodiment collects the test information by using the instruction interception point under the original test process, so as to restore the multi-instruction concurrent scene more truly, and does not need to additionally construct the test process, thereby saving the test resources, improving the test quality of the concurrent lock test, and realizing the more accurate and more precise concurrent lock test.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
FIG. 6 illustrates a schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 6, the apparatus 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM)602 or a computer program loaded from a storage unit 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The calculation unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
A number of components in the device 600 are connected to the I/O interface 605, including: an input unit 606 such as a keyboard, a mouse, or the like; an output unit 607 such as various types of displays, speakers, and the like; a storage unit 608, such as a magnetic disk, optical disk, or the like; and a communication unit 609 such as a network card, modem, wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The computing unit 601 may be a variety of general and/or special purpose processing components having 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 dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The computing unit 601 performs the various methods and processes described above, such as the concurrent lock test method. For example, in some embodiments, the concurrent lock testing method may be implemented as a computer software program tangibly embodied 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 onto the device 600 via the ROM 602 and/or the 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 concurrent lock testing method described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the concurrent lock test method in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a 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 may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The Server may be a cloud Server, which is also called a cloud computing Server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service extensibility in the conventional physical host and Virtual Private Server (VPS) service. The server may also be divided into servers of a distributed system, or servers that incorporate a blockchain.
According to the technical scheme of the embodiment of the disclosure, the test information is collected by using the instruction interception point under the original test process, so that the multi-instruction concurrency scene is relatively truly restored, the test process does not need to be additionally constructed, the test resource is saved, the test quality of the concurrency lock test can be improved, and the more accurate and more precise concurrency lock test with finer granularity is realized.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in this disclosure may be performed in parallel or sequentially or in a different order, as long as the desired results of the technical solutions provided by this disclosure can be achieved, and are not limited herein.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.

Claims (17)

1. A concurrent lock testing method, comprising:
determining a target concurrent lock to be tested according to the lock test instruction;
setting an instruction interception breakpoint on an instruction receiving channel of the target concurrent lock;
controlling the instruction interception breakpoint to conduct a connection path between the instruction receiving channel and the target concurrent lock only when the number of intercepted instructions exceeds a preset number;
and receiving a processing result of the target concurrent lock on the instructions exceeding the preset number.
2. The method of claim 1, further comprising:
and in response to the processing result being an instruction set comprising at least one instruction, optimizing the target concurrent lock by using the instruction set.
3. The method of claim 1, wherein the determining a target concurrent lock to be tested according to lock test instructions comprises:
and responding to the test process to enter a unit test stage, and determining the target concurrent lock to be tested according to the lock test instruction.
4. The method of claim 1, further comprising:
acquiring a virtual machine object through a virtual interface, and generating an event request manager according to the virtual machine object;
and clearing the instruction interception breakpoint set by the history by using the event request manager.
5. The method of claim 4, further comprising:
and monitoring the quantity of the instructions intercepted at the instruction interception breakpoint through the virtual machine programming interface.
6. The method of any of claims 1-5, further comprising:
and responding to the processing result as an empty set, and generating feedback information that the target concurrent lock meets the locking requirement.
7. The method of claim 6, wherein the generating feedback that the target concurrent lock meets a locking requirement in response to the processing result being an empty set comprises:
responding to the processing result that the processing result is an empty set, acquiring the preset number of instructions intercepted by the instruction interception point this time, and generating a corresponding test instruction set;
after the locking pause function of the target concurrent lock is controlled;
issuing the test instruction set to the target concurrent lock with the locking function suspended;
and responding to the test instructions in the test instruction set, wherein the test instructions can pass through the target concurrent lock after the locking function is suspended, and generating feedback information that the target concurrent lock meets the locking requirement.
8. A concurrent lock testing device, comprising:
a concurrent lock determination unit configured to determine a target concurrent lock to be tested according to the lock test instruction;
an instruction interception breakpoint generating unit configured to set an instruction interception breakpoint on an instruction receiving channel of the target concurrent lock;
an instruction interception breakpoint control unit configured to control the instruction interception breakpoint to conduct a connection path between the instruction receiving channel and the target concurrent lock only when the number of intercepted instructions exceeds a preset number;
a processing result receiving unit configured to receive a processing result of the target concurrent lock on instructions exceeding the preset number.
9. The apparatus of claim 8, further comprising:
a concurrent lock optimization unit configured to optimize the target concurrent lock with an instruction set including at least one of the instructions in response to the processing result being the instruction set.
10. The apparatus of claim 8, wherein the concurrency lock determination unit is further configured to determine a target concurrency lock to be tested according to the lock test instruction in response to the test procedure entering a unit test phase.
11. The apparatus of claim 8, further comprising:
the management device comprises a manager generating unit, a service managing unit and a service managing unit, wherein the manager generating unit is configured to acquire a virtual machine object through a virtual interface and generate an event request manager according to the virtual machine object;
a historical instruction interception breakpoint clearing unit configured to clear the historically set instruction interception breakpoints using the event request manager.
12. The apparatus of claim 11, further comprising:
and the instruction quantity monitoring unit is configured to monitor the quantity of the intercepted instructions at the instruction interception breakpoint through the virtual machine programming interface.
13. The apparatus of any of claims 8-12, further comprising:
a feedback information generating unit configured to generate feedback information that the target concurrent lock satisfies a locking requirement in response to the processing result being an empty set.
14. The apparatus of claim 13, wherein the feedback information generating unit comprises:
the test instruction set generating subunit is configured to respond to that the processing result is an empty set, acquire 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 after suspending a locking function;
the test instruction issuing subunit is configured to issue the test instruction set to the target concurrent lock after the locking function is suspended;
and the feedback information generation subunit is configured to respond to that the test instructions in the test instruction set can pass through the target concurrent lock after the locking function is suspended, and generate feedback information that the target concurrent lock meets the locking requirement.
15. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the concurrent lock test method of any one of claims 1-7.
16. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the concurrent lock testing method of any of claims 1-7.
17. A computer program product comprising a computer program which, when executed by a processor, implements a concurrent lock testing method according to any one of claims 1-7.
CN202110697331.5A 2021-06-23 2021-06-23 Concurrent lock testing method, related device and computer program product Pending CN113360330A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110697331.5A CN113360330A (en) 2021-06-23 2021-06-23 Concurrent lock testing method, related device and computer program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110697331.5A CN113360330A (en) 2021-06-23 2021-06-23 Concurrent lock testing method, related device and computer program product

Publications (1)

Publication Number Publication Date
CN113360330A true CN113360330A (en) 2021-09-07

Family

ID=77536002

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110697331.5A Pending CN113360330A (en) 2021-06-23 2021-06-23 Concurrent lock testing method, related device and computer program product

Country Status (1)

Country Link
CN (1) CN113360330A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105045711A (en) * 2015-06-30 2015-11-11 北京嘀嘀无限科技发展有限公司 Concurrent simulation test method and apparatus
US10430321B1 (en) * 2018-08-21 2019-10-01 International Business Machines Corporation White box code concurrency testing for transaction processing
CN111459798A (en) * 2020-03-03 2020-07-28 深圳壹账通智能科技有限公司 Test method, test device, test medium, and electronic apparatus

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105045711A (en) * 2015-06-30 2015-11-11 北京嘀嘀无限科技发展有限公司 Concurrent simulation test method and apparatus
US10430321B1 (en) * 2018-08-21 2019-10-01 International Business Machines Corporation White box code concurrency testing for transaction processing
CN111459798A (en) * 2020-03-03 2020-07-28 深圳壹账通智能科技有限公司 Test method, test device, test medium, and electronic apparatus

Similar Documents

Publication Publication Date Title
US20210383295A1 (en) Method and apparatus for stress testing, electronic device and computer readable medium
EP3860051A2 (en) Method, apparatus, electronic device, readable storage medium and program for determining robustness
CN113220420A (en) Service monitoring method, device, equipment, storage medium and computer program product
CN114328132A (en) Method, device, equipment and medium for monitoring state of external data source
CN114417780B (en) State synchronization method and device, electronic equipment and storage medium
CN113238815B (en) Interface access control method, device, equipment and storage medium
CN114861039A (en) Parameter configuration method, device, equipment and storage medium of search engine
CN116645082A (en) System inspection method, device, equipment and storage medium
CN115357493A (en) Test method, test device, electronic equipment and storage medium
CN113360330A (en) Concurrent lock testing method, related device and computer program product
EP3832985B1 (en) Method and apparatus for processing local hot spot, electronic device and storage medium
CN112799642B (en) Method, apparatus, device and storage medium for processing data
CN115438056A (en) Data acquisition method, device, equipment and storage medium
CN114003497A (en) Method, device and equipment for testing service system and storage medium
CN114756301A (en) Log processing method, device and system
US10713103B2 (en) Lightweight application programming interface (API) creation and management
CN113961405B (en) State switching instruction verification method and device, electronic equipment and storage medium
CN113326513B (en) Application testing method and device, system, electronic equipment and computer readable medium
CN116483732A (en) Testing method, device and equipment based on multiple data sources
CN111597579B (en) Sanitary safety detection method, device, electronic equipment and storage medium
CN117251419A (en) File monitoring method and device, electronic equipment and storage medium
CN116841948A (en) Method and device for data transmission between Central Processing Units (CPUs) and electronic equipment
CN115757275A (en) Asset information management method and device, electronic equipment and storage medium
CN117729005A (en) Network asset mapping method
CN113934581A (en) Method and device for acquiring disk fault information of storage system, electronic equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination