CN116775501A - Software testing method, server, readable storage medium and chip system - Google Patents
Software testing method, server, readable storage medium and chip system Download PDFInfo
- Publication number
- CN116775501A CN116775501A CN202311077527.XA CN202311077527A CN116775501A CN 116775501 A CN116775501 A CN 116775501A CN 202311077527 A CN202311077527 A CN 202311077527A CN 116775501 A CN116775501 A CN 116775501A
- Authority
- CN
- China
- Prior art keywords
- file
- information
- program
- memory
- tested
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 86
- 238000013522 software testing Methods 0.000 title abstract description 54
- 238000012360 testing method Methods 0.000 claims abstract description 44
- 238000004458 analytical method Methods 0.000 claims abstract description 28
- 230000002159 abnormal effect Effects 0.000 claims abstract description 17
- 230000008569 process Effects 0.000 claims description 24
- 238000004590 computer program Methods 0.000 claims description 18
- 238000010586 diagram Methods 0.000 description 9
- 230000004044 response Effects 0.000 description 9
- 230000005856 abnormality Effects 0.000 description 7
- 230000006870 function Effects 0.000 description 6
- 238000004891 communication Methods 0.000 description 3
- 238000002360 preparation method Methods 0.000 description 3
- 230000001360 synchronised effect Effects 0.000 description 3
- 230000001960 triggered effect Effects 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 230000000977 initiatory effect Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 238000009825 accumulation Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000011521 glass Substances 0.000 description 1
- 230000008676 import Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The application provides a software testing method, a server, a readable storage medium and a chip system, which are applied to the technical field of computers, wherein the method comprises the following steps: generating a script file, wherein the script file comprises information of a first file, information of a second file and information of at least one register, the first file is a file for storing an execution state of a program to be tested, the second file is a file for storing compiled data corresponding to the program to be tested, and the at least one register is used for storing instructions and/or data of the currently running program to be tested; loading a program to be tested by using a script file; and performing test analysis on the program to be tested. According to the method and the device for automatically loading the program to be tested through the script file, the labor cost can be saved, and the analysis efficiency of the abnormal program is improved.
Description
Technical Field
The present application relates to the field of computer technology, and in particular, to a software testing method, a server, a readable storage medium, and a chip system.
Background
When the computer program of the terminal device runs abnormally (for example, the read-write operations in the computer program are too frequent), the terminal device may be down (i.e., the terminal device cannot resume running). At this time, the terminal device may generate a dump file to store memory information, register information, call stack information, and the like when the computer program runs abnormally. By testing and analyzing the dump file, the defects of the computer program can be found in time, and the stability of the computer program is improved.
Currently, a software test system is generally used to perform test analysis on dump files. Before the software test system performs test analysis on the dump file, a developer is required to manually select the dump file and the elf file and manually fill the values of the registers, so that the software test system can correctly load out the computer program with abnormal operation and perform test analysis on the computer program with abnormal operation.
However, in the above test scheme, the time taken for the developer to manually select the dump file and manually fill the register values is long, resulting in a low test analysis efficiency for the abnormally operating computer program.
Disclosure of Invention
The application provides a software testing method, a server, a readable storage medium and a chip system, which can improve the testing analysis efficiency of a program to be tested.
In a first aspect, the present application provides a software testing method, the method comprising:
generating a script file, wherein the script file comprises information of a first file, information of a second file and information of at least one register, the first file is a file for storing an execution state of a program to be tested, the second file is a file for storing compiled data corresponding to the program to be tested, and the at least one register is used for storing instructions and/or data of the currently running program to be tested;
Loading a program to be tested by using a script file;
and performing test analysis on the program to be tested.
By generating the script file, the script file comprising the information of the first file, the information of the second file and the information of at least one register can be obtained. And then the script file can be utilized to automatically load the program to be tested, manual intervention is not needed, and the program to be tested can be quickly loaded. Based on the method, the loaded program to be tested can be automatically tested and analyzed to obtain the test and analysis result of the program to be tested, so that a user can adjust and optimize the program to be tested according to the test and analysis result. Therefore, labor cost can be saved, and analysis efficiency of abnormal programs can be improved.
In some possible implementations, before generating the script file, the method further includes:
information of at least one register is determined based on the first file and a third file for storing information of a plurality of global variables.
According to the implementation manner, the information of at least one register can be automatically determined according to the first file and the third file, and a user does not need to manually input the information of the register, so that preparation is made for accurately loading the program to be tested, and the efficiency of loading the program to be tested is improved to a certain extent.
In some possible implementations, determining information of at least one register from the first file and the third file includes:
based on the third file, determining information of a first storage space corresponding to a first global variable in a first memory space, wherein the first global variable is any one global variable among a plurality of global variables, the first memory space is used for storing the first file, and the information of the first storage space comprises one or more of the following: a first start address, a first end address, and a first address length;
under the condition of first file segment storage, determining a first memory segment based on the information of a plurality of memory segments and a first storage space, wherein the first memory segment is a memory segment where a first global variable in the plurality of memory segments is located, and the first file segment storage refers to dividing the first memory space into a plurality of memory segments to store a first file;
acquiring a value of a first global variable from a first memory segment based on information of a first memory space;
information of at least one register is determined according to the value of the first global variable and a first offset, the first offset being used to represent a corresponding storage location of the information of the at least one register in the first storage space.
In the implementation manner, the information of at least one register can be accurately determined, so that the program to be tested can be accurately loaded based on the information of at least one register.
In some possible implementations, in the case of the first file segment saving, determining the first memory segment based on the information of the plurality of memory segments and the first storage space includes:
acquiring information of each memory segment in a plurality of memory segments, wherein the information of each memory segment comprises one or more of the following: a second start address, a second end address, a second offset, and a second address length;
a first memory segment is determined from the plurality of memory segments based on the information of the first memory space and the information of each memory segment.
In the implementation manner, the first memory segment in the plurality of memory segments can be accurately determined by traversing the information of the plurality of memory segments based on the information of the first memory space, so that preparation is made for accurately determining the information of the at least one register.
In some possible implementations, before determining the information of the at least one register based on the value of the first global variable and the first offset, the method further includes:
and under the condition that the first file is not stored in a segmented mode, acquiring the value of the first global variable from the first memory space based on the information of the first memory space.
In some possible implementations, the script file further includes information for a plurality of memory segments. Therefore, the program to be tested can be accurately loaded based on the information of the memory segments.
In some possible implementations, the information of the first file includes a first path, the first path representing a storage location of the first file; and/or the information of the second file comprises a second path, the second path being used to represent a storage location of the second file.
In the implementation manner, the first file can be obtained faster by accessing the first path, the second file can be obtained faster by accessing the second path, the path is not required to be manually selected by a user, the labor cost is saved, and the efficiency of loading the program to be tested is further improved.
In some possible implementations, loading the program to be tested with the script file further includes:
copying the script file from a third path to a fourth path, wherein the third path is a generation path of the script file, and the fourth path is a running path of the script file;
and loading the program to be tested by using the script file in the process of running the script file. So that the program to be tested can be loaded correctly.
In some possible implementations, the program to be tested is a program when an operating system is abnormal, and at least one register is used for storing instructions and/or data of the program to be tested currently running when the operating system is abnormal. Therefore, the user can timely process the abnormality in the program to be tested according to the test analysis result of the program to be tested, and the stability of the program to be tested is improved.
In some possible implementations, loading the program to be tested with the script file includes:
and responding to a first operation of a user, loading the program to be tested by utilizing the script file, wherein the first operation is used for triggering and starting the test of the program to be tested.
In a second aspect, the present application provides a server comprising a processor and a memory; the processor is coupled to a memory for storing a computer program, the processor invoking instructions to cause the server to perform the first aspect and any one of the possible software testing methods of the first aspect.
In a third aspect, the present application provides a chip system for use in an electronic device comprising a memory, a display screen and a sensor; the chip system includes: one or more interface circuits and one or more processors; the interface circuit and the processor are interconnected through a circuit; the interface circuit is used for receiving signals from the memory and sending signals to the processor, wherein the signals comprise computer codes or instructions stored in the memory; the processor invokes instructions to cause the server to perform the first aspect and any one of the possible software testing methods of the first aspect.
Wherein, the chip system can comprise one chip or a plurality of chips; when a plurality of chips are included in a chip system, the present application does not limit parameters such as the type and the number of chips.
In a fourth aspect, the present application provides a readable storage medium having stored therein code or instructions for a processor to condition the instructions such that a server performs the first aspect and any one of the possible software testing methods of the first aspect.
In a fifth aspect, the application provides a computer program product for causing a computer to perform the first aspect and any one of the possible software testing methods of the first aspect when the computer program product is run on the computer.
It will be appreciated that the advantages of the second to fifth aspects may be found in the relevant description of the first aspect, and are not described here again.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments or the description of the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of an application scenario of a software testing method according to an embodiment of the present application;
FIG. 2 is a first interface diagram of a server according to an embodiment of the present application;
FIG. 3 is a second interface diagram of a server according to an embodiment of the present application;
FIG. 4 is a third interface diagram of a server according to an embodiment of the present application;
FIG. 5 is a flowchart of a software testing method according to an embodiment of the present application;
FIG. 6 is a flowchart of a software testing method according to an embodiment of the present application;
FIG. 7 is a flowchart of a software testing method according to an embodiment of the present application;
FIG. 8 is a schematic structural diagram of a software testing device according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application. Wherein, in the description of the embodiments of the present application, unless otherwise indicated, "/" means or, for example, a/B may represent a or B; "and/or" herein is merely an association relationship describing an association object, and means that three relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist together, and B exists alone. In addition, in the description of the embodiments of the present application, "plurality" means two or more than two. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
The terms "first," "second," "third," and the like, are used below for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first", "a second", or a third "may explicitly or implicitly include one or more such feature.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in various places are not necessarily all referring to the same embodiment, but mean "one or more, but not all, of the embodiments" unless expressly specified otherwise.
The software testing method provided by the embodiment of the application can be applied to a scene of testing the software program of the electronic equipment. For example, in a scenario where a user needs to verify an exception handling capability of a software program of an electronic device, the user may simulate an erroneous operation of the electronic device, obtain the software program of the electronic device when the user is operating erroneously, and test the software program of the electronic device when the user is operating erroneously.
Further, the software testing method of the embodiment of the application is suitable for the electronic equipment with a micro control unit (microcontroller unit, MCU) or a single-chip microcomputer (single chip microcomputer). Illustratively, the electronic device may be a wearable device (e.g., a smart watch 100, a smart bracelet, a wireless headset, etc.), a VR device (e.g., VR glasses, VR helmet, etc.), an in-vehicle device, a mobile phone, a folding screen, etc., and the embodiments of the present application are not limited to a specific type of electronic device.
In order to facilitate the description of the embodiments of the present application, terms related to the embodiments of the present application are explained below.
The dump file is a mirror image of memory (RAM). The dump file is used to store the execution state of the software program of the electronic device. Mirroring (mirroring) is a form of file storage where data on one disk exists as an identical copy on another disk.
The executable and linkable format (executable and linkable format, elf) file is a file format for binary files, executable files, object code, shared libraries, and core dump format files. The elf file is used for storing compiled data corresponding to the software program. Illustratively, the compiled data may include debug information or the like set in a software program runtime compiler.
The map file is a file generated by the software program based on the elf file during the compiling process. It can be seen that the field file contains information in the map file. The map file is used for storing information of global variables in the software program, information of functions in the software program, the situation that the software program occupies memory, and the like.
Optionally, in some embodiments, the electronic device generates a dump file when an exception (e.g., a flashing back, crash, etc.) occurs. An exception (permission) is an error that may occur at the time of execution of a software program of an electronic device that causes the software program to terminate.
After generating the dump file, the electronic device may send the dump file to the server 200 or the cloud server such that the dump file is stored in the server 200 or the cloud server. When the electronic device transmits the dump file to the server 200, the server 200 may analyze the dump file to determine a cause of the abnormality of the electronic device. When the electronic device sends the dump file to the cloud server, the server 200 may obtain the dump file from the cloud server. After the dump file is obtained, the server 200 may analyze the dump file.
The server 200 may be, for example, a server with display hardware and corresponding software support. For example, the server may be a tablet computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, etc., and the specific type of the server 200 is not limited in the embodiments of the present application.
It should be appreciated that the connection between the electronic device and the server 200 may be a wired connection or a wireless connection. For example, the wired connection mode may be serial connection, and the wireless connection mode may be Wifi connection or bluetooth connection.
In the following, referring to fig. 1 to fig. 4, an electronic device is taken as an example of a smart watch 100, and an application scenario of an embodiment of the present application is described in detail.
Referring to fig. 1, fig. 1 shows an application scenario schematic diagram of a software testing method according to an embodiment of the present application.
As shown in fig. 1, the smart watch 100 is in a dead state, at which time the MCU of the smart watch 100 may generate dump files. The dump file stores the execution state of the software program corresponding to the smart watch 100. After the MCU of the smart watch 100 generates the dump file, the server 200 may acquire the dump file, thereby acquiring an execution state of the software program corresponding to the smart watch 100.
To obtain an accurate cause of the crash of the smart watch 100, the server 200 may also obtain an elf file, thereby obtaining compiled data corresponding to the software program.
It should be noted that, the manner in which the server 200 obtains the dump file and/or the elf file may be any of the following: the smart watch 100 may send the dump file and/or the elf file to the server 200 through a bluetooth module in the smart watch 100, and the user manually imports the dump file and/or the elf file in a display interface of the server 200, so that the server obtains the dump file and/or the elf file.
In summary, after obtaining the dump file and the elf file, the server 200 may store the dump file and the elf file in a hard disk of the server 200. Thereby enabling the server 200 to perform a test analysis on the dump file.
As shown in fig. 1, the server 200 may perform test analysis on dump files through a software test platform (e.g., trace32, windbg, etc.) provided in the server 200. In response to a user's start-up operation, the server 200 may start up the software test platform. After the software test platform is started, a user can select dump files and select the elf files in a display interface of the software test platform.
As shown in fig. 2, a user may select a dump file in a first interface of the software test platform, and in response to a selection operation by the user, the software test platform may obtain the dump file from a hard disk (e.g., D-disk) of the server 200. As shown in fig. 3, the user may select an elf file in the second interface of the software testing platform, and in response to a selection operation by the user, the software testing platform may obtain the elf file from the hard disk (e.g., D-disk) of the server 200.
In order to obtain an instruction when the software program of the smart watch 100 runs abnormally, the software test platform also needs to obtain the value of the register.
As shown in fig. 4, after the dump file and the elf file are obtained, the value of each of the plurality of registers (e.g., register R1, register R2, registers R3, …, register R11, register R12, and register R13, etc.) is displayed in window a of the third interface of the software test platform (or the interface of the Watch).
At this time, an initial value corresponding to each of the plurality of registers is displayed in a window B (or a Register interface) of the third interface of the software test platform. The initial value of each of the plurality of registers is 0 (as shown by window B in fig. 4). The user needs to input in window B the values of the plurality of registers displayed in window a. That is, the user may modify the initial value corresponding to each register in window B such that the value of the modified register in window B is the same as the value of the register displayed in window a.
For example, the value of the modified register R1 is 0 (as shown in window a in fig. 4), the value of the modified register R2 is 1, the value of the modified register R3 is 536986744, the value of the modified register R4 is 0, …, the value of the modified register R11 is 269488144, the value of the modified register R12 is 286331153, the value of the modified register R13 is 0, and the like.
It should be understood that embodiments of the present application may include other registers in addition to those listed above. The initial values of the other registers and the values of the other registers modified by the user are determined according to actual storage conditions, and are not described herein.
In response to the user's input operation in window B, the values of the plurality of registers displayed in window a may be filled into the software test platform, thereby ensuring that the software test platform may correctly reproduce the execution state of the software program before the smart watch 100 crashes, or in other words, the crash call stack of the smart watch 100. Therefore, the user can determine the cause of the crash of the smart watch 100, accurately locate the abnormal running instruction, and timely modify or optimize the abnormal running instruction to improve the stability of the software program corresponding to the smart watch 100.
It should be understood that the number of registers shown in fig. 4, and the values corresponding to the respective registers are all exemplary, and the number of registers and the values of the registers are not particularly limited in the present application.
However, when the type or version of the smart watch 100 changes, the dump file size also changes. Therefore, when the software test platform performs test analysis on different dump files, the dump files need to be loaded on correct addresses to obtain accurate register values. After obtaining the values of the registers, the user needs to manually populate the corresponding interfaces of the software test platform with the values of the registers. After the user fills the register values, the software test platform can get the correct dead call stack for the smart watch 100.
The crash call stack refers to an operating state of a software program before the smart watch 100 crashes, or the crash call stack refers to a site of the software program before the smart watch 100 crashes. It should be noted that, in the embodiment of the present application, the user refers to a developer.
In order to solve the above problems, an embodiment of the present application provides a software testing method capable of generating a script file containing dump files and elf files and values of registers. And then, the script file is utilized to automatically load the program to be tested, the program to be tested is tested and analyzed, when the dump files generated by the electronic equipment of different types or versions are tested and analyzed, the user does not need to manually select the dump files and the elf files, the user does not need to manually input the values of the registers, the labor cost is saved, and the efficiency of analyzing the abnormal program is improved.
The application scenario of the embodiment of the present application has been described above, and the specific implementation procedure of the software testing method of the embodiment of the present application is described in detail below with reference to fig. 5.
Referring to fig. 5, fig. 5 shows a flowchart of a software testing method according to an embodiment of the application.
As shown in fig. 5, the implementation process of the software testing method according to the embodiment of the present application includes the following steps:
S101, generating a script file.
Alternatively, in some embodiments, script files are used to combine different commands and execute automatically and continuously in a determined order. The script file may include information of the first file, information of the second file, and information of at least one register. Illustratively, the script file may be in a.cmm format.
Optionally, in some embodiments, the information of the first file may include a first path. The first path is used to represent a storage location of the first file. For example, when the hard disk of the server 200 is divided into a C disk, a System (C:) and a D disk as shown in FIG. 2, a Data (D:) two areas as shown in FIG. 2, and the first file is stored on the D disk, the first path may be D: \MaintenanceLog Dump.
At this time, the script file includes a storage location of the first file. Based on this, the server 200 may obtain the first file stored in the server 200 by accessing the storage location of the first file in the course of running the script file. Therefore, by accessing the first path, the server 200 can obtain the first file faster, and the user does not need to manually select the first path, so that the labor cost is saved, and the efficiency of loading the program to be tested is further improved.
Optionally, in other embodiments, the information of the first file may further include the first file. The first file is a file storing the execution state of the program to be tested. Illustratively, the first file may be a dump file. When the first file is a dump file, the format of the first file is a.dmp format or a.log format. As shown in fig. 2, the name of the first file is dump. The modification date of the first file is 2023/5/50, and the modification time is 14:46. The first file is of the log file type. log files are typically text files that can be opened by a notepad to view the log file contents. The first file has a size of 4705KB.
At this time, the script file includes the first file. Based on this, the server 200 may directly acquire the first file in the process of running the script file.
Alternatively, in some embodiments, the program to be tested may be a program when the operating system of the electronic device is running normally. The execution state of the program to be tested can comprise memory information, register information, call stack information and the like when an operating system of the electronic equipment normally operates.
In the case of an abnormality of the electronic device, the program to be tested may be a program when an abnormality occurs in an operating system of the electronic device. At this time, the execution state of the program to be tested may include memory information, register information, call stack information, and the like when an abnormality occurs in the operating system of the electronic device. The test analysis is carried out on the program to be tested, so that a user can timely process the abnormality in the program to be tested according to the test analysis result of the program to be tested, and the stability of the program to be tested is improved.
Optionally, in some embodiments, the information of the second file may include a second path. The second path is used to represent a storage location of the second file. For example, when the hard disk of the server 200 is divided into two areas of a C disk and a D disk, and the second file is stored on the D disk, the second path may be D: \output\application. Therefore, by accessing the second path, the server 200 can obtain the second file faster, and the user does not need to manually select the second path, so that the labor cost is saved, and the efficiency of loading the program to be tested is further improved.
Optionally, in other embodiments, the information of the second file may further include the second file. The second file is a file storing compiled data corresponding to the program to be tested. The second file may be an elf file, for example. When the second file is an elf file, the format of the second file is the elf format. As shown in fig. 3, the name of the second file is application. The second file was modified by 2023/5/50 for 14:46. The second file is of the type of an elf file. The second file is 206353KB in size. It should be noted that, for the explanation of the two cases of the information of the second file, reference may be made to the description of the information related to the first file, which is not repeated herein.
Optionally, in some embodiments, at least one register is used to store instructions and/or data of a currently running program under test. And under the condition that the electronic equipment is abnormal, at least one register is used for storing instructions and/or data of a program to be tested currently operated when the operating system is abnormal. The information of the at least one register includes a value of the at least one register. The value of each register is represented by a bit of that register. Illustratively, the at least one register may include 16 registers, R1-R16, each of which is a 32 bit (bit) register.
The server 200 may obtain information of the first file. The server 200 may obtain information of the second file. The process of obtaining the information of the first file and the information of the second file by the server 200 is automatic, and the user does not need to manually select the information of the first file and the information of the second file in the display interface of the server 200. The server 200 can obtain the information of at least one register without manually inputting the information of at least one register in the display interface of the server 200 by a user, thereby saving labor cost. After acquiring the information of the first file and the information of the second file and the information of the at least one register, the server 200 may generate a script file based on the information of the first file, the information of the second file, and the information of the at least one register.
It should be understood that the information of the first file and the information of the second file may be obtained by the server 200 at the same time, or may be obtained by the server 200 separately in the order described above, which is not limited by the present application.
In summary, the server 200 may generate a script file, so that the server 200 may automatically load the program to be tested by using the script file, thereby improving the analysis efficiency of the abnormal problem of the electronic device.
It will be appreciated that when the type or version of the electronic device changes, the corresponding information of the first file, the second file and the at least one register may change. Accordingly, the server 200 may generate a corresponding script file based on the changed information of the first file, the changed information of the second file, and the changed information of the at least one register. Therefore, the embodiment of the application can be applied to the test of software programs of electronic equipment with different types or versions, and has strong applicability.
It should be noted that, the server 200 may obtain the information of the first file and the information of the second file from the hard disk of the server 200. Alternatively, the server 200 may acquire the information of the first file and the information of the second file from a database previously installed in the server 200. Alternatively, the server 200 may obtain, from the cloud server, the information of the first file and the information of the second file uploaded by the electronic device in advance, which is not limited in the present application.
S102, loading the program to be tested by using the script file.
After generating the script file, the server 200 may load the program under test with the script file, thereby providing a data basis for subsequent test analysis.
Optionally, in some embodiments, in the man-machine interaction mode, the user may trigger to start the testing process of the program to be tested, so that the user one-button start server 200 can test the program to be tested. The server 200 may load a program to be tested using a script file in response to a first operation of a user. The first operation is used for triggering and starting the test of the program to be tested.
Specifically, the user may initiate a test in the display interface of the server 200, and in response to a user-triggered initiation operation, the server 200 may load a program to be tested using a script file, thereby initiating a test of the program to be tested.
Considering that the generation path of the script file and the running path of the script file in the server 200 may be different, the server 200 may copy the script file from the generation path to the running path before loading the program to be tested with the script file. Thereby ensuring that the server 200 can correctly load the program to be tested in the process of running the script file.
Alternatively, in some embodiments, the server 200 may copy the script file from the third path to the fourth path. The third path is a generation path of the script file. The fourth path is the running path of the script file. After copying, the fourth path contains the script file.
After the script file is copied to the fourth path, the server 200 may run the script file. In the course of running the script file, the server 200 may load the program to be tested using the script file. Thus, the server 200 can accurately load the program to be tested, and provide a data basis for subsequent test analysis.
S103, testing and analyzing the program to be tested.
After obtaining the program to be tested, the server 200 may perform test analysis on the program to be tested. Therefore, a user can obtain the execution state of the program to be tested, and the program to be tested is optimized and adjusted according to the execution state of the program to be tested.
The software testing method in the embodiment of the application can obtain the script file containing the information of the first file, the information of the second file and the information of at least one register by generating the script file. And then the script file can be utilized to automatically load the program to be tested, manual intervention is not needed, and the program to be tested can be quickly loaded. Based on the method, the loaded program to be tested can be automatically tested and analyzed to obtain the test and analysis result of the program to be tested, so that a user can adjust and optimize the program to be tested according to the test and analysis result. Therefore, labor cost can be saved, and analysis efficiency of abnormal programs can be improved.
Based on the above description, before generating the script file, the server 200 also needs to determine information of at least one register, so that the server 200 locates an instruction line currently running the program to be tested according to the information of at least one register. In the embodiment of the present application, the server 200 may determine the information of at least one register in various implementation manners, and a possible implementation manner of determining the information of at least one register by the server 200 in the embodiment of the present application is described below.
Alternatively, in some embodiments, the server 200 may determine the information of at least one register from the first file and the third file. The third file is used to store information for a plurality of global variables. The third file may be a map file, for example. When the third file is a map file, the format of the third file is a map format.
Optionally, in other embodiments, the server 200 may further determine the information of at least one register according to the first file and the second file. Since the third file is a text file and the second file is an executable file, the process of determining the information of the at least one register from the text file is simpler than the process of determining the information of the at least one register from the executable file.
In summary, the server 200 may obtain information of at least one register, so as to prepare for accurately loading the program to be tested, thereby improving the efficiency of loading the program to be tested to a certain extent.
Based on the above description, a detailed implementation process of determining information of at least one register by the server 200 in the embodiment of the present application will be described in detail with reference to fig. 6.
S201, based on the third file, information of a first storage space corresponding to the first global variable in the first memory space is determined.
Optionally, in some embodiments, the first global variable is any one of a plurality of global variables. The first global variable is used for storing information of at least one register, other state information of a currently running program to be tested and the like. The first memory space is used for storing a first file. The first file contains binary data of a first global variable.
Optionally, in some embodiments, the information of the first storage space includes one or more of: a first start address, a first end address, and a first address length. Typically, the size of the first memory space is larger than the size of the first memory space. The first start address represents a corresponding start address location of the first global variable in the first memory space. The first end address represents an end address location of the first global variable corresponding in the first memory space. The first start address and/or the first end address are addresses that the compiler automatically generates at compile time. The first address length represents the length that the first global variable occupies when stored in the first memory space. For example, the first address length is 5 bytes.
Illustratively, the first global variable may be m_auctaskarray. The information of the 16 registers R1-R16 may be included in the m_aucTaskArray.
It will be appreciated that when the type or model of the electronic device changes, the first start address and/or the first end address generated by the compiler at compile time also changes accordingly. The first address length may change.
The server 200 may acquire the third file based on the information of the third file. When the information of the third file includes the fifth path, the server 200 may acquire the third file by accessing the fifth path. When the information of the third file includes the third file, the server 200 may directly acquire the third file. The server 200 may then determine, based on the third file, information of a corresponding first storage space of the first global variable in the first memory space. Alternatively, the server 200 may read, from the third file, information of a first storage space corresponding to the first global variable in the first memory space.
In summary, the server 200 may determine information of a first memory space corresponding to the first global variable in the first memory space, thereby preparing for the server 200 to determine information of at least one register.
Because the size of the first memory space is limited, the size of the first file stored in the first memory space is also limited. In general, the execution state of the program to be tested stored in the first file is the execution state of the program to be tested which is concerned by the user, and the execution state of the program to be tested which is not concerned by the user is not required to be stored, and the execution state of the program to be tested which cannot be accessed by the user is not required to be stored, so that the situation that the loading speed of the first file is slow due to the fact that the first file is too large can be avoided.
However, the execution state of the program to be tested, which the user is interested in, may include execution states of a plurality of discrete subroutines. Therefore, when the electronic device stores the execution state of the program to be tested in the first file, the execution states of the plurality of discontinuous subroutines need to be saved in a segmented manner, so that the execution states of the plurality of discontinuous subroutines can be accurately saved in the first file.
For the first files generated by the electronic devices of different versions, the addresses and the sizes of the memory segments in the different first files are different, so before determining the value of the first global variable, the server 200 needs to determine whether the first file is saved in segments, thereby ensuring the accuracy of the obtained value of the first global variable.
S202, determining whether the first file is saved in a segmented mode.
It should be noted that, there is no sequential order between S201 and S202, and S201 and S202 may be executed simultaneously or sequentially.
The server 200 may determine whether the first file is saved in segments in preparation for an accurate determination of the value of the first global variable.
Alternatively, the server 200 may determine whether the first file is saved in segments based on a preset flag bit. The preset flag bit may be a magic word, for example. In general, a magic word may comprise a plurality of complex numbers.
If the judgment result of S202 is that the first file segment is saved, the server 200 may execute S203 and S204. If the judgment result of S202 is that the first file is not saved in segments, the server 200 may execute S205.
S203, determining a first memory segment based on the information of the memory segments and the first storage space when the first file is stored in the segment.
Under the condition that the first file is stored in a segmented mode, the first file comprises a plurality of memory segments. Each memory segment of the plurality of memory segments is spatially contiguous. The memory segments may or may not be adjacent to each other.
Optionally, in some embodiments, the first memory segment is a memory segment in which the first global variable of the plurality of memory segments is located. The first file segment saving refers to dividing the first memory space into a plurality of memory segments to save the first file.
In the case of determining that the first file segment is saved, the server 200 may determine the first memory segment based on the information of the plurality of memory segments and the first storage space.
Specifically, server 200 may obtain information for each of a plurality of memory segments. The information for each memory segment includes one or more of the following: a second start address, a second end address, a second offset, and a second address length. The second start address represents a corresponding start address location in the first memory space of the memory segment. The second end address represents a corresponding end address location in the memory segment in the first memory space. The second offset is used to represent the corresponding relative storage location of the memory segment in the first memory space. The second address length represents the length that the memory segment occupies when stored in the first memory space. The second starting address of each memory segment and/or the second ending address of each memory segment is different. The second start address and the second end address are absolute addresses. The second offset is the relative address.
In the first memory space, the second offset of each memory segment is determined by means of accumulation. That is, the second offset of the next memory segment of the two adjacent memory segments is related to the second address length of the previous memory segment.
For example, the information for each memory segment may be stored in the first memory space in a 16 byte storage format. The first to fourth bytes of the 16 bytes are used for storing preset flag bits of each memory segment, the fifth to eighth bytes are used for storing second start addresses of each memory segment, the ninth to twelfth bytes are used for storing second address lengths, and the thirteenth to sixteenth bytes are reserved bytes. Starting from the seventeenth byte, the contents of each memory segment are stored.
Thus, the server 200 may determine the first memory segment from the plurality of memory segments based on the information of the first memory space and the information of each of the plurality of memory segments. In other words, the server 200 may accurately determine the first memory segment by traversing the information of each of the plurality of memory segments based on the information of the first memory space. For example, server 200 may determine a first memory segment from the plurality of memory segments based on the first starting address, the second offset, and the second address length. Providing for accurate determination of information of at least one register.
Optionally, in some embodiments, in the case of the first file segment save, the script file generated by the server 200 further includes information of a plurality of memory segments. That is, the script file may also include information for each of the plurality of memory segments. Thus, the server 200 can accurately load the program to be tested based on the information of the memory segments.
S204, acquiring the value of the first global variable from the first memory segment based on the information of the first memory space.
After determining the information of the first memory segment and the first storage space, the server 200 may obtain the value of the first global variable from the first memory segment based on the information of the first storage space.
Alternatively, in some embodiments, the server 200 may obtain the value of the first global variable from the first memory segment based on the first start address, the first address length, the start address of the first memory segment (or, alternatively, the second start address), and the content of the first memory segment. For example, the first start address is 0x20000500, the first address length is 0x100, and the start address of the first memory segment is 0x20000400. At this time, the server 200 may calculate the address of the first global variable in the first memory segment based on the first start address and the start address of the first memory segment. The first global variable has an address of 0x20000500-0x20000400 in the first memory segment. Then, the server 200 may read 0x100 bytes of content starting from 0x20000500-0x20000400 in the first memory segment. The server 200 may determine 0x100 bytes of content starting from 0x20000500-0x20000400 as the value of the first global variable.
S205, when the first file is not saved in segments, the value of the first global variable is acquired from the first memory space based on the information of the first memory space.
In the case where it is determined that the first file is not saved in segments, the server 200 may directly read the value of the first global variable from the first memory space based on the information of the first storage space. Specifically, the server 200 may read the value of the first global variable from the first memory space based on the first start address and the first address length.
S206, determining information of at least one register according to the value of the first global variable and the first offset.
Optionally, in some embodiments, the first offset is used to represent a corresponding storage location of the information of the at least one register in the first storage space. It should be noted that, the first offset may be set by the user according to the actual storage condition.
After obtaining the value of the first global variable, the server 200 may determine information of at least one register based on the value of the first global variable and the first offset variable.
The register is illustratively a 32-bit (i.e., 4 bytes) register, the first offset is 15 bytes, and the first global variable occupies 100 bytes of address length in the first memory space (or, alternatively, 100 bytes of address length in the first memory space). That is, in the first global variable, the information of the register is stored starting from the 15 th byte of 100 bytes.
At this time, the server 200 may determine the information of the register to be 4 bytes of content starting from the 15 th byte. In other words, the server 200 may determine the contents of the 15 th to 18 th bytes as the information of the register.
It should be noted that, the software testing method of the embodiment of the present application may be implemented not only by the server 200, but also by a software module set in the server 200.
Based on the above description, a specific implementation procedure of the software testing method according to the embodiment of the present application is illustrated in the following with reference to fig. 7.
Assume that the software module set in the server 200 is a trace32 software test platform. The information of the first file is a first path, and the first file is a dump file. The information of the second file is a second path, and the second file is an elf file. The information of the third file is a fifth path, and the third file is a map file. The first global variable is m_auctaskarray. The at least one register includes 16 registers R1-R16.
Referring to fig. 7, fig. 7 is a flow chart illustrating a software testing method according to an embodiment of the application. As shown in fig. 7, the specific implementation process of the software testing method in the embodiment of the present application is as follows:
and 11, the trace32 software testing platform respectively acquires a first path, a second path and a fifth path. That is, trace32 software test platform can obtain the path of dump file, the path of the elf file and the path of map file.
And 12, the trace32 software testing platform reads the map file by accessing the fifth path, and acquires the starting address of the m_aucTaskArray in the first memory space and the address length of the m_aucTaskArray in the first memory space from the map file.
In step 13, the trace32 software test platform may determine whether the dump file is saved in segments.
There is no time sequence between the step 12 and the step 13, and the step 12 and the step 13 may be executed simultaneously or sequentially.
If the judging result in the step 13 is dump file segment saving, the trace32 software testing platform can execute the steps 14-16. If the result of the step 13 is that the dump file is not saved in segments, the trace32 software testing platform may execute the step 17.
In step 14, the trace32 software testing platform may record a start address of each memory segment of the plurality of memory segments, an address length of each memory segment, and an offset in the first memory space of each memory segment.
In step 15, the trace32 software testing platform may determine the memory segment where the m_auctaskarray is located according to the starting address of the m_auctaskarray in the first memory space.
In step 16, the trace32 software testing platform may read the value of m_auctaskarray from the memory segment where m_auctaskarray is located according to the address length of m_auctaskarray in the first memory space.
In step 17, the trace32 software testing platform may read the value of m_auctaskarray from the first memory space according to the address length of m_auctaskarray in the first memory space.
In step 18, the trace32 software testing platform may determine information of the 16 registers R1-R16 according to the value of m_auctask array and the offset of the information of the registers in the first storage space.
After obtaining the information of the 16 registers of the first path, the second path and the R1-R16, the trace32 software testing platform may generate a script file based on the information of the 16 registers of the first path, the second path and the R1-R16, step 19. At this point, the information of the 16 registers of the first path, the second path and R1-R16 are all automatically filled into the script file.
In addition, in the case of dump file segment saving, the script file also includes information of each of the plurality of memory segments.
After the script file is generated, a user can decide whether to start the trace32 software testing platform according to the actual testing condition, so that the trace32 software testing platform starts the testing process of the program to be tested. When the user needs to start the trace32 software testing platform, the user may trigger the first operation in the display interface of the trace32 software testing platform, and at this time, the trace32 software testing platform may execute step 20.
In step 20, the trace32 software test platform may initiate testing of the program under test in response to a first operation triggered by the user in a display interface of the trace32 software test platform.
Because the generation path of the script file in the trace32 software test platform is different from the running path of the script file, the trace32 software test platform needs to execute the step 21 before running the script file, thereby ensuring that the trace32 software test platform can normally run the script file.
At step 21, the trace32 software test platform may copy the script file from the generation path to the run path.
Step 22, when the script file is run, the trace32 software testing platform can automatically load the dump file and the elf file to obtain a program to be tested, namely a crash call stack of the electronic equipment. Because the trace32 software test platform can correctly load dump files, and the trace32 software test platform contains 16 registers R1-R16, the information of the corresponding registers is filled in each register of the 16 registers, and therefore, the trace32 software test platform can accurately obtain a dead call stack of the electronic equipment.
In summary, the software testing method of the embodiment of the application can automatically load out the script file of the program to be tested by generating. When a user starts the trace32 software test platform by one key, the trace32 software test platform can run a script file in response to a start operation triggered by the user. the trace32 software test platform can automatically and correctly load the program to be tested in the process of running the script file.
Based on the method, the trace32 software test platform can perform test analysis on the loaded program to be tested, so that a user can determine the reason of abnormality of the electronic equipment. Therefore, the user does not need to manually select the first path and the second path, and does not need to manually input the values of the 16 registers R1-R16, so that the labor cost is saved, and the analysis efficiency of the program to be tested is improved.
It may be understood that the specific implementation process of the software testing method according to the embodiment of the present application is described by using only trace32 software testing platform as an example, and the software testing method according to the embodiment of the present application may also be implemented by other software testing platforms or tools set in the server 200, which are not limited to this.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present application.
Referring to fig. 8, fig. 8 is a schematic structural diagram of a software testing device according to an embodiment of the application. As shown in fig. 8, the software testing apparatus 300 according to an embodiment of the present application may include:
The generating module 301 is configured to generate a script file, where the script file includes information of a first file, information of a second file, and information of at least one register, the first file is a file storing an execution state of a program to be tested, the second file is a file storing compiled data corresponding to the program to be tested, and the at least one register is used to store an instruction and/or data of the currently running program to be tested;
the loading module 302 is configured to load a program to be tested by using the script file;
and the processing module 303 is used for performing test analysis on the program to be tested.
Optionally, in some embodiments, the software testing apparatus may further include a determining module 304, before generating the script file, the determining module 304 configured to determine information of at least one register according to the first file and a third file, and the third file is configured to store information of a plurality of global variables.
Optionally, in some embodiments, the determining module 304 is specifically configured to determine, based on the third file, information of a first storage space corresponding to a first global variable in a first memory space, where the first global variable is any one global variable of a plurality of global variables, and the first memory space is used to store the first file, and the information of the first storage space includes one or more of the following: a first start address, a first end address, and a first address length; under the condition of first file segment storage, determining a first memory segment based on the information of a plurality of memory segments and a first storage space, wherein the first memory segment is a memory segment where a first global variable of the plurality of memory segments is located, and the first file segment storage refers to dividing the first memory space into the plurality of memory segments to store a first file; acquiring a value of a first global variable from a first memory segment based on information of a first memory space; information of at least one register is determined according to the value of the first global variable and a first offset, the first offset being used to represent a corresponding storage location of the information of the at least one register in the first storage space.
Optionally, in some embodiments, the determining module 304 is further configured to obtain information of each memory segment of the plurality of memory segments, where the information of each memory segment includes one or more of the following: a second start address, a second end address, a second offset, and a second address length; a first memory segment is determined from the plurality of memory segments based on the information of the first memory space and the information of each memory segment.
Optionally, in some embodiments, before determining the information of the at least one register according to the value of the first global variable and the first offset, the determining module 304 is further configured to, in a case where the first file is not saved in segments, obtain the value of the first global variable from the first memory space based on the information of the first memory space.
Optionally, in some embodiments, the script file further includes information for a plurality of memory segments.
Optionally, in some embodiments, the information of the first file includes a first path, the first path being used to represent a storage location of the first file; and/or the information of the second file comprises a second path, the second path being used to represent a storage location of the second file.
Optionally, in some embodiments, the loading module 302 is further configured to copy the script file from the third path to a fourth path, where the fourth path is a running path of the script file; and loading the program to be tested by using the script file in the process of running the script file.
Optionally, in some embodiments, the program to be tested is a program when an operating system is abnormal, and at least one register is used to store instructions and/or data of the program to be tested currently running when the operating system is abnormal.
Optionally, in some embodiments, the loading module 302 is further configured to load the program to be tested with the script file in response to a first operation of a user, where the first operation is used to trigger starting a test of the program to be tested.
It should be understood that the term "module" may be implemented in software and/or hardware, and embodiments of the application are not limited in this regard. For example, a "module" may be a software program, a hardware circuit, or a combination of both that implements the functionality described above. The hardware circuitry may include (application specific integrated circuit, ASIC) application specific integrated circuits, electronic circuits, processors (e.g., shared, dedicated, or group processors, etc.) and memory that execute one or more software or firmware programs, integrated logic circuits, and/or other suitable devices that can provide the above described functionality.
It should be noted that, because the content of information interaction and execution process between the modules and the embodiment of the method of the present application are based on the same concept, specific functions and technical effects thereof may be referred to in the method embodiment section, and details thereof are not repeated herein. It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions.
It should be further noted that, in the foregoing embodiment, each functional unit and module may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
Referring to fig. 9, fig. 9 shows a schematic structural diagram of a server according to an embodiment of the present application. As shown in fig. 9, the server 200 according to the embodiment of the present application may include:
a processor 401, a memory 402, a communication interface 403, and a bus 404. The processor 401, the memory 402, and the communication interface 403 communicate with each other via the bus 404, or may communicate with each other via other means such as wireless transmission. The memory 402 is used for storing instructions, and the processor 401 is used for executing the instructions stored by the memory 402. The memory 402 stores program codes, and the processor 401 may call the program codes stored in the memory 402 to execute the software testing method shown in fig. 5 or fig. 7.
It should be appreciated that in embodiments of the present application, the processor 401 may be a CPU, and the processor 401 may also be other general purpose processors, digital Signal Processors (DSPs), application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or any conventional processor or the like.
The memory 402 may include read only memory and random access memory and provides instructions and data to the processor 401. Memory 402 may also include non-volatile random access memory. The memory 402 may be volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory.
The nonvolatile memory may be a read-only memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an electrically Erasable EPROM (EEPROM), or a flash memory. The volatile memory may be random access memory (random access memory, RAM) which acts as an external cache.
By way of example, and not limitation, many forms of RAM are available, such as Static RAM (SRAM), dynamic Random Access Memory (DRAM), synchronous Dynamic Random Access Memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), and direct memory bus RAM (DR RAM).
The bus 404 may include a power bus, a control bus, a status signal bus, and the like in addition to a data bus. But for clarity of illustration, the various buses are labeled as bus 404 in fig. 9.
It should be understood that the structure of the server 200 is merely illustrative, and the server 200 according to the embodiment of the present application may further include other hardware besides the processor 401, the memory 402, the communication interface 403 and the bus 404, which is not limited by the embodiment of the present application.
Illustratively, the present application provides a readable storage medium having code or instructions stored therein, which when executed by a processor, cause the server 200 to implement the method of the previous embodiments.
Illustratively, the present application provides a chip system for application to a server 200 comprising a memory, a display screen, and a sensor; the chip system includes: one or more interface circuits and one or more processors; the interface circuit and the processor are interconnected through a circuit; the interface circuit is used for receiving signals from the memory and sending signals to the processor, wherein the signals comprise computer codes or instructions stored in the memory; the computer code or instructions, when invoked by the processor, cause the server 200 to perform the methods of the previous embodiments.
Illustratively, the present application provides a computer program product which, when run on a computer, causes the server 200 to implement the method in the previous embodiments.
In the above-described embodiments, all or part of the functions may be implemented by software, hardware, or a combination of software and hardware. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer codes or instructions. When the computer program code or instructions are loaded and executed on a computer, the processes or functions in accordance with the present application are fully or partially produced. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer code or instructions may be stored in a computer readable storage medium. Computer readable storage media can be any available media that can be accessed by a computer or data storage devices, such as server 200, a data center, etc., that contain an integration of one or more of the available media. Usable media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid State Disks (SSDs)), among others.
Those of ordinary skill in the art will appreciate that implementing all or part of the above-described method embodiments may be accomplished by a computer program to instruct related hardware, the program may be stored in a computer readable storage medium, and the program may include the above-described method embodiments when executed. And the aforementioned storage medium includes: a Read Only Memory (ROM) or a random access memory (random access memory, RAM), a magnetic disk or an optical disk, or the like.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
Claims (13)
1. A method of testing software, comprising:
generating a script file, wherein the script file comprises information of a first file, information of a second file and information of at least one register, the first file is a file for storing an execution state of a program to be tested, the second file is a file for storing compiling data corresponding to the program to be tested, and the at least one register is used for storing instructions and/or data of the program to be tested which is currently running;
loading the program to be tested by using the script file;
and carrying out test analysis on the program to be tested.
2. The method of claim 1, wherein prior to generating the script file, the method further comprises:
and determining information of the at least one register according to the first file and a third file, wherein the third file is used for storing information of a plurality of global variables.
3. The method of claim 2, wherein determining information of the at least one register from the first file and the third file comprises:
based on the third file, determining information of a first storage space corresponding to a first global variable in a first memory space, wherein the first global variable is any global variable in the plurality of global variables, the first memory space is used for storing the first file, and the information of the first storage space comprises one or more of the following: a first start address, a first end address, and a first address length;
Under the condition that the first file is stored in a segmented mode, determining a first memory segment based on information of a plurality of memory segments and the first storage space, wherein the first memory segment is a memory segment where the first global variable is located in the plurality of memory segments, and the first file is stored in a segmented mode by dividing the first memory space into the plurality of memory segments so as to store the first file;
acquiring the value of the first global variable from the first memory segment based on the information of the first storage space;
and determining information of the at least one register according to the value of the first global variable and a first offset, wherein the first offset is used for representing a corresponding storage position of the information of the at least one register in the first storage space.
4. The method of claim 3, wherein the determining the first memory segment based on the plurality of memory segments and the information of the first storage space in the case of the first file segment save comprises:
acquiring information of each memory segment in the plurality of memory segments, wherein the information of each memory segment comprises one or more of the following: a second start address, a second end address, a second offset, and a second address length;
And determining the first memory segment from the plurality of memory segments based on the information of the first memory space and the information of each memory segment.
5. A method according to claim 3, wherein prior to determining the information of the at least one register from the value of the first global variable and the first offset, the method further comprises:
and under the condition that the first file is not stored in a segmented mode, acquiring the value of the first global variable from the first memory space based on the information of the first memory space.
6. The method of claim 4, wherein the script file further comprises information of the plurality of memory segments.
7. The method of claim 1, wherein the information of the first file includes a first path representing a storage location of the first file; and/or, the information of the second file comprises a second path, and the second path is used for representing the storage position of the second file.
8. The method of claim 1, wherein loading the program under test with the script file further comprises:
Copying the script file from a third path to a fourth path, wherein the third path is a generation path of the script file, and the fourth path is a running path of the script file;
and loading the program to be tested by using the script file in the process of running the script file.
9. Method according to any one of claims 1 to 8, wherein the program to be tested is a program when an operating system is abnormal, and the at least one register is used for storing instructions and/or data of the program to be tested currently running when the operating system is abnormal.
10. The method according to any one of claims 1 to 8, wherein loading the program to be tested with the script file comprises:
and responding to a first operation of a user, and loading the program to be tested by utilizing the script file, wherein the first operation is used for triggering and starting the test of the program to be tested.
11. A server comprising a processor and a memory, the processor and the memory being coupled, the memory being for storing a computer program, the processor invoking instructions to cause the server to perform the method of any of claims 1-10.
12. A readable storage medium, wherein the readable storage medium stores a computer program, the processor invoking instructions to cause a server to perform the method of any of claims 1 to 10.
13. A chip system, wherein the chip system is applied to a server comprising a memory, a display screen and a sensor; the chip system includes: one or more interface circuits and one or more processors; the interface circuit and the processor are interconnected through a circuit; the interface circuit is used for receiving signals from the memory and sending signals to the processor, wherein the signals comprise computer codes or instructions stored in the memory; the processor invokes instructions to cause a server to perform the method of any one of claims 1 to 10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311077527.XA CN116775501B (en) | 2023-08-25 | 2023-08-25 | Software testing method, server, readable storage medium and chip system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311077527.XA CN116775501B (en) | 2023-08-25 | 2023-08-25 | Software testing method, server, readable storage medium and chip system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN116775501A true CN116775501A (en) | 2023-09-19 |
CN116775501B CN116775501B (en) | 2023-12-12 |
Family
ID=88013813
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311077527.XA Active CN116775501B (en) | 2023-08-25 | 2023-08-25 | Software testing method, server, readable storage medium and chip system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116775501B (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101645033A (en) * | 2009-05-15 | 2010-02-10 | 上海闻泰电子科技有限公司 | Debugging method in abnormality of mobile phone software |
CN102929747A (en) * | 2012-11-05 | 2013-02-13 | 中标软件有限公司 | Method for treating crash dump of Linux operation system based on loongson server |
US20180181480A1 (en) * | 2016-12-28 | 2018-06-28 | Nxp Usa, Inc. | Software Watchpoints Apparatus for Variables Stored in Registers |
US10127138B2 (en) * | 2013-06-06 | 2018-11-13 | Microsoft Technology Licensing, Llc. | Debugging native code by transitioning from execution in native mode to execution in interpreted mode |
CN109358975A (en) * | 2018-09-28 | 2019-02-19 | 珠海市君天电子科技有限公司 | A kind of analysis method, device, electronic equipment and storage medium that software is operating abnormally |
CN112380110A (en) * | 2020-09-30 | 2021-02-19 | 深圳点猫科技有限公司 | Client crash notification method, device and equipment |
CN115328796A (en) * | 2022-08-23 | 2022-11-11 | 华中科技大学 | Software vulnerability auxiliary positioning method and system for ARM architecture |
CN115756934A (en) * | 2022-12-02 | 2023-03-07 | 北京火山引擎科技有限公司 | Application crash analysis method and device |
CN116340053A (en) * | 2023-03-13 | 2023-06-27 | 西安万像电子科技有限公司 | Log processing method, device, computer equipment and medium for system crash |
-
2023
- 2023-08-25 CN CN202311077527.XA patent/CN116775501B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101645033A (en) * | 2009-05-15 | 2010-02-10 | 上海闻泰电子科技有限公司 | Debugging method in abnormality of mobile phone software |
CN102929747A (en) * | 2012-11-05 | 2013-02-13 | 中标软件有限公司 | Method for treating crash dump of Linux operation system based on loongson server |
US10127138B2 (en) * | 2013-06-06 | 2018-11-13 | Microsoft Technology Licensing, Llc. | Debugging native code by transitioning from execution in native mode to execution in interpreted mode |
US20180181480A1 (en) * | 2016-12-28 | 2018-06-28 | Nxp Usa, Inc. | Software Watchpoints Apparatus for Variables Stored in Registers |
CN109358975A (en) * | 2018-09-28 | 2019-02-19 | 珠海市君天电子科技有限公司 | A kind of analysis method, device, electronic equipment and storage medium that software is operating abnormally |
CN112380110A (en) * | 2020-09-30 | 2021-02-19 | 深圳点猫科技有限公司 | Client crash notification method, device and equipment |
CN115328796A (en) * | 2022-08-23 | 2022-11-11 | 华中科技大学 | Software vulnerability auxiliary positioning method and system for ARM architecture |
CN115756934A (en) * | 2022-12-02 | 2023-03-07 | 北京火山引擎科技有限公司 | Application crash analysis method and device |
CN116340053A (en) * | 2023-03-13 | 2023-06-27 | 西安万像电子科技有限公司 | Log processing method, device, computer equipment and medium for system crash |
Also Published As
Publication number | Publication date |
---|---|
CN116775501B (en) | 2023-12-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109508178B (en) | Program development method and device | |
US9262283B2 (en) | Method for reading kernel log upon kernel panic in operating system | |
US11593091B2 (en) | Method and apparatus for upgrading firmware of transfer device on mobile carrier, and non-transitory storage medium | |
CN111679868A (en) | Automobile software model integration method, device, equipment and storage medium | |
CN113094252B (en) | Test case generation method and device, computer equipment and storage medium | |
CN115756984A (en) | Memory test method, device, equipment and storage medium | |
CN109918338B (en) | Safety chip operating system testing device | |
CN113590491B (en) | Test platform and product test method | |
CN110889116A (en) | Advertisement blocking method and device and electronic equipment | |
CN116775501B (en) | Software testing method, server, readable storage medium and chip system | |
CN106649081B (en) | A kind of method and device that commissioning test wraps offline in client application | |
CN111666102A (en) | File format conversion method, chip verification method, related device and network chip | |
CN113254065B (en) | Application software compatibility method and device | |
CN111370049B (en) | eMMC chip testing method and device | |
CN109426546A (en) | Using starting method and device, computer storage medium and equipment | |
CN106897588B (en) | Processing method and device of label function | |
CN114895921B (en) | File processing method and device, electronic equipment and storage medium | |
CN113408845B (en) | Processing method and device of production flow, computer equipment and storage medium | |
CN115757140A (en) | Software compatibility testing method and device, storage medium and computer equipment | |
CN112559370A (en) | Front-end-based React project unit testing method and related equipment | |
JP5738065B2 (en) | Control program development support device | |
US10459825B2 (en) | Intelligent expansion of system information collection | |
CN114546440A (en) | System upgrading method and device | |
CN114443088A (en) | Module upgrading method and device, electronic equipment and storage medium | |
CN116048999A (en) | Embedded software data access method, device, terminal and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |