CN111382076B - Application program testing method and device, electronic equipment and computer storage medium - Google Patents

Application program testing method and device, electronic equipment and computer storage medium Download PDF

Info

Publication number
CN111382076B
CN111382076B CN202010163489.XA CN202010163489A CN111382076B CN 111382076 B CN111382076 B CN 111382076B CN 202010163489 A CN202010163489 A CN 202010163489A CN 111382076 B CN111382076 B CN 111382076B
Authority
CN
China
Prior art keywords
application program
file
dynamic link
link library
target dynamic
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.)
Active
Application number
CN202010163489.XA
Other languages
Chinese (zh)
Other versions
CN111382076A (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.)
Douyin Vision Co Ltd
Original Assignee
Douyin Vision 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 Douyin Vision Co Ltd filed Critical Douyin Vision Co Ltd
Priority to CN202010163489.XA priority Critical patent/CN111382076B/en
Publication of CN111382076A publication Critical patent/CN111382076A/en
Application granted granted Critical
Publication of CN111382076B publication Critical patent/CN111382076B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • 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

Abstract

The application provides a test method and device of an application program, electronic equipment and a computer readable storage medium, and relates to the field of data processing. The method comprises the following steps: when the application program is started, determining a target dynamic link library through a script file preset in the application program; recording related information of any file accessed by the application program through the target dynamic library; when the access is finished and any file meets the preset condition, the corresponding relevant information is used as a test result, and the test result is output. According to the method and the device, the program developer can rapidly locate and repair the loopholes of the application program, the fact that after any file is accessed by the application program, the file meets the preset condition is achieved, the problem that the application program collapses due to the fact that the number of files which do not meet the preset condition reaches a certain number is solved, and user experience is improved.

Description

Application program testing method and device, electronic equipment and computer storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method and apparatus for testing an application program, an electronic device, and a computer readable storage medium.
Background
With development of technology, hardware performance of the intelligent terminal is more and more powerful, and operation of various types of application programs in the intelligent terminal can be supported. However, sometimes, some vulnerabilities exist in the application itself, which may cause the application to crash during running.
For example, an application may need to open and use various files at runtime, including system files, program files of the application itself, or user files, etc., to perform I/O operations. Normally, an application program closes a file after using the file, and in the case that a vulnerability exists in the application program itself, a situation that the application program does not close the file in time, namely "file leakage" occurs. Files that are simultaneously opened on some operating system platforms are limited, program crashes can be caused if the number of file leaks exceeds the limit, and crashed information cannot be generally located to a specific leaked file, namely, which file is opened by which code of an application program and the opened file is not closed, so that user experience of a user when the application program is used is reduced, and great repair difficulty is caused to a program developer.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
The application program testing method, device, electronic equipment and computer readable storage medium can solve the problems that when the application program acts, user experience of a user is reduced when the application program is used, and a program developer is difficult to repair. The technical scheme is as follows:
in a first aspect, there is provided a method for testing an application program, the method comprising:
when the application program is started, determining a target dynamic link library through a script file preset in the application program;
recording related information of any file accessed by the application program through the target dynamic library;
when the access is finished and any file meets the preset condition, the corresponding relevant information is used as a test result, and the test result is output.
In a second aspect, there is provided an apparatus for testing an application program, the apparatus comprising:
the first processing module is used for determining a target dynamic link library through a script file preset in the application program when the application program is started;
the second processing module is used for recording related information of any file accessed by the application program through the target dynamic library;
and the third processing module is used for taking the corresponding related information as a test result when the access is finished and any file meets the preset condition, and outputting the test result.
In a third aspect, an electronic device is provided, the electronic device comprising:
a processor, a memory, and a bus;
the bus is used for connecting the processor and the memory;
the memory is used for storing operation instructions;
the processor is configured to, by invoking the operation instruction, cause the processor to execute an operation corresponding to a test method of the application program as shown in the first aspect of the application.
In a fourth aspect, a computer readable storage medium is provided, on which a computer program is stored, which program, when being executed by a processor, implements the method for testing an application program according to the first aspect of the present application.
The beneficial effects that this application provided technical scheme brought are:
in the embodiment of the invention, when the application program is started, a target dynamic link library is determined through a script file preset in the application program, and for any file accessed by the application program, the related information of the file is recorded through the target dynamic library, when the access is finished and any file meets the preset condition, the corresponding related information is used as a test result, and the test result is output. In this way, in the running process of the application program, the related information of the file accessed by the application program is recorded through the preset target dynamic link library, and after the access is finished, the related information corresponding to the file which does not meet the preset condition is output as a test result, so that a program developer locates a specific code segment with the vulnerability in the application program based on the test result, and the code segment is corrected, the program developer can rapidly locate and repair the vulnerability of the application program, the problem that the application program crashes due to the fact that the number of the files which do not meet the preset condition reaches a certain number is solved, and the user experience is improved.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale.
FIG. 1 is a flow chart of a testing method for an application according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a testing method of an application according to another embodiment of the present disclosure;
FIG. 3 is a schematic structural diagram of a testing device for an application according to another embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an electronic device for testing an application according to another embodiment of the present application.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are used merely to distinguish one from another device, module, or unit, and are not intended to limit the device, module, or unit to the particular device, module, or unit or to limit the order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
The application program testing method, device, electronic equipment and computer readable storage medium aim to solve the technical problems in the prior art.
The following describes the technical solutions of the present application and how the technical solutions of the present application solve the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
In one embodiment, a method for testing an application program is provided, as shown in fig. 1, and includes:
step S101, when an application program is started, determining a target dynamic link library through a script file preset in the application program;
in practical applications, the application program may be installed in the intelligent terminal. After the application program is installed in the intelligent terminal, a program file, such as a script file, required by the running of the application program can be obtained.
Script (Script) is simply a piece of written commands that are viewable (e.g., can be viewed and edited with a notepad open), which when executed is a piece of machine-recognizable instructions translated by an interpreter of the system and executed in program order.
In practical application, the script file can be obtained after the application program is installed, however, because the script file is a set of text commands, even after the application program is installed, the user can change the text commands in the script file according to the actual requirements, thereby realizing the requirements of the user.
Further, a dynamic link library (Dynamic Link Library, abbreviated DLL) is one way to implement the shared function library concept. The extensions of these library functions are ". Dll", ". Ocx" (containing an ActiveX controlled library) or ". Drv" (legacy system driver).
Dynamic linking provides a way for a process to call a function that does not belong to its executable code. The executable code of the functions is located in a DLL file that contains one or more functions that have been compiled, linked, and stored separately from the process in which they are used. DLLs also help to share data and resources. Multiple applications can access the contents of a single DLL copy in memory at the same time.
In practice, different operating systems typically have corresponding default dynamic link libraries. For example, in Windows, the dynamic link library is most often a file with an ". Dll" extension, but may also be ". Ocx" or other extensions; in Linux it is often a file of ". So". They provide code, data, or functions to applications running under the Windows operating system or Linux operating system, respectively. The application may open, enable, query, disable, and close the driver according to instructions in the DLL file.
Step S102, aiming at any file accessed by an application program, recording the related information of the file through a target dynamic library;
wherein access to the file may include, but is not limited to, an open, close, read, or write operation to the file; the file may be any file that the application may access, including but not limited to a system file, a program file of the application itself, or a user file; the relevant information of the file includes, but is not limited to, file name, access frequency, access time consumption, function name accessed or call stack information of the file.
Step S103, when the application program finishes accessing any file, the related information meeting the preset condition is taken as a test result, and the test result is output.
When the access of the application program to any file is finished, detecting whether the file meets a preset condition, if so, taking relevant information corresponding to the file as a test result, outputting the test result, and further storing the test result; if not, no other operations may be performed.
In the embodiment of the invention, when an application program is started, a target dynamic link library is determined through a script file preset in the application program, and relative information of the file is recorded through the target dynamic link library aiming at any file accessed by the application program, when the access is finished and any file meets the preset condition, the corresponding relative information is used as a test result, and the test result is output. In this way, in the running process of the application program, the related information of the file accessed by the application program is recorded through the preset target dynamic link library, and after the access is finished, the related information corresponding to the file which does not meet the preset condition is output as a test result, so that a program developer locates a specific code segment with the vulnerability in the application program based on the test result, and the code segment is corrected, the program developer can rapidly locate and repair the vulnerability of the application program, the problem that the application program crashes due to the fact that the number of the files which do not meet the preset condition reaches a certain number is solved, and the user experience is improved.
In another embodiment, there is provided a method for testing an application program, as shown in fig. 2, the method including:
step S201, when an application program is started, determining a target dynamic link library through a script file preset in the application program;
in practical application, the application program can be installed in an intelligent terminal, and the intelligent terminal can have the following characteristics:
(1) In a hardware system, the device includes a central processing unit, a memory, an input unit, and an output unit, that is, the device is often a microcomputer device having a communication function. In addition, there may be various input modes such as a keyboard, a mouse, a touch panel, a microphone, a camera, and the like, and the input may be adjusted as necessary. Meanwhile, the equipment often has various output modes, such as a receiver, a display screen and the like, and can be adjusted according to the needs;
(2) On a software architecture, the device must be provided with an operating system, such as Windows Mobile, symbian, palm, android, iOS, etc. Meanwhile, the operating systems are more and more open, and personalized application programs developed based on the open operating system platforms are layered endlessly, such as an address book, a calendar, a notepad, a calculator, various games and the like, so that the demands of personalized users are met to a great extent;
(3) In terms of communication capability, the device has flexible access mode and high-bandwidth communication performance, and can automatically adjust the selected communication mode according to the selected service and the environment, thereby facilitating the use of users. The device can support GSM (Global System for Mobile Communication, global System for Mobile communications), WCDMA (Wideband Code Division Multiple Access ), CDMA2000 (Code Division Multiple Access, code Division multiple Access), TDSCDMA (Time Division-Synchronous Code Division Multiple Access, time Division synchronous code Division multiple Access), wi-Fi (Wireless Fidelity), wiMAX (Worldwide Interoperability for Microwave Access ), etc., thereby adapting to various system networks, supporting not only voice services, but also various Wireless data services;
(4) In terms of functional use, the device is more focused on humanization, individualization and multifunctionality. With the development of computer technology, the device enters a mode of 'centering on people' from a mode of 'centering on the device', and embedded computing, control technology, artificial intelligence technology, biological authentication technology and the like are integrated, so that the aim of people is fully embodied. Due to the development of software technology, the device can adjust the settings according to personal needs, and is more personalized. Meanwhile, the device integrates a plurality of software and hardware, and the functions are more and more powerful.
Further, after the application program is installed in the intelligent terminal, a program file, such as a script file, required by the application program in running can be obtained.
Script (Script) is simply a piece of written commands that are viewable (e.g., can be viewed and edited with a notepad open), which when executed is a piece of machine-recognizable instructions translated by an interpreter of the system and executed in program order.
The script has the following characteristics:
grammar and structure are generally relatively simple;
learning and use are generally simpler;
usually, the "interpretation" of the program is easy to modify as a running mode, and no "compiling" is needed;
the development productivity of the program is superior to the running efficiency;
the work efficiency of a system administrator is greatly improved.
Scripts may typically be invoked and executed temporarily by an application. Various scripts are widely used in web page design because the scripts not only can reduce the size of web pages and increase the web page browsing speed, but also can enrich the representation of web pages, such as animation, sound, etc. As the most common example, when clicking Email address on the webpage, the Email software such as Outlook Express or Foxmail can be automatically called, which is realized by script function, wherein the webpage corresponds to browser, and the automatic call Email software is a text command in script.
In practical application, the script file can be obtained after the application program is installed, however, because the script file is a set of text commands, even after the application program is installed, the user can change the text commands in the script file according to the actual requirements, thereby realizing the requirements of the user.
Further, a dynamic link library (Dynamic Link Library, abbreviated DLL) is one way to implement the shared function library concept. The extensions of these library functions are ". Dll", ". Ocx" (containing an ActiveX controlled library) or ". Drv" (legacy system driver).
Dynamic linking provides a way for a process to call a function that does not belong to its executable code. The executable code of the functions is located in a DLL file that contains one or more functions that have been compiled, linked, and stored separately from the process in which they are used. DLLs also help to share data and resources. Multiple applications can access the contents of a single DLL copy in memory at the same time.
Updates can be more easily applied to individual modules using a dynamic link library without affecting other parts of the program. For example, a large network game, if the codes of the whole game of hundreds of MB or even a few GB are placed in an application program, the later modification work will be very time-consuming, and if the codes of different functions are respectively placed in a plurality of dynamic link libraries, the update can be applied without regenerating or installing the whole program.
A dynamic link library file is a non-executable binary program file that allows applications to share code and other resources necessary to perform a particular task. The DLL file contains a number of functions and resources that allow programs based on a given operating system to operate in the given operating system environment.
The dynamic link library has the following advantages:
1) The characteristics of the application program are expanded;
2) May be written in a number of programming languages;
3) The management of the software project is simplified;
4) The memory is saved;
5) The resource sharing is facilitated;
6) Facilitating localization of applications;
7) Helping to solve platform differences;
8) May be used for some special purposes. For example, windows makes certain features available only to DLLs.
In practice, different operating systems typically have corresponding default dynamic link libraries. For example, in Windows, the dynamic link library is most often a file with an ". Dll" extension, but may also be ". Ocx" or other extensions; in Linux it is often a file of ". So". They provide code, data, or functions to applications running under the Windows operating system or Linux operating system, respectively. The application may open, enable, query, disable, and close the driver according to instructions in the DLL file.
In a preferred embodiment of the present invention, the step of determining the target dynamic link library through a script file preset in the application program includes:
determining environmental variables of target parameters corresponding to the application program through the script file;
and determining a target dynamic link library from the environment variables.
Specifically, the embodiment of the invention can be applied to a test stage of an application program, before the application program is run, a dynamic link library containing various standard I/O (Input/Output) functions meeting the requirements of an operating system, such as open/close, write/read, and the like, can be realized in advance by writing codes, and then a script file, such as a wrap. Sh script, is used to declare an environment variable of a target parameter, such as an environment variable of ld_reload, and a path of the dynamic link library, that is, the dynamic link library which is written in advance, is specified in the environment variable of the target parameter. Thus, a pre-written dynamic link library can be obtained when the application program is installed; or before the application program is installed and operated, the pre-written dynamic link library is stored to the target path, and then the environment variable of the target parameter is re-declared, so that the pre-written dynamic link library is appointed when the application program is operated; of course, other manners are possible, and may be adjusted according to actual requirements in practical applications, which is not limited by the embodiment of the present invention.
Further, when the application program is running, the application program executes a text command of declaring the environment variable of the ld_reload in the wrap. Sh script, so as to determine the environment variable of the target parameter corresponding to the application program.
Step 202, replacing a system standard dynamic link library in a preset system by using a target dynamic link library; an application program is installed in a preset system;
in practical application, when an application program runs in a terminal provided with a specified operating system, a system standard dynamic link library of the operating system can be used by default, and under normal conditions, the application program can access various files during running, specifically can open the files, acquire file contents, and close the opened files when the access is finished.
However, when a vulnerability occurs in an application, a case occurs in which a file is opened by the application but is not closed, which is called "file leakage". When the number of file leaks exceeds a threshold, the application program may crash, such as a failed boot, flashing back, etc.
In the embodiment of the invention, the preset dynamic link library can monitor all I/O operations on the starting path of the application program and the conventional code execution path, collect the information such as the opened file name and the call stack, and the like, and through the information, a program developer can easily find out the loophole of the application program, namely which section of code of the application program opens which file, so that the corresponding code section is revealed according to the file which is not closed, and the code section is modified, thereby avoiding the situation that the application program is crashed.
Therefore, in the embodiment of the invention, after the target dynamic link library is determined, the target dynamic link library is replaced with the system standard dynamic link library in the operating system; wherein the application program is installed in the operating system.
Step S203, recording the related information of the file by a target dynamic library aiming at any file accessed by the application program;
wherein access to the file may include, but is not limited to, an open, close, read, or write operation to the file; the file may be any file that the application may access, including but not limited to a system file, a program file of the application itself, or a user file; the relevant information of the file includes, but is not limited to, file name, access frequency, access time consumption, function name accessed or call stack information of the file.
In a preferred embodiment of the present invention, the step of recording, for any file accessed by the application program, information about the file by the target dynamic library includes:
when the application program executes any I/O operation on any file, the file name and call stack information of any file are recorded.
Specifically, during the running process of the application program, when the application program executes any I/O operation on any file, the relevant information of the file, mainly file name and call stack information, is recorded through the target dynamic library.
Where a call stack is a stack in computer science that stores messages about running subroutines. Sometimes referred to as a "stack" only, but not necessarily only subroutine messages are stored in the stack. The call stack is most often used to store the return address of the subroutine. When any subroutine is called, the main program must register the address to which the subroutine should return after running. Thus, if the called subroutine is to call another subroutine, its own return address must be stored in the call stack and retrieved after its own execution. In a recursive program, each level of recursion must add an address to the call stack, so if the program presents an infinite recursion (or just an excessive number of recursion levels), the call stack will produce stack overflow.
The main functions of the call stack, in addition to storing return addresses, may also be used to store:
local variable: the variables of the subroutines can be stored in a call stack, so that the function of separating the variables among different subroutines can be achieved;
parameter transfer: if the register is insufficient to accommodate the parameters of the subroutine, the parameters may be stored on the call stack;
environmental delivery: some languages (such as Pascal and Ada) support "multi-layer subroutines," i.e., subroutines in which local variables of the main program can be utilized. These variables may be passed into the subroutine through the call stack.
Based on the features of the call stack, in the embodiment of the invention, the code segment with the bug in the application program can be determined based on the file name of the file and the call stack information.
Step S204, when the access is finished and any file meets the preset condition, the corresponding relevant information is used as a test result, and the test result is output.
When the access of the application program to any file is finished, detecting whether the file meets a preset condition, if so, taking relevant information corresponding to the file as a test result, outputting the test result, and further storing the test result; if not, no other operations may be performed.
In a preferred embodiment of the present invention, the application completing access to any one of the files comprises the application performing a closing operation on any one of the files;
when the access is finished and any file meets the preset condition, the step of taking the corresponding related information as a test result comprises the following steps:
when the application program executes closing operation on any file, detecting whether any file is closed or not;
if any file is not closed, judging that the preset condition is met, and taking the related information of any file as a test result.
Specifically, the end of the access of the application program to any file may include the application program executing the closing operation on the file, in the normal case, the file will be closed, and in the case that the application program has a bug, the file will not be closed, so, in the case that the application program executes the closing operation and the file is not closed, the file name of the file which is not closed and the call stack information corresponding to the file name are obtained, and then the call stack information is output as a test result, so that the program developer can locate which code of the application program specifically accesses which file and does not close the file through the call stack information, thereby correcting the code segment, and further solving the problem that the application program crashes due to the fact that the file is not closed after the application program finishes accessing any file.
Of course, other ways of locating code segments with vulnerabilities in application programs besides the way of detecting whether accessed is closed are also suitable for the application, and may be set according to actual requirements in practical applications, which is not limited by the embodiment of the present invention.
In the embodiment of the invention, when an application program is started, a target dynamic link library is determined through a script file preset in the application program, and relative information of the file is recorded through the target dynamic link library aiming at any file accessed by the application program, when the access is finished and any file meets the preset condition, the corresponding relative information is used as a test result, and the test result is output. In this way, in the running process of the application program, the related information of the file accessed by the application program is recorded through the preset target dynamic link library, and after the access is finished, the related information corresponding to the file which does not meet the preset condition is output as a test result, so that a program developer locates a specific code segment with the vulnerability in the application program based on the test result, and the code segment is corrected, the program developer can rapidly locate and repair the vulnerability of the application program, the problem that the application program crashes due to the fact that the number of the files which do not meet the preset condition reaches a certain number is solved, and the user experience is improved.
Fig. 3 is a schematic structural diagram of a testing device for an application according to another embodiment of the present application, and as shown in fig. 3, the device of this embodiment may include:
the first processing module 301 is configured to determine, when an application program is started, a target dynamic link library according to a script file preset in the application program;
the second processing module 302 is configured to record, for any file accessed by the application program, related information of the file through the target dynamic library;
and the third processing module 303 is configured to take the corresponding related information as a test result when the access is completed and any file satisfies a preset condition, and output the test result.
In a preferred embodiment of the present invention, the first processing module includes:
the environment variable determining submodule is used for determining environment variables of target parameters corresponding to the application program through the script file;
and the target dynamic link library determining submodule is used for determining the target dynamic link library from the environment variables.
In a preferred embodiment of the present invention, further comprising:
the replacing module is used for replacing a system standard dynamic link library in a preset system by adopting the target dynamic link library after the step of determining the target dynamic link library through a script file preset in an application program; an application program is installed in the preset system.
In a preferred embodiment of the invention, the second processing module is specifically configured to:
when the application program executes any I/O operation on any file, the file name and call stack information of any file are recorded through the target dynamic library.
In a preferred embodiment of the present invention, the end of access includes the application performing a closing operation on either file;
the third processing module includes:
the detection sub-module is used for detecting whether any file is closed or not when the application program initiates a closing instruction to any file;
and the judging sub-module is used for judging that the preset condition is met if any file is not closed, and taking the related information of any file as a test result.
The application program testing device of the present embodiment may execute the application program testing methods shown in the first embodiment and the second embodiment of the present application, and the implementation principles are similar, and are not repeated here.
In the embodiment of the invention, when an application program is started, a target dynamic link library is determined through a script file preset in the application program, and relative information of the file is recorded through the target dynamic link library aiming at any file accessed by the application program, when the access is finished and any file meets the preset condition, the corresponding relative information is used as a test result, and the test result is output. In this way, in the running process of the application program, the related information of the file accessed by the application program is recorded through the preset target dynamic link library, and after the access is finished, the related information corresponding to the file which does not meet the preset condition is output as a test result, so that a program developer locates a specific code segment with the vulnerability in the application program based on the test result, and the code segment is corrected, the program developer can rapidly locate and repair the vulnerability of the application program, the problem that the application program crashes due to the fact that the number of the files which do not meet the preset condition reaches a certain number is solved, and the user experience is improved.
Referring now to fig. 4, a schematic diagram of an electronic device 400 suitable for use in implementing embodiments of the present disclosure is shown. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 4 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
An electronic device includes: a memory and a processor, where the processor may be referred to as a processing device 401 hereinafter, the memory may include at least one of a Read Only Memory (ROM) 402, a Random Access Memory (RAM) 403, and a storage device 408 hereinafter, as shown in detail below: as shown in fig. 4, the electronic device 400 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 401, which may perform various suitable actions and processes according to a program stored in a Read Only Memory (ROM) 402 or a program loaded from a storage means 408 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data necessary for the operation of the electronic device 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other by a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
In general, the following devices may be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 407 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 408 including, for example, magnetic tape, hard disk, etc.; and a communication device 409. The communication means 409 may allow the electronic device 400 to communicate with other devices wirelessly or by wire to exchange data. While fig. 4 shows an electronic device 400 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via communications device 409, or from storage 408, or from ROM 402. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 401.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: when an application program is started, determining a target dynamic link library through a script file preset in the application program; recording related information of the files by a target dynamic library aiming at any file accessed by an application program; when the access is finished and any file meets the preset condition, the corresponding relevant information is used as a test result, and the test result is output.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules or units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. Where the name of a module or unit does not in some cases constitute a limitation of the unit itself.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, there is provided a test method of an application program, including:
when the application program is started, determining a target dynamic link library through a script file preset in the application program;
recording related information of any file accessed by the application program through the target dynamic library;
when the access is finished and any file meets the preset condition, the corresponding relevant information is used as a test result, and the test result is output.
Preferably, the step of determining the target dynamic link library through a script file preset in the application program includes:
determining environmental variables of target parameters corresponding to the application program through the script file;
and determining the target dynamic link library from the environment variables.
Preferably, after the step of determining the target dynamic link library through the script file preset in the application program, the method further comprises:
replacing a system standard dynamic link library in a preset system by adopting the target dynamic link library; the application program is installed in the preset system.
Preferably, the step of recording, by the target dynamic library, related information of any file accessed by the application program, includes:
When the application program executes any I/O operation on any file, recording the file name and call stack information of the any file through the target dynamic library.
Preferably, the access end includes the application program executing a closing operation on the any file;
and when the access is finished and any file meets the preset condition, taking the corresponding related information as a test result, wherein the step comprises the following steps:
when the application program initiates a closing instruction to any file, detecting whether the any file is closed or not;
if any file is not closed, judging that the preset condition is met, and taking the related information of any file as a test result.
According to one or more embodiments of the present disclosure, there is provided an apparatus of example one, comprising:
the first processing module is used for determining a target dynamic link library through a script file preset in the application program when the application program is started;
the second processing module is used for recording related information of any file accessed by the application program through the target dynamic library;
and the third processing module is used for taking the corresponding related information as a test result when the access is finished and any file meets the preset condition, and outputting the test result.
Preferably, the first processing module includes:
the environment variable determining submodule is used for determining environment variables of target parameters corresponding to the application program through the script file;
and the target dynamic link library determining submodule is used for determining the target dynamic link library from the environment variables.
Preferably, the method further comprises:
the replacing module is used for replacing a system standard dynamic link library in a preset system by adopting the target dynamic link library after the step of determining the target dynamic link library through a script file preset in the application program; the application program is installed in the preset system.
Preferably, the second processing module is specifically configured to:
when the application program executes any I/O operation on any file, recording the file name and call stack information of the any file through the target dynamic library.
Preferably, the access end includes the application program executing a closing operation on the any file;
the third processing module includes:
the detection submodule is used for detecting whether any file is closed or not when the application program initiates a closing instruction to any file;
And the judging sub-module is used for judging that the preset condition is met if any file is not closed, and taking the related information of any file as a test result.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.

Claims (10)

1. A method for testing an application program, comprising:
when the application program is started, determining a target dynamic link library through a script file preset in the application program;
recording file names and call stack information of any files accessed by the application program through the target dynamic link library;
when the access is finished and any file is not closed, the corresponding file name and call stack information are used as test results, and the test results are output.
2. The method for testing an application program according to claim 1, wherein the step of determining the target dynamic link library from a script file preset in the application program comprises:
determining environmental variables of target parameters corresponding to the application program through the script file;
And determining the target dynamic link library from the environment variables.
3. The method for testing an application program according to claim 1 or 2, further comprising, after the step of determining the target dynamic link library from a script file preset in the application program:
replacing a system standard dynamic link library in a preset system by adopting the target dynamic link library; the application program is installed in the preset system.
4. The method for testing an application program according to claim 1, wherein the step of recording, for any file accessed by the application program, a file name and call stack information of the file through the target dynamic link library includes:
when the application program executes any I/O operation on any file, the file name and call stack information of the any file are recorded through the target dynamic link library.
5. The method according to claim 1 or 4, wherein the end of access includes the application performing a closing operation on the arbitrary file;
and when the access is finished and any file is not closed, taking the corresponding file name and call stack information as a test result, wherein the step of taking the corresponding file name and call stack information as test results comprises the following steps:
When the application program initiates a closing instruction to any file, detecting whether the any file is closed or not;
and if any file is not closed, taking the file name and call stack information of any file as a test result.
6. An application program testing apparatus, comprising:
the first processing module is used for determining a target dynamic link library through a script file preset in the application program when the application program is started;
the second processing module is used for recording the file name and call stack information of any file accessed by the application program through the target dynamic link library;
and the third processing module is used for taking the corresponding file name and call stack information as a test result when the access is finished and any file is not closed, and outputting the test result.
7. The apparatus according to claim 6, wherein the first processing module includes:
the environment variable determining submodule is used for determining environment variables of target parameters corresponding to the application program through the script file;
and the target dynamic link library determining submodule is used for determining the target dynamic link library from the environment variables.
8. The apparatus according to claim 6 or 7, characterized by further comprising:
the replacing module is used for replacing a system standard dynamic link library in a preset system by adopting the target dynamic link library after the step of determining the target dynamic link library through a script file preset in the application program; the application program is installed in the preset system.
9. An electronic device, comprising:
a processor, a memory, and a bus;
the bus is used for connecting the processor and the memory;
the memory is used for storing operation instructions;
the processor is configured to execute the method for testing the application program according to any one of claims 1 to 5 by calling the operation instruction.
10. A computer readable storage medium storing computer instructions which, when run on a computer, cause the computer to perform the method of testing an application program according to any one of the preceding claims 1-5.
CN202010163489.XA 2020-03-10 2020-03-10 Application program testing method and device, electronic equipment and computer storage medium Active CN111382076B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010163489.XA CN111382076B (en) 2020-03-10 2020-03-10 Application program testing method and device, electronic equipment and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010163489.XA CN111382076B (en) 2020-03-10 2020-03-10 Application program testing method and device, electronic equipment and computer storage medium

Publications (2)

Publication Number Publication Date
CN111382076A CN111382076A (en) 2020-07-07
CN111382076B true CN111382076B (en) 2023-04-25

Family

ID=71218679

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010163489.XA Active CN111382076B (en) 2020-03-10 2020-03-10 Application program testing method and device, electronic equipment and computer storage medium

Country Status (1)

Country Link
CN (1) CN111382076B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113127374B (en) * 2021-05-19 2022-05-17 支付宝(杭州)信息技术有限公司 Application program testing method and device applied to iOS equipment

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008110111A1 (en) * 2007-03-13 2008-09-18 Huawei Technologies Co., Ltd. Method and device to call dynamic library and dynamic library server and master program implementing device
JP2010267128A (en) * 2009-05-15 2010-11-25 Ntt Docomo Inc Analysis system, analysis device, detection method, analysis method and program
CN106201633A (en) * 2016-07-29 2016-12-07 腾讯科技(深圳)有限公司 A kind of method and device injecting dll file
CN106294071A (en) * 2016-08-11 2017-01-04 宁波舜宇光电信息有限公司 A kind of software crash formation gathering method and system thereof
CN106371940A (en) * 2015-07-21 2017-02-01 腾讯科技(深圳)有限公司 Solution method and device for program crash
CN107085548A (en) * 2016-02-16 2017-08-22 阿里巴巴集团控股有限公司 A kind of method, device and electronic equipment for monitoring application program internal memory
CN109726560A (en) * 2018-06-26 2019-05-07 360企业安全技术(珠海)有限公司 Terminal device system protection method and device
CN110362487A (en) * 2019-07-11 2019-10-22 腾讯科技(深圳)有限公司 A kind of test method and device of application program
CN110795355A (en) * 2019-10-30 2020-02-14 深圳开立生物医疗科技股份有限公司 Method and device for detecting memory leakage

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9141510B2 (en) * 2011-08-24 2015-09-22 Microsoft Technology Licensing, Llc Memory allocation tracking
CN104899016B (en) * 2014-03-07 2018-10-09 腾讯科技(深圳)有限公司 Allocating stack Relation acquisition method and device
US10198335B2 (en) * 2016-09-23 2019-02-05 Intel Corporation Detecting root causes of use-after-free memory errors

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008110111A1 (en) * 2007-03-13 2008-09-18 Huawei Technologies Co., Ltd. Method and device to call dynamic library and dynamic library server and master program implementing device
JP2010267128A (en) * 2009-05-15 2010-11-25 Ntt Docomo Inc Analysis system, analysis device, detection method, analysis method and program
CN106371940A (en) * 2015-07-21 2017-02-01 腾讯科技(深圳)有限公司 Solution method and device for program crash
CN107085548A (en) * 2016-02-16 2017-08-22 阿里巴巴集团控股有限公司 A kind of method, device and electronic equipment for monitoring application program internal memory
CN106201633A (en) * 2016-07-29 2016-12-07 腾讯科技(深圳)有限公司 A kind of method and device injecting dll file
CN106294071A (en) * 2016-08-11 2017-01-04 宁波舜宇光电信息有限公司 A kind of software crash formation gathering method and system thereof
CN109726560A (en) * 2018-06-26 2019-05-07 360企业安全技术(珠海)有限公司 Terminal device system protection method and device
CN110362487A (en) * 2019-07-11 2019-10-22 腾讯科技(深圳)有限公司 A kind of test method and device of application program
CN110795355A (en) * 2019-10-30 2020-02-14 深圳开立生物医疗科技股份有限公司 Method and device for detecting memory leakage

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
janakaud.file-leak-detector.《https://hub.nuaa.cf/janakaud/file-leak-detector/tree/66647a9bde2fda889f947f4af710b1c9a846c87a》.2019,全文. *
jenkinsci.lib-file-leak-detector.《https://hub.nuaa.cf/jenkinsci/lib-file-leak-detector/tree/540cd9caa1f9728b7c099b6150f302e1e741d868》.2018,全文. *
廖维川 ; .Windows动态链接库调试技术.科技广场.2008,(第08期),全文. *

Also Published As

Publication number Publication date
CN111382076A (en) 2020-07-07

Similar Documents

Publication Publication Date Title
US9307342B2 (en) Dynamic rendering for software applications
CN109325195A (en) Rendering method and system, computer equipment, the computer storage medium of browser
US10019598B2 (en) Dynamic service discovery
CN103443763B (en) Comprise to connect the ISA Bridge of the support called rewriteeing virtual function
CN106681749B (en) Local code patch updating method and device based on android platform
CN110851204B (en) Application starting method and device and application packaging method and device
CN111223036A (en) GPU virtualization sharing method and device, electronic equipment and storage medium
WO2017166448A1 (en) Kernel vulnerability repair method and device
CN111382076B (en) Application program testing method and device, electronic equipment and computer storage medium
CN111400068A (en) Interface control method and device, readable medium and electronic equipment
US20190065223A1 (en) Disabling Just-In-Time Translation For Application Functions
CN111506904B (en) Method and device for online bug repair
US10606612B2 (en) Context check bypass to enable opening shared-object libraries
CN111385661B (en) Method, device, terminal and storage medium for voice control of full screen playing
CN112882921B (en) Fault simulation method and device
CN115237458A (en) Method for calling inference hardware to execute AI application and related product
CN110502251B (en) Application installation method and device
CN111552531A (en) Page display method, device, terminal and storage medium
CN112306683A (en) Function hijacking method, device, medium and electronic equipment
CN112068814A (en) Method, device, system and medium for generating executable file
US9697018B2 (en) Synthesizing inputs to preserve functionality
CN111859403A (en) Method and device for determining dependency vulnerability, electronic equipment and storage medium
CN111797009A (en) Method and device for detecting code compatibility and electronic equipment
WO2023109311A1 (en) Resource access method and apparatus, and storage medium and electronic device
US11354433B1 (en) Dynamic taint tracking on mobile devices

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
CB02 Change of applicant information

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: Tiktok vision (Beijing) Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant