CN117632698A - Detection method, apparatus, device, storage medium, and computer program product - Google Patents

Detection method, apparatus, device, storage medium, and computer program product Download PDF

Info

Publication number
CN117632698A
CN117632698A CN202210998261.1A CN202210998261A CN117632698A CN 117632698 A CN117632698 A CN 117632698A CN 202210998261 A CN202210998261 A CN 202210998261A CN 117632698 A CN117632698 A CN 117632698A
Authority
CN
China
Prior art keywords
code
detection
task
detected
packet
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
CN202210998261.1A
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202210998261.1A priority Critical patent/CN117632698A/en
Publication of CN117632698A publication Critical patent/CN117632698A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The application provides a detection method, apparatus, device, storage medium and computer program product, the method comprising: responding to code detection trigger, and acquiring an object code difference set identifier; the target code difference set is identified as an identification of an associated code difference set associated with the combined code packet to be detected and the detection task to be executed; inquiring a historical detection result record table according to the target code difference set identification and the target task identification of the detection task to be executed; if the query result indicates that the target record item exists in the history detection result record table, determining that the detection result of the to-be-detected combined code packet related to the to-be-executed detection task is passing detection, and skipping to execute the to-be-executed detection task of the to-be-detected combined code packet; the target record item is used for indicating that the detection result corresponding to the target code difference set identifier and the target task identifier is passing detection. By adopting the embodiment of the application, the detection efficiency of the merging codes to be detected can be improved under the precondition that the accuracy is not lost.

Description

Detection method, apparatus, device, storage medium, and computer program product
Technical Field
The present application relates to the field of computer technology, and in particular, to a detection method, a detection apparatus, a computer device, a computer readable storage medium, and a computer program product.
Background
The continuous integration (Continuous Integration, CI) is a process of constructing software and completing initial testing, and in an actual development process, when a developer submits a code and applies for merging into a backbone, the process is triggered to complete detection tasks such as detecting rationality and legitimacy of the code merged into the code. It can be seen that the purpose of continuous integration is mainly to ensure the correctness of the incorporated code.
Currently, to improve the efficiency of continuous integration, most teams optimize from the compiling speed to expect to reduce the waiting time, thereby improving the development efficiency. However, directly optimizing the compiling speed is a matter of great investment and difficult to be profitable, and the compiling speed in many schemes is improved at the cost of reducing the accuracy, which in turn causes the hidden trouble of efficiency degradation. Therefore, how to improve the detection efficiency of the merging code to be detected under the precondition of not losing accuracy becomes a problem to be solved.
Disclosure of Invention
The embodiment of the application provides a detection method, a detection device, a detection equipment, a storage medium and a computer program product, which can improve the detection efficiency of a merging code to be detected on the premise of not losing accuracy.
In a first aspect, an embodiment of the present application provides a detection method, including:
responding to code detection trigger, and acquiring an object code difference set identifier; the target code difference set is identified as an identification of an associated code difference set associated with a to-be-detected combined code packet and a to-be-executed detection task, the to-be-detected combined code packet is generated according to an initial code packet and a to-be-integrated code packet corresponding to the initial code packet, the associated code difference set is composed of associated difference codes, and the associated difference codes are difference codes associated with the to-be-executed detection task in difference codes between the to-be-detected combined code packet and the initial code packet;
inquiring a historical detection result record table according to the target code difference set identifier and the target task identifier of the detection task to be executed to obtain an inquiry result;
if the query result indicates that a target record item exists in the history detection result record table, determining that the detection result of the to-be-detected combined code packet related to the to-be-executed detection task is detection passing, and skipping execution of the to-be-executed detection task on the to-be-detected combined code packet; the target record item is used for indicating that the detection result corresponding to the target code difference set identifier and the target task identifier is passing detection.
In a second aspect, embodiments of the present application provide a detection apparatus, including:
the processing unit is used for responding to code detection trigger and acquiring an object code difference set identifier; the target code difference set is identified as an identification of an associated code difference set associated with a to-be-detected combined code packet and a to-be-executed detection task, the to-be-detected combined code packet is generated according to an initial code packet and a to-be-integrated code packet corresponding to the initial code packet, the associated code difference set is composed of associated difference codes, and the associated difference codes are difference codes associated with the to-be-executed detection task in difference codes between the to-be-detected combined code packet and the initial code packet;
the processing unit is also used for inquiring a historical detection result record table according to the target code difference set identifier and the target task identifier of the detection task to be executed to obtain an inquiry result;
and the determining unit is used for determining that the detection result of the to-be-detected combined code packet about the to-be-executed detection task is detection passing if the query result indicates that a target record item exists in the historical detection result record table, and skipping the execution of the to-be-executed detection task on the to-be-detected combined code packet, wherein the target record item is used for indicating that the detection result corresponding to the target code difference set identifier and the target task identifier is detection passing.
In a third aspect, an embodiment of the present application provides a computer device, where the computer device includes a processor, a communication interface, and a memory, where the processor, the communication interface, and the memory are connected to each other, where the memory stores a computer program, and the processor is configured to invoke the computer program to execute a detection method provided by an embodiment of the present application.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium storing a computer program that when executed by a processor implements the detection method provided by embodiments of the present application.
In a fifth aspect, embodiments of the present application provide a computer program product comprising a computer program or computer instructions which, when executed by a processor, implement the detection method provided by the embodiments of the present application.
By adopting the embodiment of the application, when the to-be-detected merging code executes the to-be-detected task, if the detection result corresponding to the identification indicating the target code difference set corresponding to the to-be-detected merging code and the identification of the to-be-detected task is found to be the detection passing in the history detection result record table, the detection result of the to-be-detected merging code executing the to-be-detected task can be directly obtained to be the detection passing, and the to-be-detected merging code is not executed any more, so that repeated detection operation can be reduced, detection time can be saved, and the detection efficiency of the to-be-detected merging code can be improved under the premise of not losing accuracy.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a block diagram of a detection system according to an embodiment of the present application;
fig. 2 is a schematic flow chart of a detection method according to an embodiment of the present application;
FIG. 3 is a schematic flow chart of another detection method according to an embodiment of the present disclosure;
FIG. 4 shows a process flow of the detection method provided by the present application;
FIG. 5 is a schematic diagram of a detection device according to an embodiment of the present disclosure;
fig. 6 is a schematic diagram of a computer device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
To facilitate an understanding of the embodiments disclosed herein, some concepts to which the embodiments of the present application relate are first described. The description of these concepts includes, but is not limited to, the following.
1. Code difference set
The code difference set refers to a set of codes that are added or changed or deleted to the combined code packet to be detected relative to the initial code packet.
2. Code differential set identification
The code difference set identification refers to a short code which can be corresponding to the content of the code difference set and is not easy to repeat. Alternatively, the code differential set identification may be a key (key) value of the code differential set.
3. Detection task
In the application, the detection task may be a task related to continuous integration and used for detecting the rationality and legality of the code, and may include compiling the detection task, simulating the running detection task, code specification detection task and the like.
Alternatively, the compilation detection task may also be referred to as a compilation check. The compiling inspection refers to: (1) a process of generating a target program from a source program written in a source language by using a compiler; (2) the actions of the object program are generated by the compiler. The compiling check is a key step in the continuous integration check, in which the code to be combined is combined with the initial code, and then the combined code is subjected to a complete compiling process, and if the compiling can be successfully completed, the compiling check is passed.
Alternatively, the simulation run detection task may also be referred to as unit testing. Unit testing refers to checking and verifying the smallest testable unit in software. For the meaning of a unit in a unit test, generally, the specific meaning of the unit is to be determined according to practical situations, for example, a unit in a C language refers to a function, a unit in Java refers to a class, and a unit in graphic software may refer to a window or a menu. In general, a unit is an artificially defined minimum measured function module. Unit testing is the lowest level of testing activity to be performed during the development of software, where individual units of software will be tested in isolation from other parts of the program.
Alternatively, the code specification detection task may also be referred to as code specification scanning. Code specification scanning refers to scanning codes by using a certain tool, and identifying problems in which the agreed specification is not satisfied. When a problem is found, the inspection result of the code specification scan is determined to be an inspection failure.
4. History detection result record table
In this application, the history detection result record table may also be regarded as a persistent integrated cache service. The continuous integrated cache service is a continuous integrated core storage service, and stores or queries the detection result corresponding to the associated detection task by the task type+key value of the difference set. For example, one code difference set has a key value 6153jla1, and the detection task is a compilation check, and then after the compilation check is performed, the execution result (success or failure) may be stored in this service in the form of compilation check +6153 jla.
In order to facilitate understanding of the embodiments of the present application, the detection method of the present application is described below.
In order to improve the detection efficiency of the merging codes on the premise of not losing accuracy, the embodiment of the application provides a detection method. Referring to fig. 1, fig. 1 is a schematic diagram of a detection system according to an embodiment of the present application. The code detection end 101 and the code management end 102 can perform data interaction through a network, and the code management end 102 and the development end 103 can also perform data interaction through the network. The following describes a general implementation procedure of the detection method according to the embodiment of the present application with reference to fig. 1: firstly, a code detection end 101 receives a code detection instruction sent by a code management end 102, triggers code detection, and obtains the identification of an associated code difference set associated with a combined code packet to be detected and a detection task to be executed; the to-be-detected combined code packet is generated according to the initial code packet and the to-be-combined code packet corresponding to the initial code packet, and the to-be-combined code packet is sent to the code management end by the development end 103. Then, the code detection end 101 queries the historical detection result record table according to the target code difference set identifier and the target task identifier of the detection task to be executed, and obtains a query result. Finally, if the query result indicates that the target record item exists in the history detection result record table, the code detection end 101 determines that the detection result of the to-be-detected combined code packet related to the to-be-executed detection task is detection passing, and skips executing the to-be-executed detection task on the to-be-detected combined code packet; the target record item is used for indicating that the detection result corresponding to the target code difference set identifier and the target task identifier is passing detection. If the query result indicates that the target record item does not exist in the historical detection result record table, executing the detection task to be executed aiming at the combined code packet to be detected, and obtaining the detection result of the combined code packet to be detected, which is related to the detection task to be executed.
Practice shows that the model processing scheme provided by the embodiment of the application can have the following beneficial effects: (1) if the detection result corresponding to the identification of the code difference set corresponding to the merging code to be detected and the identification of the task to be executed is found to be the detection passing in the historical detection result record table, the detection result of executing the task to be executed by the merging code to be detected can be determined to be the detection passing, and the task to be executed by the merging code to be detected is skipped, so that the detection efficiency of the merging code to be detected can be improved under the premise of not losing accuracy. (2) After the detection result of the execution of the detection task to be executed by the merging code to be detected is determined to be that the detection is passed, the execution of the detection task to be executed by the merging code to be detected can be skipped, so that the consumption of host machine resources can be reduced, and the detection cost is reduced. (3) The detection method has universality, can be applied to the flow improvement of software development, and is directly applied to the continuous integration process.
It should be noted that: in a specific implementation, the above scheme may be executed by a code detection end, where the code detection end may be one or more computer devices. The computer device may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), basic cloud computing services such as big data and artificial intelligence platforms, and the like. Moreover, the computer device mentioned in the embodiments of the present application may be located outside the blockchain network or may be located inside the blockchain network, which is not limited thereto; a blockchain network is a network composed of a point-to-point network (P2P network) and a blockchain, and a blockchain refers to a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm, etc., which is essentially a decentralised database, and is a string of data blocks (or referred to as blocks) generated by association using a cryptographic method.
Alternatively, the code management terminal 102 in the detection system may be the computer device mentioned above. Alternatively, the development terminal 103 in the detection system may be a terminal device. The terminal equipment comprises, but is not limited to, a tablet computer, a notebook computer, a desktop computer, intelligent voice interaction equipment, an intelligent watch, intelligent household appliances, an intelligent vehicle-mounted terminal and the like.
Optionally, the embodiment of the application can be applied to various scenes such as cloud technology, artificial intelligence, intelligent traffic, auxiliary driving and the like.
The detection method provided in the embodiment of the present application is described in detail below.
Referring to fig. 2, fig. 2 is a flow chart of a detection method according to an embodiment of the present application. The method may be performed by a code detection terminal (e.g., code detection terminal 101 in fig. 1), and the method is described below by taking the example that the code detection terminal is a computer device. As shown in fig. 2, the detection method may include the steps of:
s201, responding to code detection trigger, acquiring an object code difference set identifier, wherein the object code difference set identifier is the identifier of an associated code difference set associated with a to-be-detected combined code packet and a to-be-executed detection task.
The to-be-detected merging code packet is generated according to the initial code packet and the to-be-merged code packet corresponding to the initial code packet, the associated code difference set is composed of associated difference codes, and the associated difference codes are difference codes associated with to-be-executed detection tasks in the difference codes between the to-be-detected merging code packet and the initial code packet.
In an alternative embodiment, the to-be-detected combined code packet may be obtained by performing code combination on the initial code packet and a to-be-combined code packet corresponding to the initial code packet, where a difference code between the to-be-detected combined code packet and the initial code packet may be a code included in the to-be-combined code packet. For example, if the code packet to be integrated is used to implement a new function, the code packet to be integrated and the initial code packet are combined, that is, the codes in the code packet to be integrated are integrated into the initial code packet, and the difference code between the code packet to be detected and the initial code packet generated at this time is the code included in the code packet to be integrated.
In an alternative embodiment, the to-be-detected combined code packet may be obtained by performing code adjustment on the initial code packet according to the to-be-combined code packet corresponding to the initial code packet, where the difference code between the to-be-detected combined code packet and the initial code packet is not equivalent to the code included in the to-be-combined code packet. For example, the code package to be integrated is used for performing a code adjustment operation such as bug fix or code optimization on the initial code package, and then code adjustment may be performed on the codes in the initial code package according to an instruction operation (such as a code deleting operation, a code adding operation, a code replacing operation, etc.) indicated by the code package to be integrated, where a difference code between the generated code package to be detected and the initial code package is not equal to a code included in the code package to be integrated.
As can be seen from the foregoing, the associated difference code is the difference code associated with the detection task to be executed among the difference codes between the merging code packet to be detected and the initial code packet. Thus, for the same combined code packet to be detected, the associated code difference sets associated with different detection tasks to be performed are different. For example, assuming that a code difference set between a to-be-detected combined code packet and an initial code packet is marked as C, and a to-be-executed detection task corresponding to the to-be-detected combined code packet includes a compiling check, for the to-be-detected combined code packet, an associated code difference set associated with the compiling check task may be C1, C1 e C; assuming that the to-be-executed detection task corresponding to the to-be-detected combined code packet is a unit test, for the to-be-detected combined code packet, the associated code difference set associated with the unit test task may be C2, C2 e C. It will be appreciated that the associated code difference set associated with the combined code packet to be detected and the detection task to be performed is a subset of the code difference set formed by the difference codes between the codes in the combined code packet to be detected and the codes in the initial code packet.
In an optional embodiment, before step S201, if the computer device receives the first code detection instruction sent by the code management end, it determines that a code detection trigger is detected; the first code detection instruction is sent to the code detection end after the code management end receives a code combination request sent by the development end, wherein the code combination request is used for requesting the code management end to combine a code packet to be combined with an initial code packet.
For example, suppose a developer initiates a merge request (alternatively referred to as a merge application (e.g., noted as a merge application a)) to merge code to be merged into initial code through an originating end. If the code detection end receives the merging application A sent by the development end through the code management end, the code detection trigger is determined to be detected.
In another alternative embodiment, before step S201, if the computer device detects that the re-detection condition is satisfied, it determines that a code detection trigger is detected; the condition of re-detection is that the detection is not passed when the combined code packet to be detected is detected last time, and the number of re-detection is less than or equal to a set threshold. For example, when the compiling inspection is performed for the merging code packet to be detected last time, if there is a case that the detection is not passed, there may be a problem not only with the code itself but also due to a problem of hardware at the code detection end, and the like, at this time, in order to eliminate the problem of hardware at the code detection end, the merging code to be detected may be re-detected.
Optionally, meeting the re-detection condition may also refer to a case where a (rebase) pending code needs to be changed or a (merge) pending code needs to be merged. Optionally, the rebase code to be combined and the merge code to be combined mainly aim at a scene of error of the code to be combined. That is, when the development end determines that the code in the code packet to be merged has an error, the code to be merged may be updated, and at this time, the development end may reinitiate a merging request of the code to be merged into the initial code, so that the code detection end redetects the code packet to be merged and the code packet to be detected formed by the code packet to be merged and the initial code packet.
It should be noted that the task to be detected is one of tasks in continuous integration. Optionally, when the computer device performs the detection task on the combined code packet to be detected, multiple detection tasks may be performed concurrently. For example, the compiling inspection is performed on the integrated code to be detected, and meanwhile, the unit test, the code specification scanning and other detection tasks are also performed. In this case, when the detection result of the compiling inspection performed on the to-be-detected combined code packet last time is that the detection is passed, and the detection result of the performing unit test is that the detection is not passed, the condition that the detection is not passed when the detection is performed on the to-be-detected combined code packet last time is also included, and the re-detection condition is satisfied, but only the unit test is needed to be performed on the to-be-detected combined code packet again at this time.
In this embodiment, if the detection result of the to-be-detected combined code packet obtained by the last detection about the to-be-executed detection task is detection passing and no target record item exists in the history detection result record table, a target record item is added in the history detection result record table, where the target record item is used to indicate that the detection result corresponding to the target code difference set identifier and the target task identifier is detection passing.
In an alternative embodiment, the computer device, in response to the code detection trigger, obtains the target code differential set identification, may include: acquiring an initial code difference set corresponding to a to-be-detected combined code packet, wherein the initial code difference set is formed by difference codes between the to-be-detected combined code packet and the initial code packet; removing redundant information in the initial code difference set and information irrelevant to executing the detection task to be executed to obtain an associated code difference set associated with the combined code packet to be detected and the detection task to be executed; and performing abstract calculation on the associated code difference set, determining the identification of the associated code difference set according to the abstract calculation result, and determining the identification of the determined associated code difference set as the identification of the target code difference set.
Optionally, the initial code difference set corresponding to the to-be-detected combined code packet may be obtained by comparing the code in the to-be-detected combined code packet with the code in the initial code packet by the code detection end, or may be obtained by analyzing the code in the to-be-combined code packet and the code in the initial code packet by the code management end by calling a version control tool of the code warehouse.
Alternatively, the redundant information is, for example, a line number, a file hash value, redundant context information of a changed file, or the like. Alternatively, the information not related to executing the task to be detected may be referred to as configurable don't care change information, for example, in executing the compiling checking task, the change information of the configured unit test file is the information not related to executing the compiling checking. Alternatively, the redundant information of the code difference set and the information not related to performing the detection task to be performed may be collectively referred to as invalid information of the code difference set.
Optionally, when the computer device performs digest calculation on the associated code difference set and determines the identifier of the associated code difference set according to the result of the digest calculation, the computer device may perform the digest calculation on the associated code difference set by using a secure hash algorithm256 (Secure Hash Algorithm, SHA 256); secondly, calculating the summary calculation result by using a Message-summary algorithm 5 (MD5) algorithm; then, the first 8 bits of the MD5 result are determined as the identification of the associated code difference set; and finally, determining the identification of the determined association code difference set as the identification of the target code difference set. For example, the target code differential set is identified as 6153jla1.
Where SHA256 is one branch of SHA 2. For messages of arbitrary length, SHA256 generates a 256-bit hash value, called a message digest. This summary corresponds to an array of 32 bytes in length, typically represented by a hexadecimal string of length 64, where 1 byte = 8 bits and a hexadecimal character is 4 bits in length.
The MD5 algorithm is a hash function widely used in the field of computer security and is used for ensuring complete and consistent information transmission. The MD5 algorithm is input as arbitrary length information and output as fixed length information.
In another alternative embodiment, the computer device, in response to the code detection trigger, obtaining the target code differential set identification may include: acquiring a code difference set corresponding to a to-be-detected combined code packet, wherein the code difference set is formed by difference codes between the to-be-detected combined code packet and an initial code packet; and performing abstract calculation on the code difference set, and determining the target code difference set identification according to an abstract calculation result. That is, in this embodiment, the computer apparatus does not need to perform the invalid information eliminating process on the code difference set. It can be understood that, in this embodiment, for the same combined code packet to be detected, the code difference sets corresponding to different tasks to be detected are the same, so that the target code difference set identifiers corresponding to different tasks to be detected are also the same.
S202, inquiring a historical detection result record table according to the target code difference set identification and the target task identification of the detection task to be executed, and obtaining an inquiry result.
In an alternative embodiment, each entry in the history detection result record table is generated according to a history code difference set identifier and a history task identifier, the history code difference set identifier is an identifier of a history code difference set associated with a history merge code package and a history detection task, and the history detection task is a detection task indicated by the history task identifier; each entry is added to the history detection result record table when it is determined that the detection result of the history merging code packet concerning the history detection task is the passing of the detection. In this embodiment, each entry in the history detection result record table indicates that the detection result of the detection task corresponding to the history combined code packet is passing detection. Optionally, the record items in the history detection result record table may be increased when the detection result is detected by the detection unit when the combined code packet to be detected is detected in advance; or the number of the detection results is increased when the last detection result is the detection passing when the repeated detection is carried out on the combined code packet to be detected; the detection result may be increased in the case where the detection is passed when detecting the history combined code packet one or more times before performing the task of detection for the combined code packet to be detected.
For example, assuming that the associated detection task of one merged code packet is a compilation check, the identifier of the associated code difference set is 6153jla, when it is determined that the detection result of the compilation check on the merged code packet is that the detection is passed, the entry "compilation check+6153 jla" may be added to the history detection result record table.
In another alternative embodiment, each entry in the history detection result record table is generated according to the history code difference set identifier, the history task identifier, and the detection result identifier of the detection task corresponding to the history combined code packet. Optionally, the detection result identifier of the detection task corresponding to the history combined code packet is used for indicating that the detection passes or the detection does not pass.
For example, assuming that the detection result is identified as 1 indicating that detection is passed and the detection result is identified as 2 indicating that detection is not passed, assuming that the associated detection task of one merged code packet is a compilation check, the identification of the associated code difference set is 6153jla1, and when it is determined that the detection result of the compilation check on the history merged code packet is that detection is passed, the entry "compilation check+6153jla1+1" may be added to the history detection result record table. For another example, assuming that the associated detection task of a merged code packet is a unit test, the identifier of the associated code difference set is 6189jla, when it is determined that the detection result of the unit test about the historical merged code packet is that the detection fails, the record item "unit test+6189jla3+2" may be added to the historical detection result record table.
S203, if the query result indicates that a target record item exists in the history detection result record table, determining that the detection result of the to-be-detected combined code packet related to the to-be-executed detection task is detection passing, and skipping to execute the to-be-executed detection task of the to-be-detected combined code packet; the target record item is used for indicating that the detection result corresponding to the target code difference set identifier and the target task identifier is passing detection.
That is, if the query result indicates that the target record item exists in the history detection result record table, it is indicated that the task to be performed related to the target code difference set identification has been performed before the current detection is performed, and the previous detection result is that the detection is passed.
And S204, if the query result indicates that the target record item does not exist in the historical detection result record table, executing the detection task to be executed aiming at the combined code packet to be detected, and obtaining the detection result of the combined code packet to be detected about the detection task to be executed.
In an alternative embodiment, if the detection result of the combined code packet to be detected about the task to be detected is that the detection is passed, adding a target record item in the history detection result record table, where the added target record item is generated according to the target code difference set identifier and the target task identifier of the task to be detected. Alternatively, the computer device may send a message passing the detection to the code management end, so that the code management end stores the merged code packet to be detected in the code repository. If the detection result of the combined code packet to be detected about the detection task to be executed is not passed, a message that the detection result is not passed is sent to the code management end, so that the code management end informs the development end of detection failure, and the developer can take relevant measures conveniently. For example, a merging request for merging the code packet to be merged into the initial code packet is reinitiated, or a merging request for merging the code packet to be merged into the initial code packet is initiated after updating the code packet to be merged, or the like.
The detection method described in the embodiments of the present application is exemplified below.
Step one, a developer initiates a merging request (or called a merging application A) for merging a code packet to be merged into an initial code packet through a developing end. And when the code detection end receives the code detection instruction sent by the code management end, determining that the code detection trigger is detected.
And step two, the code detection end responds to the code detection trigger to acquire the target code difference set identifier associated with the combined application A, for example 001c4364.
Step three, assuming that the task to be detected about the merging code to be detected is compiling check, and the task identifier corresponding to the compiling check is "01", the code detection end can query whether a record item of "01+001c4364" exists in the query history detection result record table. Alternatively, the code detection end may query whether "compile check +001c4364" exists in the query history detection result record table.
Step four, if the history detection result record table has ' 01+001c4364 ' or ' compiling check
The record of +001c4364″ is that the compiling inspection of the merging code to be detected is directly skipped and marked as passing. If the record item of "01+001c4364" or "compile check +001c4364" does not exist in the history detection result record table, a compile check is performed on the merged code to be detected.
And step five, if the detection result of the compiling detection of the merging code to be detected is that the detection passes, adding a record item of '01+001c4364' or 'compiling detection +001c 4364' in a history detection result record table.
And step six, the developer initiates a merging request (or called as a merging application B) for merging the code package to be merged into the initial code package through the development terminal. And when the code detection end receives the code detection instruction sent by the code management end, determining that the code detection trigger is detected.
And step seven, the code detection end responds to the code detection trigger to acquire the target code difference set identifier of the combined code packet with detection corresponding to the combined application B as 001c4364.
Step eight, assuming that the task to be detected on the merging code to be detected corresponding to the merging application B is a compiling check, the code detecting end queries the history detection result record table according to "01+001c4364" or "compiling check +001c4364", finds that the record item of "01+001c4364" or "compiling check +001c4364" exists in the history detection result record table, that is, finds that the compiling check corresponding to 001c4364 has been detected, and the detection passes, the code detecting end can determine that the detection result on the execution of the compiling check of the merging code packet to be detected is the detection passing, so that the detection task is directly skipped.
By adopting the embodiment of the application, when the merging code to be detected is detected, if the corresponding detection result is inquired in the historical detection result record table to be the detection passing by using the identification of the code difference set corresponding to the merging code to be detected and the identification of the detection task to be executed, the detection result of executing the detection task to be executed on the merging code can be determined to be the detection passing by, and the execution of the detection task to be executed on the merging code is skipped, so that repeated detection operation can be reduced, detection time is saved, and the detection efficiency of the merging code to be detected is improved under the premise of not losing accuracy. In addition, because the detection time is saved, the resource consumption of the code detection end can be reduced by adopting the embodiment of the application.
Referring to fig. 3, fig. 3 is a flow chart of another detection method according to an embodiment of the present application. In comparison with the method shown in fig. 2, the detection method shown in fig. 3 also describes that a pre-detection operation is performed on the combined code packet to be detected before the combined code packet to be detected is detected. The method may be performed by a code detection terminal (e.g., code detection terminal 101 in fig. 1), and the method is described below by taking the example that the code detection terminal is a computer device. As shown in fig. 3, the detection method may include the steps of:
S301, if a second code detection instruction sent by the code management end is received, acquiring an initial code packet and a code packet to be combined from the code management end, wherein the second code detection instruction is sent to the code detection end after the code management end receives the code packet to be combined sent by the development end.
The code management end receives a code packet to be integrated sent by the development end, and the developer actively synchronizes the code to be integrated to a code warehouse of the code management end through the development end. Alternatively, this process may also be referred to as synchronization code. The synchronous code refers to that the development end synchronizes the code to a remote code warehouse, taking a git warehouse as an example, and the development end pushes any local code to the remote warehouse in a push (push) mode, so that the code is regarded as being synchronized to the remote code warehouse.
It should be noted that, in the process of synchronizing the code, a developer does not initiate a merging application of the code package to be merged into the initial code package through the developing end. Optionally, initiating the merging application of the code package to be merged into the initial code package means that after the code package to be merged is synchronized to the remote code repository, the development end actively initiates a merge request (merge request) to merge the code package to be merged into the initial code package.
In an alternative embodiment, the initial code packet may be a code packet corresponding to the last node in the target branch, where the target branch is mostly the main branch (master branch). In this embodiment, the code packet to be combined is merged into the initial code packet, that is, the code packet to be combined is merged into the target branch. Thus, a new node is generated on the target branch, and the code packet corresponding to the new node is the merging code packet to be detected.
S302, carrying out code combination processing on the initial code packet and the code packet to be combined to obtain a code packet to be detected and a target code difference set identifier.
Wherein the target code differential set is identified as an identification of an associated code differential set associated with the merged code packet to be detected and the detection task to be performed.
In an alternative embodiment, the specific process of the computer device obtaining the target code differential set identifier may refer to the related description in step S201, which is not described herein.
Optionally, the computer device may store the target code difference set identifier corresponding to the merged code packet to be detected.
S303, executing a detection task to be executed aiming at the combined code packet to be detected, and obtaining a pre-detection result of the combined code to be detected, which relates to the detection task to be executed.
S304, if the pre-detection result is that the detection is passed, adding a target record item in a history detection result record table, wherein the target record item is generated according to a target code difference set identifier and a target task identifier of a detection task to be executed; the target record item is used for indicating that the detection result corresponding to the target code difference set identifier and the target task identifier is passing detection.
In an alternative embodiment, the description of the history detection result record table may be referred to the description in step S202, which is not described herein.
S305, if a first code detection instruction sent by the code management end is received, the detection of the code detection trigger is determined, and the first code detection instruction is sent to the code detection end after the code management end receives the code merging request sent by the development end.
The code merging request is used for requesting the code management end to merge the code packet to be merged with the initial code packet.
S306, responding to code detection trigger, and acquiring the target code difference set identification.
In an alternative embodiment, the computer device in step S306 may acquire the target code difference set identifier, which is calculated again according to the procedure described in step S201, or may acquire the target code difference set identifier stored in the pre-detection stage of the to-be-detected combined code packet.
S307, inquiring the historical detection result record table according to the target code difference set identification and the target task identification of the detection task to be executed, and obtaining an inquiry result.
In an alternative embodiment, each entry in the history detection result record table is generated according to a history code difference set identifier and a history task identifier, the history code difference set identifier is an identifier of a history code difference set associated with a history merge code package and a history detection task, and the history detection task is a detection task indicated by the history task identifier; each entry is added to the history detection result record table when it is determined that the detection result of the history merging code packet concerning the history detection task is the passing of the detection. In this embodiment, each entry in the history detection result record table indicates that the detection result of the detection task corresponding to the history combined code packet is passing detection.
In another alternative embodiment, each entry in the history detection result record table is generated according to the history code difference set identifier, the history task identifier, and the detection result identifier of the detection task corresponding to the history combined code packet. Optionally, the detection result identifier of the detection task corresponding to the history combined code packet is used for indicating that the detection passes or the detection does not pass.
And S308, if the query result indicates that the target record item exists in the history detection result record table, determining that the detection result of the to-be-detected combined code packet related to the to-be-executed detection task is detection passing, and skipping to execute the to-be-executed detection task of the to-be-detected combined code packet.
That is, if the query result indicates that the target record item exists in the history detection result record table, it is indicated that the task to be performed related to the target code difference set identification has been performed before the current detection is performed, and the previous detection result is that the detection is passed.
S309, if the query result indicates that the target record item does not exist in the history detection result record table, executing the detection task to be executed for the combined code packet to be detected, and obtaining a detection result of the combined code packet to be detected about the detection task to be executed.
In an alternative embodiment, if the detection result of the combined code packet to be detected about the task to be detected is that the detection is passed, adding a target record item in the history detection result record table, where the added target record item is generated according to the target code difference set identifier and the target task identifier of the task to be detected. If the detection result of the combined code packet to be detected about the detection task to be executed is not passed, a message that the detection result is not passed can be sent to the code management end, so that the code management end informs the development end of detection failure, and the developer can take relevant measures conveniently. For example, a merging request for merging the code packet to be merged into the initial code packet is reinitiated, or a merging request for merging the code packet to be merged into the initial code packet is initiated after updating the code packet to be merged, or the like.
The detection method described in step S301 to step S308 is exemplified below.
Step one, developing a code package to be combined by a developer through a development end, and sending the code package to be combined to a code management end (namely synchronizing the code package to be combined into a code warehouse), wherein a combining application of the code package to be combined to an initial code package is not initiated at the moment.
And step two, after the code detection end acquires that the code package to be combined is synchronized to the code management end, immediately executing pre-detection, and carrying out trial combination on codes in the code package to be combined and codes in the initial code package to obtain a code package to be detected.
And thirdly, if the merging is successful, acquiring an object code difference set identifier corresponding to the merged code packet to be detected, for example, 39c48313.
And step four, executing a detection task to be executed (for example, compiling checking) aiming at the combined code packet to be detected, wherein the task corresponding to the compiling checking is marked as '01', and obtaining a pre-detection result.
And step five, if the detection result is that the detection passes, adding a record item of '01+39c481313' or 'compiling check +39c 48313' into a history detection result record table.
And step six, the developer initiates a merging request (or called as a merging application (e.g. named as a merging application C)) for really merging the code package to be merged into the initial code package through the development terminal.
And step seven, after the code detection end receives the request, determining that the code detection trigger is detected, and responding to the code detection trigger to acquire the target code difference set identification of the combined code packet to be detected, for example 39c48313.
And step eight, the code detection end queries a history detection result record table according to '01+39c481313' or 'compiling check +39c 48313', discovers that the record item of '01+39c48113' or 'compiling check +39c 48313' exists in the history detection result record table, namely that the compiling check corresponding to 39c48313 is detected and the detection is passed, and the code detection end can determine that the detection result of the combined code packet to be detected about executing the compiling check is the detection passing, so that the detection task is directly skipped.
In this embodiment of the present application, the code detection end may pre-detect a to-be-executed detection task corresponding to a to-be-detected combined code packet, and if the pre-detection result is that the detection is passed, add a record item in the history detection result record table, so when the development end actually initiates a code merging request, the code detection end may query whether a record item indicating that a detection result corresponding to a target difference set identifier corresponding to the to-be-detected combined code packet and a target task identifier of the to-be-executed detection task is passed exists in the history detection result record table, and if the record item indicates that the detection result corresponding to the target difference set identifier of the to-be-detected combined code packet is passed, determine that the detection result of the to-be-detected combined code packet about the to-be-executed detection task is passed, and skip executing the to-be-executed detection task to the to-be-detected combined code packet. Therefore, by adopting the embodiment of the application, the detection efficiency of the combined code packet to be detected can be improved under the precondition that the accuracy is not lost when the real detection is executed by pre-detecting the combined code before the real detection is executed.
Referring to fig. 4, fig. 4 shows a process flow of the detection method provided in the present application. As shown in fig. 4, when a developer locally develops the to-be-incorporated code 401 according to personal or demand code through the development end, or remotely compiles the to-be-incorporated code through the development end, according to (i.e., personal/demand code 406 in fig. 4), or remotely compiles the to-be-incorporated code (i.e., remote compilation 407 in fig. 4), a Merge Request (i.e., initiate Merge Request (MR) 402 in fig. 4) for merging the to-be-incorporated code into an initial code is initiated. Then, the code detection end performs the merging detection 403 on the to-be-detected merging code, if the detection result is failure (corresponding to the foregoing detection not passing), the code management end may notify the development end to perform the modification error or update code (i.e. the modification error/update code 404 in fig. 4) on the to-be-detected merging code, and re-perform the merging detection 403 on the modified or updated code. If the check result is successful (corresponding to the foregoing detection passing), a message of check success is sent to the code management end, so that the code management end successfully merges into the code (i.e., successful merge 405 in fig. 4), and the detection result is recorded in the history detection result record table (i.e., merge into the check result 408 based on the code difference set in fig. 4).
When the developer locally develops the code 401 to be merged again through the developing end and initiates a merging request (i.e. 404 in fig. 4) that the code to be merged merges into the initial code, the code detecting end queries the merging detection result from the history detection result record table according to the code difference set and the detection task, and if the fact that the detection result for indicating the code difference set and the detection task is successful is queried, a message for successfully detecting the code is sent to the code managing end, so that the code managing end successfully merges into the code (i.e. successfully merges 405 in fig. 4). If the detection result is failure (corresponding to the foregoing detection not passing), the code management end may notify the initiator of performing modification error or update code (i.e. modification error/update code 404 in fig. 4) on the merging code to be detected, and re-perform the merging detection 403 on the modified or updated code.
In order to verify the effectiveness of the detection method provided by the embodiment of the application, experiments are carried out by applying the detection method provided by the embodiment of the application to the actual detection process. Experimental results show that in the actual running process, the computer device skips the inspection 20 times out of 100 times of the merging inspection when executing the compiling inspection task. The normal one-time check takes about 18 minutes, and once the hit check skips the strategy, the check can be completed within 1 minute, and the total time consumption is optimized by 20%. Similarly, for unit test tasks (20 minutes is consumed in total on 10 computer devices (i.e. the code detection end is a plurality of computer devices) to be concurrently executed, the in-check can be completed within 1 minute after the hit check skip strategy, and the total consumption can be optimized by 20%. In actual operation, the use cost is almost 0, and the time-consuming average value of continuous integration can be directly optimized by 10% -30%. Therefore, the detection method provided by the embodiment of the application can reduce the time required by detection, so that the detection efficiency is improved, and meanwhile, the detection cost can be reduced.
It should be noted that, when the embodiment of the present application is applied to a specific product or technology, the code packet to be incorporated, the initial code packet, the code packet to be detected and the like related to the embodiment of the present application are all acquired after obtaining the permission or consent of the user; and the collection, use and handling of the to-be-incorporated code packages, the initial code packages, the to-be-detected incorporated code packages, etc. requires compliance with relevant laws and regulations and standards of the relevant countries and regions.
Based on the above description of the related embodiments of the detection method, the embodiments of the present application also provide a detection apparatus, which may be a computer program (including program code) running in a computer device, and the detection apparatus may perform the detection method shown in fig. 2 or fig. 3. Referring to fig. 5, fig. 5 is a schematic diagram of a detection device according to an embodiment of the present application, where the detection device may include the following units:
a processing unit 501, configured to obtain an object code difference set identifier in response to a code detection trigger; the method comprises the steps that an object code difference set is identified as an identification of an associated code difference set associated with a to-be-detected combined code packet and a to-be-executed detection task, the to-be-detected combined code packet is generated according to an initial code packet and a to-be-combined code packet corresponding to the initial code packet, the associated code difference set is formed by associated difference codes, and the associated difference codes are difference codes associated with the to-be-executed detection task in difference codes between the to-be-detected combined code packet and the initial code packet;
The processing unit 501 is further configured to query the historical detection result record table according to the target code difference set identifier and the target task identifier of the detection task to be executed, so as to obtain a query result;
the determining unit 502 is configured to determine that the detection result of the to-be-detected combined code packet about the to-be-executed detection task is detection passing if the query result indicates that the target record item exists in the history detection result record table, and skip execution of the to-be-executed detection task by the to-be-detected combined code packet; the target record item is used for indicating that the detection result corresponding to the target code difference set identifier and the target task identifier is passing detection.
In an alternative embodiment, the processing unit 501 is further configured to execute the task to be executed for the combined code packet to be detected if the query result indicates that the target entry does not exist in the history detection result record table, so as to obtain a detection result of the combined code packet to be detected about the task to be executed.
In an alternative embodiment, each entry in the history detection result record table is generated according to a history code difference set identifier and a history task identifier, the history code difference set identifier is an identifier of a history code difference set associated with a history merge code package and a history detection task, and the history detection task is a detection task indicated by the history task identifier; each entry is added to the history detection result record table when it is determined that the detection result of the history merging code packet concerning the history detection task is the passing of the detection.
In an optional implementation manner, the determining unit 502 is further configured to determine that the code detection trigger is detected if the first code detection instruction sent by the code management end is received;
the first code detection instruction is sent to the code detection end after the code management end receives a code combination request sent by the development end, wherein the code combination request is used for requesting the code management end to combine a code packet to be combined with an initial code packet.
In an alternative embodiment, the processing unit 501, when configured to obtain the target code difference set identifier in response to a code detection trigger, is specifically configured to:
acquiring an initial code difference set corresponding to a to-be-detected combined code packet, wherein the initial code difference set is formed by difference codes between the to-be-detected combined code packet and the initial code packet;
removing redundant information in the initial code difference set and information irrelevant to executing the detection task to be executed to obtain an associated code difference set associated with the combined code packet to be detected and the detection task to be executed;
and performing abstract calculation on the associated code difference set, determining the identification of the associated code difference set according to the abstract calculation result, and determining the identification of the determined associated code difference set as the identification of the target code difference set.
In an alternative embodiment, the processing unit 501 is further configured to:
if a second code detection instruction sent by the code management end is received, acquiring an initial code packet and a code packet to be combined from the code management end; the second code detection instruction is sent to the code detection end by the code management end after receiving the code packet to be combined sent by the development end;
carrying out code merging processing on the initial code packet and the code packet to be merged to obtain a code packet to be detected, and obtaining an object code difference set identifier;
executing a detection task to be executed aiming at the combined code packet to be detected to obtain a pre-detection result of the combined code to be detected, which is related to the detection task to be executed;
if the pre-detection result is that the detection is passed, adding a target record item in a history detection result record table, wherein the target record item is generated according to a target code difference set identifier and a target task identifier of a detection task to be executed.
In an alternative embodiment, the determining unit 502 is further configured to:
if the re-detection condition is detected to be met, determining that the code detection trigger is detected;
the condition of re-detection is that the detection is not passed when the merging code to be detected is detected last time, and the number of re-detection is less than or equal to a set threshold.
In an alternative embodiment, the processing unit 501 is further configured to:
if the detection result of the to-be-detected combined code packet obtained by the last detection on the to-be-executed detection task is that the detection is passed and the target record item does not exist in the history detection result record table, adding the target record item into the history detection result record table.
According to embodiments passed through in the present application, each of the steps involved in the methods shown in fig. 2 and 3 may be performed by each of the modules in the detection apparatus shown in fig. 6. For example, steps S201, S202 shown in fig. 2 may each be performed by the processing unit 501 shown in fig. 5, and step S203 may be performed by the determination unit 502 shown in fig. 5. As another example, steps S301, S302, S303, S304, S306, S307, S309 shown in fig. 3 may be performed by the processing unit 501 shown in fig. 5, and steps S305, S308 may be performed by the determining unit 502 shown in fig. 5.
According to the embodiment provided in the application, each unit in the detection device shown in fig. 6 may be separately or completely combined into one or several other units, or some (some) units may be further split into a plurality of units with smaller functions to form the detection device, which may achieve the same operation without affecting the implementation of the technical effects of the embodiments of the application. The above units are divided based on logic functions, and in practical applications, the functions of one unit may be implemented by a plurality of units, or the functions of a plurality of units may be implemented by one unit. In other embodiments of the present application, the detection-based device also includes other units, and in practical applications, these functions may be implemented with assistance of other units, and may be implemented by cooperation of multiple units.
According to an embodiment provided herein, a detection apparatus as shown in fig. 6 may be constructed by running a computer program (including program code) capable of executing the steps involved in the respective methods as shown in fig. 2 on a general-purpose computer device such as a computer including a processing element such as a Central Processing Unit (CPU), a random access storage medium (RAM), a read only storage medium (ROM), and the like, and a storage element, and implementing the detection method of the embodiments of the present application. The computer program may be recorded on, for example, a computer-readable storage medium, and loaded into and executed by the above-described computer apparatus via the computer-readable storage medium.
It may be understood that the specific implementation of each unit in the detection device and the beneficial effects that can be achieved in the detection device provided in the embodiments of the present application may refer to the description of the foregoing detection method embodiments, which is not repeated herein.
Based on the description of the method embodiment and the apparatus embodiment, the embodiment of the application further provides a computer device. Referring to fig. 6, the computer device includes at least a processor 601, a memory 602, and a communication interface 603. The processor 601, the memory 602, and the communication interface 603 may be connected by a bus 604 or other means, and the embodiments of the present application are exemplified by connection via the bus 604.
Among them, the processor (or central processing unit (Central Processing Unit, CPU)) 601 is a computing core and a control core of the computer device, and can parse various instructions in the computer device and process various data of the computer device, for example: the CPU can be used for analyzing a startup and shutdown instruction sent by a user to the computer equipment and controlling the computer equipment to perform startup and shutdown operation; and the following steps: the CPU may transmit various types of interaction data between internal structures of the computer device, and so on. The communication interface 603 may optionally include a standard wired interface, a wireless interface (e.g., wi-Fi, mobile communication interface, etc.), controlled by the processor 601 for transceiving data. Memory 602 is a Memory device in a computer device for storing computer programs and data. It will be appreciated that the memory 602 herein may include both built-in memory of the computer device and extended memory supported by the computer device. Memory 602 provides storage space that stores the operating system of a computer device, which may include, but is not limited to: windows system, linux system, android system, iOS system, etc., which are not limiting in this application. In an alternative implementation, the processor 601 of the embodiment of the present application may execute the following operations by executing a computer program stored in the memory 602:
Responding to code detection trigger, and acquiring an object code difference set identifier; the method comprises the steps that an object code difference set is identified as an identification of an associated code difference set associated with a to-be-detected combined code packet and a to-be-executed detection task, the to-be-detected combined code packet is generated according to an initial code packet and a to-be-combined code packet corresponding to the initial code packet, the associated code difference set is formed by associated difference codes, and the associated difference codes are difference codes associated with the to-be-executed detection task in difference codes between the to-be-detected combined code packet and the initial code packet;
inquiring a historical detection result record table according to the target code difference set identification and the target task identification of the detection task to be executed to obtain an inquiry result;
if the query result indicates that the target record item exists in the history detection result record table, determining that the detection result of the to-be-detected combined code packet related to the to-be-executed detection task is passing detection, and skipping to execute the to-be-executed detection task of the to-be-detected combined code packet; the target record item is used for indicating that the detection result corresponding to the target code difference set identifier and the target task identifier is passing detection.
In an alternative embodiment, the processor 601 is further configured to execute the task to be executed for the combined code packet to be detected if the query result indicates that the target entry does not exist in the history detection result record table, so as to obtain a detection result of the combined code packet to be detected about the task to be executed.
In an alternative embodiment, each entry in the history detection result record table is generated according to a history code difference set identifier and a history task identifier, the history code difference set identifier is an identifier of a history code difference set associated with a history merge code package and a history detection task, and the history detection task is a detection task indicated by the history task identifier; each entry is added to the history detection result record table when it is determined that the detection result of the history merging code packet concerning the history detection task is the passing of the detection.
In an alternative embodiment, processor 601 is further configured to: if a first code detection instruction sent by a code management end is received, determining that a code detection trigger is detected;
the first code detection instruction is sent to the code detection end after the code management end receives a code combination request sent by the development end, wherein the code combination request is used for requesting the code management end to combine a code packet to be combined with an initial code packet.
In an alternative embodiment, the processor 601, when configured to obtain the target code differential set identifier in response to a code detection trigger, is specifically configured to:
Acquiring an initial code difference set corresponding to a to-be-detected combined code packet, wherein the initial code difference set is formed by difference codes between the to-be-detected combined code packet and the initial code packet;
removing redundant information in the initial code difference set and information irrelevant to executing the detection task to be executed to obtain an associated code difference set associated with the combined code packet to be detected and the detection task to be executed;
and performing abstract calculation on the associated code difference set, determining the identification of the associated code difference set according to the abstract calculation result, and determining the identification of the determined associated code difference set as the identification of the target code difference set.
In an alternative embodiment, processor 601 is further configured to:
if a second code detection instruction sent by the code management end is received, acquiring an initial code packet and a code packet to be combined from the code management end; the second code detection instruction is sent to the code detection end by the code management end after receiving the code packet to be combined sent by the development end;
carrying out code merging processing on the initial code packet and the code packet to be merged to obtain a code packet to be detected, and obtaining an object code difference set identifier;
executing a detection task to be executed aiming at the combined code packet to be detected to obtain a pre-detection result of the combined code to be detected, which is related to the detection task to be executed;
If the pre-detection result is that the detection is passed, adding a target record item in a history detection result record table, wherein the target record item is generated according to a target code difference set identifier and a target task identifier of a detection task to be executed.
In an alternative embodiment, processor 601 is further configured to:
if the re-detection condition is detected to be met, determining that the code detection trigger is detected;
the condition of re-detection is that the detection is not passed when the merging code to be detected is detected last time, and the number of re-detection is less than or equal to a set threshold.
In an alternative embodiment, processor 601 is further configured to:
if the detection result of the to-be-detected combined code packet obtained by the last detection on the to-be-executed detection task is that the detection is passed and the target record item does not exist in the history detection result record table, adding the target record item into the history detection result record table.
In a specific implementation, the processor 601, the memory 602, and the communication interface 603 described in the embodiments of the present application may execute an implementation manner of a computer device described in the detection method provided in the embodiments of the present application, or may execute an implementation manner described in the detection apparatus provided in the embodiments of the present application, which is not described herein again.
The embodiment of the application also provides a computer readable storage medium, and a computer program is stored in the computer readable storage medium, and when the computer program is executed by a processor, the detection method provided by the embodiment of the application is realized. The specific implementation manner may refer to the foregoing description, and will not be repeated here.
The present application also provides a computer program product, which includes a computer program or computer instructions, and the computer program or computer instructions implement the detection method provided in the embodiments of the present application when executed by a processor. The specific implementation manner may refer to the foregoing description, and will not be repeated here.
It should be noted that, for simplicity of description, the foregoing method embodiments are all expressed as a series of action combinations, but it should be understood by those skilled in the art that the present application is not limited by the described order of action, as some steps may take other order or be performed simultaneously according to the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required in the present application.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be implemented by a program to instruct related hardware, the program may be stored in a computer readable storage medium, and the storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
The foregoing disclosure is only illustrative of some of the embodiments of the present application and is not, of course, to be construed as limiting the scope of the appended claims, and therefore, all changes that come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein.

Claims (12)

1. A method of detection, the method comprising:
responding to code detection trigger, and acquiring an object code difference set identifier; the target code difference set is identified as an identification of an associated code difference set associated with a to-be-detected combined code packet and a to-be-executed detection task, the to-be-detected combined code packet is generated according to an initial code packet and a to-be-integrated code packet corresponding to the initial code packet, the associated code difference set is composed of associated difference codes, and the associated difference codes are difference codes associated with the to-be-executed detection task in difference codes between the to-be-detected combined code packet and the initial code packet;
Inquiring a historical detection result record table according to the target code difference set identifier and the target task identifier of the detection task to be executed to obtain an inquiry result;
if the query result indicates that a target record item exists in the history detection result record table, determining that the detection result of the to-be-detected combined code packet related to the to-be-executed detection task is detection passing, and skipping execution of the to-be-executed detection task on the to-be-detected combined code packet; the target record item is used for indicating that the detection result corresponding to the target code difference set identifier and the target task identifier is passing detection.
2. The method according to claim 1, wherein the method further comprises:
and if the query result indicates that the target record item does not exist in the historical detection result record table, executing the detection task to be executed aiming at the combined code packet to be detected, and obtaining a detection result of the combined code packet to be detected, which is related to the detection task to be executed.
3. The method of claim 1, wherein each entry in the history detection results record table is generated from a history code difference set identification and a history task identification, the history code difference set identification being an identification of a history code difference set associated with a history merge code package and a history detection task, the history detection task being a detection task indicated by the history task identification; and each record item is added into the history detection result record table when the detection result of the history merging code packet about the history detection task is determined to pass detection.
4. A method according to any one of claims 1-3, wherein the method further comprises:
if a first code detection instruction sent by a code management end is received, determining that the code detection trigger is detected;
the first code detection instruction is sent to the code detection end after the code management end receives a code combination request sent by the development end, and the code combination request is used for requesting the code management end to combine the code packet to be combined with the initial code packet.
5. The method of claim 4, wherein the acquiring the target code differential set identification in response to the code detection trigger comprises:
acquiring an initial code difference set corresponding to the to-be-detected combined code packet, wherein the initial code difference set is formed by difference codes between the to-be-detected combined code packet and the initial code packet;
removing redundant information in the initial code difference set and information irrelevant to executing the detection task to be executed to obtain an associated code difference set associated with the combined code packet to be detected and the detection task to be executed;
And performing abstract calculation on the associated code difference set, determining the identification of the associated code difference set according to an abstract calculation result, and determining the determined identification of the associated code difference set as an object code difference set identification.
6. The method according to claim 4, wherein the method further comprises:
if a second code detection instruction sent by the code management end is received, acquiring the initial code packet and the code packet to be combined from the code management end; the second code detection instruction is sent to the code detection end by the code management end after the code detection end receives the code package to be combined sent by the development end;
performing code combination processing on the initial code packet and the code packet to be combined to obtain the code packet to be detected, and obtaining the target code difference set identification;
executing the detection task to be executed aiming at the combined code packet to be detected to obtain a pre-detection result of the combined code to be detected, which is related to the detection task to be executed;
if the pre-detection result is that the detection is passed, adding the target record item in the history detection result record table, wherein the target record item is generated according to the target code difference set identifier and the target task identifier of the detection task to be executed.
7. The method according to claim 1, wherein the method further comprises:
if the detection condition is met, determining that the code detection trigger is detected;
wherein, the condition of re-detection is that the detection is not passed when the merging code to be detected is detected last time, and the number of re-detection is less than or equal to a set threshold.
8. The method of claim 7, wherein the method further comprises:
if the detection result of the to-be-detected combined code packet obtained by the last detection on the to-be-executed detection task is that the detection is passed and the target record item does not exist in the history detection result record table, adding the target record item in the history detection result record table.
9. A detection device, the device comprising:
the processing unit is used for responding to code detection trigger and acquiring an object code difference set identifier; the target code difference set is identified as an identification of an associated code difference set associated with a to-be-detected combined code packet and a to-be-executed detection task, the to-be-detected combined code packet is generated according to an initial code packet and a to-be-integrated code packet corresponding to the initial code packet, the associated code difference set is composed of associated difference codes, and the associated difference codes are difference codes associated with the to-be-executed detection task in difference codes between the to-be-detected combined code packet and the initial code packet;
The processing unit is further used for inquiring a historical detection result record table according to the target code difference set identifier and the target task identifier of the detection task to be executed to obtain an inquiry result;
the determining unit is used for determining that the detection result of the to-be-detected combined code packet related to the to-be-executed detection task is detection passing if the query result indicates that a target record item exists in the historical detection result record table, and skipping the execution of the to-be-executed detection task on the to-be-detected combined code packet; the target record item is used for indicating that the detection result corresponding to the target code difference set identifier and the target task identifier is passing detection.
10. A computer device comprising a memory, a communication interface, and a processor, wherein the memory, the communication interface, and the processor are interconnected; the memory stores a computer program, and the processor calls the computer program stored in the memory to implement the detection method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored therein a computer program which, when executed by a processor, implements the detection method according to any one of claims 1 to 8.
12. A computer program product, characterized in that it comprises a computer program or computer instructions which, when executed by a processor, implement the detection method according to any of claims 1 to 8.
CN202210998261.1A 2022-08-18 2022-08-18 Detection method, apparatus, device, storage medium, and computer program product Pending CN117632698A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210998261.1A CN117632698A (en) 2022-08-18 2022-08-18 Detection method, apparatus, device, storage medium, and computer program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210998261.1A CN117632698A (en) 2022-08-18 2022-08-18 Detection method, apparatus, device, storage medium, and computer program product

Publications (1)

Publication Number Publication Date
CN117632698A true CN117632698A (en) 2024-03-01

Family

ID=90017006

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210998261.1A Pending CN117632698A (en) 2022-08-18 2022-08-18 Detection method, apparatus, device, storage medium, and computer program product

Country Status (1)

Country Link
CN (1) CN117632698A (en)

Similar Documents

Publication Publication Date Title
CN110297689B (en) Intelligent contract execution method, device, equipment and medium
CN109951547B (en) Transaction request parallel processing method, device, equipment and medium
CN112104709B (en) Intelligent contract processing method, device, medium and electronic equipment
CN109800005B (en) Client hot update method and device
CN112559635B (en) Service processing method, device, equipment and medium for Ethernet alliance chain node
CN112612850A (en) Data synchronization method and device
CN111782526A (en) Interface testing method and device, electronic equipment and storage medium
CN113760339A (en) Vulnerability repair method and device
CN113626416A (en) Data verification method and device, computing equipment and storage medium
CN109218338B (en) Information processing system, method and device
CN111090442B (en) Application updating method, device and storage medium
CN117632698A (en) Detection method, apparatus, device, storage medium, and computer program product
CN113590179B (en) Plug-in detection method and device, electronic equipment and storage medium
CN114924742A (en) Hot patch making and applying method and device for virtual machine simulation software
CN111460436B (en) Unstructured data operation method and system based on blockchain
CN114417347A (en) Vulnerability detection method, device, equipment, storage medium and program of application program
CN114090514A (en) Log retrieval method and device for distributed system
WO2024088151A1 (en) Method for obtaining service pack and communication apparatus
CN112711602A (en) Running method and device of storage process, database system and storage medium
CN114416106B (en) Method, system, electronic device and storage medium for updating compiling count value
CN113031960B (en) Code compiling method, device, server and storage medium
CN117573730B (en) Data processing method, apparatus, device, readable storage medium, and program product
CN117009962B (en) Anomaly detection method, device, medium and equipment based on effective label
CN116048590A (en) Production line problem repairing method, device, electronic equipment and computer readable medium
CN117149210A (en) Software optimization method, system, 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