Commit Graph

95 Commits

Author SHA1 Message Date
Henrik Skupin
b5f314390e Bug 892902 - [mozprocess] Enable unit tests on Windows. r=ahal
MozReview-Commit-ID: 70gC7gNkX75

--HG--
extra : rebase_source : aafb41aa59febf14c688be720e51503b0d7b3427
2018-02-07 08:28:11 +01:00
Henrik Skupin
ac424f01de Bug 892902 - [mozprocess] Ensure that process returncodes are positive on Windows. r=ahal
In contrast to Posix the returncodes on Windows have positive
and not negative numbers.

MozReview-Commit-ID: 4foHWf9RR0B

--HG--
extra : rebase_source : 8e06cbb3e669fea7abe46cd8b53386b56030574d
2018-02-12 23:05:14 +01:00
Henrik Skupin
111c06a7ca Bug 892902 - [mozprocess] Returncode for kill() on Windows has to be set from wait(). r=ahal
Currently the returncode gets set immediately after the process
has been terminated via TerminateJobObject() or TerminateProcess().
Given that in both cases the process has not been quit yet, but
still waits for all streams to be closed, the returncode has to
be set by via wait().

Also in case of TerminateJobObject() the _cleanup method is never
called if an exception occurs.

MozReview-Commit-ID: 4NEyqafN0DD

--HG--
extra : rebase_source : ae176d5e052785cc77865e1bf220013e87d7a3f0
2018-02-12 22:46:14 +01:00
Henrik Skupin
a426ad7cda Bug 892902 - [mozprocess] Remove dependency of psutil for pid exists check. r=ahal
The psutil package has only been used to check for the existence
of a given pid. Given the troubles with getting psutil compiled
on Windows, or by supplying the correct wheel, it has been decided
to get rid of this dependency.

Instead the ProcessHandler class itself now got the feature to
determine the existence of a pid by using ctypes to do the
necessary Windows API calls.

MozReview-Commit-ID: KAiSv0AH8HZ

--HG--
extra : rebase_source : 55e9ecac6ce12b0abcbaceb9aa385100744b16dd
2018-02-12 16:39:57 +01:00
Henrik Skupin
581602594e Bug 1435820 - Rename mozprocess unit tests and support files. r=ahal
MozReview-Commit-ID: 2LhfafKi8ym

--HG--
rename : testing/mozbase/mozprocess/tests/process_normal_broad_python.ini => testing/mozbase/mozprocess/tests/process_normal_broad.ini
rename : testing/mozbase/mozprocess/tests/process_normal_deep_python.ini => testing/mozbase/mozprocess/tests/process_normal_deep.ini
rename : testing/mozbase/mozprocess/tests/process_normal_finish_python.ini => testing/mozbase/mozprocess/tests/process_normal_finish.ini
rename : testing/mozbase/mozprocess/tests/process_waittimeout_python.ini => testing/mozbase/mozprocess/tests/process_waittimeout.ini
rename : testing/mozbase/mozprocess/tests/process_waittimeout_10s_python.ini => testing/mozbase/mozprocess/tests/process_waittimeout_10s.ini
rename : testing/mozbase/mozprocess/tests/infinite_loop.py => testing/mozbase/mozprocess/tests/scripts/infinite_loop.py
rename : testing/mozbase/mozprocess/tests/proccountfive.py => testing/mozbase/mozprocess/tests/scripts/proccountfive.py
rename : testing/mozbase/mozprocess/tests/procnonewline.py => testing/mozbase/mozprocess/tests/scripts/procnonewline.py
rename : testing/mozbase/mozprocess/tests/test_mozprocess_kill.py => testing/mozbase/mozprocess/tests/test_kill.py
rename : testing/mozbase/mozprocess/tests/test_mozprocess_misc.py => testing/mozbase/mozprocess/tests/test_misc.py
rename : testing/mozbase/mozprocess/tests/test_mozprocess_output.py => testing/mozbase/mozprocess/tests/test_output.py
rename : testing/mozbase/mozprocess/tests/test_mozprocess_params.py => testing/mozbase/mozprocess/tests/test_params.py
rename : testing/mozbase/mozprocess/tests/test_mozprocess_poll.py => testing/mozbase/mozprocess/tests/test_poll.py
rename : testing/mozbase/mozprocess/tests/test_mozprocess_wait.py => testing/mozbase/mozprocess/tests/test_wait.py
extra : rebase_source : e026178ca6fe2a34d5621e50f7f28812e3ad4ac8
2018-02-05 21:50:57 +01:00
Henrik Skupin
4bc4175eb0 Bug 1435820 - [mozprocess] Remove unused C implemenation of proclaunch and all its support files. r=ahal
Only test_mozprocess.py was still using the C implementation but is
disabled since ages.

Given that the proclaunch script as written in Python replaced the
C implemenation lets remove all the old unused code.

MozReview-Commit-ID: J4izHz5ljtO

--HG--
extra : rebase_source : e33720aa3a6734fa3dd5fc082441ef54d515e75f
2018-02-05 21:25:47 +01:00
Henrik Skupin
96ed8b8cf5 Bug 921632 - Re-enable delayed kill broad mozprocess unit test. r=ahal
MozReview-Commit-ID: 93KwNlw84ld

--HG--
extra : rebase_source : fd96ee848ea3b4211db338f6f337372901fff210
2018-02-05 15:16:48 +01:00
Andrew Halberstadt
f354075c7a Bug 1434430 - [flake8] Fix blank 'except' statements r=rwood
This is a new issue that gets linted with flake8 3.5.0. Basically you should
never use a blank except: statement.

This will catch all exceptions, including KeyboardInterrupt and SystemExit
(which is likely not intended). If a catch all is needed, use
`except: Exception`.  If you *really* mean to also catch KeyboardInterrupt et
al, use `except: BaseException`.

Of course, being specific is often better than a catch all.

MozReview-Commit-ID: FKx80MLO4RN

--HG--
extra : rebase_source : 7c74a7d0d81f2c984b47aff3a0ee3448b791177b
2018-01-31 14:32:08 -05:00
Henrik Skupin
5db8c27e13 Bug 1434932 - Release mozprocess 0.26. r=ahal
MozReview-Commit-ID: IHblWy0ypqs

--HG--
extra : rebase_source : 48fa68ad2344f805d78d7f6461e22bf0192f8044
2018-02-01 16:37:20 +01:00
Henrik Skupin
067a604727 Bug 1434932 - [mozprocess] ProcessHandler.wait() doesn't immediately return with timeout=0. r=ahal
MozReview-Commit-ID: 6ArknLHR933

--HG--
extra : rebase_source : c95ca78311957a7c93b69a398c2c6127f2096c09
2018-02-01 16:36:28 +01:00
Geoff Brown
b5087ee353 Bug 1322616 - Differentiate between timeout and output timeout in mozprocess; r=jmaher 2017-12-05 15:43:03 -07:00
Tom Prince
a45ea20b93 Bug 1413575: Adjust in-tree references to mozbase documentation to point in-tree. r=ahal
MozReview-Commit-ID: rctbByyjTA

--HG--
extra : rebase_source : a682eb6d77b79640ac9ec20e9d64340613bcfed7
2017-11-20 11:43:13 -07:00
Steve Armand
fa0b6e7c7e Bug 1397849 - Enable py2 and py3 linter on testing/mozbase. r=ahal
MozReview-Commit-ID: GnaVLhtO4un

--HG--
extra : rebase_source : 8839a423c5db505469b813957649b1605ed5737f
2017-09-25 22:57:18 -04:00
Sylvestre Ledru
4e9cf83ee8 Bug 1378712 - Remove all trailing whitespaces r=Ehsan
MozReview-Commit-ID: Kdz2xtTF9EG

--HG--
extra : rebase_source : 7235b3802f25bab29a8c6ba40a181a722f3df0ce
2017-07-06 14:00:35 +02:00
Andrew Halberstadt
c9beaa56b4 Bug 1373294 - Fix E305 (two blank lines after method or class) in files enabled by flake8 linter, r=jmaher
This is needed before we can upgrade to flake8 3.3.0, as that version starts flagging these errors.

These files were modified by running:
autopep8 --select E305 --in-place -r <dir>

on the affected directories. I did it one dir at a time and verified the result after each.

MozReview-Commit-ID: FmlsfiKIbtr

--HG--
extra : rebase_source : 9df32258cadff5d27a0e72113c57f782756c0b18
2017-06-15 12:10:59 -04:00
Sam Giles
eda63b77d4 Bug 1340429 - Bump mozprocess to 0.24; r=jgraham
MozReview-Commit-ID: G3473IJp0i2

--HG--
extra : rebase_source : c74a707cef891135da77ffb7dd2854c0159265ff
2017-02-17 05:53:06 +00:00
Sam Giles
8c1f7ef5cc Bug 1329528 - Reap zombie processes on Mac OS if killing the process group initially fails with EPERM; r=ahal
MozReview-Commit-ID: IKqXKIN0mXx

--HG--
extra : rebase_source : 40e012f3cbeca139e15ce23e33f4c131f1e4d6cd
2017-02-16 06:18:17 +00:00
Andrew Halberstadt
8415b25e37 Bug 1003417 - Add a 'mozbase' subsuite to python unittests on linux, r=ted
The subsuite is added conditionally because we only have the capability of
running source-check tasks on linux at the moment. Once taskcluster support
for windows and mac has matured a bit and the taskcluster configs support
source-check there, we should apply the subuite unconditionally.

MozReview-Commit-ID: Kk9Irz3fn14

--HG--
extra : rebase_source : b9266a06583083c36477d4e93f5462ee614cdb71
2016-11-16 16:43:42 -05:00
James Graham
5f011d137e Bug 1328823 - Bump mozprocess version number to 0.24 for release, r=ahal
MozReview-Commit-ID: 251xwdA7rxc

--HG--
extra : rebase_source : 2662ed18044da7173eaaeca941c0e72b3f9ba089
2017-01-06 15:39:55 +00:00
Andrew Halberstadt
2d76b4f70d Bug 1317970 - Make mozbase tests use mozunit for consistent formatting, r=chmanchester
The mozbase unittests don't use mozunit, so their output is confusing in the log.
This makes mozbase output consistent with the rest of the python unittests.

MozReview-Commit-ID: AIs5mza8Rn6

--HG--
extra : rebase_source : 10f65e612f5b3cebb921c47699f5a8be7cd2ba5a
2016-11-17 16:36:18 -05:00
Andrew Halberstadt
ffb7cb0b99 Bug 1309060 - Ignore "No such process" when trying to find pgid in mozprocess, r=gps
For some reason calling os.getpgid(proc.pid) in this bug results in an OSError "No such process"
on OSX. This bug is starting the ProcessHandler from a concurrent.futures Thread, that must be
somehow related.

I tried debugging this, but couldn't figure out why this is happening. However, the pgid is not
needed for this use case, and simply ignoring the error works. We also ignore this very same
exception when calling os.getpgid elsewhere in mozprocess, so there must be some weird OSXism
happening.

MozReview-Commit-ID: 2YXhBaORC5s

--HG--
extra : rebase_source : 120e4bff7ef29d2a0ad1e3bdd2df11b8b682d981
2016-11-03 10:24:11 -04:00
Francesco Pischedda
f45ed99748 Bug 1280573 - Add testing/mozbase to flake8 linter: r=ahal
added testing/mozbase to tools/lint/flake8.lint
fixed a first batch of PEP8 errors/warnings

at first the commad autopep8 -i --max-line-length 99 -r -j 8 .
has been used to fix simpler problems, run from testing/mozbase

some of the issues can not easily fixed :
- undefined 'names' in code for example isLinux - isLinux and isBsd "fixed" with # noqa
- undefined 'message' resolved with return fmt.format(...
- undefined 'structured' resolved replacing those with mozlog
- long comments - some remaining - addressed with # noqa
- package level import everything - addressed with # flake8: noqa

restored testing/mozbase/mozdevice/mozdevice/Zeroconf.py
fixed issues reported on mozreview
fixed ')' in testing/mozbase/mozprocess/mozprocess/qijo.py imports
finally fixed multiline string at testing/mozbase/manifestparser/tests/test_manifestparser.py:114
^^^ and again, but now with ./mach python-test --path-only testing/mozbase/manifestparser/tests/test_manifestparser.py passing
fixed testing/mozbase/manifestparser/tests/test_convert_directory.py assert

fixed this error:
10:15:21     INFO -      return lambda line: stack_fixer_module.fixSymbols(line)
10:15:21     INFO -  TypeError: fixSymbols() takes exactly 2 arguments (1 given)

fixed two spaces lint error even of #  noqa comments
restored assignement to lambda with #  noqa to silence the lint error
global noqa for testing/mozbase/manifestparser/tests/test_filters.py
stupid is/is not error...

MozReview-Commit-ID: 1FpJF54GqIi

--HG--
extra : rebase_source : 3cf0277fb36a296e3506aeacc2ff05e1b03f9eac
2016-09-30 16:08:37 +02:00
Henrik Skupin
4a66067bde Bug 1176758 - Release mozprocess 0.23 and mozrunner 6.12. r=ahal
MozReview-Commit-ID: JeQhPhZHbUX

--HG--
extra : rebase_source : 729a8393b18ce7b75d3e615d5010cd32744cc16f
2016-06-30 16:45:21 +02:00
Henrik Skupin
c0ae4f73e9 Bug 1176758 - Allow mozprocess to detect and kill detached child processes. r=ahal
MozReview-Commit-ID: B9yfLYUZw76

--HG--
extra : rebase_source : dcf4d1a7b58b2045cf058247f3d6ffc753b398b1
2016-06-30 16:44:56 +02:00
Henrik Skupin
be1e7aaec0 Bug 1276886 - [mozprocess] Fix hang in output readers when process is in a new process group. r=ahal
MozReview-Commit-ID: 9e6HNAaF0Yo

In case of in-process restarts it can happen that the new process gets forked into a new process group.
When that happens we loose the capability to kill the process. To prevent a hang when joining the output
reader threads in wait(), we simply skip that call by passing-through the IO error.

--HG--
extra : rebase_source : 702dfec407ed13114f59fa6ccb0d82c5b0790550
2016-06-02 20:19:34 +02:00
Andrew Halberstadt
95882ef0e4 Bug 1274584 - [mozprocess] Fix IO Completion Port failed to signal process shutdown, r=jgriffin
Sometimes the IO completion port doesn't shutdown child processes. When this happens,
mozprocess will attempt to force kill the child processes manually. However, there is
a bug here which causes the OSError to get raised.

Although this fixes that bug, the original issue(s) which prevented the IOC port
from signaling shutdown remain and are still undiagnosed.

MozReview-Commit-ID: L3DQPW0Is5v

--HG--
extra : rebase_source : cf6320cffea5a4c8fb5d62861c41065d9dcefa52
2016-05-30 11:02:13 -04:00
Andrew Halberstadt
7746cfd17f Bug 1274584 - [mozprocess] Improve debugging messages on windows, r=jgriffin
We can set MOZPROCESS_DEBUG to help debug windows process code. However on try
it is unreadable as there are multiple things using mozprocess, and each process
has multiple threads. It's impossible to tell which log message comes from where.
This improves the debug logs a bit by always specifying the PID and thread name.

There are a few other drive-by cleanups in this thread. The only one of note is
removing a python 2.5 only code path.

MozReview-Commit-ID: L3DQPW0Is5v

--HG--
extra : rebase_source : f07c07f53b06b1160cd3e70cb06b8dc12a89c3ab
2016-05-30 11:00:59 -04:00
Andrew Halberstadt
c2f03c6447 Bug 1152428 - [mozprocess] Fix UnicodeEncodeError when non-ascii characters are in the environment, r=wlach
MozReview-Commit-ID: 3AG9oLxWexy

--HG--
extra : rebase_source : a1f0d66c9434e2129c166181105b55fad43fe716
2016-03-16 11:07:35 -04:00
Ms2ger
4d796781c7 Bug 1257510 - Use modern exception syntax in mozbase; r=ahal
The comma form is long-deprecated.
2016-03-18 09:03:25 +01:00
Chris Manchester
7bec6d7863 Bug 1055224 - Run gtest output through a stack fixer. r=ahal
--HG--
extra : commitid : EI5D81v5sjt
2016-01-15 10:36:46 -08:00
Julien Pagès
46f35681b7 Bug 1215756 - Fix mozprocess unit tests failures. r=ahal
This now check process status based on pids, not anymore
on an arbitrary string given in the command line.

Some cleanup in there, including removing code duplicate.
2015-10-21 10:57:58 -04:00
Julien Pagès
e6f8f405f1 Bug 1139487 - Remove mozprocess.pid, mozprocess.wpk. r=jmaher
--HG--
extra : commitid : DGexoEWiJn4
extra : rebase_source : 51bc43ca702d67522e58a74286dcaa3487bdacc7
2015-10-06 21:35:43 +02:00
Gregory Szorc
2ec17b35ed Bug 1176642 - Fix typo in import name; r=smacleod
This regressed in 101600812e66.

--HG--
extra : commitid : D0l0sNE394Y
extra : amend_source : 3b811d6911996fb5e56ade252d7c71e83e16bbfe
2015-06-25 13:06:25 -07:00
Gregory Szorc
03600b9f4c Bug 1176642 - Use relative imports in mozprocess; r=smacleod
This regressed in 101600812e66.

--HG--
extra : commitid : BIrMVQYfgXC
2015-06-25 12:55:48 -07:00
Gregory Szorc
df5168acca Bug 1176642 - Use absolute_import, remove unused imports from mozprocess; r=chmanchester
--HG--
extra : commitid : AYv7GiLGo4p
extra : rebase_source : bc4157c319894b7a6a9aeda7623cba3f2544738e
2015-06-25 12:13:27 -07:00
Julien Pagès
4dc4420abe Bug 1124695 - [mozrunner] and/or [mozprocess] should send SIGTERM before sending SIGKILL by default; r=ahal
--HG--
extra : rebase_source : f748f2b0ed6e3cf17f7bc9da1be8a8d243dff468
2015-02-27 15:11:14 -05:00
Philip Chee
ceb176ce0d Bug 1050561 - Decode string when building an environment block to support non-ASCII environment variables. r=ahalberstadt 2015-04-07 16:09:49 +08:00
Julien Pagès
5bd5f0f1fe Bug 1088192 - mozprocess.ProcessHandlerMixin does not handle missing property "proc" on unstarted processes. r=ahal 2015-03-17 01:10:00 +01:00
Julien Pagès
ef6b0d32e0 Bug 923381 - [mozprocess] mozprocess.ProcessHandler should have an option not to print. r=ahal 2015-03-12 13:38:00 +01:00
Chris Manchester
b232b5d003 Bug 1140507 - Bump mozprocess version and release to pypi to pick up recent changes.;r=ahal DONTBUILD 2015-03-06 13:55:58 -08:00
Chris Manchester
c49a2dcff4 Bug 1139722 - Allow use of nested job objects in mozprocess on windows versions that support them.;r=ahal
This patch detects when breaking away from the parent job isn't strictly necessary to manage processses in a new job to allow using nested job objects to manage processes and their children. Loss of job object functionality is handled in mozprocess as non-fatal, however mozrunner and others doing things like restarting firefox require it.
2015-03-05 18:02:38 -08:00
Ted Mielczarek
61b17bc728 bug 1137228 - use readline instead of iterator for reading mozprocess output. r=ahal
--HG--
extra : rebase_source : dfea4b912d5e91e13330e92fdd300a44bf0a9dc4
2015-02-26 15:16:59 -05:00
Julien Pagès
21fb986d25 Bug 794984 - [mozprocess] Add ability to separate stderr from stdout. r=ahal
A new parameter called 'processStderrLine' is added. When specified, stdout gets processed by the
'processOutputLine' callbacks and stderr is processed by the 'processStderrLine' callbacks. When
not specified, stderr is redirected to stdout which is the same default behaviour.

A side effect of this is that mozprocess now uses three threads to process output. One thread each
for stdout and stderr that reads output lines and stores them in a Queue as fast as possible, this
makes sure there is no blocking in stdout.write(). A third thread executes the callbacks.
2015-02-23 07:39:00 -05:00
Andrew Halberstadt
56769d6693 Bug 1060527 - [mozprocess] signal finished if IO completion port unexpectedly closed on windows, r=jgriffin
--HG--
extra : rebase_source : 773b4bdcbaa088caa958b6d084989439f00a0370
2014-11-14 08:47:32 -05:00
Pankaj Malhotra(:bitgeeky)
945b5e8e0b Bug 1064960 - [mozprocess] Guard against the output thread trying to join with itself. r=ahal 2014-11-04 02:35:00 +01:00
Daniel Lee
eed6da99ca Bug 705864 - [mozprocess] mozprocess tests should use mozprocess.pid. r=ahal 2014-10-07 07:00:40 -07:00
Daniel Lee
955aae0525 Bug 1067008 - [mozprocess] mozprocess.pid running_process should look at the entire command not just the executable name. r=ahal 2014-09-16 16:56:21 -07:00
Armen Zambrano Gasparnian
d1eeaa0d52 Bug 1051799 - [mozprocess] Bump mozprocess to 0.21. r=wlach. DONTBUILD 2014-08-11 11:36:01 -04:00
Armen Zambrano Gasparnian
115f77927e Bug 1046087 - Normalize line endings on mozprocess for Adb Windows. r=wlach 2014-08-11 08:59:56 -04:00
Ryan VanderMeulen
1bcc49deea Backed out changeset 735394aa3813 (bug 1046087) for Windows bustage.
CLOSED TREE
2014-08-08 13:01:25 -04:00