aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-11-09 17:29:38 +0200
committerJukka Jylänki <jujjyl@gmail.com>2013-11-09 20:58:48 +0200
commit23d8911d25700c246093849dac35377dc21a233f (patch)
treeacdb5dc97b448a3856c649344777ca69f8a6b5e6
parente0268fa1035a718341c53921eee9318d4a8033cd (diff)
Fix test_asm_pgo on Windows by using response files. The test failed by exceeding Windows command line length limitations, giving an error "WindowsError: [Error 87] The parameter is incorrect". Also extend the logging given by EM_BUILD_VERBOSE=3 to print out the compiler invokations.
-rw-r--r--tools/response_file.py6
-rw-r--r--tools/shared.py21
2 files changed, 16 insertions, 11 deletions
diff --git a/tools/response_file.py b/tools/response_file.py
index f19cf8af..7f916752 100644
--- a/tools/response_file.py
+++ b/tools/response_file.py
@@ -1,4 +1,5 @@
import tempfile, os, sys, shlex
+import shared
# Routes the given cmdline param list in args into a new response file and returns the filename to it.
# The returned filename has a suffix '.rsp'.
@@ -9,6 +10,11 @@ def create_response_file(args, directory):
args = map(lambda p: p.replace('\\', '\\\\').replace('"', '\\"'), args)
response_fd.write('"' + '" "'.join(args) + '"')
response_fd.close()
+
+ # Register the created .rsp file to be automatically cleaned up once this process finishes, so that
+ # caller does not have to remember to do it.
+ shared.configuration.get_temp_files().note(response_filename)
+
return response_filename
# Reads a response file, and returns the list of cmdline params found in the file.
diff --git a/tools/shared.py b/tools/shared.py
index d38aef4c..78d7e54e 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -3,7 +3,7 @@ from subprocess import Popen, PIPE, STDOUT
from tempfile import mkstemp
from distutils.spawn import find_executable
import jsrun, cache, tempfiles
-from response_file import create_response_file
+import response_file
import logging, platform
def listify(x):
@@ -41,8 +41,8 @@ class WindowsPopen:
# emscripten.py supports reading args from a response file instead of cmdline.
# Use .rsp to avoid cmdline length limitations on Windows.
if len(args) >= 2 and args[1].endswith("emscripten.py"):
- self.response_filename = create_response_file(args[2:], TEMP_DIR)
- args = args[0:2] + ['@' + self.response_filename]
+ response_filename = response_file.create_response_file(args[2:], TEMP_DIR)
+ args = args[0:2] + ['@' + response_filename]
try:
# Call the process with fixed streams.
@@ -78,13 +78,6 @@ class WindowsPopen:
def kill(self):
return self.process.kill()
- def __del__(self):
- try:
- # Clean up the temporary response file that was used to spawn this process, so that we don't leave temp files around.
- tempfiles.try_delete(self.response_filename)
- except:
- pass # Mute all exceptions in dtor, particularly if we didn't use a response file, self.response_filename doesn't exist.
-
__rootpath__ = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
def path_from_root(*pathelems):
return os.path.join(__rootpath__, *pathelems)
@@ -1214,7 +1207,13 @@ class Building:
# Run Emscripten
Settings.RELOOPER = Cache.get_path('relooper.js')
settings = Settings.serialize()
- compiler_output = jsrun.timeout_run(Popen([PYTHON, EMSCRIPTEN, filename + ('.o.ll' if append_ext else ''), '-o', filename + '.o.js'] + settings + extra_args, stdout=PIPE), None, 'Compiling')
+ args = settings + extra_args
+ if WINDOWS:
+ args = ['@' + response_file.create_response_file(args, TEMP_DIR)]
+ cmdline = [PYTHON, EMSCRIPTEN, filename + ('.o.ll' if append_ext else ''), '-o', filename + '.o.js'] + args
+ if jsrun.TRACK_PROCESS_SPAWNS:
+ logging.info('Executing emscripten.py compiler with cmdline "' + ' '.join(cmdline) + '"')
+ compiler_output = jsrun.timeout_run(Popen(cmdline, stdout=PIPE), None, 'Compiling')
#print compiler_output
# Detect compilation crashes and errors