CN115640123A - Background process closing method and device, electronic equipment and storage medium - Google Patents

Background process closing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115640123A
CN115640123A CN202211261049.3A CN202211261049A CN115640123A CN 115640123 A CN115640123 A CN 115640123A CN 202211261049 A CN202211261049 A CN 202211261049A CN 115640123 A CN115640123 A CN 115640123A
Authority
CN
China
Prior art keywords
test
file
equipment
electronic equipment
execution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211261049.3A
Other languages
Chinese (zh)
Inventor
赵明亮
尹燕
程旭
陈雯雯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202211261049.3A priority Critical patent/CN115640123A/en
Publication of CN115640123A publication Critical patent/CN115640123A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

The embodiment of the invention provides a method and a device for closing a background process, electronic equipment and a storage medium, wherein the method comprises the following steps: responding to a test starting instruction aiming at the electronic equipment, acquiring first process information of a first execution process operated before the electronic equipment executes the equipment test, and generating a first process file for representing a process state of the electronic equipment before the equipment test is executed according to the first process information; establishing a test process for carrying out equipment test, then responding to a test ending instruction generated after the electronic equipment completes the equipment test, acquiring second process information of a second execution process operated when the electronic equipment completes the equipment test, and generating a second process file for representing a process state of the electronic equipment when the equipment test is completed according to the second process information; and closing the test process related to the process of executing the equipment test by the electronic equipment according to the first process file and the second process file, thereby simplifying the operation of closing the test process.

Description

Background process closing method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for closing a background process, an electronic device, and a computer-readable storage medium.
Background
In the test and maintenance work under the electronic equipment operation system, a tester often needs to terminate the operation of a test program running in a background in the test process or after the test is finished, and when the executed test tasks relate to more test scripts or a single test script executes to call a plurality of execution programs to complete the test tasks, the number of the test programs needing to be terminated is large, so that the termination process of the test programs is excessively complicated, and the test efficiency is reduced.
Disclosure of Invention
The embodiment of the invention provides a method and a device for closing a background process, electronic equipment and a computer readable storage medium, and aims to solve or partially solve the problems that when a test program running in a background is closed in the related art, the closing process is complicated due to the fact that the number of the test programs is large, and part of the test processes are easy to miss.
The embodiment of the invention discloses a method for closing a background process, which is applied to electronic equipment, wherein the electronic equipment runs a corresponding Linux system, and the method comprises the following steps:
responding to a test starting instruction aiming at the electronic equipment, acquiring first process information of a first execution process operated before the electronic equipment executes equipment test, and generating a first process file for representing a process state of the electronic equipment before the electronic equipment executes the equipment test according to the first process information;
creating a test process corresponding to the test starting instruction, and executing a test task corresponding to the equipment test through the test process;
in response to acquiring a test ending instruction generated after the electronic equipment completes the equipment test, acquiring second process information of a second execution process operated when the electronic equipment completes the equipment test, and generating a second process file for representing a process state of the electronic equipment when the equipment test is completed according to the second process information;
and closing the test process related to the electronic equipment in the equipment test process according to the first process file and the second process file.
Optionally, the closing, by the electronic device, a test process involved in the device test process executed by the electronic device according to the first process file and the second process file includes:
and comparing the first process identification with the second process identification, and closing the test process related to the electronic equipment in the equipment test process according to the comparison result.
Optionally, the comparing the first process identifier with the second process identifier includes:
and comparing the first process identifier in the first process file with the second process identifier in the second process file, and storing the second process identifier which does not exist in the first process file and/or the first process identifier which does not exist in the second process file into a preset process closing file.
Optionally, the process closing file includes a target process identifier corresponding to a process to be closed, and the closing of the test process related to the process of executing the device test by the electronic device according to the comparison result includes:
and selecting a test process corresponding to the target process identification from the second execution process, and closing the test process.
Optionally, the obtaining, in response to a test start instruction for the electronic device, first process information of a first execution process that is run before the electronic device executes a device test, and generating, according to the first process information, a first process file for characterizing a process state of the electronic device before the electronic device executes the device test includes:
acquiring a test execution script;
and responding to a test starting instruction aiming at the test execution script, executing the test execution script to obtain first process information of a first execution process running before the electronic equipment executes equipment test, generating a first process file for representing the process state of the electronic equipment before the equipment test is executed according to the first process information, and storing the first process file into a folder to which the test execution script belongs.
Optionally, the obtaining, in response to obtaining a test end instruction generated after the electronic device completes the device test, second process information of a second execution process run by the electronic device when the device test is completed, and generating, according to the second process information, a second process file used for characterizing a process state of the electronic device when the device test is completed includes:
and in response to acquiring a test ending instruction generated after the electronic equipment completes the equipment test, executing the test execution script to acquire second process information of a second execution process operated when the electronic equipment completes the equipment test, generating a second process file for representing a process state of the electronic equipment when the equipment test is completed according to the second process information, and storing the second process file into a folder to which the test execution script belongs.
Optionally, the closing, according to the first process file and the second process file, a test process involved in the device test process executed by the electronic device, includes:
and if the test execution script is detected to have at least two process files in the folder, closing the test process related to the electronic equipment in the equipment test process according to the first process file and the second process file.
The embodiment of the invention also discloses a closing device of the background process, which is applied to the electronic equipment, wherein the electronic equipment runs a corresponding Linux system, and the device comprises:
the first file generation module is used for responding to a test starting instruction aiming at the electronic equipment, acquiring first process information of a first execution process operated before the electronic equipment executes equipment test, and generating a first process file used for representing a process state of the electronic equipment before the electronic equipment executes the equipment test according to the first process information;
the test task execution module is used for creating a test process corresponding to the test starting instruction and executing a test task corresponding to the equipment test through the test process;
the second file generation module is used for responding to a test ending instruction generated after the electronic equipment completes the equipment test, acquiring second process information of a second execution process operated when the electronic equipment completes the equipment test, and generating a second process file used for representing a process state of the electronic equipment when the equipment test is completed according to the second process information;
and the process closing module is used for closing the test process related to the electronic equipment in the equipment test process according to the first process file and the second process file.
Optionally, the first process file includes a first process identifier of the first execution process, the second process file includes a second process identifier of the second execution process, and the process shutdown module is specifically configured to:
and comparing the first process identification with the second process identification, and closing the test process related to the electronic equipment in the equipment test process according to the comparison result.
Optionally, the process shutdown module is specifically configured to:
and comparing the first process identifier in the first process file with the second process identifier in the second process file, and storing the second process identifier which does not exist in the first process file and/or the first process identifier which does not exist in the second process file into a preset process closing file.
Optionally, the process closing file includes a target process identifier corresponding to a process to be closed, and the process closing module is specifically configured to:
and selecting a test process corresponding to the target process identification from the second execution process, and closing the test process.
Optionally, the first file generating module is specifically configured to:
acquiring a test execution script;
and responding to a test starting instruction aiming at the test execution script, executing the test execution script to acquire first process information of a first execution process operated before the electronic equipment executes the equipment test, generating a first process file for representing the process state of the electronic equipment before the equipment test is executed according to the first process information, and storing the first process file into a folder to which the test execution script belongs.
Optionally, the second file generating module is specifically configured to:
and in response to a test ending instruction generated after the electronic equipment completes the equipment test, executing the test execution script to obtain second process information of a second execution process operated when the electronic equipment completes the equipment test, generating a second process file for representing a process state of the electronic equipment when the equipment test is completed according to the second process information, and storing the second process file into a folder to which the test execution script belongs.
Optionally, the process shutdown module is specifically configured to:
and if the test execution script is detected to have at least two process files in the folder, closing the test process related to the process of executing the equipment test by the electronic equipment according to the first process file and the second process file.
The embodiment of the invention also discloses electronic equipment which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory finish mutual communication through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the method according to the embodiment of the present invention when executing the program stored in the memory.
Also disclosed is a computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform a method according to an embodiment of the invention.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, in the process of testing the electronic equipment, first process information of a first execution process running before the electronic equipment executes the equipment test can be acquired in response to a test starting instruction aiming at the electronic equipment, a first process file for representing the process state of the electronic equipment before the equipment test is executed can be generated according to the first process information, a test process corresponding to the test starting instruction can be created, a test task corresponding to the equipment test can be executed through the test process, then, after the electronic equipment test is finished, second process information of a second execution process running when the electronic equipment finishes the equipment test can be acquired in response to a test finishing instruction generated after the electronic equipment test is finished, a second process file for representing the process state of the electronic equipment when the equipment test is finished is generated according to the second process information, then, the test process related to the electronic equipment in the test process can be closed according to the first process file and the second process file, therefore, in the process of testing the electronic equipment, the test process closing information can be acquired before the test is finished, the test process closing efficiency can be effectively improved, the test process closing efficiency can be effectively realized, and the test process closing efficiency can be improved based on the test closing information, and the test closing process closing operation can be effectively realized.
Drawings
Fig. 1 is a flowchart illustrating steps of a method for closing a background process according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating process shutdown provided in an embodiment of the present invention;
fig. 3 is a block diagram of a closing apparatus for a background process according to an embodiment of the present invention;
fig. 4 is a block diagram of an electronic device provided in an embodiment of the present invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention more comprehensible, the present invention is described in detail with reference to the accompanying drawings and the detailed description thereof.
As an example, the electronic device may be a server, and a corresponding Linux system may be run on the server, so that in the test and maintenance work under the Linux system of the server, a tester often needs to terminate running of the background test program during the test in progress or after the test is completed, and when the test task is executed involving more test scripts or a single test script is executed and may call many execution programs to complete the test task, the number of test programs to be terminated is large, which causes an excessively complicated termination process of the test programs, and reduces the test efficiency.
In this regard, one of the core inventions of the present invention is that in the process of testing an electronic device, the test start instruction for the electronic device may be obtained by acquiring first process information of a first execution process run before the electronic device performs the device test, and generating a first process file for characterizing the process state of the electronic equipment before the equipment test is executed according to the first process information, meanwhile, a test process corresponding to the test starting instruction can be created, and a test task corresponding to the equipment test can be executed through the test process, then, after the electronic device is tested, second process information of a second execution process operated when the electronic device completes the device test can be acquired through responding to the acquired test ending instruction generated after the electronic device completes the device test, and generating a second process file for representing the process state of the electronic equipment when the equipment test is finished according to the second process information, the test process involved in the process of executing the device test by the electronic device can then be closed according to the first process file and the second process file, therefore, in the process of testing the electronic equipment, by acquiring the execution process on the primary electronic equipment before the test and acquiring the execution process of the primary electronic equipment after the test is finished, then the test process related in the test process is closed based on the acquired process information, thereby realizing the rapid closing of the test process, simplifying the operation of closing the test process in the test, saving the test time and improving the test efficiency, meanwhile, the test process can be completely closed based on the comparison of the process information in the closing process, the performance of the equipment can be effectively released, and the running stability of the equipment is improved.
Specifically, referring to fig. 1, a flowchart of steps of a method for closing a background process provided in the embodiment of the present invention is shown, which specifically includes the following steps:
step 101, responding to a test starting instruction for electronic equipment, acquiring first process information of a first execution process operated by the electronic equipment before the electronic equipment executes equipment test, and generating a first process file for representing a process state of the electronic equipment before the electronic equipment executes the equipment test according to the first process information;
optionally, for the electronic device, it may be a server, and a corresponding operating system, such as a Linux system, may be run in the server, and in the process of testing related content (hardware performance, etc.) of the server under the Linux system, it is often necessary to execute a corresponding test task through a corresponding execution process, and after the test is finished, a process involved in the test process needs to be closed to release the running performance of the server. It should be noted that, in the embodiment of the present invention, an example is given by taking a server as an example, and it is understood that the electronic device may also be other devices, and the present invention is not limited to this.
In the embodiment of the present invention, in response to a test start instruction for an electronic device, the electronic device may acquire first process information of a first execution process that is executed by the electronic device before the device test is executed, and generate, according to the first process information, a first process file for characterizing a process state of the electronic device before the device test is executed. It should be noted that, for the execution process, the execution process may include a conventional process involved in the process of running the application program by the electronic device and a test process involved in the process of performing the performance test on the electronic device, and the process that needs to be closed in the embodiment of the present invention may be the test process involved in the process of performing the performance test.
The test starting instruction can be an instruction for starting performance test on the electronic equipment and acquiring process information related to an execution process currently running by the electronic equipment before executing a performance test task; for the process information, which may be a process identifier (such as a process number) corresponding to an execution process run by the electronic device, the electronic device may generate a corresponding first process file based on the obtained process identifier corresponding to the execution process, so as to characterize a process state of the electronic device before the device test is performed, for example, before the device test is performed by the electronic device, the run execution process includes a process (1), a process (2), a process (3), a process (4), and a process (5), and then the corresponding process file may be generated by obtaining a process number corresponding to each execution process, as shown in table 1 below:
executing processes Process identification
Process (1) A
Process (2) B
Process (3) C
Process (4) D
Process (5) E
TABLE 1
In an optional embodiment, a tester may write a test execution script for automatically closing a process using a Shell language, and run the test execution script in a Linux system, so that in a process of testing an electronic device, the test execution script may be obtained, then, in response to a test start instruction for the test execution script, the test execution script may be executed to obtain first process information of a first execution process run before the electronic device performs the device test, and a first process file for characterizing a process state of the electronic device before performing the device test is generated according to the first process information, and the first process file is stored in a folder to which the test execution script belongs, so that the process information is obtained before testing the electronic device through the test execution script, and a corresponding process file is generated, and then, the process file is stored in the folder in which the test execution script is stored, and a mapping relationship between the test execution script and the process file is established, thereby facilitating subsequent closing of a test process involved in the test process.
102, creating a test process corresponding to the test starting instruction, and executing a test task corresponding to the equipment test through the test process;
in a specific implementation, different test tasks may correspond to different test processes, and the electronic device may analyze the test start instruction to obtain a corresponding test task and at least one process identifier corresponding to the test task, then create a corresponding test process based on the process identifier, and execute the corresponding test task according to the created test process, for example, perform performance test, stability test, pressure test, and the like on a hard disk of the electronic device, which is not limited by the present invention.
103, in response to acquiring a test ending instruction generated after the electronic device completes the device test, acquiring second process information of a second execution process operated when the electronic device completes the device test, and generating a second process file for representing a process state of the electronic device when the device test is completed according to the second process information;
when the performance test of the electronic equipment is started, the electronic equipment can create a corresponding test process based on the test task and execute corresponding performance test contents based on the test process, and after the test task is completed, the electronic equipment can respond to a test ending instruction generated after the electronic equipment completes the equipment test, obtain second process information of a second execution process running when the electronic equipment completes the equipment test, and generate a second process file for representing a process state of the electronic equipment when the equipment test is completed according to the second process information. The test ending instruction may be an instruction that is automatically generated by the electronic device after the test task is detected to be completed by detecting the task state of the test task, or an instruction that is manually input by a tester after the test task is completed, which is not limited in the present invention.
In a specific implementation, after the electronic device is tested, the electronic device may execute the test execution script in response to obtaining a test end instruction generated after the electronic device completes the device test to obtain second process information of a second execution process run when the electronic device completes the device test, generate a second process file for representing a process state of the electronic device when the device test is completed according to the second process information, and store the second process file in a folder to which the test execution script belongs. For example, after the electronic device completes a test task, the executed execution processes include a process (1), a process (2), a process (3), a process (4), a process (5), a process (6), a process (7), a process (8), and the like, and then a corresponding process file may be generated by acquiring a process number corresponding to each execution process, as shown in table 2 below:
executing a process Process identification
Process (1) A
Process (3) C
Process (4) D
Process (5) E
Process (6) F
Process (7) G
Process (8) H
TABLE 2
And step 104, closing the test process related to the electronic equipment in the equipment test process according to the first process file and the second process file.
For a first process file representing the process state of the electronic equipment before the electronic equipment performs the equipment test and a second process file representing the process state of the electronic equipment when the equipment test is completed, the electronic equipment can close the test process related to the electronic equipment in the process of performing the equipment test according to the first process file and the second process file, so that in the process of testing the electronic equipment, the execution process on the electronic equipment is acquired before the test and the execution process of the electronic equipment is acquired after the test is completed, and then the test process related to the test process in the test process is closed based on the acquired process information, so that the test process is quickly closed, the operation of closing the test process in the test is simplified, the test time is saved, the test efficiency is improved, meanwhile, the full closing of the test process can be realized based on the comparison of process information in the closing process, the equipment performance can be effectively released, and the running stability of the equipment is improved.
In a specific implementation, the first process file includes a first process identifier of the first execution process, and the second process file includes a second process identifier of the second execution process, so that after the electronic device completes the test task, the first process identifier and the second process identifier may be compared, and the test process involved in the test process of the electronic device execution device is closed according to the comparison result. Specifically, the first process identifier in the first process file may be compared with the second process identifier in the second process file, and the second process identifier that does not exist in the first process file and/or the first process identifier that does not exist in the second process file may be stored in a preset process shutdown file. If the process closing file comprises the target process identification corresponding to the process to be closed, the test process corresponding to the target process identification can be selected from the second execution process, and the test process is closed.
For example, as shown in table 1 and table 2 above, process identifiers included in the first process file and the second process file may be compared to obtain process identifiers such as B, F, G, and H, and then these process identifiers may be used as target process identifiers of processes to be closed, where a process (2) corresponding to the process identifier B has been closed, and then test processes corresponding to the process identifiers such as F, G, and H, including a process (6), a process (7), and a process (8), may be screened from currently running execution processes of the electronic device based on the process identifiers F, G, and H, and then the process (6), the process (7), and the process (8) are closed, so that in a process of testing the electronic device, by acquiring an execution process on the electronic device before testing and acquiring an execution process of the electronic device after testing is completed, and then closing the test processes involved in the test process based on the acquired process information, fast closing of the test processes is achieved, operations of closing the test processes in the test are simplified, test time is saved, test efficiency is improved, and meanwhile, the comparison and the stability of the closed process in the test process is effectively improved.
In addition, before the test process is closed, the electronic device may detect the process file, and if it is detected that at least two process files exist in the folder to which the test execution script belongs, the test process related to the test process of the electronic device in the process of executing the device test is closed according to the first process file and the second process file.
It should be noted that the embodiment of the present invention includes but is not limited to the above examples, and it is understood that, under the guidance of the idea of the embodiment of the present invention, a person skilled in the art may also set the method according to actual requirements, and the present invention is not limited to this.
In the embodiment of the invention, in the process of testing the electronic equipment, first process information of a first execution process running before the electronic equipment executes the equipment test can be acquired in response to a test starting instruction aiming at the electronic equipment, a first process file for representing the process state of the electronic equipment before the equipment test is executed can be generated according to the first process information, a test process corresponding to the test starting instruction can be created, a test task corresponding to the equipment test can be executed through the test process, then, after the electronic equipment test is finished, second process information of a second execution process running when the electronic equipment finishes the equipment test can be acquired in response to a test finishing instruction generated after the electronic equipment test is finished, a second process file for representing the process state of the electronic equipment when the equipment test is finished is generated according to the second process information, then, the test process related to the electronic equipment in the test process can be closed according to the first process file and the second process file, therefore, in the process of testing the electronic equipment, the test process closing information can be acquired before the test is finished, the test process closing efficiency can be effectively improved, the test process closing efficiency can be effectively realized, and the test process closing efficiency can be improved based on the test closing information, and the test closing process closing operation can be effectively realized.
In order to make the technical solutions in the embodiments of the present invention better understood by those skilled in the art, the following is exemplified by an example:
the tester can use the shell language to compile an automatic process closing tool which is used in the Linux system. Firstly, preliminarily collecting all process information operated before testing, screening irrelevant information in the process information, extracting a process number to generate a document, and storing the document as pid1.log; then collecting all process information again after the test is finished, screening the captured process information again, extracting a process number to generate a document, and storing the document as pid2.Log; comparing the generated pid1.log file with the pid2.log file, and storing different parts of contents after comparison into a buffer.log file; finally, the process numbers stored in the difference.log are used for executing killing operation one by one, namely the killing process operation is completed; and backing up the pid log document under the current file under the new old folder (if the pid log document is not required to be newly created), and clearing the pid log document for the next use, so that the operation of the automatic closing execution test program is finished. Specifically, referring to fig. 2, a schematic flow chart of process shutdown provided in the embodiment of the present invention is shown, including:
1. before the test is executed, the script is executed, all program process numbers of the server running before the test can be automatically obtained, all the process numbers are stored as pid1.Log, and the process numbers are stored in a folder where the script is located.
This step related command in the script: ps-ef | awk' { print $2} > > pid.log; wherein $2 is the sequence number in the ps-ef column where the command obtains the process number in the process information.
2. After the script executes the first step, it checks the file for pid log (e.g., pid1.Log for the first time and pid2.Log for the second time) to determine if there are two (e.g., pid1.Log and pid2. Log). If not 2, ending; if 2, the remaining steps of the script are executed.
This step related command in the script: ls-l | grep 'pid' | wc-l; the command may check the number of generated pid.log files for subsequent comparison.
3. And after the test task is executed, executing the script again, automatically acquiring process numbers of all programs run by the server before the test, saving all the process numbers as pid2.Log, and saving the process numbers under a folder where the script is located. (commands already described in step 2)
4. After the script executes the last step, the file pid log is checked to determine whether the file is two (for example, pid1.Log and pid2. Log). If not 2, ending; if 2, the remaining steps of the script are executed. (commands already described in step 3)
5. And comparing the content of different process numbers in the pid1.Log and the pid2.Log, and saving the different process numbers as buffer. Script this step related command: diffpid1.Logpid2.Log > > differ.log
6. Log document as variable, killing process operation is carried out on the process numbers one by one, and after all the processes are executed, the killing test process is completed.
Script this step commands: log document extracts process numbers one by using a loop function, sets the process numbers as a variable to be $ pid, executes kill-9$ pid, and closes all newly added process numbers in the test.
7. And backing up the pid log file under the current folder to the new old folder, and clearing the pid log under the current file for the next test of the automatic closing program.
Script this step commands: and (4) creating an old folder mkdirold by the current document, and moving pid & ltlog & gt generated by the end of the test to mvpid & ltlog & gt/below the old folder for the next script to use.
It should be noted that for simplicity of description, the method embodiments are shown as a series of combinations of acts, but those skilled in the art will recognize that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Referring to fig. 3, a block diagram of a structure of a closing apparatus for a background process provided in the embodiment of the present invention is shown, and is applied to an electronic device, where the electronic device runs a corresponding Linux system, and specifically includes the following modules:
a first file generating module 301, configured to, in response to a test start instruction for an electronic device, obtain first process information of a first execution process that is run before the electronic device executes a device test, and generate, according to the first process information, a first process file that is used to represent a process state of the electronic device before the electronic device executes the device test;
a test task execution module 302, configured to create a test process corresponding to the test starting instruction, and execute a test task corresponding to the device test through the test process;
a second file generating module 303, configured to, in response to obtaining a test end instruction generated after the electronic device completes the device test, obtain second process information of a second execution process that is run when the electronic device completes the device test, and generate, according to the second process information, a second process file used for representing a process state of the electronic device when the device test is completed;
a process closing module 304, configured to close, according to the first process file and the second process file, a test process involved in the process of executing the device test by the electronic device.
In an optional embodiment, the first process file includes a first process identifier of the first executing process, the second process file includes a second process identifier of the second executing process, and the process shutdown module 304 is specifically configured to:
and comparing the first process identification with the second process identification, and closing the test process related to the electronic equipment in the equipment test process according to the comparison result.
In an optional embodiment, the process shutdown module 304 is specifically configured to:
and comparing the first process identifier in the first process file with the second process identifier in the second process file, and storing the second process identifier which does not exist in the first process file and/or the first process identifier which does not exist in the second process file into a preset process closing file.
In an optional embodiment, the process closing file includes a target process identifier corresponding to a process to be closed, and the process closing module 304 is specifically configured to:
and selecting the test process corresponding to the target process identification from the second execution process, and closing the test process.
In an optional embodiment, the first file generating module 301 is specifically configured to:
acquiring a test execution script;
and responding to a test starting instruction aiming at the test execution script, executing the test execution script to obtain first process information of a first execution process running before the electronic equipment executes equipment test, generating a first process file for representing the process state of the electronic equipment before the equipment test is executed according to the first process information, and storing the first process file into a folder to which the test execution script belongs.
In an optional embodiment, the second file generating module 303 is specifically configured to:
and in response to a test ending instruction generated after the electronic equipment completes the equipment test, executing the test execution script to obtain second process information of a second execution process operated when the electronic equipment completes the equipment test, generating a second process file for representing a process state of the electronic equipment when the equipment test is completed according to the second process information, and storing the second process file into a folder to which the test execution script belongs.
In an optional embodiment, the process shutdown module 304 is specifically configured to:
and if the test execution script is detected to have at least two process files in the folder, closing the test process related to the electronic equipment in the equipment test process according to the first process file and the second process file.
For the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for relevant points.
In addition, an embodiment of the present invention further provides an electronic device, including: the processor, the memory, and the computer program stored in the memory and capable of running on the processor, when executed by the processor, implement each process of the above-mentioned background process closing method embodiment, and can achieve the same technical effect, and are not described herein again to avoid repetition.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when being executed by a processor, the computer program implements each process of the above-mentioned background process closing method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
Fig. 4 is a schematic diagram of a hardware structure of an electronic device implementing various embodiments of the present invention.
The electronic device 400 includes, but is not limited to: radio frequency unit 401, network module 402, audio output unit 403, input unit 404, sensor 405, display unit 406, user input unit 407, interface unit 408, memory 409, processor 410, and power supply 411. It will be appreciated by those skilled in the art that the electronic device structures involved in the embodiments of the present invention are not intended to be limiting, and that the electronic device may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components may be used. In the embodiment of the present invention, the electronic device includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted terminal, a wearable device, a pedometer, and the like.
It should be understood that, in the embodiment of the present invention, the radio frequency unit 401 may be used for receiving and sending signals during a message sending and receiving process or a call process, and specifically, receives downlink data from a base station and then processes the received downlink data to the processor 410; in addition, the uplink data is transmitted to the base station. Typically, radio unit 401 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like. Further, the radio unit 401 can also communicate with a network and other devices through a wireless communication system.
The electronic device provides wireless broadband internet access to the user via the network module 402, such as assisting the user in sending and receiving e-mails, browsing web pages, and accessing streaming media.
The audio output unit 403 may convert audio data received by the radio frequency unit 401 or the network module 402 or stored in the memory 409 into an audio signal and output as sound. Also, the audio output unit 403 may also provide audio output related to a specific function performed by the electronic apparatus 400 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit 403 includes a speaker, a buzzer, a receiver, and the like.
The input unit 404 is used to receive audio or video signals. The input Unit 404 may include a Graphics Processing Unit (GPU) 4041 and a microphone 4042, and the Graphics processor 4041 processes image data of a still picture or video obtained by an image capturing apparatus (such as a camera) in a video capture mode or an image capture mode. The processed image frames may be displayed on the display unit 406. The image frames processed by the graphic processor 4041 may be stored in the memory 409 (or other storage medium) or transmitted via the radio frequency unit 401 or the network module 402. The microphone 4042 may receive sound and may be capable of processing such sound into audio data. The processed audio data may be converted into a format output transmittable to a mobile communication base station via the radio frequency unit 401 in case of the phone call mode.
The electronic device 400 also includes at least one sensor 405, such as light sensors, motion sensors, and other sensors. Specifically, the light sensor includes an ambient light sensor that adjusts the brightness of the display panel 4061 according to the brightness of ambient light, and a proximity sensor that turns off the display panel 4061 and/or the backlight when the electronic apparatus 400 is moved to the ear. As one type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), detect the magnitude and direction of gravity when stationary, and can be used to identify the posture of an electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), and vibration identification related functions (such as pedometer, tapping); the sensors 405 may also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be described in detail herein.
The display unit 406 is used to display information input by the user or information provided to the user. The Display unit 406 may include a Display panel 4061, and the Display panel 4061 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like.
The user input unit 407 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic device. Specifically, the user input unit 407 includes a touch panel 4071 and other input devices 4072. Touch panel 4071, also referred to as a touch screen, may collect touch operations by a user on or near it (e.g., operations by a user on or near touch panel 4071 using a finger, a stylus, or any suitable object or attachment). The touch panel 4071 may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 410, receives a command from the processor 410, and executes the command. In addition, the touch panel 4071 can be implemented by using various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. In addition to the touch panel 4071, the user input unit 407 may include other input devices 4072. Specifically, the other input devices 4072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a track ball, a mouse, and a joystick, which are not described herein again.
Further, the touch panel 4071 can be overlaid on the display panel 4061, and when the touch panel 4071 detects a touch operation thereon or nearby, the touch operation is transmitted to the processor 410 to determine the type of the touch event, and then the processor 410 provides a corresponding visual output on the display panel 4061 according to the type of the touch event. It is understood that in one embodiment, the touch panel 4071 and the display panel 4061 are two separate components to implement the input and output functions of the electronic device, but in some embodiments, the touch panel 4071 and the display panel 4061 may be integrated to implement the input and output functions of the electronic device, and this is not limited herein.
The interface unit 408 is an interface for connecting an external device to the electronic apparatus 400. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input/output (I/O) port, a video I/O port, an earphone port, and the like. The interface unit 408 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the electronic apparatus 400 or may be used to transmit data between the electronic apparatus 400 and an external device.
The memory 409 may be used to store software programs as well as various data. The memory 409 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, etc. Further, the memory 409 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The processor 410 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, performs various functions of the electronic device and processes data by operating or executing software programs and/or modules stored in the memory 409 and calling data stored in the memory 409, thereby performing overall monitoring of the electronic device. Processor 410 may include one or more processing units; preferably, the processor 410 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 410.
The electronic device 400 may further comprise a power supply 411 (e.g. a battery) for supplying power to various components, and preferably, the power supply 411 may be logically connected to the processor 410 through a power management system, so as to implement functions of managing charging, discharging, and power consumption through the power management system.
In addition, the electronic device 400 includes some functional modules that are not shown, and are not described in detail here.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one of 8230, and" comprising 8230does not exclude the presence of additional like elements in a process, method, article, or apparatus comprising the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.
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 technical 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 invention.
It can be clearly understood by those skilled in the art that, for convenience and simplicity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention or a part thereof which substantially contributes to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U disk, a removable hard disk, a ROM, a RAM, a magnetic disk or an optical disk, and various media capable of storing program codes.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A method for closing a background process is applied to an electronic device, wherein the electronic device runs a corresponding Linux system, and the method comprises the following steps:
responding to a test starting instruction aiming at the electronic equipment, acquiring first process information of a first execution process operated before the electronic equipment executes equipment test, and generating a first process file for representing a process state of the electronic equipment before the electronic equipment executes the equipment test according to the first process information;
creating a test process corresponding to the test starting instruction, and executing a test task corresponding to the equipment test through the test process;
in response to a test ending instruction generated after the electronic equipment completes the equipment test, acquiring second process information of a second execution process operated when the electronic equipment completes the equipment test, and generating a second process file for representing a process state of the electronic equipment when the equipment test is completed according to the second process information;
and closing the test process related to the process of executing the equipment test by the electronic equipment according to the first process file and the second process file.
2. The method according to claim 1, wherein the first process file includes a first process identifier of the first execution process, the second process file includes a second process identifier of the second execution process, and the closing the test process involved in the device test process performed by the electronic device according to the first process file and the second process file comprises:
and comparing the first process identification with the second process identification, and closing the test process related to the process of executing the equipment test by the electronic equipment according to the comparison result.
3. The method of claim 2, wherein comparing the first process identifier to the second process identifier comprises:
and comparing the first process identifier in the first process file with the second process identifier in the second process file, and storing the second process identifier which does not exist in the first process file and/or the first process identifier which does not exist in the second process file into a preset process closing file.
4. The method according to claim 3, wherein the process shutdown file includes a target process identifier corresponding to a process to be shutdown, and the shutdown of the test process related to the electronic device in the device test process according to the comparison result includes:
and selecting a test process corresponding to the target process identification from the second execution process, and closing the test process.
5. The method according to claim 1, wherein the obtaining, in response to a test start instruction for an electronic device, first process information of a first execution process that is executed by the electronic device before a device test is executed, and generating, according to the first process information, a first process file for characterizing a process state of the electronic device before the device test is executed comprises:
acquiring a test execution script;
and responding to a test starting instruction aiming at the test execution script, executing the test execution script to acquire first process information of a first execution process operated before the electronic equipment executes the equipment test, generating a first process file for representing the process state of the electronic equipment before the equipment test is executed according to the first process information, and storing the first process file into a folder to which the test execution script belongs.
6. The method according to claim 5, wherein the obtaining second process information of a second execution process that is run when the electronic device completes the device test in response to obtaining a test end instruction that is generated after the electronic device completes the device test, and generating a second process file that is used for characterizing a process state of the electronic device when the device test is completed according to the second process information includes:
and in response to a test ending instruction generated after the electronic equipment completes the equipment test, executing the test execution script to obtain second process information of a second execution process operated when the electronic equipment completes the equipment test, generating a second process file for representing a process state of the electronic equipment when the equipment test is completed according to the second process information, and storing the second process file into a folder to which the test execution script belongs.
7. The method according to claim 5 or 6, wherein the closing the test process involved in the device test process performed by the electronic device according to the first process file and the second process file comprises:
and if the test execution script is detected to have at least two process files in the folder, closing the test process related to the electronic equipment in the equipment test process according to the first process file and the second process file.
8. A closing device of a background process is applied to an electronic device, wherein the electronic device runs a corresponding Linux system, and the device comprises:
the first file generation module is used for responding to a test starting instruction aiming at the electronic equipment, acquiring first process information of a first execution process operated before the electronic equipment executes equipment test, and generating a first process file used for representing a process state of the electronic equipment before the electronic equipment executes the equipment test according to the first process information;
the test task execution module is used for creating a test process corresponding to the test starting instruction and executing a test task corresponding to the equipment test through the test process;
the second file generation module is used for responding to a test ending instruction generated after the electronic equipment completes the equipment test, acquiring second process information of a second execution process operated when the electronic equipment completes the equipment test, and generating a second process file used for representing a process state of the electronic equipment when the equipment test is completed according to the second process information;
and the process closing module is used for closing the test process related to the electronic equipment in the equipment test process according to the first process file and the second process file.
9. An electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
the memory is used for storing a computer program;
the processor, when executing a program stored on the memory, implementing the method of any of claims 1-7.
10. A computer-readable storage medium having stored thereon instructions, which when executed by one or more processors, cause the processors to perform the method of any one of claims 1-7.
CN202211261049.3A 2022-10-14 2022-10-14 Background process closing method and device, electronic equipment and storage medium Pending CN115640123A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211261049.3A CN115640123A (en) 2022-10-14 2022-10-14 Background process closing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211261049.3A CN115640123A (en) 2022-10-14 2022-10-14 Background process closing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115640123A true CN115640123A (en) 2023-01-24

Family

ID=84944382

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211261049.3A Pending CN115640123A (en) 2022-10-14 2022-10-14 Background process closing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115640123A (en)

Similar Documents

Publication Publication Date Title
CN108089977B (en) Application program exception handling method and device and mobile terminal
US11543935B2 (en) Information processing method and terminal device
CN110096203B (en) Screenshot method and mobile terminal
CN109523253B (en) Payment method and device
CN110308834B (en) Setting method of application icon display mode and terminal
CN109544172B (en) Display method and terminal equipment
CN109726121B (en) Verification code obtaining method and terminal equipment
CN112231144A (en) Data processing method and device and electronic equipment
KR102497444B1 (en) Object recognition method and mobile terminal
CN111309390A (en) Method for acquiring configuration information and electronic equipment
CN108270928B (en) Voice recognition method and mobile terminal
CN110780751A (en) Information processing method and electronic equipment
CN108089935B (en) Application program management method and mobile terminal
CN107872367B (en) Black screen detection method, mobile terminal and computer readable storage medium
CN111427644B (en) Target behavior identification method and electronic equipment
CN111310165B (en) Account switching or registering method and electronic equipment
CN111131930B (en) Device resource control method, first electronic device, and computer-readable storage medium
CN109871324B (en) Control operation method and device
CN111443968A (en) Screenshot method and electronic equipment
CN108228357B (en) Memory cleaning method and mobile terminal
CN110928616A (en) Shortcut icon management method and electronic equipment
CN115328770A (en) Application program testing method and device, electronic equipment and storage medium
CN115640123A (en) Background process closing method and device, electronic equipment and storage medium
CN110955365B (en) Application identifier display method and electronic equipment
CN111045588B (en) Information viewing method and electronic equipment

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