Граф коммитов

37 Коммитов

Автор SHA1 Сообщение Дата
Roman Yurchak 8977c4fd0d
Explicitly close file descriptors in python code. NFC (#14074) 2021-06-15 17:05:21 -07:00
juj 4778850d89
Partially revert commit that broke using emrun.py outside the tree (#13412)
* Partially revert commit that broke using emrun.py outside the tree:

commit 4fc6505151
Author: Sam Clegg <sbc@chromium.org>
Date:   Sun Sep 13 19:05:11 2020 -0700

    Use shared wrappers for shutils. NFC. (#12200)

    We we not being consistent in our use of safe_copy and
    safe_move and try_delete.

* Add comment.

* Make emrun.py python 2 compatible again

* flake
2021-03-16 19:54:26 +02:00
Sam Clegg c94f3b2ee4
Fix crash in emrun.py (#13553)
Split out from #13412 and add a test.

Fixes https://github.com/emscripten-core/emsdk/issues/712
2021-02-24 12:34:33 -08:00
juj 5d6537b5e2
Fix a bug in emrun on macOS (#12034)
* Fix a bug in emrun where on macOS the http server might quit too early if python psutil package is not installed

* Address review
2021-02-04 13:00:33 +02:00
Sam Clegg 9608511c6f
Split emrun tests out of `browser` (#12594)
Unlike the other browser tests they don't use the test
runner harness and instead launch their own browser.

I was finding that running the test locally in isolation
that browser test harness would interfere with the
browser that emrun was starting.. since they both honor
EMTEST_BROWSER.
2020-10-28 21:06:38 -07:00
Sam Clegg 7c2d0936d0
Remove python2 support. NFC. (#12610)
We have been error'ing out python3 usage for a while now.
This change finally removes the python2 support so there
is no way back.

And to show we mean it, include an f-string in there
for good measure.

Fixes: #7198
2020-10-28 15:32:49 -07:00
Sam Clegg d059fd603d
emrun: use argparse in more conventional way (#12520)
* emrun: use argparse in more conventional way

This is not quite NFC since passing command line arguments
to the page that start with `-` now requires a separator.

This used to work:

./emrun filename.html --foo --bar

Where as now one needs to add `--` to signal the end of emrun's
argument parsing.

So either:

./emrun filename.html -- --foo --bar

or:

./emrun -- filename.html --foo --bar

* error_check
2020-10-23 16:08:12 -07:00
Sam Clegg 9faf0a79e3
emrun: Don't send response on `^exit^` message (#12523)
This message means that the browser itself is closing
or has already closed.

Without this change the tests the rely on this all report
exceptions sending the `OK` response.  e.g:

```
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 49430)
Traceback (most recent call last):
  File "/usr/lib/python3.8/socketserver.py", line 650, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.8/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.8/http/server.py", line 647, in __init__
    super().__init__(*args, **kwargs)
  File "/usr/lib/python3.8/socketserver.py", line 720, in __init__
    self.handle()
  File "/usr/lib/python3.8/http/server.py", line 427, in handle
    self.handle_one_request()
  File "/usr/lib/python3.8/http/server.py", line 415, in handle_one_request
    method()
  File "/home/sbc/dev/wasm/emscripten/emrun.py", line 703, in do_POST
    self.wfile.write(b'OK')
  File "/usr/lib/python3.8/socketserver.py", line 799, in write
    self._sock.sendall(b)
BrokenPipeError: [Errno 32] Broken pipe
----------------------------------------
```
2020-10-14 19:11:57 -07:00
Guanzhong Chen 4e1e9fb7b4
Make emrun work with file names containing space on Windows (#12385)
Essentially, if the first argument to the `cmd.exe` function `start` has
quotes, it will be interpreted as the title of a new `cmd.exe` window instead
of the command to execute. This can be fixed by specifying `""` as the first
argument.
2020-09-30 21:38:43 -04:00
Sam Clegg 4fc6505151
Use shared wrappers for shutils. NFC. (#12200)
We we not being consistent in our use of safe_copy and
safe_move and try_delete.
2020-09-13 19:05:11 -07:00
Sam Clegg cb518a9b5e
Simplify use of win32api and winreg in emrun (#11843)
1. import winreg
   winreg is python standard module.   It was called `_winreg` in
   python2 but `winreg` in python3.  Unlike pywin32 it is not
   a seprate module and we never need to worry about it being missing.

2. Make pywin32 mandatory in the functions that need it.
   There are just a couple of functions that use win32api.  This is
   a non-standard module, but that that we include bundled in the
   emsdk version python for windows.
   Here we simply `import win32api` in those locations.
   For win_get_file_properties there was exactly one caller that
   was already wrapped in a catch all so I also removed a try/catch
   from here.
2020-08-10 19:50:09 -07:00
Sam Clegg 2aa8c55a6a
Cleanup emrun.py (#11487)
- Avoid overuse of `global` keyword
- Avoid redundant argument to argparse
- Wrap long lines
2020-06-24 15:09:39 -07:00
Ashley Hauck 23f6814614
[emrun.py] Ensure ordering of first few lines printed (#11374)
If the second packet arrives before the first, expected_http_seq_num
will be -1, and the second packet will immediately be printed. Then, the
first packet arrives, printing after the second, causing the output to
have shuffled lines.
2020-06-10 13:19:45 -07:00
b1ue 8d3c6e17ec emrun: Set COOP,COEP and CORP headers (#10077)
* emrun: Set COOP,COEP and CORP headers

This enables emrun to serve pages by taking into account
the upcoming restrictions on Content Policy for Firefox 72.

In Firefox 71, we currently need to set these flags to test the
upcoming feature:
browser.tabs.remote.useCORP
browser.tabs.remote.useCrossOriginOpenerPolicy
browser.tabs.remote.useCrossOriginEmbedderPolicy
dom.postMessage.sharedArrayBuffer.withCOOP_COEP

* fixup: remove semicolons
2020-01-03 18:18:02 +02:00
juj d19bfb3af5
Update emrun to latest version (#10046)
* Update emrun to latest version, with better browser process detection for multiprocess browsers.

* flake

* Fix emrun stdout posting on localhost

* Fix test_zzz_emrun to work on Firefox, and clean up after the browser process when done

* xxx test

* Account also for --profile in EMTEST_BROWSER

* Update comments, also fix failure behavior if no psutil is available

* Improve readability
2019-12-17 14:01:39 +02:00
Guanzhong Chen 872cc3e06c
Fix all flake8 issues on python 3 (#9209) 2019-08-12 14:58:11 -07:00
Tim Lander 3e5f597ac3 [emrun] Use HTTP/1.1, instead of the default of HTTP/1.0 (#9127) 2019-08-02 11:03:16 -07:00
Alon Zakai 83470f1d53
emrun stability fix (#8504)
If the browser process got detached, don't change behavior depending on whether we received messages or not, as that can be racy (depends if the messages managed to reach us in time or not). Instead, do the simple and robust behavior of continuing as if --serve_after_close was passed in.

Should help with #8495 (but unclear if it fixes it or not).
2019-04-26 12:59:56 -07:00
Alon Zakai 2d6d2bad50
emrun stability improvements (#8456)
These do not fix all the issues that lead to random test failures, but they do fix at least two:

*    Send a sync message before doing window.close. Otherwise, the close and the message may race (e.g., the close may happen before the message is sent from the browser). In that case, we don't get the exit code, and exit with 0, which makes the test fail.
*    Be careful with the initial ping ("pageload" message) to the server - the server may not be up yet, and if not, the xhr will throw immediately. Keep trying until that succeeds.
2019-04-17 10:33:05 -07:00
titrindl 19dbb4ca5e Added --no_private_browsing emrun argument (#8319)
Added --no_private_browsing argument to emrun to allow running tests which require features which are disabled in private browsing modes (for example, indexeddb).
2019-04-01 14:10:30 -07:00
Jacob Greenfield 3a8f19986e Use default browser for emrun on macOS (#8243)
Fixes #8179.
2019-03-11 13:41:37 -07:00
Sam Clegg 24f613c545
Enable flake8 by default (#8112) 2019-02-17 09:38:58 -08:00
juj 31bc5c2d1b
Make sure that .js files are served with MIME type application/javascript or pthreads importScripts() in src/worker.js can refuse to run them (#8052) 2019-02-11 21:55:44 +02:00
Alon Zakai aae3002191
kripken/emscripten => emscripten-core/emscripten (#7880)
Big renaming of all links. NFC.
2019-01-18 11:11:03 -08:00
Sam Clegg 6d5b777ffd
Use context manager when writing python files. NFC. (#7861) 2019-01-16 00:10:57 -08:00
Mickaël Schoentgen 9a4db16f57 Fix all DeprecationWarning: invalid escape sequence (#7854)
Hello,

This is a sanitization patch for Python sources. Those DeprecationWarnings are already converted to SyntaxWarning in Python 3.8 and will become SyntaxError in Python 4.0.

Signed-off-by: Mickaël Schoentgen contact@tiger-222.fr
2019-01-15 17:05:25 -08:00
Sam Clegg 5187ea2631
Add copyright headers to locally authored files (#7116) 2018-09-14 11:08:09 -07:00
hujiajie ecea5aaf2b fix integer overflow warnings when '--safe_firefox_profile' is passed to emrun (#6953) 2018-08-06 10:09:40 -07:00
Sam Clegg 4e20b6417c
Use implict truthyness of len(). NFC. (#6771)
And a couple of other small python cleanups
2018-07-01 17:57:48 -07:00
Alon Zakai 29c0cc67e8
Sanity test fixes (#6167)
* update sanity.test_node

* fix executability of em++.py
2018-02-09 10:11:03 -08:00
Kagami Sascha Rosylight e12102edf4 Use Firefox headless mode for browser tests (#5901)
* also get latest emrun from upstream
2018-02-05 14:45:30 -08:00
Heejin Ahn 1513d7297d Change OS X to macOS (#6138) 2018-01-24 08:01:18 -08:00
juj 9e468af66b Update to latest emrun with fixed args[0] file to serve choice and parsed --browser and --browser_args (#6111) 2018-01-18 09:28:27 -08:00
Jukka Jylänki 18af894160 Update to latest emrun.py with argparse and javascript.options.shared_memory retained for testing purposes (emrun is a test harness driver) 2018-01-11 12:55:10 +02:00
Jukka Jylänki 360f06e995 Update emrun to latest to add application/wasm support and --browser_args cmdline parameter. 2018-01-04 13:55:58 +02:00
Jukka Jylänki 1063564552 Update emrun.py to latest version (brings python 3 compatibility) 2017-10-03 17:03:20 +03:00
Jukka Jylänki 57c18ddf39 Fix emrun to be dual python2/python3 callable. Closes #5211 and #5482. 2017-08-16 15:15:12 +03:00