CN103761184A - Method, device and system for testing code segment of program - Google Patents

Method, device and system for testing code segment of program Download PDF

Info

Publication number
CN103761184A
CN103761184A CN201310752450.1A CN201310752450A CN103761184A CN 103761184 A CN103761184 A CN 103761184A CN 201310752450 A CN201310752450 A CN 201310752450A CN 103761184 A CN103761184 A CN 103761184A
Authority
CN
China
Prior art keywords
tested
program
test
code section
code
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.)
Granted
Application number
CN201310752450.1A
Other languages
Chinese (zh)
Other versions
CN103761184B (en
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.)
Chongqing Hanyuan Machinery Co ltd
Guangdong Gaohang Intellectual Property Operation Co ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201310752450.1A priority Critical patent/CN103761184B/en
Publication of CN103761184A publication Critical patent/CN103761184A/en
Application granted granted Critical
Publication of CN103761184B publication Critical patent/CN103761184B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a method, a device and a system for testing a code segment of a program. The method for testing the code segment of the program comprises the steps of invoking a position of a tested code segment in a tested program during testing the tested program, and setting a breakpoint/skip processing unit; operating the tested program, interrupting an execution process of the tested code segment by the breakpoint/skip processing unit during executing the tested program to the position of the tested code segment, and skipping the execution of the tested program to a test process; and operating a test code segment in a process of executing test and obtaining a test result. According to the method, the device and the system, the process execution of the tested code segment is controlled by a test process, so that the process execution is interrupted and then joined into the test process to finish testing of the code segment; and a test module is not required to be embedded in the tested program, so that the interference on the original tested program also can be avoided.

Description

Code segment method of testing, device and the system of program
Technical field
The invention belongs to computer program field, relate in particular to code segment method of testing, device and the system of program.
Background technology
Along with the complexity of current software systems improves constantly, make the importance of software test also obtain further embodiment.
In prior art, in the mode that binary program image is tested, comprise, in the inside of program Embedded test module, that is, by moving specific code segment, carry out program test.
Inventor is through research discovery, and above-mentioned program test mode of the prior art, need to increase new test module, can make like this complexity of the logic of calling program further improve, and then just likely introduces new defect; Like this, when there is defect, just being difficult to location defect is tested object on earth,, the problem of tested code section self is still due to what cause adding of test module, that is, program test mode of the prior art can make the complexity of calling program increase, because test module itself is just likely introduced extra defect, thereby original program is caused to interference.
Summary of the invention
In view of this, the invention provides code segment method of testing and the device of program, to reduce the interference object to original program.
First aspect, the invention provides a kind of code segment method of testing of program, comprising:
When tested program is tested, in described tested program, call the position of tested code section, breakpoint/redirect processing unit is set;
Move described tested program, when described tested program, carry out when calling described tested code fragment position, described breakpoint/redirect processing unit interrupts the execution flow process of described tested code section, and the execution of described tested program is jumped to testing process;
Carrying out in described testing process, move test code section, and obtain test result.
In the possible implementation of the first of first aspect, the type of code of described tested code section comprises:
Binary program reflection.
In conjunction with the possible implementation of the first of first aspect, in the possible implementation of the second, described tested program comprises:
Operating system program or application program.
In the possible implementation of the second of first aspect, in the third possible implementation, described breakpoint/redirect processing unit comprises:
By breakpoint, probe being set, on-the-fly modifying code segment or virtual executory one or combination in any realization.
In the 4th kind of possible implementation of first aspect, described in obtain after test result, also comprise:
After testing process finishes, recover the execution of described tested program journey.
In conjunction with the 4th kind of possible implementation of first aspect, in the 5th kind of possible implementation, described testing process comprises:
Structure and checkout environment;
Call described tested code section;
After described tested code section is finished, carry out inspection and the record of described test environment result.
In conjunction with the 4th kind of possible implementation of first aspect, in the 6th kind of possible implementation, described testing process comprises:
Structure and checkout environment;
Call the copy of described tested code section;
After the copy of described tested code section is finished, carry out inspection and the record of described test environment result.
In conjunction with the 5th kind or the 6th kind of possible implementation of first aspect, in the 7th kind of implementation, also comprise:
Recover, before the execution of interrupted described tested program, to clear up described test environment.
In conjunction with the 6th kind of possible implementation of first aspect, in the 8th kind of possible implementation, before described structure and checkout environment, also comprise:
When the copy of described tested code section does not exist, create the copy of described tested code section.
In conjunction with the 8th kind of possible implementation of first aspect, in the 9th kind of possible implementation, the copy of described tested code section comprises:
Code segment with the equivalence of described tested code section logic function.
Second aspect, the invention provides a kind of code segment proving installation of program, comprising:
Breakpoint setting unit for when tested program is tested, is called the position of tested code section in described tested program, and breakpoint/redirect processing unit is set;
Described breakpoint/redirect processing unit, for when the execution of described tested program is when calling described tested code fragment position, described breakpoint/redirect processing unit interrupts the execution flow process of described tested code section, and the execution of described tested program is jumped to testing process;
Test cell, for carrying out described testing process, operation test code section, and obtain test result.
In the possible implementation of the first of second aspect, the type of code of described tested code section comprises:
Binary program reflection.
In conjunction with the possible implementation of the first of second aspect, in the possible implementation of the second, described tested program comprises:
Operating system program or application program order.
In conjunction with the possible implementation of the second of second aspect, in the third possible implementation, described breakpoint/redirect processing unit comprises:
Breakpoint, probe, on-the-fly modify code segment or virtual executory one or combination in any.
In the 4th kind of possible implementation of second aspect, also comprise:
Recovery unit, for by described breakpoint/redirect processing unit, the execution that recovers described tested program journey.
In conjunction with the 4th kind of possible implementation of second aspect, in the 5th kind of possible implementation, described test cell, comprising:
Test environment constructing module, for structure and checkout environment;
Code segment calling module, for calling described tested code section;
Test result acquisition module, after being finished in described tested code section, carries out inspection and the record of described test environment result.
In conjunction with the 4th kind of possible implementation of second aspect, in the 6th kind of possible implementation, described test cell, comprising:
Test environment constructing module, for structure and checkout environment;
Code segment calling module, for calling the copy of described tested code section;
Test result acquisition module, after being finished, carries out inspection and the record of described test environment result for the copy of described tested code section.
In conjunction with the 5th kind or the 6th kind of possible implementation of second aspect, at test cell described in the 7th kind of implementation, also comprise:
Test environment cleaning module, for before the execution of the interrupted described tested program journey of recovery, clears up described test environment.
In conjunction with the 6th kind of possible implementation of second aspect, in the 8th kind of possible implementation, described test cell, also comprises:
Copy creating module, for before described structure and checkout environment, when the copy of described tested code section does not exist, creates the copy of described tested code section.
In conjunction with the 8th kind of possible implementation of second aspect, in the 9th kind of possible implementation, the copy of described tested code section comprises:
Code segment with the equivalence of described tested code section logic function.
The third aspect, the invention provides a kind of code segment test macro of program, comprises the code segment proving installation of program; Described code segment proving installation comprises:
Breakpoint setting unit for when tested program is tested, is called the position of tested code section in described tested program, and breakpoint/redirect processing unit is set;
Described breakpoint/redirect processing unit, for when the execution of described tested program is when calling described tested code fragment position, described breakpoint/redirect processing unit interrupts the execution flow process of described tested code section, and the execution of described tested program is jumped to testing process;
Test cell, for carrying out described testing process, operation test code section, and obtain test result.
From above-mentioned technical scheme, can find out, be no longer in prior art for the test of code segment in the present invention, in the mode that adopts hard coded, and need to be at the internal build test module of tested program; But can control tested program by a test procedure, carry out, it is interrupted in operation tested program to the position of calling tested code section, and will carry out flow process and jump to testing process and come the test of completion code section; Because the technical scheme in the present invention is not provided with test module in tested program, so can not improve the complexity of tested program logic, also just can not introduce new defect to tested program, and then by the present invention, just can avoid, due to what the new defect of introducing caused, original tested program is caused to interference.
Accompanying drawing explanation
In order to be illustrated more clearly in the present invention or technical scheme of the prior art, to the accompanying drawing of required use in embodiment or description of the Prior Art be briefly described below, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skills, do not paying under the prerequisite of creative work, can also obtain according to these accompanying drawings other accompanying drawing.
Fig. 1 is the schematic flow sheet of code segment method of testing described in the application;
Fig. 2 is the schematic flow sheet of testing process described in the application;
Fig. 3 is the another schematic flow sheet of code segment method of testing described in the application;
Fig. 4 is the another schematic flow sheet of testing process described in the application;
Fig. 5 is the another schematic flow sheet of code segment method of testing described in the application;
Fig. 6 is the structural representation of code segment proving installation described in the application;
Fig. 7 is that the hardware of code segment proving installation in the application forms schematic diagram.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, rather than whole embodiment.Based on the embodiment in the present invention, those of ordinary skills, not making the every other embodiment obtaining under creative work prerequisite, belong to the scope of protection of the invention.
In order to realize the object that reduces the interference to original program, in one aspect of the invention, provide a kind of code segment method of testing of program, as shown in Figure 1, comprise step:
S11, when tested program is tested, in tested program, call the position of tested code section, breakpoint/redirect processing unit is set.
In the present invention, the code segment in program is tested, can be realized by a test procedure, for the ease of understanding and distinguishing, in the present invention, the program under tested code section is called to tested program, the program that tested code section is tested is called to test procedure.
For the code segment section to setting in tested program, test, first test procedure is provided with breakpoint/redirect processing unit in the calling station of tested code section, to facilitate the control for tested program.
S12, operation tested program, carry out when calling the position of described tested code section when tested program, and breakpoint/redirect processing unit interrupts the execution flow process of tested code section, and the execution of tested program is jumped to the testing process of tested code section
When carrying out the test of code segment, first move tested program, when tested program runs to the position that need to call tested code section, breakpoint/redirect processing unit will be taken over the invoked procedure of tested code section; And tested program is redirected to the testing process of test procedure, take over the invoked procedure of tested code section.Specifically can comprise, first interrupt the execution flow process of tested code section, then, the execution of tested program be jumped to the testing process of tested code section.
S13, carrying out in described testing process, operation test code section, and obtain test result.
In the execution of tested program, jump to after the testing process of tested code section, test procedure can be carried out corresponding testing process, and then can obtain test result.
In actual applications, test code section can be the tested code self that modulation is used, and can be also the copy of test code section.Thereby can to tested code, test by the operation of test code section.
In the present invention, test for code segment is no longer in prior art, in the mode that adopts hard coded, need to be at the internal build test module of tested program, but can control by a test procedure execution route of tested code section corresponding programme, making wherein has no progeny enters testing process and comes the test of completion code section; Like this, just can not improve the complexity of logic in the affiliated program of tested code section, thereby avoid the interference to original program.
Preferably, in the present invention, for the type of code of carrying out the tested code section of testing, can be binary code segment program image, such as, operating system program reflection, the very difficult ISP who controls and itself be bottom while moving due to kernel program, so cannot directly apply existing, as testing tools such as Xunit, so by the test mode in the present invention, can, not changing under kernel scale-of-two mirror image scene, it be tested.Like this, after redirect/breakpoint processing unit of kernel setting is triggered, program jumps in testing process and carries out.In testing process, can be provided with test code, test code can be compiled in a scale-of-two image file with tested code, also can adopt dynamic-form to load.Like this, in the present invention, by redirect/breakpoint technology, solved the problem that does not change the kernel test difficulty under kernel scale-of-two mirror image scene, thereby promoted debugging and the testing efficiency of kernel development.
In the test process of code section, test code modulation tested code, can coordinating by redirect/breakpoint trigger and test code logic, or by generating the mode of tested code equivalent copy, prevent from again being triggered by tested code, thereby avoiding occurring occurs endless loop between redirect/breakpoint processing unit and tested code, finally realize the encapsulation function of test code part to tested code.
In actual applications, breakpoint/redirect processing unit can be specifically to realize by breakpoint, probe, the combination that on-the-fly modifies code segment or virtual executory one or more settings.
Further, in the present invention, in order not affect the execution of tested program, or, can proceed the test of other follow-up code segments, obtain after the test result of tested code section, the execution flow process of test code section can also be jumped to tested program; Like this, after testing process finishes, just can recover the execution of tested program.
In actual applications, the step of testing process can as shown in Figure 2, comprise:
S21, structure and checkout environment;
S22, call described tested code section;
After S23, described tested code section are finished, carry out inspection and the record of described test environment result.
As shown in Figure 3, when the testing process that adopts step S21 to S23 to record, the overall flow of carrying out the test of code segment is:
When tested program is normally carried out to the position of tested code section, test procedure is taken over the invoked procedure of tested program by the breakpoint/redirect processing unit being positioned at herein,, the execution flow process of interrupting tested code section, is then relocated to testing process by jump instruction by the execution of the program under tested code section.
In testing process, first structure and checkout environment, in addition, before test process calls tested code, test procedure also will be forbidden repeating of jump instruction in redirect/breakpoint processing logic.
Then, test procedure can call tested code section, makes tested code section carry out its operation;
After the operation of tested code section is finished, carry out inspection and the record of test environment result, that is, generate test result;
Then, the execution flow process of test code section is jumped to tested program, thereby can recover the follow-up execution of tested program.
Preferably, before the execution flow process of test code section is jumped to tested program, can also comprise step: cleaning test environment, thus carry out environment cleaning work.
In actual applications, the step of testing process can also as shown in Figure 4, comprise:
S31, structure and checkout environment;
S32, call the copy of described tested code section;
After S33, described tested code section are finished, carry out inspection and the record of described test environment result.
As shown in Figure 5, when the testing process that adopts step S31 to S33 to record, the overall flow of carrying out the test of code segment is:
When tested program is normally carried out to the position of tested code section, test procedure is taken over the invoked procedure of tested program by the breakpoint/redirect processing unit being positioned at herein,, the execution flow process of interrupting tested code section, is then relocated to testing process by jump instruction by the execution of the program under tested code section.
In testing process, first structure and checkout environment.
Then, test procedure can call the copy of tested code section, and moves the copy of tested code section; Concrete, in the present invention, the copy of tested code section can be identical with tested code section, and in addition, the copy of tested code section can be also and the code segment of tested code section logic function equivalence.
After the operation of the copy of tested code section is finished, return to inspection and the record of carrying out test environment result, that is, generate test result;
Then, the execution flow process of test code section is jumped to tested program, thereby can recover the follow-up execution of tested program.
Preferably, before the execution flow process of test code section is jumped to tested program, can also comprise step: cleaning test environment, thus carry out environment cleaning work.
Preferably, before the above-mentioned copy that calls tested code section, when the copy of tested code section does not exist, can also create the step of the copy of tested code section.
Corresponding to the code segment method of testing embodiment of program illustrated in fig. 1, in the application on the other hand, also provide a kind of code segment proving installation of program, as shown in Figure 6, comprising:
Breakpoint setting unit 01 for breakpoint setting unit, for when tested program is tested, is called the position of tested code section in described tested program, and breakpoint/redirect processing unit is set;
Breakpoint/redirect processing unit 02, for described breakpoint/redirect processing unit, for when the execution of described tested program is when calling described tested code fragment position, described breakpoint/redirect processing unit interrupts the execution flow process of described tested code section, and the execution of described tested program is jumped to testing process;
Test cell 03, for carrying out described testing process, operation test code section, and obtain test result.
In the present invention, the code segment proving installation that code segment in program is tested, it can be a test procedure of realizing by software, for the ease of understanding and distinguishing, in the present invention, program under tested code section is called to tested program, the program that tested code section is tested is called to test procedure.
For the code segment section to setting in tested program is tested, first breakpoint setting unit 01 is provided with breakpoint/redirect processing unit in the calling station of tested code section, like this, when carrying out the test of code segment section, first move tested program, when tested program runs to the position that need to call tested code section, breakpoint/redirect processing unit 02 will be taken over the invoked procedure of tested code section; And tested program being redirected to the testing process of test procedure, the invoked procedure of taking over tested code section specifically comprises, first interrupts the execution flow process of tested code section, then, the execution of tested program is jumped to the testing process of tested code section.
Jump to the testing process of tested code section in the execution of tested program after, test cell 03 can start the execution of testing process, and then can move test code section, and obtains test result.
In the present invention, test for code segment is no longer in prior art, in the mode that adopts hard coded, need to be at the internal build test module of tested program, but can control by a test procedure execution route of tested code section corresponding programme, making wherein has no progeny enters testing process and comes the test of completion code section; Like this, just can not improve the complexity of logic in the affiliated program of tested code section, thereby avoid the interference to original program.
Preferably, in the present invention, for the type of code of carrying out the tested code section of testing, can be binary code segment program image, such as, operating system program reflection, the very difficult ISP who controls and itself be bottom while moving due to kernel program, so cannot directly apply existing, as testing tools such as Xunit, so by the test mode in the present invention, can, not changing under kernel scale-of-two mirror image scene, it be tested.Like this, after redirect/breakpoint processing unit of kernel setting is triggered, program jumps in testing process and carries out.In testing process, can be provided with test code, test code can be compiled in a scale-of-two image file with tested code, also can adopt dynamic-form to load.Like this, in the present invention, by redirect/breakpoint technology, solved the problem that does not change the kernel test difficulty under kernel scale-of-two mirror image scene, thereby promoted debugging and the testing efficiency of kernel development.
In the test process of code section, test code modulation tested code, can coordinating by redirect/breakpoint trigger and test code logic, or by generating the mode of tested code equivalent copy, prevent from again being triggered by tested code, thereby avoiding occurring occurs endless loop between redirect/breakpoint processing unit and tested code, finally realize the encapsulation function of test code part to tested code.
In actual applications, breakpoint/redirect processing unit can be specifically to realize by breakpoint, probe, the combination that on-the-fly modifies code segment or virtual executory one or more settings.
Further, in the present invention, in order not affect the execution of tested program, or, the test of other follow-up code segments can be proceeded, obtaining after the test result of tested code section, recovery unit can also be comprised, like this, by recovery unit, lead to the execution flow process of test code section is jumped to tested program; Thereby make, after testing process finishes, just can recover the execution of tested program.
In actual applications, test cell 03 specifically can comprise:
Test environment constructing module, for structure and checkout environment;
Code segment calling module, for calling tested code section;
Test result acquisition module, after being finished, carries out inspection and the record of test environment result for tested code section.
As shown in Figure 3, when adopting test cell to comprise above-mentioned test environment constructing module, code segment calling module and test result acquisition module, the overall flow of carrying out the test of code segment can be:
When tested program is normally carried out to the position of tested code section, breakpoint/redirect the processing unit 02 being positioned at is herein taken over the invoked procedure of tested program,, the execution flow process of interrupting tested code section, is then relocated to testing process by jump instruction by the execution of the program under tested code section.
In testing process, first test environment constructing module structure and checkout environment, in addition, before test process calls tested code, test environment constructing module also will be forbidden repeating of jump instruction in redirect/breakpoint processing logic.
Then, code segment calling module calls tested code section, makes tested code section carry out its operation;
After the operation of tested code section is finished, test result acquisition module returns to inspection and the record of carrying out test environment result,, generates test result that is;
Then, recovery unit jumps to tested program by the execution flow process of test code section, thereby can recover the follow-up execution of tested program.
Preferably, the test cell in the application, can also comprise test environment cleaning module, and test environment cleaning module, for before the execution flow process of test code section is jumped to tested program, is cleared up test environment, thereby carried out environment cleaning work.
In actual applications, test cell 03 specifically can also comprise:
Test environment constructing module, for structure and checkout environment;
Code segment calling module, for calling the copy of described tested code section;
Test result acquisition module, after being finished, carries out inspection and the record of described test environment result for tested code section.
As shown in Figure 3, when adopting test cell 03 to comprise above-mentioned test environment constructing module, code segment calling module and test result acquisition module, the overall flow of carrying out the test of code segment can be:
When tested program is normally carried out to the position of tested code section, breakpoint/redirect the processing unit 02 being positioned at is herein taken over the invoked procedure of tested program,, the execution flow process of interrupting tested code section, is then relocated to testing process by jump instruction by the execution of the program under tested code section.
In testing process, first test environment constructing module structure and checkout environment.
Then, code segment calling module test procedure can call the copy of tested code section, and moves the copy of tested code section; Concrete, in the present invention, the copy of tested code section can be identical with tested code section, and in addition, the copy of tested code section can be also and the code segment of tested code section logic function equivalence.
After the operation of the copy of tested code section is finished, test result acquisition module returns to inspection and the record of carrying out test environment result,, generates test result that is;
Then, recovery unit jumps to tested program by the execution flow process of test code section, thereby can recover the follow-up execution of tested program.
Preferably, the test cell in the application, can also comprise test environment cleaning module, and test environment cleaning module, for before the execution flow process of test code section is jumped to tested program, is cleared up test environment, thereby carried out environment cleaning work.
Preferably, the test cell 03 in the present invention can also comprise copy creating module, and copy creating module, for before the above-mentioned copy that calls tested code section, when the copy of tested code section does not exist, creates the copy of tested code section.
In the application on the other hand, the code segment test macro of another kind of program is also provided, this code segment test macro has comprised the code segment proving installation in a upper embodiment, because the code segment proving installation in the code segment test macro in the present embodiment is identical with the structure of the code segment proving installation in a upper embodiment, principle of work is identical and beneficial effect is identical, so just repeat no more at this.
Further, the embodiment of the present invention also provides the hardware of code segment proving installation to form.Can comprise at least one processor (for example CPU), and at least one storer.The executable module that processor is stored for execute store, for example computer program.Storer may comprise high-speed random access memory (RAM:Random Access Memory), also may also comprise non-unsettled storer (non-volatile memory), for example at least one magnetic disk memory.By at least one network interface (can be wired or wireless), realize the communication connection between this system gateway and at least one other network element, can use internet, wide area network, local network, Metropolitan Area Network (MAN) etc.
Referring to Fig. 7, in some embodiments, in storer, stored programmed instruction, programmed instruction can be executed by processor, wherein, programmed instruction comprises breakpoint setting unit 01, breakpoint/redirect processing unit 02 and test cell 03, the corresponding units that the specific implementation of each unit can disclose referring to Fig. 6.
The present invention program can describe in the general context of the computer executable instructions of being carried out by computing machine, for example program element.Usually, program element comprises and carries out particular task or realize routine, program, object, assembly, data structure of particular abstract data type etc.Also can in distributed computing environment, put into practice the present invention program, in these distributed computing environment, by the teleprocessing equipment being connected by communication network, be executed the task.In distributed computing environment, program element can be arranged in the local and remote computer-readable storage medium including memory device.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, between each embodiment identical similar part mutually referring to, each embodiment stresses is and the difference of other embodiment.Especially, for device embodiment, because it is substantially similar in appearance to embodiment of the method, so describe fairly simplely, relevant part is referring to the part explanation of embodiment of the method.Device embodiment described above is only schematic, the wherein said unit as separating component explanation can or can not be also physically to separate, the parts that show as unit can be or can not be also physical locations, can be positioned at a place, or also can be distributed in multiple network element.Can select according to the actual needs some or all of module wherein to realize the object of the present embodiment scheme.Those of ordinary skills, in the situation that not paying creative work, are appreciated that and implement.
Above the embodiment of the present invention is described in detail, has applied embodiment herein the present invention is set forth, the explanation of above embodiment is just for helping to understand method and apparatus of the present invention; , for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention meanwhile.

Claims (21)

1. a code segment method of testing for program, is characterized in that, comprising:
When tested program is tested, in described tested program, call the position of tested code section, breakpoint/redirect processing unit is set;
Move described tested program, when described tested program, carry out when calling described tested code fragment position, described breakpoint/redirect processing unit interrupts the execution flow process of described tested code section, and the execution of described tested program is jumped to testing process;
Carrying out in described testing process, move test code section, and obtain test result.
2. according to the method described in claim 1, it is characterized in that, the type of code of described tested code section comprises:
Binary program reflection.
3. according to the method described in claim 2, it is characterized in that, described tested program comprises:
Operating system program or application program.
4. according to the method described in claim 3, it is characterized in that, described breakpoint/redirect processing unit comprises:
By breakpoint, probe being set, on-the-fly modifying code segment or virtual executory one or combination in any realization.
5. according to the method described in claim 1, it is characterized in that, described in obtain after test result, also comprise:
After testing process finishes, recover the execution of described tested program journey.
6. according to the method described in claim 5, it is characterized in that, described testing process comprises:
Structure and checkout environment;
Call described tested code section;
After described tested code section is finished, carry out inspection and the record of described test environment result.
7. according to the method described in claim 5, it is characterized in that, described testing process comprises:
Structure and checkout environment;
Call the copy of described tested code section;
After the copy of described tested code section is finished, carry out inspection and the record of described test environment result.
8. according to arbitrary described method in claim 6 or 7, it is characterized in that, also comprise:
Recover, before the execution of interrupted described tested program, to clear up described test environment.
9. according to the method described in claim 7, it is characterized in that, also comprise:
Before described structure and checkout environment, when the copy of described tested code section does not exist, create the copy of described tested code section.
10. according to the method described in claim 9, it is characterized in that, the copy of described tested code section comprises:
Code segment with the equivalence of described tested code section logic function.
The code segment proving installation of 11. 1 kinds of programs, is characterized in that, comprising:
Breakpoint setting unit for when tested program is tested, is called the position of tested code section in described tested program, and breakpoint/redirect processing unit is set;
Described breakpoint/redirect processing unit, for when the execution of described tested program is when calling described tested code fragment position, described breakpoint/redirect processing unit interrupts the execution flow process of described tested code section, and the execution of described tested program is jumped to testing process;
Test cell, for carrying out described testing process, operation test code section, and obtain test result.
12. according to the device described in claim 11, it is characterized in that, the type of code of described tested code section comprises:
Binary program reflection.
13. according to the device described in claim 12, it is characterized in that, described tested program comprises:
Operating system program or application program.
14. according to the device described in claim 13, it is characterized in that, described breakpoint/redirect processing unit comprises:
Breakpoint, probe, on-the-fly modify code segment or virtual executory one or combination in any.
15. according to the method described in claim 11, it is characterized in that, also comprises:
Recovery unit, after finishing for testing process, the execution that recovers described tested program journey.
16. according to the device described in claim 15, it is characterized in that, described test cell, comprising:
Test environment constructing module, for structure and checkout environment;
Code segment calling module, for calling described tested code section;
Test result acquisition module, after being finished in described tested code section, carries out inspection and the record of described test environment result.
17. according to the device described in claim 15, it is characterized in that, described test cell, comprising:
Test environment constructing module, for structure and checkout environment;
Code segment calling module, for calling the copy of described tested code section;
Test result acquisition module, after being finished, carries out inspection and the record of described test environment result for the copy of described tested code section.
18. according to arbitrary described device in claim 16 or 17, it is characterized in that, described test cell, also comprises:
Test environment cleaning module, for before the execution of the interrupted described tested program journey of recovery, clears up described test environment.
19. according to the device described in claim 17, it is characterized in that, described test cell, also comprises:
Copy creating module, for before described structure and checkout environment, when the copy of described tested code section does not exist, creates the copy of described tested code section.
20. according to the device described in claim 19, it is characterized in that, the copy of described tested code section comprises:
Code segment with the equivalence of described tested code section logic function.
The code segment test macro of 21. 1 kinds of programs, is characterized in that, comprises as the code segment proving installation of program as described in arbitrary in claim 11 to 20.
CN201310752450.1A 2013-12-31 2013-12-31 Code segment method of testing, device and the system of program Active CN103761184B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310752450.1A CN103761184B (en) 2013-12-31 2013-12-31 Code segment method of testing, device and the system of program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310752450.1A CN103761184B (en) 2013-12-31 2013-12-31 Code segment method of testing, device and the system of program

Publications (2)

Publication Number Publication Date
CN103761184A true CN103761184A (en) 2014-04-30
CN103761184B CN103761184B (en) 2017-01-04

Family

ID=50528426

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310752450.1A Active CN103761184B (en) 2013-12-31 2013-12-31 Code segment method of testing, device and the system of program

Country Status (1)

Country Link
CN (1) CN103761184B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104809071A (en) * 2015-05-14 2015-07-29 北京润科通用技术有限公司 Code testing method and device
CN105653244A (en) * 2014-11-10 2016-06-08 华为数字技术(苏州)有限公司 Software optimization method and device
CN107038108A (en) * 2015-08-20 2017-08-11 腾讯科技(深圳)有限公司 The method of testing and device of software
WO2017162058A1 (en) * 2016-03-23 2017-09-28 阿里巴巴集团控股有限公司 Software test method and device
CN107665169A (en) * 2016-07-29 2018-02-06 龙芯中科技术有限公司 The method of testing and device of processor program
CN112395185A (en) * 2019-08-15 2021-02-23 腾讯科技(深圳)有限公司 Program testing method and related device
CN112579409A (en) * 2020-12-05 2021-03-30 西安翔腾微电子科技有限公司 OpenGL graphic task analysis method
CN113742237A (en) * 2021-09-13 2021-12-03 北京奕斯伟计算技术有限公司 Program debugging method, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101183330A (en) * 2007-12-13 2008-05-21 东信和平智能卡股份有限公司 Online debugging system of embedded system and debug method thereof
US20090307532A1 (en) * 2008-06-04 2009-12-10 Jason Neal Raber Stealthy debugger
CN101727393A (en) * 2009-12-29 2010-06-09 青岛海信宽带多媒体技术有限公司 Method for dynamically testing embedded system software
CN102395928A (en) * 2009-03-27 2012-03-28 Abb股份公司 System and method for automatically testing a program for safety-related automation systems

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101183330A (en) * 2007-12-13 2008-05-21 东信和平智能卡股份有限公司 Online debugging system of embedded system and debug method thereof
US20090307532A1 (en) * 2008-06-04 2009-12-10 Jason Neal Raber Stealthy debugger
CN102395928A (en) * 2009-03-27 2012-03-28 Abb股份公司 System and method for automatically testing a program for safety-related automation systems
CN101727393A (en) * 2009-12-29 2010-06-09 青岛海信宽带多媒体技术有限公司 Method for dynamically testing embedded system software

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ROB STEPHENS: "《Visual Basic 2005 设计与开发专家教程》", 31 July 2008, article "Visual Basic 2005 设计与开发专家教程", pages: 435-437 *

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105653244B (en) * 2014-11-10 2019-04-19 华为数字技术(苏州)有限公司 A kind of optimization method for software and device
CN105653244A (en) * 2014-11-10 2016-06-08 华为数字技术(苏州)有限公司 Software optimization method and device
CN104809071B (en) * 2015-05-14 2017-08-11 北京润科通用技术有限公司 A kind of code test method and device
CN104809071A (en) * 2015-05-14 2015-07-29 北京润科通用技术有限公司 Code testing method and device
CN107038108A (en) * 2015-08-20 2017-08-11 腾讯科技(深圳)有限公司 The method of testing and device of software
CN107229558B (en) * 2016-03-23 2020-10-16 阿里巴巴集团控股有限公司 Software testing method and device
CN107229558A (en) * 2016-03-23 2017-10-03 阿里巴巴集团控股有限公司 Method for testing software and device
WO2017162058A1 (en) * 2016-03-23 2017-09-28 阿里巴巴集团控股有限公司 Software test method and device
CN107665169A (en) * 2016-07-29 2018-02-06 龙芯中科技术有限公司 The method of testing and device of processor program
CN107665169B (en) * 2016-07-29 2020-07-28 龙芯中科技术有限公司 Method and device for testing processor program
CN112395185A (en) * 2019-08-15 2021-02-23 腾讯科技(深圳)有限公司 Program testing method and related device
CN112395185B (en) * 2019-08-15 2024-04-12 腾讯科技(深圳)有限公司 Program testing method and related device
CN112579409A (en) * 2020-12-05 2021-03-30 西安翔腾微电子科技有限公司 OpenGL graphic task analysis method
CN113742237A (en) * 2021-09-13 2021-12-03 北京奕斯伟计算技术有限公司 Program debugging method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN103761184B (en) 2017-01-04

Similar Documents

Publication Publication Date Title
CN103761184A (en) Method, device and system for testing code segment of program
CN101401333B (en) A debugging method and apparatus for performing telecom class service development based on model driven
CN109848985B (en) Robot graphic programming method and device and intelligent terminal
CN109144515B (en) Off-line simulation method and device for DCS graphical algorithm configuration
CN105022620B (en) A kind of applied software development method based on mobile platform
CN105224454A (en) A kind of adjustment method, polycaryon processor and commissioning device
CN105159738A (en) Hot patch implementation method and system
CN105117346A (en) Automatic testing method and system for distributed system of virtualization platform
CN103077111A (en) Method and system for locating continuous integration failed case
CN104899136A (en) Method and device used for generating test case
CN103488466A (en) Method and device for executing application program
CN104298602A (en) Method and device for debugging application program
CN106020905A (en) Microcontroller firmware developing and updating method and system
CN103513966A (en) PHP developing framework based on assemblies
CN103500250A (en) Automatic layout method for digraph created GMF graph editor
CN106021101A (en) Method and device for testing mobile terminal
CN103631719A (en) Web automated testing method and device
CN105279092A (en) Software testing method and apparatus
CN104391754A (en) Method and device for processing task exception
CN105260184B (en) A kind of adjustment method and device for restoring image file
CN103019772A (en) Automatic compilation method and system in software development
CN104407852A (en) Code isolation-based construction method for embedded software and calling method for embedded software
CN103034501B (en) The function calling method of a kind of linux platform and function call device
CN103631480A (en) View object control method and electronic equipment
CN103631585A (en) Method and system for developing application program

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20171208

Address after: 402260 Chongqing city Jiangjin Luohuang Industrial Park B District

Patentee after: CHONGQING HANYUAN MACHINERY Co.,Ltd.

Address before: 510640 Guangdong City, Tianhe District Province, No. five, road, public education building, unit 371-1, unit 2401

Patentee before: GUANGDONG GAOHANG INTELLECTUAL PROPERTY OPERATION Co.,Ltd.

Effective date of registration: 20171208

Address after: 510640 Guangdong City, Tianhe District Province, No. five, road, public education building, unit 371-1, unit 2401

Patentee after: GUANGDONG GAOHANG INTELLECTUAL PROPERTY OPERATION Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee before: HUAWEI TECHNOLOGIES Co.,Ltd.

TR01 Transfer of patent right