JunManYuanLong / monkey_tcloud

Tcloud中集成的Monkey自动化
MIT License
21 stars 12 forks source link

在运行monkey测试的时候,选择多台手机测试会出现反复的装包卸载,运行失败等 #1

Open lin54241930 opened 4 years ago

lin54241930 commented 4 years ago

初步怀疑是因为multiprocessing创建了重复的多进程,导致在部分手机上不断的重复安装卸载,program.py中第31行会打印出创建的case,在我选择了2台以上手机的时候,这里打印出来的case都是成倍的增长,按理说这里应该是一个设备对应一个case出现重复安装的原因初步猜测也是因为创建case的问题,导致重复创建多进程,因为是小白,所以没能分析出啦具体是哪里的问题,烦请大佬指导下

tsbxmw commented 4 years ago

@lin54241930 有具体的 log 么,可以贴出来帮忙看下。

lin54241930 commented 4 years ago

@lin54241930 有具体的 log 么,可以贴出来帮忙看下。

2020-09-08 14:51:38,626 <36141> [tcloud_update.py (216)] INFO (0) update monkey <68> success 2020-09-08 14:51:38,628 <36198> [tcloud_update.py (232)] INFO (QCUCKFBQUO45YTSK) update task 2020-09-08 14:51:38,628 <36198> [tcloud_update.py (265)] INFO {'begin_time': '2020-09-08 14:51:38', 'process': 0} 2020-09-08 14:51:38,629 <36199> [tcloud_update.py (232)] INFO (11b6b0b80804) update task 2020-09-08 14:51:38,629 <36199> [tcloud_update.py (265)] INFO {'begin_time': '2020-09-08 14:51:38', 'process': 0} 2020-09-08 14:51:38,630 <36200> [tcloud_update.py (232)] INFO (QCUCKFBQUO45YTSK) update task 2020-09-08 14:51:38,630 <36200> [tcloud_update.py (265)] INFO {'begin_time': '2020-09-08 14:51:38', 'process': 0} 2020-09-08 14:51:38,630 <36141> [runner.py (79)] INFO +------------+------------------+ | process id | device id | +------------+------------------+ | 36198 | QCUCKFBQUO45YTSK | | 36199 | 11b6b0b80804 | | 36200 | QCUCKFBQUO45YTSK | | 36201 | 11b6b0b80804 | +------------+------------------+

我改了一部分你的,加了一个自动输入安装时需要输入密码的功能,但是我在使用2台或者2台以上手机的时候,这里打印出来的设备就不对了,本来只有两台手机,打印出了4个devices出来,process id 也有4个,所以这里就有重复了

lin54241930 commented 4 years ago

@lin54241930 有具体的 log 么,可以贴出来帮忙看下。

2020-09-08 15:40:56,057 <18404> [runner.py (95)] ERROR An attempt has been made to start a new process before the current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

2020-09-08 15:40:56,058 <18406> [tcloud_update.py (189)] INFO (0) update monkey 2020-09-08 15:40:56,059 <18406> [tcloud_update.py (209)] INFO {'jenkins_url': 'http://localhost:8888/job/monkey_autotest/48/'} Traceback (most recent call last): File "/Users/**/.jenkins/workspace/monkey_autotest/automonkey/runner.py", line 71, in run_monkeys process.start() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/process.py", line 121, in start self._popen = self._Popen(self) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/context.py", line 224, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/context.py", line 283, in _Popen return Popen(process_obj) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 32, in init super().init(process_obj) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/popen_fork.py", line 19, in init self._launch(process_obj) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 42, in _launch prep_data = spawn.get_preparation_data(process_obj._name) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/spawn.py", line 154, in get_preparation_data _check_not_importing_main() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/spawn.py", line 134, in _check_not_importing_main raise RuntimeError(''' RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

2020-09-08 15:40:56,060 <18404> [tcloud_update.py (189)] INFO (0) update monkey

运行的时候,会直接报multiprocessing的错,感觉是这个没加:if name == 'main': 但是我加了还是有其他的问题

tsbxmw commented 4 years ago